Difference between revisions of "MPI"

From HCL
Jump to: navigation, search
(New page: You can choose different MPIs. E.g. Open MPI: http://www.open-mpi.org )
 
 
(35 intermediate revisions by 4 users not shown)
Line 1: Line 1:
You can choose different MPIs.
+
== Documentation ==
 +
* http://www.mpi-forum.org/docs/docs.html
  
E.g. Open MPI: [[ http://www.open-mpi.org ]]
+
== Implementations ==
 +
* [[LAM]]
 +
* [[MPICH]]
 +
* [[OpenMPI]]
 +
* [[MPICH2]]
 +
 
 +
== Manual installation ==
 +
Install in separate subfolder <code>$HOME/SUBDIR</code>, because you may need some MPI implementations (see [[Libraries]])
 +
 
 +
== Tips & Tricks ==
 +
* For safe consecutive communications create new context, for example:
 +
<source lang="C">
 +
int communication_operation(MPI_Comm comm) {
 +
MPI_Comm newcomm;
 +
MPI_Comm_dup(comm, &newcomm);
 +
... // work with newcomm
 +
MPI_Comm_free(&newcomm);
 +
}
 +
</source>
 +
Mind the overhead of <code>MPI_Comm_dup</code> and <code>MPI_Comm_free</code>.
 +
 
 +
* If you are having trouble with the multi-homed nature of the HCL Cluster, check [http://www.open-mpi.org/faq/?category=tcp#tcp-selection here]
 +
 
 +
== Debugging ==
 +
* Add the following code:
 +
<source lang="C">
 +
int rank;
 +
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 +
if (!rank)
 +
  getc(stdin);
 +
MPI_Barrier(MPI_COMM_WORLD);
 +
</source>
 +
* Compile your code with <code>-g</code> option
 +
* Run parallel application
 +
* Attach to process(es) from [[GDB]]
 +
** MPICH-1 runs a background process for each application process: 0, 0b, 1, 1b, ..., therefore, attach to the first ones.
 +
 
 +
== Profiling  ==
 +
 
 +
[http://www.bsc.es/computer-sciences/performance-tools/paraver/general-overview Paraver] by Barcelona Supercomputing Center is a "a flexible performance visualization and analysis tool"
 +
 
 +
[http://www.bsc.es/computer-sciences/performance-tools/downloads Download here] and [http://www.bsc.es/computer-sciences/performance-tools/documentation tutorials here].
 +
 
 +
Use Extrae to create trace files.
 +
 
 +
Configered and installed extrae on Grid5000 with:
 +
 
 +
./configure --prefix=$HOME --with-papi=$HOME --with-mpi=/usr --enable-openmp --with-unwind=$HOME --without-dyninst
 +
make; make install
 +
 
 +
Create trace.sh (modified from example extrae file):
 +
 
 +
<source lang="bash">#!/bin/bash
 +
export EXTRAE_HOME=$HOME
 +
export EXTRAE_CONFIG_FILE=$HOME/bin/extrae.xml
 +
export LD_LIBRARY_PATH=${EXTRAE_HOME}/lib:@sub_MPI_HOME@/lib:@sub_PAPI_HOME@/lib:@sub_UNWIND_HOME@/lib:$LD_LIBRARY_PATH
 +
export LD_PRELOAD=${EXTRAE_HOME}/lib/libmpitrace.so
 +
 
 +
## Run the desired program
 +
$*</source>
 +
 
 +
Using the standard extrae.xml supplied with the package.
 +
 
 +
  mpirun -np 3 ~/bin/trace.sh ./executable
 +
 
 +
Files created: ''TRACE.mpits, TRACExxxxxx.mpit''
 +
 
 +
On head node run:
 +
 
 +
  mpi2prv -f TRACE.mpits -e ./executable -o output_tracefile.prv
 +
 
 +
On local machine open ''output_tracefile.prv'' with paraver

Latest revision as of 23:01, 16 July 2012

Documentation

Implementations

Manual installation

Install in separate subfolder $HOME/SUBDIR, because you may need some MPI implementations (see Libraries)

Tips & Tricks

  • For safe consecutive communications create new context, for example:
int communication_operation(MPI_Comm comm) {
MPI_Comm newcomm;
MPI_Comm_dup(comm, &newcomm);
... // work with newcomm
MPI_Comm_free(&newcomm);
}

Mind the overhead of MPI_Comm_dup and MPI_Comm_free.

  • If you are having trouble with the multi-homed nature of the HCL Cluster, check here

Debugging

  • Add the following code:
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (!rank)
  getc(stdin);
MPI_Barrier(MPI_COMM_WORLD);
  • Compile your code with -g option
  • Run parallel application
  • Attach to process(es) from GDB
    • MPICH-1 runs a background process for each application process: 0, 0b, 1, 1b, ..., therefore, attach to the first ones.

Profiling

Paraver by Barcelona Supercomputing Center is a "a flexible performance visualization and analysis tool"

Download here and tutorials here.

Use Extrae to create trace files.

Configered and installed extrae on Grid5000 with:

./configure --prefix=$HOME --with-papi=$HOME --with-mpi=/usr --enable-openmp --with-unwind=$HOME --without-dyninst
make; make install

Create trace.sh (modified from example extrae file):

#!/bin/bash
export EXTRAE_HOME=$HOME
export EXTRAE_CONFIG_FILE=$HOME/bin/extrae.xml
export LD_LIBRARY_PATH=${EXTRAE_HOME}/lib:@sub_MPI_HOME@/lib:@sub_PAPI_HOME@/lib:@sub_UNWIND_HOME@/lib:$LD_LIBRARY_PATH
export LD_PRELOAD=${EXTRAE_HOME}/lib/libmpitrace.so

## Run the desired program
$*

Using the standard extrae.xml supplied with the package.

 mpirun -np 3 ~/bin/trace.sh ./executable

Files created: TRACE.mpits, TRACExxxxxx.mpit

On head node run:

 mpi2prv -f TRACE.mpits -e ./executable -o output_tracefile.prv

On local machine open output_tracefile.prv with paraver