1
1

Fixes trac:3294: space for the periods has already been allocated by

ompi_comm_split(), and the entire set of periods from the old
communicator have already been copied to the new communicator.  But up
here in mca_topo_base_cart_sub(), we need to subset the periods that
are actually stored on the new communicator according to remain_dims
(just like we did for the set of dimensions).

This commit renames a few variables to be a little less misleading,
and then adds a loop to copy over the periods information.  I could
have added this into the first loop (that subset-copies the
dimensions), but this code is already confusing enough and this is not
a performance-critical section: so I made it a new loop.

Note that all the topo code will be revamped a bit when the new
MPI-2.2 topo stuff (currently off in a mercurial branch) finally makes
it back to the SVN trunk.  But that new stuff will only get to v1.7 --
this commit will need to be CMR'ed to v1.6.x.

cmr:v1.7
cmr:v1.6.2

This commit was SVN r27248.

The following Trac tickets were found above:
  Ticket 3294 --> https://svn.open-mpi.org/trac/ompi/ticket/3294
Этот коммит содержится в:
Jeff Squyres 2012-09-06 14:16:29 +00:00
родитель b75d877a3f
Коммит 0d2962ebf0

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

@ -50,10 +50,10 @@ int mca_topo_base_cart_sub (ompi_communicator_t* comm,
int ndim;
int dim;
int i;
int *d;
int *d, *dold;
int *c;
int *r;
int *p;
int *p, *pold;
*new_comm = MPI_COMM_NULL;
@ -99,15 +99,27 @@ int mca_topo_base_cart_sub (ompi_communicator_t* comm,
if (temp_comm != MPI_COMM_NULL) {
temp_comm->c_topo_comm->mtc_ndims_or_nnodes = ndim;
if (ndim >= 1) {
p = temp_comm->c_topo_comm->mtc_dims_or_index;
d = comm->c_topo_comm->mtc_dims_or_index;
/* Copy the dimensions */
d = temp_comm->c_topo_comm->mtc_dims_or_index;
dold = comm->c_topo_comm->mtc_dims_or_index;
r = remain_dims;
for (i = 0; i < comm->c_topo_comm->mtc_ndims_or_nnodes;
++i, ++d, ++r) {
++i, ++dold, ++r) {
if (*r) {
*p++ = *d;
*d++ = *dold;
}
}
/* Copy the periods */
p = temp_comm->c_topo_comm->mtc_periods_or_edges;
pold = comm->c_topo_comm->mtc_periods_or_edges;
r = remain_dims;
for (i = 0; i < comm->c_topo_comm->mtc_ndims_or_nnodes;
++i, ++pold, ++r) {
if (*r) {
*p++ = *pold;
}
}