Changes between Version 4 and Version 5 of Challenge
- Timestamp:
- 03/11/19 16:10:49 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Challenge
v4 v5 43 43 44 44 45 MPI Reference 46 ============= 45 == MPI Reference == 47 46 48 Constants: 47 === Constants === 49 48 50 MPI_COMM_WORLD (type MPI_Comm) 51 MPI_STATUS_IGNORE (type MPI_Status*) 52 MPI_ANY_SOURCE (type int) 53 MPI_INT (type MPI_Datatype) 54 MPI_DOUBLE (type MPI_Datatype) 49 * `MPI_COMM_WORLD` (type `MPI_Comm`) 50 * `MPI_STATUS_IGNORE` (type `MPI_Status*`) 51 * `MPI_ANY_SOURCE` (type `int`) 52 * `MPI_ANY_TAG` (type `int`) 53 * `MPI_INT` (type `MPI_Datatype`) 54 * `MPI_DOUBLE` (type `MPI_Datatype`) 55 55 56 === Functions === 56 57 57 Functions: 58 * `MPI_Init(NULL, NULL)` 59 * `MPI_Finalize()` 58 60 59 MPI_Init(NULL, NULL); 60 MPI_Finalize(); 61 62 MPI_Init must be called before other MPI functions. MPI_Finalize 61 `MPI_Init` must be called before other MPI functions. `MPI_Finalize` 63 62 must be called before termination and after all other MPI functions. 64 63 65 MPI_Comm_size(MPI_Comm comm, int *nprocs); 66 MPI_Comm_rank(MPI_Comm comm, int *rank); 64 * `MPI_Comm_size(MPI_Comm comm, int *nprocs)` 65 * `MPI_Comm_rank(MPI_Comm comm, int *rank)` 67 66 68 67 Get the number of processes in the communicator, and the "rank" (ID 69 68 number) of this process within the communicator. 70 69 71 int MPI_Send(const void *buf, int count, MPI_Datatype datatype, 72 int dest, int tag, MPI_Comm comm); 70 * `int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)` 73 71 74 72 Sends a message to the process of rank dest. 75 You can use NULL for buf if countis 0 --- an empty message.73 You can use `NULL` for `buf` if `count` is 0 --- an empty message. 76 74 77 int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, 78 int tag, MPI_Comm comm, MPI_Status *status); 75 * `int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status)` 79 76 80 77 Receives a message from the specified source process. 81 source can be MPI_ANY_SOURCE--- to receive from any source ("wildcard").82 status can be MPI_STATUS_IGNORE, if you don't care about the status.83 Otherwise, declare a variable of type MPI_Statusand pass a pointer to it.78 `source` can be `MPI_ANY_SOURCE` --- to receive from any source ("wildcard"). 79 status can be `MPI_STATUS_IGNORE`, if you don't care about the status. 80 Otherwise, declare a variable of type `MPI_Status` and pass a pointer to it. 84 81 82 {{{ 85 83 int MPI_Sendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, 86 84 int dest, int sendtag, … … 88 86 int source, int recvtag, 89 87 MPI_Comm comm, MPI_Status *status); 88 }}} 90 89 91 Combines one MPI_Send operation and one MPI_Recvoperation into a90 Combines one `MPI_Send` operation and one `MPI_Recv` operation into a 92 91 single command. It behaves as if the two operations execute 93 92 concurrently in separate threads. Used to avoid deadlocks that could 94 result if all processes do MPI_Send; MPI_Recv.93 result if all processes do `MPI_Send; MPI_Recv`.
