OcamlMpi has the instructions for blocking 开发者_运维问答send and receive. Has anyone done a non-blocking receive for ocamlmpi?
Unfortunately there does not appear to be any references to non-blocking MPI calls in the OcamlMPI source. However, I noticed that for the blocking versions MPI_Send is being used. Under certain conditions MPI_Send will behave like a non-blocking call (for example for small messages that fit in the default outgoing message buffers), however that behavior is implementation dependent and it is not something you can rely on.
By the look of the OcamlMPI source I don't think it would be difficult to implement your own non-blocking equivalents, take a look in "msgs.c" (a file in the OcamlMPI source), the function "caml_mpi_send" contains the code for the standard send. Replacing the MPI_Send with MPI_Isend and handling the return of an MPI_Request data structure should do the trick. Oh, and you would need to add another function for MPI_Wait. Check the MPI standard for more info.
Hope that helps!
Mpi.iprobe is available in the latest ocamlmpi Subversion trunk:
http://forge.ocamlcore.org/projects/ocamlmpi/
This provides a non-blocking check for new messages. Once a message is available, the normal blocking receive can be used to retrieve the message.
精彩评论