MPI implementations generally provide shell scripts to support the compilation and execution of parallel MPI programs. On HPC systems, you nearly always use one of the MPI compiler scripts (or "wrappers") to compile your MPI code and link the appropriate message passing libraries into the executable automatically. These wrappers are typically tailored to the particular interconnect and compilers that pertain to the HPC system. It greatly simplifies code building from the user's perspective.

The MPI wrapper scripts have standard names that do not depend on the underlying compilers. Therefore, the PATH environment variable determines the specific script that will be used for a given compilation. The PATH can in turn be altered by loading an environment module. For example, on Frontera, the modules for the Intel compilers and Intel MPI library are loaded at login to produce a default environment that includes the preferred Intel scripts and libraries.

Here are the standard names of the compiler wrappers for each language:

MPI compiler wrappers for each language.
Compiler Language TypeSuffix
mpicc C .c
mpicxx C++ .C, .cpp, .cxx
mpif77/mpif90 F77/F90 .f, .for, .ftn / .f90, .f95, .fpp

As the table indicates, specific program-name suffixes are required for the input files to each compiler wrapper. To compile without proceeding to the link step, use the -c option. Otherwise, the result is an executable that is named a.out by default; it may be renamed with the -o option. Put linker options such as library paths and library names after the source and object file names, as explained in the documentation for the system you are using. If you are using Frontera, you may refer to the Include and Library Paths section in the Frontera User Guide.

 
©  |   Cornell University    |   Center for Advanced Computing    |   Copyright Statement    |   Access Statement
CVW material development is supported by NSF OAC awards 1854828, 2321040, 2323116 (UT Austin) and 2005506 (Indiana University)