Introduction to MPI

History of MPI

Message passing
Early 80s
1991-1992
MPI letters
1994: MPI-1
1998: MPI-2
2012: MPI-3
Hands-on: create and compile MPI codes
1
2
3
cd
mkdir intro-mpi
cd intro-mpi
1
2
3
4
mpicc -o first first.c
mpirun -np 1 ./first
mpirun -np 2 ./first
mpirun -np 4 ./first

MPI in a nutshell

Overview
Basic routines
MPI communicators (first defined in MPI-1)

MPI defines communicator groups for point-to-point and collective communications:

MPI Examples

hello.c
1
2
3
4
mpicc -o hello hello.c
mpirun -np 1 ./hello
mpirun -np 2 ./hello
mpirun -np 4 ./hello
evenodd.c
1
2
3
4
mpicc -o evenodd evenodd.c
mpirun -np 1 ./evenodd
mpirun -np 2 ./evenodd
mpirun -np 4 ./evenodd
rank_size.c
1
2
3
4
mpicc -o rank_size rank_size.c
mpirun -np 1 ./rank_size
mpirun -np 2 ./rank_size
mpirun -np 4 ./rank_size