Difference between revisions of "MPI"
From HCL
| Line 1: | Line 1: | ||
| − | + | == Implementations == | |
* Open MPI: [http://www.open-mpi.org] | * Open MPI: [http://www.open-mpi.org] | ||
| + | |||
| + | == 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>. | ||
== Debugging == | == Debugging == | ||
Revision as of 16:44, 2 March 2010
Implementations
- Open MPI: [1]
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);
}
<source>
Mind the overhead of <code>MPI_Comm_dup</code> and <code>MPI_Comm_free</code>.
== 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);
- Compile your code with
-goption - 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.