OpenMP
Get started with learning to use OpenMP API for handling of multiple threads.
OpenMP is an API that implements a multithreaded, shared memory form of parallelism. It uses a set of compiler directives (statements that we add to our C code) that are incorporated at compile-time to generate a multithreaded version of our code.
We can think of pthreads (from the previous lesson) as doing multithreaded programming “by hand”, and OpenMP as a slightly more automated, higher-level API to make our program multithreaded. OpenMP takes care of many of the low-level details that we would normally have to implement ourselves, if we were using pthreads from the ground up.
Blueprint of an OpenMP program
Here is the general code structure of an OpenMP program with omp.h
included at the top:
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy