From: degomme Date: Tue, 19 Apr 2016 00:04:58 +0000 (+0200) Subject: sometimes, maxdims is too much X-Git-Tag: v3_13~62 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/252d554dc64ab6e538e22bf03a1d89f982aaef01 sometimes, maxdims is too much --- diff --git a/src/smpi/smpi_topo.cpp b/src/smpi/smpi_topo.cpp index 1e5f55d56f..2f22566b87 100644 --- a/src/smpi/smpi_topo.cpp +++ b/src/smpi/smpi_topo.cpp @@ -203,8 +203,8 @@ int smpi_mpi_cart_coords(MPI_Comm comm, int rank, int maxdims, int coords[]) { int smpi_mpi_cart_get(MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords) { MPI_Topology topo = smpi_comm_topo(comm); - - for(int i = 0 ; i < maxdims ; i++) { + int ndims=topo->topo.cart->ndims < maxdims ? topo->topo.cart->ndims : maxdims; + for(int i = 0 ; i < ndims ; i++) { dims[i] = topo->topo.cart->dims[i]; periods[i] = topo->topo.cart->periodic[i]; coords[i] = topo->topo.cart->position[i];