Hello,

I am trying to better understand the semantics of passive synchronization in
one-sided communication calls. Doesn't MPI_Win_unlock()
block to ensure that all the preceeding RMA calls in that epoch have been
synced?
In that case, why is an undefined value returned when trying to load from a
local window? (see below)

    MPI_Alloc_mem(128, MPI_INFO_NULL, &ptr);
    MPI_Win_create(ptr, 128, 1, MPI_INFO_NULL, MPI_COMM_WORLD, &win);

    // write to the target window of the head node
    if (rank == (size - 1)) {
        MPI_Win_lock(MPI_LOCK_EXCLUSIVE, 0, 0, win);
        in = 10;
        MPI_Put(&in, 1, MPI_INT, 0, 0, 1, MPI_INT, win);
        MPI_Win_unlock(0, win);
    } else {
        // busy wait
        start = MPI_Wtime();
        end = MPI_Wtime();
        while ((end - start) < 1)
            end = MPI_Wtime();
    }

    // read from the head node's window
    MPI_Win_lock(MPI_LOCK_EXCLUSIVE, 0, 0, win);
    MPI_Get(&out, 1, MPI_INT, 0, 0, 1, MPI_INT, win);
    MPI_Win_unlock(0, win);

    MPI_Barrier(MPI_COMM_WORLD);
    printf("R%d: %d\n", rank, out);

The output of the above program with 1.5.3rc1 (and also with MPICH2 1.4rc2)
is:
R2: 10
R1: 10
R0: 0

whereas I expect to see:
R2: 10
R1: 10
R0: 10

Thanks,
Abhishek

Reply via email to