Compiling MPI + OpenMP program on Hydra
It is used OPENMPI to compile and run MPI program.
Loading openmpi module
Run the following command in order to load mpi module
If you forget running the above
command, some errors may occur because MPICH will
be used instead OpenMPI.
Both MPICH and OpenMPI are MPI implementations
and OpenMPI usually has better performance.
Compiling C program by combining MPI and OpenMP
- mpicc -O -fopenmp /path/to/mycode.c -o /path/to/myprogram
Compiling C++ program by combining MPI and OpenMP
- mpiCC -O -fopenmp /path/to/mycode.cpp -o /path/to/myprogram
Compiling fortran program by combining MPI and OpenMP
- mpif90 -O -fopenmp /path/to/mycode.f90 -o /path/to/myprogram
-o <file>: place the output into <file>. If this
option is omitted, the compiler will create execution program named
a.out in working directory.
<path>: directory where the code is. It is optional.
-O: compile the program with optimization
-fopenmp: compiling openMP program