Giles, Thanks for the small bug fix. It helped clear up that test case but I'm again running into another segmentation fault on a more complicated problem.
I've attached another 'working' example. This time I am using the MPI_Ineighbor_alltoallw on a triangular topology; node 0 communicates bi-directionally with nodes 1 and 2, node 1 with nodes 0 and 2, and node 2 with node 0 and 1. Each node is sending one double (with value my_rank) to each of its neighbors. The code has two different calls to the MPI API that only differ in the receive buffer arguments. In both versions, I am sending from and receiving into the same static array. In the working (non-segfaulting) version, I am receiving into the latter half of the array by pointing to the start of the second half (&send_number[2]) and specifying displacements of 0 and 8 bytes. In the segfaulting version, I am again receiving into the latter half of the array by pointing to the start of the array (send_number) with displacements of 16 to 24 bytes. The program run with the command 'mpirun -n 3 ./simpleneighborhood_multiple' compiled with the latest OpenMPI (1.10.2) + patch encounters a segmentation fault when receiving using the latter commands. The same program compiled with MPICH (3.2) runs without any problems and with the expected results. Let me know if I'm screwing anything up. Thanks for the help. Sincerely, Jun On Mon, Feb 29, 2016 at 9:34 PM, Gilles Gouaillardet <gil...@rist.or.jp> wrote: > Thanks for the report and the test case, > > this is a bug and i pushed a commit to master. > for the time being, you can download a patch for v1.10 at > https://github.com/ggouaillardet/ompi-release/commit/4afdab0aa86e5127767c4dfbdb763b4cb641e37a.patch > > Cheers, > > Gilles > > > On 3/1/2016 12:17 AM, Jun Kudo wrote: > > Hello, > I'm trying to use the neighborhood collective communication capabilities > (MPI_Ineighbor_x) of MPI coupled with the distributed graph constructor > (MPI_Dist_graph_create_adjacent) but I'm encountering a segmentation fault > on a test case. > > I have attached a 'working' example where I create a MPI communicator with > a simple distributed graph topology where Rank 0 contains Node 0 that > communicates bi-directionally (receiving from and sending to) with Node 1 > located on Rank 1. I then attempt to send integer messages using the > neighborhood collective MPI_Ineighbor_alltoall. The program run with the > command 'mpirun -n 2 ./simpleneighborhood' compiled with the latest > OpenMPI (1.10.2) encounters a segmentation fault during the non-blocking > call. The same program compiled with MPICH (3.2) runs without any problems > and with the expected results. To muddy the waters a little more, the same > program compiled with OpenMPI but using the blocking neighborhood > collective, MPI_Neighbor_alltoall, seems to run just fine as well. > > I'm not really sure at this point if I'm making a simple mistake in the > construction of my test or if something is more fundamentally wrong. I > would appreciate any insight into my problem! > > Thanks ahead of the time for help and let me know if I can provide anymore > information. > > Sincerely, > Jun > > > _______________________________________________ > users mailing listus...@open-mpi.org > Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users > Link to this post: > http://www.open-mpi.org/community/lists/users/2016/02/28608.php > > > > _______________________________________________ > users mailing list > us...@open-mpi.org > Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users > Link to this post: > http://www.open-mpi.org/community/lists/users/2016/02/28610.php >
#include <mpi.h> #include <iostream> int main (int argc, char* argv[]) { MPI_Init(nullptr, nullptr); //--> Connect graph to my mpi communicator bool reorder = false; int indegree = 2; int outdegree = 2; int sources[indegree]; int sweights[indegree]; int destinations[outdegree]; int dweights[outdegree]; int my_rank; MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); //get my rank if (my_rank == 0) { sources[0] = 1; sources[1] = 2; sweights[0] = 1; sweights[1] = 1; destinations[0] = 1; destinations[1] = 2; dweights[0] = 1; dweights[1] = 1; }else if (my_rank == 1) { sources[0] = 0; sources[1] = 2; sweights[0] = 1; sweights[1] = 1; destinations[0] = 0; destinations[1] = 2; dweights[0] = 1; dweights[1] = 1; }else if (my_rank == 2) { sources[0] = 0; sources[1] = 1; sweights[0] = 1; sweights[1] = 1; destinations[0] = 0; destinations[1] = 1; dweights[0] = 1; dweights[1] = 1; } MPI_Info mpi_info = MPI_INFO_NULL; MPI_Info_create(&mpi_info); MPI_Comm mpi_comm_with_graph; MPI_Dist_graph_create_adjacent(MPI_COMM_WORLD, indegree, sources, sweights, outdegree, destinations, dweights, mpi_info, reorder, &mpi_comm_with_graph); MPI_Comm_rank(mpi_comm_with_graph, &my_rank); //get my rank //---------------------------------------------------------------------------- //---> Send and receive messages int sendcounts[2]; MPI_Aint sdispls[2]; MPI_Datatype send_datatype[2]; int recvcounts[2]; MPI_Aint rdispls[2]; MPI_Datatype recv_datatype[2]; int mpi_double_size; MPI_Type_size(MPI::DOUBLE, &mpi_double_size); for (int i = 0; i < 2; ++i) { send_datatype[i] = MPI::DOUBLE; recv_datatype[i] = MPI::DOUBLE; sendcounts[i] = 1; recvcounts[i] = 1; sdispls[i] = i*mpi_double_size; } //---> oversized to send from and to accept into double send_number[4]; if (my_rank == 0) { send_number[0] = 0; send_number[1] = 0; }else if (my_rank == 1) { send_number[0] = 1; send_number[1] = 1; }else if (my_rank == 2) { send_number[0] = 2; send_number[1] = 2; } send_number[2] = -1; send_number[3] = -1; MPI_Request request_array[1]; MPI_Status status[1]; int error_code; request_array[0] = MPI_REQUEST_NULL; // //---------------------------------------------------------------------------- // //---> This works fine on OpenMPI-1.10.2 with patch // for (int i = 0; i < 2; ++i) { // rdispls[i] = i*mpi_double_size; // } // error_code = MPI_Ineighbor_alltoallw // (send_number, sendcounts, sdispls, send_datatype, // &send_number[2], recvcounts, rdispls, recv_datatype, // mpi_comm_with_graph, request_array); // MPI_Wait(request_array, status); //---------------------------------------------------------------------------- //---> This segfaults on OpenMPI-1.10.2 with patch for (int i = 0; i < 2; ++i) { rdispls[i] = (i+2)*mpi_double_size; } error_code = MPI_Ineighbor_alltoallw (send_number, sendcounts, sdispls, send_datatype, send_number, recvcounts, rdispls, recv_datatype, mpi_comm_with_graph, request_array); MPI_Wait(request_array, status); MPI_Finalize(); if (my_rank == 0) { for (int i = 0; i < 4; ++i) { std::cout << "Rank : " << my_rank << " send array: " << send_number[i] << "\n"; } } return 0; }// End main