Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Array memory allocation when using MPI

Tags:

c

mpi

I am using C and MPI. How is memory allocated for arrays if the program runs on multiple processors on the same machine? Is that array being shared between all participating tasks or every task has it's own copy?

like image 588
Donatas Bacius Avatar asked Mar 22 '11 14:03

Donatas Bacius


2 Answers

Every rank has its own copy of the data. They are generally run in separate processes, and so do not share a virtual address space.

Implementations like Adaptive MPI and Phoenix put multiple ranks on threads in a common process, but they take steps to isolate each rank so that thinks it's running as a separate process.

like image 178
Phil Miller Avatar answered Sep 28 '22 22:09

Phil Miller


MPI is a distributed memory framework. It has only a limited notion of shared-memory processing. If shared memory is of importance to your program's performance, then I suggest you look into OpenMP; both can be combined in the same application. (I.e., each node would run, ideally, a single OpenMP-based process that would communicate with other instances through MPI.)

like image 22
Fred Foo Avatar answered Sep 28 '22 22:09

Fred Foo