Practical work with OpenMP
Practical work with simple codes
(BLAS) on shared memory systems. Avoiding data races
in shared memory programming.
Have a look at the exercise and download
the template.
- untar the template in a different subdirectory than the sequential
example
- cd template_shm
- make run
- You can swich between GNU- and Intel-compiler by changing the line
COMPILER=GCC_
into
COMPILER=ICC_
in the Makefile
- Set the number of parallel threads from the command line via
export OMP_NUM_THREADS=2
- The following targets/calls are available in the Makefile:
- make : Compiles and
links the code
- make run : Recompiles the whole code
and runs it
- make cache : Profiles the code wrt. cache performance
- make prof : Profiles the code
- make mem : Checks the code for correct data
accesses, pointers alloc/deallocs, memory leaks
- Intel's inspector checks als for data
races!
- doc
:
Generates documentation, see html/index.html
afterwards
- clean
: Cleans temporary files
- clean_all : Cleans
everything
- tar
:
Cleans everything and packs the remainding files into a
tar-file in the root directory
Available compilers:
- GNU:
- Performance analyzer: gprof (kprof); valgrind (kcachegrind)
- Memory analyzer: valgrind
- Thread analyzer: helgrind
finds data race
- Intel:
- Quick
Reference Card, non-commercial
license available, academic
pricing
- Performance analyzer: amplifier (amplxe-gu)
- Memory/Thread analyzer: inspector
(inspxe-gui) finds data race
OpenMP as shared memory programming
environment