cb-geo / mpm

CB-Geo High-Performance Material Point Method
https://www.cb-geo.com/research/mpm
Other
243 stars 83 forks source link

Refactor MPI communication when size is unknown #621

Closed kks32 closed 4 years ago

kks32 commented 4 years ago

Describe the feature Use MPI_Probe to determine the size of the message, instead of passing the size first followed by the message. https://www.rookiehpc.com/mpi/docs/mpi_probe.php

Describe alternatives The current implementation passes the size of the object (particles) before passing the message. This requires passing 2 messages.

bodhinandach commented 4 years ago

@kks32 By doing MPI_Probe and MPI_Get_count, do you need to block operation? Particularly, if you are putting the MPI_Send in a loop or iteration. Whereas when you send the size, I think you can just MPI_Wait by using the array of status at the end of the loop. Will MPI_Probe result in less efficient communication?

capellil commented 4 years ago

1) Using MPI_Probe will be more efficient than sending the size in a different message because it will not require an extra message to be sent. (Behind the scenes, when a sender emits a message, it also joins an envelope along with it, containing information about the message sent such as its size. MPI_Probe allows the user to query that envelope to get the size of the message. The overhead of that action is negligible; it merely consists in checking a variable in a structure, by contrast to sending an additional message.) 2) Yes, MPI_Probe will block until the message mentioned is actually sent by the sender (so that the envelope is sent to the receiver). The "unknown-size problem" is long known in MPI and distributed-memory systems in general, this is why techniques such as MPI_Probe have been developed some time ago. If the fact that MPI_Probe blocks is a problem, there is a non-blocking version MPI_Iprobe available: see https://www.rookiehpc.com/mpi/docs/mpi_iprobe.php

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

kks32 commented 4 years ago

Still todo, keeping this open.