MPI - Start

Distributed memory computing.
MPI: Quick reference (C++), docuhome page, tutorial (LLNL, MPI-book, functions)

Check:

Compiling Code:

Changing the underlying Compiler for OpenMPI (briefly):

How to MPI-parallelize the inner product:

Original code for inner product:
double scalar(const int N, const double x[], const double y[])
{
 double sum = 0.0;
for (int i=0; i<N; ++i) { sum += x[i]*y[i]; } return sum; }

int main()
{
...
double s = scalar(n,a,b);
...
}


MPI code for inner product:
#include <mpi.h>

// local sequential inner product
double scalar(const int N, const double x[], const double y[]) { double sum = 0.0;
for (int i=0; i<N; ++i)
sum += x[i]*y[i]; return sum; }
// MPI inner product double scalar(const int n, const double x[], const double y[], const MPI_Comm icomm) { const double s = scalar(n,x,y); // call sequential inner product double sg; MPI_Allreduce(&s,&sg,1,MPI_DOUBLE,MPI_SUM,icomm); return(sg);
}

int main(int argc, char* argv[])
{
...
MPI_Init(&argc,&argv);
...
double s = scalar(n,a,b,MPI_COMM_WORLD);
...
MPI_Finalize();
...
}

and  

See also the exercise sheet.


Queuing system on mephisto (5 nodes with 2 Xeon 2.67 GHz [2x6 cores], 96 GB memory each): 128: