mpiCC与mpicc命令详解
mpiCC
Compiles and links MPI programs written in C++//编译链接MPI C++源程序
Description
This command can be ud to compile and link MPI programs written in C++. It provides the options and any special libraries that are needed to compile and link MPI programs.//它提供了选项和有⽤的库来编译链接MPI程序
逃离的英文It is important to u this command (or a Makefile procesd with mpireconfig) particularly when linking programs, as it provides the necessary libraries. It can also simplify the u of the MPE profiling libraries, through the u of the -mpilog, -mpitrace,
and -mpianim commands.
mpiCC cannot be ud to compile C programs. U mpicc for C programs.
Command line arguments
-mpilog Build version that generate MPE log files
Build version that generates traces
-
mpitrace
-
Build version that generates real-time animation
mpianim
-show Show the commands that would be ud without runnning them
-help Give short help
-echo Show exactly what this program is doing. This option should normally not be ud.
others are pasd to the compiler or linker. For example, -c caus files to be compiled, -g lects c
ompilation with debugging on most systems, and -o name caus linking with the output executable given the name name.
Environment Variables
The environment variables MPICH_CCC and MPICH_CCLINKER may be ud to lect different C++ compiler and linker. Note that since MPICH is built with a particular C++ and C compiler, change the compilers ud can cau problems. U this only
if you could intermix code compiled with the different compilers.
Examples
To compile a single file foo.c, u
mpicc -c foo.c
To link the output and make an executable, u
mpicc -o foo foo.o
Combining compilation and linking in a single command
mpicc -o foo foo.c
is a convenient way to build simple programs.
See Also
mpif77, mpireconfig
Location:/home/MPI/mansrc/commands
mpicc
农历2月28
mpicc(1) LAM TOOLS mpicc(1)
NAME
mpicc, mpiCC / mpic++ - Compile LAM/MPI C/C++ programs.
SYNTAX
mpicc [-showme|-showme:compile|-showme:link] ...
mpiCC [-showme|-showme:compile|-showme:link] ...
mpic++ [-showme|-showme:compile|-showme:link] ...怎样才能写好字
OPTIONS
-showme
Does not invoke the underlying C/C++ compiler.Instead,it shows the command line that would be executed to compile the C/C++ program.
-showme:compile
Does not invoke the underlying C/C++ compiler. Instead, it shows the compiler flags that would be supplied to the C/C++ compiler.
-showme:link
Does not invoke the underlying C/C++ compiler. Instead, it shows the linker flags that would be s
upplied to the C/C++ compiler.
See cc(1) and CC(1) (or whatever your underlying C/C++ compilers are)for all other options.
DESCRIPTION
mpicc and mpiCC (mpic++ is a synonym for mpiCC provided for filenames that do not support ca-nsitive filenames) are convenience wrappers for the local native C and C++ compilers.Translation of a LAM program requires the linkag This includes all necessary options for ROMIO and/or C++ bindings support (if ROMIO/C++ support was included when LAM was compiled).
mpiCC (and therefore mpic++) is similar, but invokes the native C++
compiler instead.
The LAM Team strongly encourages using mpicc and mpiCC instead of
attempting to link to the LAM libraries manually. This allows the spe-
cific implementation of LAM to change without forcing changes to linker
directives in urs’ Makefiles (the specific t of underlying LAM
libraries has already changed multiple times, and will likely change马步舞
again in future versions).
Indeed, since mpicc/mpiCC are very thin wrappers on top of an underly-
ing compiler, there are very, very few compelling reasons not to u
mpicc/mpiCC. When it is not possible to u mpicc/mpiCC, the
-showme:compile and -showme:link arguments should be ud instead. For
example:
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
ENVIRONMENT VARIABLES
By default, mpicc us the C compiler that was lected when LAM was
configured (with the --with-cc flag to ./configure, or by tting the
environment variable CC before ./configure was invoked) as the local
native C compiler, but this can be overridden by the LAMMPICC environ-
ment variable (an older name for this environment variable is LAMHCC --
this also still works, but its u is deprecated).
Likewi, mpiCC us the C++ compiler that was lected when LAM was
configured (with the --with-cpp flag to ./configure, or by tting the
environment variable CXX before invoking ./configure) by default, but
this can be overridden by the LAMMPICXX environment variable (an older
name for this environment variable is LAMHCP -- this also still works,
but its u is deprecated).
If the environment variable LAMHOME is t, mpicc and mpiCC will u
its value as the location of the LAM installation directory instead of
the value that was compiled into mpicc/mpiCC. This means that
mpicc/mpiCC will u the value of LAMHOME as the ba to create the -I
and -L arguments that are pasd to the lower-level compiler, not the
installation directory that was supplied when mpicc/mpiCC were created.
This is almost always a Bad Idea.
The u of LAMHOME is discouraged except for some rare configuration
cas in oddly networked sites (in which ca your system administrator
should probably t this up), and for advanced urs with multiple
LAM/MPI installations who really know what they are doing; if the
LAMHOME environment variable is unintentionally left t, it can lead
to tremendous ur confusion. For example, if LAMHOME points to LAM
installation A, but the ur’s PATH points to LAM installation B, then
even though B’s mpicc will be ud, the ur program will be compiled
and linked against LAM installation A.
The LAMHOME environment variable is mainly only left in place for back-
wards compatibility; it is not required for normal functioning of
LAM/MPI. The LAM Team discourages the u of the LAMHOME environment
variable, and instead advocates simply tting the PATH properly to
switch between multiple LAM/MPI implementations.
NOTES
Previous versions of LAM encouraged the u of hcc and hcp to compile
LAM and/or MPI C and C++ applications, respectively. In very old ver-
茶的图片唯美sions of LAM, hcc and hcp did not automatically add -lmpi to the com-
mand line. hcc and hcp were eventually deprecated and replaced with
mpicc and mpiCC (or mpic++ on ca-innsitive filesystems). The exe-
cutables hcc and hcp are now simply symbolic links to mpicc and mpic++,
必修一生物respectively, just in ca there’s anyone out there that still us
tho names. It should be harmless to pass in the additional -lmpi;
mpicc and mpic++ should silently do the Right Thing (only link in the森林动物
MPI library once).
SEE ALSO
cc(1), CC(1), ld(1), lam-helpfile(5), mpif77(1)
LAM 7.1.1 September, 2004 mpicc(1)