Wrong synchronization of RMA calls in MPI

Viewed 464

I am trying to MPIs RMA scheme with Fences. In some cases it works fine, but for systems with multiple nodes I get the following error:

Error message: MPI failed with Error_code = 71950898
Wrong synchronization of RMA calls , error stack:
MPI_Rget(176): MPI_Rget(origin_addr=0x2ac7b10, origin_count=1, MPI_INTEGER, target_rank=0, target_disp=0, target_count=1, MPI_INTEGER, win=0xa0000000, request=0x7ffdc1efe634) failed
(unknown)(): Wrong synchronization of RMA calls
Error from PE:0/4

This is a schematic of how I setup the code:

call MPI_init(..)
CALL MPI_WIN_CREATE(..)
do i =1,10
   MPI_Win_fence(0, handle, err)

   calc_values()
   MPI_Put(values)
   MPI_Put(values)
   MPI_Put(values)

   MPI_Win_fence(0, handle, err)

   MPI_Rget(values, req)
   MPI_WAIT(req)
   do_something(values)

   MPI_Rget(values, req)
   MPI_WAIT(req)
   do_something(values)
enddo
call MPI_finalize()

I know that MPI_Put is non-blocking. Is it guaranteed, that the MPI_Put is finished after MPI_Win_fence(0, handle, err) or do I have to use MPI_RPUT?

What does this error even mean: Wrong synchronization of RMA calls ?

How do I fix my communication scheme?

1 Answers

Make sure you add the following call as necessary to ensure synchronization (you need to make sure your window(s) are created before putting data in them):

MPI_Win_fence(0, window);

Please look at the example below (source) and note that they are making two fence calls.

    // Create the window
    int window_buffer = 0;
    MPI_Win window;
    MPI_Win_create(&window_buffer, sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &window);
    if(my_rank == 1)
    {
        printf("[MPI process 1] Value in my window_buffer before MPI_Put: %d.\n", window_buffer);
    }
    MPI_Win_fence(0, window);
 
    if(my_rank == 0)
    {
        // Push my value into the first integer in MPI process 1 window
        int my_value = 12345;
        MPI_Put(&my_value, 1, MPI_INT, 1, 0, 1, MPI_INT, window);
        printf("[MPI process 0] I put data %d in MPI process 1 window via MPI_Put.\n", my_value);
    }
 
    // Wait for the MPI_Put issued to complete before going any further
    MPI_Win_fence(0, window);
 
    if(my_rank == 1)
    {
        printf("[MPI process 1] Value in my window_buffer after MPI_Put: %d.\n", window_buffer);
    }
 
    // Destroy the window
    MPI_Win_free(&window);
Related