Introduction
|
Shared-memory parallel programs break up large problems into a number of smaller ones and execute them simultaneously
OpenMP programs are limited to a single physical machine
OpenMP libraries are built into all commonly used C, C++, or Fortran compilers
|
Hello World
|
Pragmas are directives to the compiler to parallelize something
Thread number is typically controlled with an environment variable, OMP_NUM_THREADS
Order of execution of parallel elements is not guaranteed.
If the compiler doesn’t recognize OpenMP pragmas, it will compile a single-threaded program. But you may need to escape OpenMP function calls.
|
Parallel Operations with Arrays
|
The PARALLEL FOR (or PARALLEL DO) pragma makes a loop execute in parallel
A single variable accessed by different threads can cause wrong results
The PRIVATE clause makes a copy of a variable for each thread
|
Race Conditions with OpenMP
|
|
Searching through data
|
Reduction operators handle the common case of summation, and analogous operations
OpenMP can manage general parallel sections
You can use ‘pragma omp single’ to have a single thread execute something
|
OpenMP Tasks
|
OpenMP can manage general parallel tasks
tasks now allow the parallelization of applications exhibiting irregular parallelism such as recursive algorithms, and pointer-based data structures.
|
Calculating Electrostatic Energy
|
|
Drawing the Mandelbrot set
|
|
Introduction to GPU Programming with OpenACC
|
|