September 2008
Intermediate to advanced
280 pages
6h 31m
English
This section presents an example of debugging a shared-memory application developed using OpenMP. The necessary knowledge of OpenMP will be explained below. All that is needed is a basic understanding of threads.
OpenMP is essentially a higher-level parallel programming interface to thread-management operations. The number of threads is set via the environment variable OMP_NUM_THREADS. In the C shell, for instance, you type
% setenv OMP_NUM_THREADS 4
at the shell prompt to arrange to have four threads.
Application code consists of C interspersed with OpenMP directives. Each directive applies to the block that follows it, delimited by left and right braces. The most basic directive is
#pragma omp parallel
This ...
Read now
Unlock full access