Description
ISHAAN OHRI
18BCE0265
Aim:
Write a C program to use MPI_Reduce that divides the processors into the group to find the addition independently.
Hint. The function prototype is as follows:
MPI_Reduce( void* send_data, void* recv_data, int count,
MPI_Datatype datatype,
MPI_Op op, int root,
MPI_Comm communicator)
Source Code:
Execution:
Remarks:
int MPI_Reduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
In the above command
• sendbuf is the address of send buffer
• count is the number of elements in the send buffer
• datatype is the data type of elements of send buffer
• op is the reduce operation
• root is the rank of root process
• comm is the communicator
• recvbuf is the address of the receive buffer
Using MPI_Reduce, MPI process can apply a reduction calculation. The values sent by the MPI processes will be combined using the reduction operation given and the result will be stored on the MPI process specified as root.
Reviews
There are no reviews yet.