mpi
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| mpi [June 10, 2026 at 21:55] – Ivan Janevski | mpi [August 22, 2026 at 15:22] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| # MPI | # MPI | ||
| - | **MPI** (or **Message Passing Interface**) is a parallel computing API used for distributed parallelism. | ||
| - | ## Overview | + | **MPI** (Message Passing Interface) is a standard for distributed-memory parallel |
| - | C programming | + | |
| + | The execution model is **SPMD** (single program, multiple data): all processes start together and execute the same binary, but each plays a different role based on its **rank** (0 to N-1). Every MPI program must call `MPI_Init` first and `MPI_Finalize` last. Compile with `mpicc` (C) or `mpicxx` (C++). | ||
| ```c | ```c | ||
| - | int MPI_Init(...); | + | // compile: mpicc -o ping ping.c |
| - | int MPI_Finalize(...); | + | // run: mpirun -n 2 ./ping |
| - | int MPI_Send (...); | + | // description: |
| - | int MPI_Recv (...); | + | |
| - | int MPI_Bcast(...); | + | |
| - | int MPI_Reduce(...); | + | |
| - | int MPI_Group_size(...); | + | |
| - | int MPI_Group_rank(...); | + | |
| - | int MPI_Comm_rank (...); | + | |
| - | int MPI_Comm_size (...); | + | |
| - | int MPI_Type_commit(...); | + | |
| - | int MPI_Type_contiguous(...); | + | |
| - | int MPI_Type_free(...); | + | |
| - | ``` | + | |
| - | C++ programming language: | + | #include < |
| - | ```cpp | + | #include < |
| - | namespace MPI { | + | |
| - | | + | int main(int argc, char **argv) |
| - | | + | |
| - | | + | |
| - | | + | |
| - | class Intercomm : public Comm {...}; | + | |
| - | class Datatype {...}; | + | |
| - | | + | value = 42; |
| - | class Exception | + | |
| - | class Group {...}; | + | |
| - | class Op {...}; | + | } else { |
| - | | + | |
| - | | + | |
| - | | + | } |
| - | }; | + | |
| + | | ||
| + | | ||
| + | } | ||
| ``` | ``` | ||
| + | |||
| + | Rank 0 blocks on `MPI_Send` until rank 1 reaches `MPI_Recv`. This blocking behaviour is fundamental—MPI communication is synchronous. From here, [[mpi-point-to-point|point-to-point communication]] is the natural next concept, then [[mpi-collectives|collectives]]. | ||
| + | |||
| + | ## Concepts | ||
| + | |||
| + | 1. [[mpi-communicators|Communicators]] | ||
| + | 2. [[mpi-point-to-point|Point-to-point communication]] | ||
| + | 3. [[mpi-blocking|Blocking and non-blocking]] | ||
| + | 4. [[mpi-send-modes|Send modes]] | ||
| + | 5. [[mpi-message-ordering|Message ordering]] | ||
| + | 6. [[mpi-probing|Probing for messages]] | ||
| + | 7. [[mpi-deadlock|Deadlock]] | ||
| + | 8. [[mpi-performance-model|Performance model]] | ||
| + | 9. [[mpi-collectives|Collectives]] | ||
| + | 10. [[mpi-reduction|Reduction]] | ||
| + | 11. [[mpi-scatter-and-gather|Scatter and gather]] | ||
| + | 12. [[mpi-prefix-reductions|Prefix reductions]] | ||
| + | 13. [[mpi-nonblocking-collectives|Non-blocking collectives]] | ||
| + | 14. [[mpi-persistent-communication|Persistent communication]] | ||
| + | 15. [[mpi-derived-datatypes|Derived datatypes]] | ||
| + | 16. [[mpi-virtual-topologies|Virtual topologies]] | ||
| + | 17. [[mpi-process-groups|Process groups]] | ||
| + | 18. [[mpi-communicator-duplication|Communicator duplication]] | ||
| + | 19. [[mpi-one-sided|One-sided communication]] | ||
| + | 20. [[mpi-shared-memory-windows|Shared memory windows]] | ||
| + | 21. [[mpi-parallel-io|Parallel I/O]] | ||
| + | 22. [[mpi-time-measurement|Time measurement]] | ||
| + | 23. [[mpi-hybrid-openmp|Hybrid MPI+OpenMP]] | ||
| + | 24. [[mpi-overview|Overview]] | ||
| + | |||
mpi.1781128520.md.gz · Last modified: by Ivan Janevski
