I am new to mpi4py, so I apologize if this question is stupid. My problem: I would like to put / get multiple numpy arrays into / from memory, using one MPI RMA window. Lets say, I have two arrays of different sizes:
arr1 = np.ones(4,dtype=np.float32)
arr2 = np.ones((3,3),dtype=np.float32)
And I decide to use mpi4py’s RMA to write these memory on a specific rank. Naively, I would define and RMA window like this:
# I have 4*3*3 entries in total, so I need to define the window properly:
win = MPI.Win.Allocate((4*3*3)*MPI.DOUBLE.Get_size(),comm=comm)
and then write them to a specific rank (lets say 1) like this:
win.Lock(rank=1)
win.Put(arr1,target_rank=1)
win.Put(arr2,target_rank=1)
win.Unlock(rank=1)
# Do some other stuff
win.Free()
I tested the above procedure and it seem to work as intended, but I am not sure if this is the correct usage of RMA or if I am missing something here. Or do I need to define one RMA window per array ?