Skip to main content

7.8) Compiling And Submitting MPI Jobs


Calling these wrapper scripts will invoke the underlying compilers, corresponding to the currently loaded module. For instance, with the Intel compilers loaded mpif90 and mpif77 invoke ifort, mpicc invokes icc and mpiCC invokes icpc. Also, all the compiler options of the unwrapped commands can be used.

For example, to compile a Fortran 90 MPI code:

[bash]
$ mpif90 –o my_mpi_code my_mpi_code.f90
[/bash]

To launch the compiled MPI code the command mpirun is used:

[bash]
$ mpirun –np <n> <mpi_prog>
[/bash]

Where <n> is the number of processes and <mpi_prog> is the name of the executable. For example to run the executable my_mpi_code code on 3 cores:

[bash]
$ mpirun –np 3 ./my_mpi_code
[/bash]