next up previous
Next: Data Parallelism Example Up: OpenMPLab Previous: OpenMPLab

Setup and Hello World example

  1. The support for OpenMP has improved greatly in recent Gnu C compilers, so use a recent version, at least gcc 4.4 (you get a suitable version on the Beowulf nodes).

  2. Copy omp_hello.c from section 3 of https://computing.llnl.gov/tutorials/openMP/exercise.html.

  3. Review the source code and note how OpenMP directives and library routines are being used.

  4. Log on to a multicore machine, e.g.
    bwlf12

  5. Compile omp_hello.c for parallel execution:
    gcc -fopenmp omp_hello.c -o hello

  6. Run with the default number of cores:
    ./hello

  7. Set the number of cores to 4 and rerun:
    export OMP_NUM_THREADS=4
    ./hello
    

  8. Log into jove and run hello again.



Phil Trinder 2013-02-28