Open MP comprises a set of compiler directives that implement parallel processing in a FORTRAN, C or C++ program. The directives allow the user to mark areas of the code, such as do, while or for loops, which are suitable for parallel processing. The directives appear as a special kind of comment, so the program can be compiled and run in serial mode. However, the user can tell the compiler to "notice" the special directives, in which case a version of the program will be created that runs in parallel.
Thus the same program can easily be run in serial or parallel mode on a given computer, or run on a computer that does not have Open MP at all.
Open MP is suitable for a shared memory parallel system, that is, a situation in which there is a single memory space, and multiple processors. If memory is shared, then typically the number of processors will be small, and they will all be on the same physical machine.
By contrast, in a distributed memory system, items of data are closely associated with a particular processor. There may be a very large number of processors, and they may be more loosely coupled and even on different machines. Such a system will need to be handled with MPI or some other message passing interface.
Open MP descended in part from the old Cray microtasking directives, so if you've lived long enough to remember those, you will recognize some features.
The ROLLCALL example simply has each parallel thread print out its identifier. The text of the program shows how a parallel section can be marked, how to get the ID of a parallel thread, and how to comment out a bit of code that should only run if the code has been compiled with OpenMP.
The COMPUTE_PI example shows how information can be shared. Several processors need to compute pieces of a sum that will approximate pi.
The HELMHOLTZ example is a more extensive program that solves the Helmholtz equation on a regular grid, using a Jacobi iterative linear equation solver with overrelaxation;
The MD example is a time dependend molecular dynamics code;
Return to the FORTRAN software page.