Skip to content

Commit b90a64e

Browse files
author
rhc54
authored
Merge pull request #2022 from rhc54/topic/nnodes
Provide the number of nodes in the job
2 parents 09ad7e8 + 2f6e0fe commit b90a64e

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

opal/mca/pmix/pmix_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ BEGIN_C_DECLS
111111
#define OPAL_PMIX_LOCAL_SIZE "pmix.local.size" // (uint32_t) #procs in this job on this node
112112
#define OPAL_PMIX_NODE_SIZE "pmix.node.size" // (uint32_t) #procs across all jobs on this node
113113
#define OPAL_PMIX_MAX_PROCS "pmix.max.size" // (uint32_t) max #procs for this job
114+
#define OPAL_PMIX_NUM_NODES "pmix.num.nodes" // (uint32_t) #nodes in this nspace
114115

115116
/* topology info */
116117
#define OPAL_PMIX_NET_TOPO "pmix.ntopo" // (char*) xml-representation of network topology

orte/mca/ess/pmi/ess_pmi_module.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,13 @@ static int rte_init(void)
214214
orte_process_info.num_local_peers = 0;
215215
}
216216

217+
/* get number of nodes in the job */
218+
OPAL_MODEX_RECV_VALUE_OPTIONAL(ret, OPAL_PMIX_NUM_NODES,
219+
&wildcard_rank, &u32ptr, OPAL_UINT32);
220+
if (OPAL_SUCCESS == ret) {
221+
orte_process_info.num_nodes = u32;
222+
}
223+
217224
/* setup transport keys in case the MPI layer needs them -
218225
* we can use the jobfam and stepid as unique keys
219226
* because they are unique values assigned by the RM

orte/orted/pmix/pmix_server_register_fns.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ int orte_pmix_server_register_nspace(orte_job_t *jdata)
9696
map = jdata->map;
9797
for (i=0; i < map->nodes->size; i++) {
9898
micro = NULL;
99-
if (NULL != (node = (orte_node_t*)opal_pointer_array_get_item(jdata->map->nodes, i))) {
99+
if (NULL != (node = (orte_node_t*)opal_pointer_array_get_item(map->nodes, i))) {
100100
opal_argv_append_nosize(&list, node->name);
101101
/* assemble all the ranks for this job that are on this node */
102102
for (k=0; k < node->procs->size; k++) {
@@ -185,6 +185,13 @@ int orte_pmix_server_register_nspace(orte_job_t *jdata)
185185
kv->data.uint32 = mynode->num_procs;
186186
opal_list_append(info, &kv->super);
187187

188+
/* pass the number of nodes in the job */
189+
kv = OBJ_NEW(opal_value_t);
190+
kv->key = strdup(OPAL_PMIX_NUM_NODES);
191+
kv->type = OPAL_UINT32;
192+
kv->data.uint32 = map->num_nodes;
193+
opal_list_append(info, &kv->super);
194+
188195
/* univ size */
189196
kv = OBJ_NEW(opal_value_t);
190197
kv->key = strdup(OPAL_PMIX_UNIV_SIZE);

0 commit comments

Comments
 (0)