[mpich-discuss] Problem with target_disp Parameter and 1-sided Messages

Corey A. Henderson cahenderson at wisc.edu
Sat Jan 18 14:41:59 CST 2014


I am having a problem where I cannot set the target_disp parameter to a
positive value in any of the 1-sided calls I've tried (EG: MPI_Put,
MPI_Get, MPI_Fetch_and_op, etc.)

I am trying to use a shared (lock_all) approach with flushes. When I set
target_disp to zero, the messaging works fine as expected. If I use a
positive value I always get a Seg fault.

Obligatory disclaimer: I am not a c or MPI expert so it's entirely possible
I've made some newbie error here. But I am at my wit's end trying to figure
this out and could use help.

Info: MPICH 3.0.4 built on Ubuntu 12.04 LTS running one node on Intel®
Core™ i5-3570K CPU @ 3.40GHz × 4

I've attached the code I've isolated to show the problem. With the
targetDisp int set to 0, the data is properly transferred. If it is set to
1, or sizeof(int), I get the following seg fault from mpiexec for
targetDisp>0.

corey at UbuntuDesktop:~/workspace/TargetDispBug/Release$ mpiexec -n 2
./TargetDispBug

===================================================================================
=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
=   EXIT CODE: 139
=   CLEANING UP REMAINING PROCESSES
=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===================================================================================
YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Segmentation fault
(signal 11)
This typically refers to a problem with your application.
Please see the FAQ page for debugging suggestions

However, for targetDisp == 0 I get (as expected):

corey at UbuntuDesktop:~/workspace/TargetDispBug/Release$ mpiexec -n 2
./TargetDispBug
Received: 42.

The seg fault occurs at the MPI_Win_flush on both processes for
targetDisp>0 on either the Put or Get or both.

Any help with this would be great.

Code follows:

#include "mpi.h"

int main(int argc, char* argv[]){

    // Test main for one sided message queueing
    int rank, numranks, targetDisp = 0;
    int sizeInBytes = 10*sizeof(int), *buffer;
    MPI_Win window;

    MPI_Init(&argc, &argv);

    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &numranks);

    MPI_Win_allocate(sizeInBytes, MPI_INT, MPI_INFO_NULL, MPI_COMM_WORLD,
&buffer, &window);

    MPI_Win_lock_all(0, window);

    int *sendBuffer;
    int *receiveBuffer;

    MPI_Alloc_mem(sizeof(int), MPI_INFO_NULL, &sendBuffer);
    MPI_Alloc_mem(sizeof(int), MPI_INFO_NULL, &receiveBuffer);

    if (rank == 1) {

        sendBuffer[0] = 42;

        MPI_Put(sendBuffer, 1, MPI_INT, 0, targetDisp, 1, MPI_INT, window);

        MPI_Win_flush(0, window);

    }

    MPI_Barrier(MPI_COMM_WORLD);

    if (rank == 0) {

        MPI_Get(receiveBuffer, 1, MPI_INT, 0, targetDisp, 1, MPI_INT,
window);

        MPI_Win_flush(0, window);

        printf("Received: %d.\n", receiveBuffer[0]);

    }

    MPI_Win_unlock_all(window);

    MPI_Free_mem(sendBuffer);
    MPI_Free_mem(receiveBuffer);

    MPI_Win_free(&window);

    MPI_Finalize();
    return 0;

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20140118/1bf1c80f/attachment.html>


More information about the discuss mailing list