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