Hi all, 

Here is my problem (see attached file for more details). 

I create a window using MPI_Win_allocate_share d. 
The rank 0 is then in charge to fill iteratively the shared buffers using the 
MPI_Put function. 

At each iteration, I use also MPI_Lock and MPI_Unlock function as follows: 

MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, MPI_MODE_NOCHECK, win); 
MPI_Put(&i, buffer_size, MPI_BYTE, rank, position, buffer_size, MPI_BYTE, win); 
MPI_Win_unlock(wid, win); 

Surprisingly, at the second iteration, I get the following error: 

Open MPI v1.8.4, package: Open MPI Distribution, ident: 1.8.4, repo rev: 
v1.8.3-330-g0344f04, Dec 19, 2014 

*** An error occurred in MPI_Win_lock 
*** reported by process [140394923687937,140393890971648] 
*** on win 
*** MPI_ERR_RMA_SYNC: error executing rma sync 
*** MPI_ERRORS_ARE_FATAL (processes in this win will now abort, 
*** and potentially your MPI job) 

I observed the same behaviour when allocating the window using MPI_Win_allocate 
function. 

On the other hand, everything works well with MPI_Win_Create . 

Am I wrong somewhere, any idea would be great :-) ! 

Cheers, 

Thibaud Kloczko. 

------------------------------------------------- 
Ingénieur d'Expérimentation et de Développement 
Inria CRISAM 
2004, route des lucioles 
06902 Sophia Antipolis 
+33 4 92 38 50 03 

// Version: $Id$
// 
// 

// Commentary: 
// 
// 

// Change Log:
// 
// 

// Code:

#include "mpi.h"
#include <iostream>

int main(int argc, char **argv)
{
    MPI_Init(&argc, &argv);

    int cap = 101;
    int objectSize = sizeof(int);
    int buffer_size = cap * objectSize;
    int *array = NULL;

    MPI_Win win;

    MPI_Win_allocate_shared(buffer_size, objectSize, MPI_INFO_NULL, MPI_COMM_WORLD, &array, &win);

    int size;
    MPI_Comm_size(MPI_COMM_WORLD, &size);
    int rank;
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);

    MPI_Barrier(MPI_COMM_WORLD);
    if (rank == 0) {

        char version[MPI_MAX_LIBRARY_VERSION_STRING];
        int len;
        MPI_Get_library_version(version, &len);
        std::cout << version << std::endl;

        for (int i = 0; i < cap * size; ++i) {
            int wid = i / cap;
            std::cout << std::endl;
            std::cout << "iteration " << i << " locking window"  << std::endl;
            MPI_Win_lock(MPI_LOCK_EXCLUSIVE, wid, MPI_MODE_NOCHECK, win);
            MPI_Put(&i, buffer_size, MPI_BYTE, wid, i%size, buffer_size, MPI_BYTE, win);
            std::cout << "unlocking " << std::endl;
            MPI_Win_unlock(wid, win);
        }
    }
    MPI_Finalize();

    return 0;
}

// 
// main.cpp ends here

Reply via email to