How to use MPI to organize asynchronous communication?

I plan to use MPI to create a solver that supports asynchronous communication. The main idea is as follows.

Suppose that there are two parallel processes. Process 1 wants to send good solutions that it periodically finds for processing 2, and request good solutions from process 2 when it needs diversification.

  • At some point, process 1 uses MPI_sendto send a solution to process 2. How to guarantee compliance with MPI_Revthis MPI_send, since this transfer starts dynamically?

  • When process 1 needs a solution, how can it send a request for processing 2, and process 2 will promptly notify of its request?

+3
source share
2 answers

Depending on the nature of the MPI_ * function that you are calling, sending will be blocked until the corresponding call is called by another process, so you need to make sure that this happens in your code. There are also non-blocking MPI_Isend f.ex function calls that give you a handle request, which you can check later to see if the process has been received by sending using the appropriate receipt.

As for your problem, you can issue a non-blocking reception (MPI_Irecv is the easiest) and check the status every n seconds depending on your application. Then the status will be completed when the message is received and ready for reading.

, . ( , OpenMPI) -, 100% - .

+1

, .

1) send/recvs. send/recv irecv/isend . . - mpi-wait, , . 2 recv irecv . , - mpi-wait, , irecv . , .

2) . MPI_Put, Get.

3) , 1 2 .

+3

Source: https://habr.com/ru/post/1766658/


All Articles