Compiling MPI program on Hydra
Home
It is used OPENMPI to compile and run MPI program.
Loading openmpi module
Run the following command in order to load mpi module
module load openmpi
Note:
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 using MPI
mpicc
mpi-hello.c -o hello
Compiling C++ program by using MPI
mpiCC
-O <path>mycode.cpp -o <path>myprogram
Compiling fortran program by using MPI
mpif90
-O <path>mycode.cpp -o <path>myprogram
Compiling options:
-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