I'd like to ask how can I create MPI distributed array of integers in C with access by global indexing. I means, I'd like to create MPI array over for example 5 processor with for example 3 block size of first process, 4 block size of second process etc and I'd like to access to element value by global indexing.
1 Answer
So there's two ways you can do this:
First, you can use MPI RMA to allocate memory on a group of processes and use
MPI_PUTandMPI_GETto access the memory appropriately. This won't give you the directly accessible memory that you seem to want when you say "global indexing", but it's the best way to do this with MPI directly.The other, and perhaps better option is to use a programming model purpose built for this use, like Global Arrays, UPC, or Co-array FORTRAN. All of these can give you the distributed memory with global indexing that you seem to be looking for and some of them are even built (or can be built) on MPI under the hood.