English
Summary
Conclusions
MPI is a message-passing standard for distributed-memory systems: processes running the same program (the SPMD model) have their own memory and are distinguished by their ranks in a communicator. Open MPI 5.0 from the Ubuntu packages provides the mpicxx wrappers, the mpirun launcher, and the CMake target MPI::MPI_CXX. The point-to-point operations MPI_Send/MPI_Recv transfer a message with a tag; a standard send may wait for the receiver, so an exchange in which everyone sends first leads to a deadlock, which is eliminated with MPI_Sendrecv or nonblocking MPI_Isend/MPI_Irecv with MPI_Waitall. Collective operations (MPI_Bcast, MPI_Scatter(v), MPI_Gather(v), MPI_Reduce, MPI_Allreduce) are called by all processes of the communicator. Derived types describe structures and columns, MPI_Comm_split creates groups of processes, and Cartesian topologies simplify domain decomposition with halo exchange. Hybrid programs combine MPI between processes with OpenMP inside a process (MPI_Init_thread, MPI_THREAD_FUNNELED) and require correct binding (--map-by slot:PE=…, --report-bindings). Performance is evaluated with the α–β model and by measuring strong and weak scaling; problems limited by memory bandwidth barely speed up on a single computer, while on a cluster every node adds its own memory.
Self-check questions
- How does the distributed-memory model differ from the shared-memory model?
- What are SPMD, a rank, and a communicator? What is
MPI_COMM_WORLD? - What versions of the MPI standard exist? How does a standard differ from an implementation?
- How do you build an MPI program with the
mpicxxwrapper and in a CMake project? - What is a slot in
mpirun? How do you run more processes than cores? - What does an MPI message consist of? What are tags,
MPI_ANY_SOURCE, andMPI_Statusfor? - How do the
MPI_Send,MPI_Ssend,MPI_Bsend, andMPI_Rsendmodes differ? - Why can an “everyone sends, then receives” exchange work on small data and hang on large data?
- How do
MPI_Isend,MPI_Irecv,MPI_Wait, andMPI_Testwork? What is overlapping computation and communication? - What collective operations do you know? How does
MPI_Reducediffer fromMPI_Allreduce, andMPI_ScatterfromMPI_Scatterv? - What are the rules for calling collective operations?
- What are derived types for? How do you describe a structure and a matrix column?
- How do you create a Cartesian topology and find a process’s neighbors? What is a halo?
- What levels of thread support does MPI define? Why use
MPI_Init_thread? - How do you place the ranks of a hybrid program on cores and check the binding?
- What is needed to run an MPI program on multiple computers?
- What does the α–β model describe? How do you measure latency and bandwidth?
- How does strong scaling differ from weak scaling?
Useful links
- MPI Forum standards: https://www.mpi-forum.org/docs/
- Open MPI documentation: https://docs.open-mpi.org/
- Launching applications in Open MPI 5.0: https://docs.open-mpi.org/en/v5.0.x/launching-apps/index.html
- The
mpirunman page: https://docs.open-mpi.org/en/v5.0.x/man-openmpi/man1/mpirun.1.html - Launching over SSH: https://docs.open-mpi.org/en/v5.0.x/launching-apps/ssh.html
- The CMake FindMPI module: https://cmake.org/cmake/help/latest/module/FindMPI.html
- MPICH: https://www.mpich.org/documentation/guides/
- Open MPI projects in CLion: https://www.jetbrains.com/help/clion/openmpi.html