|
|
MPI Routines - Quick Reference
int MPI_Init (
int *argc, /* IN – First parameter to function main */
Char ***argv /* IN – Second parameter to function main */
)
Initializes the MPI session, creating some number of processes.
Just pass the address of the argc and argv argumets to main().
int MPI_Comm_size (
MPI_Comm comm, /* IN - Communicator (e.g., MPI_COMM_WORLD) */
int *size /* OUT - Number of processes in communicator */
)
Call this to find out the number of processes in a communicator.
int MPI_Comm_rank (
MPI_Comm comm, /* IN - Communicator (e.g., MPI_COMM_WORLD) */
int *rank /* OUT - The id/rank of the calling process */
)
Call this to find out the rank/id of the the current/calling process.
int MPI_Finalize ()
Every process must call this before exiting to terminate the MPI
execution environment.
int MPI_Bcast (
void *buffer, /* IN/OUT - Message address */
int cnt, /* IN - Elements in message */
MPI_Datatype dtype /* IN - Element type */
int root, /* IN - Rank of root/master process */
MPI_Comm comm /* IN - Communicator */
)
MPI_Bcast is a collective communication operation allowing one
process to broadcast a message to all other processes in a
communicator. Parameter root is the rank of the process with the
message to broadcast.
int MPI_Reduce (
void *send_buffer /* IN - Send buffer */
void *recv_buffer /* OUT - Receive buffer. Only master process */
/* gets results */
int cnt, /* IN - Number of elements to reduce */
MPI_Datatype dtype, /* IN - Element type */
MPI_Op op, /* IN - Reduction operator */
int root, /* IN - Rank of master process */
MPI_Comm comm /* IN - Communicator (e.g., MPI_COMM_WORLD */
)
MPI_Reduce is a collective communication function that performs cnt
operations. When the function returns, the process with rank root has
the results of the reductions.
int MPI_Send (
void *buffer, /* IN - Message buffer */
int cnt, /* IN - Elements in message */
MPI_Datatype dtype /* IN - Type of elements */
int dest /* IN - Destination process */
int tag, /* IN - Message identifier */
MPI_Comm comm /* IN - Communicator */
)
MPI_Send implements a blocking send operation: when the function returns,
the message buffer may be immediately reused.
int MPI_Recv (
void *buffer, /* OUT - Receiver buffer */
int cnt, /* IN - Max nbr of elements to receive */
MPI_Datatype dtyp, /* IN - Type of message elements */
int src, /* IN - Rank of message source */
int tag, /* IN - Message identification */
MPI_Comm comm, /* IN - Communicator */
MPI_Status *status /* OUT - Request handle */
)
MPI_Recv implements a blocking receive. Assuming the receive is
successful, when control returns from MPI_Recv, buffer points
to the received message.
|