Lockless Inc

NAME

mpicxx - Compiles and links MPI programs written in C++

DESCRIPTION

This shell script is used to compile and link MPI programs written in C++. It performs necessary pre-processing and linking of external libraries in order to create a working MPI program. Do not use a normal C++ compiler to compile MPI code as this needed extra processing will be missing.

The shell script adds a few extra options to the command line passed to the compiler. The most important of these are -fpic and -pie, which turn on position-independent code generation. This implementation of MPI loads multiple copies of the program within the same address space. In order for this to work, each copy needs to exist at a different address.

The other options to the compiler turn on threading support, and make sure that the MPI library can hook calls to pthread_create(). The extra hooking is needed so that threads can safely call function pointers referencing code in other programs within the same address space. MPI uses the %gs segment register to maintain references to thread-local variables as %fs-based references will be at differing offsets.

Finally, the shell script includes the argument that links with the MPI library. If you install the library in a non-default location, you may want to alter the LIB variable.

If you use a compiler other than g++, edit the CXX variable. You will want to alter the arguments to produce the same effects as those used for g++.

COMMAND LINE ARGUMENTS

The shell script expects the normal arguments passed to the C++ compiler. All arguments are passed through directly to the C++ compiler with no alteration.

EXAMPLES

To compile a single file foo.cc, use:
mpicxx -c foo.cc

To make an executable, use:
mpicxx -o foo foo.o

Compilation and linking can be combined i.e. with two source files foo1.cxx and foo2.cxx
mpicxx foo1.cxx foo2.cxx -o foo

COPYRIGHT

Copyright (C) 2012 Lockless Inc.

SEE ALSO

mpicc (1) mpif77 (1) mpiexec (1)

About Us Returns Policy Privacy Policy Send us Feedback
Company Info | Product Index | Category Index | Help | Terms of Use
Copyright © Lockless Inc All Rights Reserved.