Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] MPI_Irecv segmentation fault
From: Everette Clemmer (clemmece_at_[hidden])
Date: 2009-09-21 19:26:43


Hey all,

I'm getting a segmentation fault when I attempt to receive a single
character via MPI_Irecv. Code follows:

void recv_func() {
                if( !MASTER ) {
                        char buffer[ 1 ];
                        int flag;
                        MPI_Request request;
                        MPI_Status status;

                        MPI_Irecv( &buffer, 1, MPI_CHAR, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &request);
                        MPI_Test( &request, &flag, &status );

                       if( flag ) {
                          //do work
                      }
                }
}

void send_func( unsigned char c ) {
         if( MASTER ) {
                int totalNodes, int node, flag;
                unsigned char buffer[] = { c };
                MPI_Request request;
                MPI_Status status;
                MPI_Comm_size( MPI_COMM_WORLD, &totalNodes );
                
                for ( node = 1; node < totalNodes; node++ ) {
                    MPI_Isend( &buffer, 1, MPI_CHAR, node, 0, MPI_COMM_WORLD, &request );
                }
         }
}

The segfault disappears if I comment out the MPI_Irecv call in
recv_func so I'm assuming that there's something wrong with the
parameters that I'm passing to it. Thoughts?

Thanks,
Everette