|
Packit |
0848f5 |
/*D
|
|
Packit |
0848f5 |
mpicc - Compiles and links MPI programs written in C
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
Description:
|
|
Packit |
0848f5 |
This command can be used to compile and link MPI programs written in
|
|
Packit |
0848f5 |
C. It provides the options and any special libraries that are
|
|
Packit |
0848f5 |
needed to compile and link MPI programs.
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
It is important to use this command, particularly when linking programs,
|
|
Packit |
0848f5 |
as it provides the necessary libraries.
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
Command line arguments:
|
|
Packit |
0848f5 |
+ \-show - Show the commands that would be used without
|
|
Packit |
0848f5 |
running them
|
|
Packit |
0848f5 |
. \-help - Give short help
|
|
Packit |
0848f5 |
. \-cc=name - Use compiler 'name' instead of the default choice. Use
|
|
Packit |
0848f5 |
this only if the compiler is compatible with the MPICH
|
|
Packit |
0848f5 |
library (see below)
|
|
Packit |
0848f5 |
. \-config=name - Load a configuration file for a particular compiler.
|
|
Packit |
0848f5 |
This allows a single 'mpicc' command to be used with
|
|
Packit |
0848f5 |
multiple compilers.
|
|
Packit |
0848f5 |
. \-compile_info - Show the steps for compiling a program. This option
|
|
Packit |
0848f5 |
can be used to see what options and include paths are
|
|
Packit |
0848f5 |
used by mpicc.
|
|
Packit |
0848f5 |
. \-link_info - Show the steps for linking a program. This option
|
|
Packit |
0848f5 |
can be used to see what options and libraries are used by
|
|
Packit |
0848f5 |
mpicc.
|
|
Packit |
0848f5 |
. \-profile=name - Use the MPI profiling given by name. See below for
|
|
Packit |
0848f5 |
details
|
|
Packit |
0848f5 |
. \-echo - Show exactly what this program is doing.
|
|
Packit |
0848f5 |
This option should normally not be used.
|
|
Packit |
0848f5 |
- others - are passed to the compiler or linker. For example, '\-c'
|
|
Packit |
0848f5 |
causes files to be compiled, '\-g' selects compilation with
|
|
Packit |
0848f5 |
debugging on most systems, and '\-o name' causes linking
|
|
Packit |
0848f5 |
with the output executable given the name 'name'.
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
Environment Variables:
|
|
Packit |
0848f5 |
The environment variable 'MPICH_CC' may be used
|
|
Packit |
0848f5 |
to select different C compiler and linker. Note that since
|
|
Packit |
0848f5 |
MPICH is built with a particular C and Fortran compiler, changing the
|
|
Packit |
0848f5 |
compilers used can cause problems. Use this only if you could intermix
|
|
Packit |
0848f5 |
code compiled with the different compilers.
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
The environment variable 'MPICC_PROFILE' specifies a profile library
|
|
Packit |
0848f5 |
and has the same effect as if '\-profile=$MPICC_PROFILE' were used as
|
|
Packit |
0848f5 |
an argument to 'mpicc'. See the discussion of '\-profile' below for more
|
|
Packit |
0848f5 |
details.
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
Compatible Compilers:
|
|
Packit |
0848f5 |
The MPI library may be used with any compiler that uses the same
|
|
Packit |
0848f5 |
lengths for basic data objects (such as 'long double') and that
|
|
Packit |
0848f5 |
uses compatible run-time libraries. On many systems, the various
|
|
Packit |
0848f5 |
compilers are compatible and may be used interchangably. There are
|
|
Packit |
0848f5 |
exceptions; if you use the 'MPICH_CC' environment variable or the
|
|
Packit |
0848f5 |
'\-cc=name' command-line argument to override the choice of compiler
|
|
Packit |
0848f5 |
and encounter problems, try reconfiguring MPICH with the new compiler
|
|
Packit |
0848f5 |
and installing MPICH in a separate location. See the installation manual
|
|
Packit |
0848f5 |
for more details.
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
Examples:
|
|
Packit |
0848f5 |
To compile a single file 'foo.c', use
|
|
Packit |
0848f5 |
.vb
|
|
Packit |
0848f5 |
mpicc -c foo.c
|
|
Packit |
0848f5 |
.ve
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
To link the output and make an executable, use
|
|
Packit |
0848f5 |
.vb
|
|
Packit |
0848f5 |
mpicc -o foo foo.o
|
|
Packit |
0848f5 |
.ve
|
|
Packit |
0848f5 |
Combining compilation and linking in a single command
|
|
Packit |
0848f5 |
.vb
|
|
Packit |
0848f5 |
mpicc -o foo foo.c
|
|
Packit |
0848f5 |
.ve
|
|
Packit |
0848f5 |
is a convenient way to build simple programs.
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
Selecting a Profiling Library:
|
|
Packit |
0848f5 |
The '\-profile=name' argument allows you to specify an MPI profiling
|
|
Packit |
0848f5 |
library to be used. 'name' can have two forms\:
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
.n A library in the same directory as the MPI library
|
|
Packit |
0848f5 |
.n The name of a profile configuration file
|
|
Packit |
0848f5 |
.n
|
|
Packit |
0848f5 |
If 'name' is a library, then this library is included before the MPI
|
|
Packit |
0848f5 |
library. This allows the simple use of libraries that make use of the
|
|
Packit |
0848f5 |
MPI profiling interface and that are installed in the same directory as
|
|
Packit |
0848f5 |
the MPI library.
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
If 'name.conf' is the name of a file in the sysconfdir directory, then this
|
|
Packit |
0848f5 |
is read and may define the following variables\:
|
|
Packit |
0848f5 |
+ PROFILE_PRELIB - Libraries (and paths) to include before the MPI library
|
|
Packit |
0848f5 |
. PROFILE_POSTLIB - Libraries to include after the MPI library
|
|
Packit |
0848f5 |
- PROFILE_INCPATHS - C preprocessor arguments for any include files
|
|
Packit |
0848f5 |
For example, to add '/usr/local/myprof/include' to the include path and
|
|
Packit |
0848f5 |
the library 'libmyprof.a' in '/usr/local/myprof/lib' to the link step,
|
|
Packit |
0848f5 |
you could create the file 'myprof.conf' with the lines
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
.vb
|
|
Packit |
0848f5 |
PROFILE_PRELIB="-L/usr/local/myprof/lib -lmyprof"
|
|
Packit |
0848f5 |
PROFILE_INCPATHS="-I/usr/local/myprof/include"
|
|
Packit |
0848f5 |
.ve
|
|
Packit |
0848f5 |
and place it in the sysconfdir directory (this directory is set at
|
|
Packit |
0848f5 |
configure time when MPICH is built). Then using the command-line
|
|
Packit |
0848f5 |
argument '\-profile=myprof' will cause these
|
|
Packit |
0848f5 |
definitions to be added to the relevant compile commands.
|
|
Packit |
0848f5 |
|
|
Packit |
0848f5 |
.seealso: mpicxx, mpifort, mpiexec
|
|
Packit |
0848f5 |
D*/
|