[mpich2-commits] r7780 - in mpich2/trunk/src: include mpi/comm
goodell at mcs.anl.gov
goodell at mcs.anl.gov
Thu Jan 20 16:08:44 CST 2011
Author: goodell
Date: 2011-01-20 16:08:44 -0600 (Thu, 20 Jan 2011)
New Revision: 7780
Modified:
mpich2/trunk/src/include/mpiimpl.h
mpich2/trunk/src/mpi/comm/commutil.c
Log:
replace is_node_aware in MPID_Comm with a more expressive enum
This should simplify logic for any coll_ops overrides by the device.
Reviewed by balaji at .
Modified: mpich2/trunk/src/include/mpiimpl.h
===================================================================
--- mpich2/trunk/src/include/mpiimpl.h 2011-01-20 22:08:41 UTC (rev 7779)
+++ mpich2/trunk/src/include/mpiimpl.h 2011-01-20 22:08:44 UTC (rev 7780)
@@ -1043,6 +1043,16 @@
typedef enum MPID_Comm_kind_t {
MPID_INTRACOMM = 0,
MPID_INTERCOMM = 1 } MPID_Comm_kind_t;
+
+/* ideally we could add these to MPID_Comm_kind_t, but there's too much existing
+ * code that assumes that the only valid values are INTRACOMM or INTERCOMM */
+typedef enum MPID_Comm_hierarchy_kind_t {
+ MPID_HIERARCHY_FLAT = 0, /* no hierarchy */
+ MPID_HIERARCHY_PARENT = 1, /* has subcommunicators */
+ MPID_HIERARCHY_NODE_ROOTS = 2, /* is the subcomm for node roots */
+ MPID_HIERARCHY_NODE = 3, /* is the subcomm for a node */
+ MPID_HIERARCHY_SIZE /* cardinality of this enum */
+} MPID_Comm_hierarchy_kind_t;
/* Communicators */
/*S
@@ -1128,8 +1138,8 @@
MPID_Errhandler *errhandler; /* Pointer to the error handler structure */
struct MPID_Comm *local_comm; /* Defined only for intercomms, holds
an intracomm for the local group */
- int is_node_aware; /* true if node topology info is available,
- such as node_comm and node_roots_comm */
+
+ MPID_Comm_hierarchy_kind_t hierarchy_kind; /* flat, parent, node, or node_roots */
struct MPID_Comm *node_comm; /* Comm of processes in this comm that are on
the same node as this process. */
struct MPID_Comm *node_roots_comm; /* Comm of root processes for other nodes. */
@@ -1140,6 +1150,7 @@
int *internode_table; /* internode_table[i] gives the rank in
node_roots_comm of rank i in this comm.
It is of size 'local_size'. */
+
int is_low_group; /* For intercomms only, this boolean is
set for all members of one of the
two groups of processes and clear for
Modified: mpich2/trunk/src/mpi/comm/commutil.c
===================================================================
--- mpich2/trunk/src/mpi/comm/commutil.c 2011-01-20 22:08:41 UTC (rev 7779)
+++ mpich2/trunk/src/mpi/comm/commutil.c 2011-01-20 22:08:44 UTC (rev 7780)
@@ -90,7 +90,7 @@
comm_p->topo_fns = NULL;
comm_p->name[0] = '\0';
- comm_p->is_node_aware = 0;
+ comm_p->hierarchy_kind = MPID_HIERARCHY_FLAT;
comm_p->node_comm = NULL;
comm_p->node_roots_comm = NULL;
comm_p->intranode_table = NULL;
@@ -259,6 +259,7 @@
comm->node_comm->recvcontext_id = comm->node_comm->context_id;
comm->node_comm->rank = local_rank;
comm->node_comm->comm_kind = MPID_INTRACOMM;
+ comm->node_comm->hierarchy_kind = MPID_HIERARCHY_NODE;
comm->node_comm->local_comm = NULL;
comm->node_comm->local_size = num_local;
@@ -287,6 +288,7 @@
comm->node_roots_comm->recvcontext_id = comm->node_roots_comm->context_id;
comm->node_roots_comm->rank = external_rank;
comm->node_roots_comm->comm_kind = MPID_INTRACOMM;
+ comm->node_roots_comm->hierarchy_kind = MPID_HIERARCHY_NODE_ROOTS;
comm->node_roots_comm->local_comm = NULL;
comm->node_roots_comm->local_size = num_external;
@@ -305,7 +307,7 @@
/* don't call MPIR_Comm_commit here */
}
- comm->is_node_aware = 1;
+ comm->hierarchy_kind = MPID_HIERARCHY_PARENT;
}
fn_exit:
@@ -325,7 +327,7 @@
collective communication, for example. */
int MPIR_Comm_is_node_aware(MPID_Comm * comm)
{
- return comm->is_node_aware;
+ return (comm->hierarchy_kind == MPID_HIERARCHY_PARENT);
}
/* Returns true if the communicator is node-aware and processes in all the nodes
@@ -336,7 +338,7 @@
int i = 0, curr_nodeidx = 0;
int *internode_table = comm->internode_table;
- if (!comm->is_node_aware)
+ if (!MPIR_Comm_is_node_aware(comm))
return 0;
for (; i < comm->local_size; i++)
More information about the mpich2-commits
mailing list