MPI Flashcards
(32 cards)
What is the function used to initialise the MPI execution environment?
int MPI_Init(int *argc, char ***argv)
What is the function used to finalise the MPI execution environment?
int MPI_Finalize()
What does int MPI_Comm_size(MPI_Comm comm, int *size)
do?
Reports the number of MPI processes in the specified communicator, into the size
variable
What does int MPI_Comm_rank(MPI_Comm comm, int *rank)
do?
Reports the rank of the calling process in the specified communicator, into the rank
variable
What is the range of ranks for MPI processes?
From 0 to size-1
What is the predefined communicator that refers to all concurrent processes in an MPI program?
MPI_COMM_WORLD
What are the two basic functions for point-to-point communication in MPI?
MPI_Send
and MPI_Recv
What is the purpose of the MPI_Send
function? What is the full function definition?
- Sends a message to another process
int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)
What is the purpose of the MPI_Recv
function? What is the full function definition?
- Receives a message from another process
int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status)
List some MPI C data types.
MPI_CHAR
MPI_INT
MPI_FLOAT
MPI_DOUBLE
- etc
What are collectives? Why use them?
- Operations for communicating within a group of processes specified by a communicator
- Collectives can make MPI programming more efficient
What is the purpose of MPI_Bcast
? What is the full function definition?
- Broadcasts data from one process to all others in a communicator (one-to-all)
int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm)
What is the purpose of MPI_Scatter
? What is the full function definition?
- Scatters data from one process to all others in a communicator
- Each process receives a subset of the data
int MPI_Scatter(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
What is the purpose of MPI_Gather
? What is the full function definition?
- Gathers data from all processes in a communicator to one process
int MPI_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
What is the purpose of MPI_Allgather
? What is the full function definition?
- Gathers data from all processes in a communicator to all processes
- All processes recieve the result
int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
What is the purpose of MPI_Reduce
? What is the full function definition?
- Reduces a variable and returns result to specified process
int MPI_Reduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype type, MPI_Op op, int root, MPI_Comm comm)
What is the purpose of MPI_Allreduce
? What is the full function definition?
- Reduces a variable and returns result to all processes
int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype type, MPI_Op op, MPI_Comm comm)
What command is used to compile an MPI program in C?
mpicc -o program program.c
What command is used to run an MPI process?
mpirun -np 5 program
5 is the number of processes
What is blocking communication in MPI? What is a benefit?
- Communication where execution block until the message is received or safe to change buffers
- It helps avoid overwriting buffers before it is safe to do so
What are non-blocking communications? Why can they be good? Why can they be bad?
- They allow simultaneous computation and communication
- Helps avoid deadlocks
- We need to ensure the program works correctly and does not overwrite buffers
What is the purpose of MPI_Isend
? What is the full function definition?
- Sends a message without blocking
int MPI_Isend(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)
What is the purpose of MPI_Irecv
? What is the full function definition?
- Receives a message without blocking
int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request)
What is the purpose of MPI_Wait
? What is the full function definition?
- Waits for a non-blocking request to complete
int MPI_Wait(MPI_Request *request, MPI_Status *status)