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