Memory Sharing Control for MPI Created Processes

I have shared memory used by several processes, these processes are created using MPI .

Now I need a mechanism to control access to this shared memory.

I know that named semaphore and flock mechanisms can be used for this, but just want to know if MPI supports any special locking mechanism for using shared memory?

I am working on C under Linux.

+1
source share
2 answers

MPI actually provides support for shared memory (starting with version 3.0). You can try to study the chapter "One-way communication" ( http://www.mpi-forum.org/docs/mpi-3.0/mpi30-report.pdf ), starting with MPI_WIN_ALLOCATE_SHARED (11.2.3). To use this, you need to make sure that you have an implementation that supports it. I know that the latest versions of MPICH and Open MPI work.

+2
source

No, MPI does not support shared memory support. In fact, MPI would not want to support shared memory. The reason is that a program written using MPI must scale for a large number of processors, and a large number of processors never have shared memory.

However, it can often happen that groups of a small number of processors (in this set of a large number of processors) share a common memory. However, OpenMP is used to use this shared memory.

OpenMP is very simple. I highly recommend you study it.

+1
source

All Articles