Linux command
mpic++ 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Compile MPI C++ program
mpic++ -o [program] [source.cpp]
Compile with optimization
mpic++ -O2 -o [program] [source.cpp]
Show compiler command
mpic++ --showme [source.cpp]
说明
mpic++ is a compiler driver shipped with MPI implementations (Open MPI, MPICH, MVAPICH, Intel MPI) that invokes the underlying system C++ compiler with the include paths, library paths, and link libraries needed to build MPI programs. It is the C++ counterpart to mpicc and is typically a symlink or alias to mpicxx. The wrapped compiler can be overridden via the `OMPI_CXX` (Open MPI) or `MPICH_CXX` (MPICH) environment variable, allowing the same wrapper to drive `g++`, `clang++`, `icpx`, etc.
参数
- -o _file_
- Output file name.
- -O _level_
- Optimization level.
- --showme
- Show underlying compiler command.
- -I _dir_
- Include directory.
- -L _dir_
- Library directory.
- -std= _standard_
- C++ standard version (c++11, c++14, c++17, c++20).
- -show
- Print the underlying compiler command line that would be invoked, then exit (MPICH-style).
- --showme:compile / --showme:link / --showme:command
- Print only the compile flags, only the link flags, or only the wrapped compiler name (Open MPI).
FAQ
What is the mpic++ command used for?
mpic++ is a compiler driver shipped with MPI implementations (Open MPI, MPICH, MVAPICH, Intel MPI) that invokes the underlying system C++ compiler with the include paths, library paths, and link libraries needed to build MPI programs. It is the C++ counterpart to mpicc and is typically a symlink or alias to mpicxx. The wrapped compiler can be overridden via the `OMPI_CXX` (Open MPI) or `MPICH_CXX` (MPICH) environment variable, allowing the same wrapper to drive `g++`, `clang++`, `icpx`, etc.
How do I run a basic mpic++ example?
Run `mpic++ -o [program] [source.cpp]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -o _file_ do in mpic++?
Output file name.