Skip to content

Commit 9e9261e

Browse files
committed
pmix: correctly set locality flags in proc_flags
do not use opal_process_info.cpuset which is not set at that time.
1 parent 24df0ed commit 9e9261e

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

opal/mca/pmix/native/pmix_native.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,19 @@ static bool native_get_attr(const char *attr, opal_value_t **kv)
13061306
myrank = native_pname.vpid;
13071307
id.jobid = native_pname.jobid;
13081308

1309+
#if OPAL_HAVE_HWLOC
1310+
/* fetch my cpuset */
1311+
OBJ_CONSTRUCT(&vals, opal_list_t);
1312+
if (OPAL_SUCCESS == (rc = opal_dstore.fetch(opal_dstore_internal, &native_pname,
1313+
OPAL_DSTORE_CPUSET, &vals))) {
1314+
kp = (opal_value_t*)opal_list_get_first(&vals);
1315+
cpuset = strdup(kp->data.string);
1316+
} else {
1317+
cpuset = NULL;
1318+
}
1319+
OPAL_LIST_DESTRUCT(&vals);
1320+
#endif
1321+
13091322
/* we only need to set locality for each local rank as "not found"
13101323
* equates to "non local" */
13111324
ranks = opal_argv_split(lclpeers->data.string, ',');
@@ -1337,7 +1350,7 @@ static bool native_get_attr(const char *attr, opal_value_t **kv)
13371350
} else {
13381351
/* determine relative location on our node */
13391352
locality = opal_hwloc_base_get_relative_locality(opal_hwloc_topology,
1340-
opal_process_info.cpuset,
1353+
cpuset,
13411354
kp->data.string);
13421355
}
13431356
OPAL_LIST_DESTRUCT(&vals);
@@ -1359,6 +1372,11 @@ static bool native_get_attr(const char *attr, opal_value_t **kv)
13591372
(void)opal_dstore.store(opal_dstore_internal, &id, &kvn);
13601373
OBJ_DESTRUCT(&kvn);
13611374
}
1375+
#if OPAL_HAVE_HWLOC
1376+
if (NULL != cpuset) {
1377+
free(cpuset);
1378+
}
1379+
#endif
13621380
opal_argv_free(ranks);
13631381

13641382
return found;

0 commit comments

Comments
 (0)