Interaction with a spawned process in mpi4py?

Given the situation when a master process generates a set of workflows B, each of which generates its own unique workflow C, how can I open a communicator between C and A?

I am trying to create a loop, using mpi4py, between several pieces of code that were written separately from each other while minimizing code modifications. So, the general structure of MPI code will be:

  • Master A (one process) spawns 8 processes of worker B and scatters the array for them.
  • Each process B spawns worker C, performs some manipulations with the array, and passes it to its own worker.
  • Each working C manipulates the array in its own way, and then (ideally) master A collects the array from each array C.

I know that this will be due to the discovery of an intercommunicator between existing processes, possibly using group communication. What would be the best way to achieve this?

Thanks.

+4
source share
1 answer

There are two ways to do this from my head. I would not say that one is better or worse than the other, although the first is probably better suited to your use case.

  • ( - ), MPI_COMM_CONNECT MPI_COMM_ACCEPT, A , . A , , , , , . , A MPI_COMM_ACCEPT ( , ).

  • , MPI_COMM_SPAWN, , . , ( A , ).

+2

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


All Articles