wiki:mpi-overview
Table of Contents
MPI reference
Quick reference for MPI functions, datatypes, and reduction operators.
Functions
// Initialisation MPI_Init(&argc, &argv) // initialise MPI; must be first MPI_Finalize() // shut down MPI; must be last MPI_Abort(comm, errorcode) // terminate all processes in comm // Communicator queries MPI_Comm_rank(comm, &rank) // rank of calling process in comm MPI_Comm_size(comm, &size) // number of processes in comm MPI_Comm_split(comm, color, key, &newcomm) // partition into sub-communicators MPI_Comm_free(&comm) // release a communicator // Point-to-point MPI_Send(buf, count, type, dest, tag, comm) MPI_Recv(buf, count, type, src, tag, comm, &status) MPI_Sendrecv(sbuf, sc, st, dest, stag, rbuf, rc, rt, src, rtag, comm, &status) MPI_Isend(buf, count, type, dest, tag, comm, &req) MPI_Irecv(buf, count, type, src, tag, comm, &req) MPI_Wait(&req, &status) MPI_Test(&req, &flag, &status) MPI_Waitall(count, reqs, statuses) // Collectives MPI_Barrier(comm) MPI_Bcast(buf, count, type, root, comm) MPI_Scatter(sbuf, sc, st, rbuf, rc, rt, root, comm) MPI_Gather(sbuf, sc, st, rbuf, rc, rt, root, comm) MPI_Scatterv(sbuf, scounts, displs, st, rbuf, rc, rt, root, comm) MPI_Gatherv(sbuf, sc, st, rbuf, rcounts, displs, rt, root, comm) MPI_Allgather(sbuf, sc, st, rbuf, rc, rt, comm) MPI_Alltoall(sbuf, sc, st, rbuf, rc, rt, comm) MPI_Reduce(sbuf, rbuf, count, type, op, root, comm) MPI_Allreduce(sbuf, rbuf, count, type, op, comm) MPI_Scan(sbuf, rbuf, count, type, op, comm) // inclusive prefix reduction // Derived datatypes MPI_Type_contiguous(count, oldtype, &newtype) MPI_Type_vector(count, blocklength, stride, oldtype, &newtype) MPI_Type_create_struct(count, blocklengths, displs, types, &newtype) MPI_Type_commit(&type) MPI_Type_free(&type) // One-sided MPI_Win_create(base, size, disp_unit, info, comm, &win) MPI_Put(obuf, oc, ot, target_rank, disp, tc, tt, win) MPI_Get(obuf, oc, ot, target_rank, disp, tc, tt, win) MPI_Accumulate(obuf, oc, ot, target_rank, disp, tc, tt, op, win) MPI_Win_fence(assert, win) MPI_Win_free(&win) // Timing MPI_Wtime() // wall-clock time in seconds MPI_Wtick() // resolution of MPI_Wtime
Built-in datatypes
| C type | MPI type |
|---|---|
int | MPI_INT |
long | MPI_LONG |
float | MPI_FLOAT |
double | MPI_DOUBLE |
char | MPI_CHAR |
unsigned char | MPI_UNSIGNED_CHAR |
long long | MPI_LONG_LONG |
Built-in reduction operators
| Operator | Meaning |
|---|---|
MPI_SUM | sum |
MPI_PROD | product |
MPI_MAX | maximum |
MPI_MIN | minimum |
MPI_LAND | logical and |
MPI_LOR | logical or |
MPI_BAND | bitwise and |
MPI_BOR | bitwise or |
MPI_MAXLOC | maximum value and the rank that holds it |
MPI_MINLOC | minimum value and the rank that holds it |
wiki/mpi-overview.md · Last modified: by 127.0.0.1
