1
1

minor fix in graph_map and cart_map: in case the communicator passed to the functions

does not have a topo-modules assigned (yet), we return as newrank their rank in the original commmunicator. This is the solution suggested by the MPI spec.

This commit was SVN r5380.
Этот коммит содержится в:
Edgar Gabriel 2005-04-15 15:15:29 +00:00
родитель b28ca88025
Коммит c59b09a6a7
2 изменённых файлов: 32 добавлений и 18 удалений

Просмотреть файл

@ -50,23 +50,27 @@ int MPI_Cart_map(MPI_Comm comm, int ndims, int *dims,
return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM, return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_COMM,
FUNC_NAME); FUNC_NAME);
} }
if(!OMPI_COMM_IS_CART(comm)) {
return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_TOPOLOGY,
FUNC_NAME);
}
if ((NULL == dims) || (NULL == periods) || (NULL == newrank)) { if ((NULL == dims) || (NULL == periods) || (NULL == newrank)) {
return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_ARG, return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_ARG,
FUNC_NAME); FUNC_NAME);
} }
} }
/* get the function pointer on this communicator */ if(!OMPI_COMM_IS_CART(comm)) {
func = comm->c_topo->topo_cart_map; /* In case the communicator has no topo-module attached to
it, we just return the "default" value suggested by MPI:
/* call the function */ newrank = rank */
if ( MPI_SUCCESS != *newrank = ompi_comm_rank(comm);
(err = func(comm, ndims, dims, periods, newrank))) { }
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, err, FUNC_NAME); else {
/* get the function pointer on this communicator */
func = comm->c_topo->topo_cart_map;
/* call the function */
if ( MPI_SUCCESS !=
(err = func(comm, ndims, dims, periods, newrank))) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, err, FUNC_NAME);
}
} }
return MPI_SUCCESS; return MPI_SUCCESS;

Просмотреть файл

@ -55,15 +55,25 @@ int MPI_Graph_map(MPI_Comm comm, int nnodes, int *index, int *edges,
FUNC_NAME); FUNC_NAME);
} }
} }
/* map the function pointer to do the right thing */
func = comm->c_topo->topo_graph_map;
/* call the function */
if ( MPI_SUCCESS != if(!OMPI_COMM_IS_GRAPH(comm)) {
(err = func(comm, nnodes, index, edges, newrank))) { /* In case the communicator has no topo-module attached to
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, err, FUNC_NAME); it, we just return the "default" value suggested by MPI:
newrank = rank */
*newrank = ompi_comm_rank(comm);
} }
else {
/* map the function pointer to do the right thing */
func = comm->c_topo->topo_graph_map;
/* call the function */
if ( MPI_SUCCESS !=
(err = func(comm, nnodes, index, edges, newrank))) {
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, err, FUNC_NAME);
}
}
/* All done */ /* All done */
return MPI_SUCCESS; return MPI_SUCCESS;
} }