Learn X in Y minutes

submited by
Style Pass
2024-11-13 21:30:08

OpenMP is a library used for parallel programming on shared-memory machines. OpenMP allows you to use simple high-level constructs for parallelism, while hiding the details, keeping it easy to use and quick to write. OpenMP is supported by C, C++, and Fortran.

Slave: Slave threads are created for sections of code which are marked by a special directive, these are the threads which will run the parallel sections.

The exact number of “Hello, Worlds” depends on the number of cores of your machine, for example I got 12 my laptop.

A loop must be easily parallelisable for OpenMP to unroll and facilitate the assignment amoungst threads. If there are any data dependancies between one iteration to the next, OpenMP can’t parallelise it.

It should be noted that this example is fairly contrived and the actual speedup depends on implementation and it should also be noted that serial code may run faster than parallel code due to cache preformace.

Leave a Comment