c++ - MPI_Neighbor_alltoall segfault -
i working on mpi application needs use (distributed) graph communicator communicating between nodes. there cases easiest thing nodes communicate themselves. while testing code ran problem segfault couldn't explain. here's minimal example reproduces problem (in openmpi 1.8.1):
#include <iostream> #include <vector> #include <mpi.h> int main(void) { mpi_init(null, null); mpi_comm mpi_neighbor_comm; int v[2] = {0, 0}, w[2] = {0, 0}; mpi_dist_graph_create_adjacent(mpi_comm_world, 2, v, (int *)mpi_unweighted, 2, w, (int *)mpi_unweighted, mpi_info_null, 0, &mpi_neighbor_comm); int major, minor; mpi_get_version(&major, &minor); std::cerr << "version " << major << '.' << minor << std::endl; int indegree, outdegree, weighted; mpi_dist_graph_neighbors_count(mpi_neighbor_comm, &indegree, &outdegree, &weighted); std::cerr << "degrees: " << indegree << ", " << outdegree << std::endl; std::vector<int> in(indegree, 0), out(outdegree, 1); mpi_neighbor_alltoall(&out[0], 1, mpi_int, &in[0], 1, mpi_int, mpi_neighbor_comm); std::cerr << in[0] << std::endl; mpi_comm_free(&mpi_neighbor_comm); mpi_finalize(); return 0; }
this gives following output when run 1 process:
$ mpiexec -n 1 ./mpi_test version 3.0 degrees: 2, 2 1 [lmc-038262:51444] *** process received signal *** [lmc-038262:51444] signal: segmentation fault: 11 (11) [lmc-038262:51444] signal code: address not mapped (1) [lmc-038262:51444] failing @ address: 0x0 [lmc-038262:51444] *** end of error message ***
since value "1" got transmitted in
, seems communication works - program segfaults. what's wrong? segfault disappears if comment out call mpi_neighbor_alltoall
.
Comments
Post a Comment