HomeWHATWhat Is Mpicc

What Is Mpicc

Conceptually, the role of these commands is quite simple: transparently add relevant compiler and linker flags to the user’s command line that are necessary to compile / link Open MPI programs, and then invoke the underlying compiler to actually perform the command.

As such, these commands are frequently referred to as “wrapper” compilers because they do not actually compile or link applications themselves; they only add in command line flags and invoke the back-end compiler.

Background

Open MPI is comprised of three software layers: OPAL (Open Portable Access Layer), ORTE (Open Run-Time Environment), and OMPI (Open MPI). There are wrapper compilers for each layer; each layer’s wrapper only links in the libraries relevant for that layer. Specifically, each layer provides the following wrapper compilers:

OPAL

opalcc and opalc++

ORTE

ortecc and ortec++

OMPI

mpicc, mpic++, mpicxx, mpiCC (only on systems with case-senstive file systems), and mpifort (and its legacy/deprecated names mpif77 and mpif90). Note that mpic++, mpicxx, and mpiCC all invoke the same underlying C++ compiler with the same options. All are provided as compatibility with other MPI implementations.

Fortran Notes

The Fortran wrapper compiler for MPI (mpifort, and its legacy/deprecated names mpif77 and mpif90) can compile and link MPI applications that use any/all of the MPI Fortran bindings: mpif.h, the mpi module, and the mpi_f08 module (assuming Open MPI was installed with support for each of these Fortran bindings). Specifically: it is no longer necessary to use different wrapper compilers for applications that use mpif.h vs. applications that use the mpi module – just use mpifort for all Fortran MPI applications.

Refer to more articles:  What Happened To Malik On House Of Payne

Note, however, that the Fortran compiler may require additional command-line options to enforce a specific Fortran dialect. For example, in some versions of the IBM XLF compiler, if xlf90 is the underlying Fortran compiler, -qfixed may be necessary to compile fixed-format Fortran source files.

Finally, note that mpifort will be inoperative and will return an error on use if Fortran support was not built into the MP Ilayer.

Overview

mpicc is a convenience wrappers for the underlying C compiler. Translation of an Open MPI program requires the linkage of the Open MPI-specific libraries which may not reside in one of the standard search directories of ld(1). It also often requires the inclusion of header files what may also not be found in a standard location.

mpicc passes its arguments to the underlying C compiler along with the -I, -L and -l options required by Open MPI programs.

The Open MPI Team strongly encourages using the wrapper compilers instead of attempting to link to the Open MPI libraries manually. This allows the specific implementation of Open MPI to change without forcing changes to linker directives in users’ Makefiles. Indeed, the specific set of flags and libraries used by the wrapper compilers depends on how Open MPI was configured and built; the values can change between different installations of the same version of Open MPI.

Indeed, since the wrappers are simply thin shells on top of an underlying compiler, there are very, very few compelling reasons not to use mpicc. When it is not possible to use the wrappers directly, the -showme:compile and -showme:link options should be used to determine what flags the wrappers would have used. For example:

Refer to more articles:  What Color Of Shoes To Wear With A Silver Dress

shell$ cc -c file1.c `mpicc -showme:compile`

shell$ cc -c file2.c `mpicc -showme:compile`

shell$ cc file1.o file2.o `mpicc -showme:link` -o my_mpi_program

RELATED ARTICLES

Most Popular

Recent Comments