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,
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)) {
return OMPI_ERRHANDLER_INVOKE (MPI_COMM_WORLD, MPI_ERR_ARG,
FUNC_NAME);
}
}
/* get the function pointer on this communicator */
func = comm->c_topo->topo_cart_map;
if(!OMPI_COMM_IS_CART(comm)) {
/* In case the communicator has no topo-module attached to
it, we just return the "default" value suggested by MPI:
newrank = rank */
*newrank = ompi_comm_rank(comm);
}
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);
/* 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;

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

@ -55,13 +55,23 @@ int MPI_Graph_map(MPI_Comm comm, int nnodes, int *index, int *edges,
FUNC_NAME);
}
}
/* 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);
if(!OMPI_COMM_IS_GRAPH(comm)) {
/* In case the communicator has no topo-module attached to
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 */