Skip to content

MPI OpenMP exercise

Sebastian Rettenberger edited this page Jul 15, 2013 · 8 revisions

Prepare your Git repository

Before you start this exercise you need an additional patch from the Git repository. You can apply the patch with Git's cherry-pick command:

git cherry-pick 678b723b3235f555826becf283ae03407ae4d12b

... and another patch (adds an OpenMP option to scons)

git pull
git cherry-pick 6624e61b9b82a8e6098bcf556d187a7fb9d7f492
  • move src/examples/swe_mpi.cpp to src/examples/swe_mpi_solution.cpp
  • copy src/examples/swe_simple.cpp src/examples/swe_mpi.cpp

Compile SWE with MPI

module load scons
module load python/2.7.2
scons copyenv=true compiler=cray parallelization=mpi

Compile SWE with OpenMP (Intel compiler)

module load scons
module load python/2.7.2
module swap PrgEnv-cray PrgEnv-intel
scons copyenv=true compiler=intel openmp=yes

Get the reference solution

  • Switch to the master branch
  • Add the patch for the SConstruct file:
git cherry-pick 6624e61b9b82a8e6098bcf556d187a7fb9d7f492
  • Open the file src/blocks/SWE_WavePropagation.cpp
    • Add the line #define LOOP_OPENMP before
#ifdef LOOP_OPENMP
#include <omp.h>
#endif
  • Remove the line that starts with solver::Hybrid<float>

Compile Vectorized Version (Intel Compiler)

module load scons
module load python/2.7.2
module swap PrgEnv-xyz PrgEnv-intel

Open the file 'SConstruct' in the main directory. Search for '-xHost' and replace it with '-mavx'.

scons copyenv=yes compiler=intel solver=fwavevec vectorize=yes showVectorization=yes