Nonblocking send data from a node to another
res = MPI_Isend(value,node[,comm=mpi_comm])
The value to be sent to the specified node.
The node to send the data
If the optional argument "comm" is given, this function will use the MPI communicator created by MPI_Create_comm. If not, the default MPI_COMM_WORLD is used.
The result of the operation (true if success, false if failed). If the optional argument "comm" is given, all nodes which are not in the communicator will return false.
Send a variable to a specified node in a nonblock (asynchronous) way. The value should be retrieved by the node with the function MPI_Irecv.
MPI_Init(); rnk = MPI_Comm_rank(); sizeNodes = MPI_Comm_size(); SLV = rnk; Master = ~ SLV; assert_checkequal(MPI_Comm_size(), 2); if Master for slaveId = 1:sizeNodes-1 value = slaveId*2 MPI_Isend(value, slaveId, 42); end else rankSource=0; tag=0; MPI_Irecv(rankSource, tag, 42); // MPI_Irecv does not return any value value=MPI_Wait(42) // the value will be returned by MPI_Wait assert_checkequal(value,2); end MPI_Finalize(); exit() | ![]() | ![]() |