mpicxx(1)
π NAME π
mpicxx β the girlboss that compiles and links MPI programs written in C++ π
β¨ DESCRIPTION β¨
Okay so bestie, listen up: this command is literally your one-stop shop for compiling and linking MPI programs written in C++. She hands you all the options and the special libraries you need to make that happen. π
And like, it's important to use her β especially when you're linking programs β because she's the one bringing the necessary libraries to the party. Not using her is giving "I forgot my charger" energy. ππ
π COMMAND LINE ARGUMENTS π
-showβ shows you the commands she would run, without actually running them. Sneak peek, no commitment. π-helpβ gives you a short lil help message.-cxx=nameβ use compiler name instead of the default choice. β οΈ Only do this if the compiler is compatible with the MPICH library (see below, girl I got you).-config=nameβ load a configuration file for a particular compiler. This is the slay that lets a singlempicxxcommand play nice with multiple compilers. π-compile_infoβ shows you the steps for compiling a program. Use this to see exactly what options and include pathsmpicxxis using.-link_infoβ shows you the steps for linking a program. Use this to see exactly what options and librariesmpicxxis using.-profile=nameβ use the MPI profiling given by name. Deets down below. π-echoβ shows exactly what this program is doing. Ngl, this one should normally not be used. π-staticβ use a statically compile MPI library, but shared libraries for all of the other dependencies.-mpi,-abiβ compile and link using the standard MPI ABI.othersβ anything else gets passed straight to the compiler or linker. Like, for example,-ccauses files to be compiled,-gselects compilation with debugging on most systems, and-o namecauses linking with the output executable given the name name.
Note bestie: -echo is the one that should normally not be used. She said what she said. π
π¦ ENVIRONMENT VARIABLES π¦
The environment variable MPICH_CXX may be used to select a different C++ compiler and linker. But likeβ¦ β οΈ since MPICH is built with a particular C and Fortran compiler, changing the compilers used can cause problems. Only do it if you could intermix code compiled with the different compilers. Periodt.
The environment variable MPICC_PROFILE specifies a profile library and has the same effect as if -profile=$MPICC_PROFILE were used as an argument to mpicc. See the discussion of -profile below for more details. π«Ά
π COMPATIBLE COMPILERS π
The MPI library may be used with any compiler that uses the same lengths for basic data objects (such as long double) and that uses compatible run-time libraries. On many systems, the various compilers are compatible and may be used interchangeably. β¨
But there are exceptions, and that's the plot twist π β if you use the MPICH_CXX environment variable or the -cxx=name command-line argument to override the choice of compiler and encounter problems, try reconfiguring MPICH with the new compiler, and installing MPICH in a separate location. See the installation manual for more details.
π EXAMPLES π
To compile a single file foo.c, use:
mpicxx -c foo.cxx
To link the output and make an executable, use:
mpicxx -o foo foo.o
Combining compilation and linking in a single command:
mpicxx -o foo foo.cxx
is a convenient way to build simple programs. Main character energy, honestly. π
π SELECTING A PROFILING LIBRARY π
The -profile=name argument allows you to specify an MPI profiling library to be used. name can have two forms:
- A library in the same directory as the MPI library
- The name of a profile configuration file
π If it's a library
If name is a library, then this library is included before the MPI library. This allows the simple use of libraries that make use of the MPI profiling interface and that are installed in the same directory as the MPI library. Cute, convenient, iconic. π
π If it's a config file
If name.conf is the name of a file in the sysconfdir directory, then this is read and may define the following variables:
PROFILE_PRELIBβ libraries (and paths) to include before the MPI libraryPROFILE_POSTLIBβ libraries to include after the MPI libraryPROFILE_INCPATHSβ C preprocessor arguments for any include files
For example, to add /usr/local/myprof/include to the include path and the library libmyprof.a in /usr/local/myprof/lib to the link step, you could create the file myprof.conf with the lines:
PROFILE_PRELIB="-L/usr/local/myprof/lib -lmyprof"
PROFILE_INCPATHS="-I/usr/local/myprof/include"
and place it in the sysconfdir directory (this directory is set at configure time when MPICH is built). Then using the command-line argument -profile=myprof will cause these definitions to be added to the relevant compile commands. Slay. π
πΈ SEE ALSO πΈ
mpiccmpifortmpiexec
So go forth and compile, bestie β them's your friends, go say hi. π«Ά
π and that's the whole page! This one came out of the MPI manual, page mpicxx(1), dated 4/10/2026. Go build something iconic, no cap. β¨ππ
π¦ where this page comes from
- nixos 26.05: mpich 5.0.1
- ubuntu stonking: mpich-doc 5.0.1-9 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms