Compiling MPI and MPI+OpenMP programs on Heracles
Home
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
Combining MPI + OpenMP
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