HPC FAQ - MPI
Supercomputer documentation is always a work in progress! Please email questions, corrections, or suggestions to the HPC support team at firstname.lastname@example.org as usual. Thanks!
Frequently Asked Questions
- 1. How do I compile an executable file to run as an MPI application?
- 2. Which compilers should I use to compile an MPI application?
- 3. How do I execute an MPI program on multiple cores?
- 4. Where can I get more MPI documentation?
- 5. How do I use multiple-level parallelism?
To compile a source file named my_app written in C, use the command:
To compile a source file named myapp written in Fortran 90 use the command:
See the MPI Documentation section of this Web site for more information on MPI compiling.
Also, see man mpicc for C compiler specifics and man mpif90 for Fortran90 compiler specifics.
For applications in C use mpicc. For applications in Fortran 90 use mpif90.
Create a shell script and submit it to the batch scheduler. For example, the script file myscript might look like this:
If you prefer a different shell, you can use sh, ksh, csh, or bash. We recommend bash, which is the default.
Run it with a command like sbatch -n t myscript, where t is the number of tasks. The batch scheduler will distribute the job over the required number of nodes.
See the MPI documentation in the Documentation section.
To use multiple-level parallelism, which is running an MPI job that uses OpenMP, loop-parallelism, or that calls a parallelized library routine, consult the Multi Node Parallelism documentation.