Skip to content

Commit ca60b28

Browse files
author
Ralph Castain
committed
Minor cleanup - add jobid <-> nspace in one more place
(cherry picked from commit f713e71)
1 parent 76d4f24 commit ca60b28

File tree

2 files changed

+39
-26
lines changed

2 files changed

+39
-26
lines changed

opal/mca/pmix/pmix1xx/pmix1_client.c

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ int pmix1_client_init(void)
103103
}
104104

105105
/* store our jobid and rank */
106-
if (NULL != getenv(OPAL_MCA_PREFIX"orte_launch")) {
106+
if (NULL != getenv(OPAL_MCA_PREFIX"orte_launch")) {
107107
/* if we were launched by the OMPI RTE, then
108108
* the jobid is in a special format - so get it */
109109
native_launch = true;
@@ -196,6 +196,44 @@ int pmix1_abort(int flag, const char *msg,
196196
return pmix1_convert_rc(rc);
197197
}
198198

199+
int pmix1_store_local(const opal_process_name_t *proc, opal_value_t *val)
200+
{
201+
pmix_value_t kv;
202+
pmix_status_t rc;
203+
pmix_proc_t p;
204+
opal_pmix1_jobid_trkr_t *job;
205+
206+
if (NULL != proc) {
207+
/* if the jobid is my own, then we can just use
208+
* my namespace */
209+
if (OPAL_PROC_MY_NAME.jobid == proc->jobid) {
210+
(void)strncpy(p.nspace, my_proc.nspace, PMIX_MAX_NSLEN);
211+
} else {
212+
/* look thru our list of jobids and find the
213+
* corresponding nspace */
214+
OPAL_LIST_FOREACH(job, &jobids, opal_pmix1_jobid_trkr_t) {
215+
if (job->jobid == proc->jobid) {
216+
(void)strncpy(p.nspace, job->nspace, PMIX_MAX_NSLEN);
217+
break;
218+
}
219+
}
220+
}
221+
p.rank = proc->vpid;
222+
} else {
223+
/* use our name */
224+
(void)strncpy(p.nspace, my_proc.nspace, PMIX_MAX_NSLEN);
225+
p.rank = OPAL_PROC_MY_NAME.vpid;
226+
}
227+
228+
PMIX_VALUE_CONSTRUCT(&kv);
229+
pmix1_value_load(&kv, val);
230+
231+
rc = PMIx_Store_internal(&p, val->key, &kv);
232+
PMIX_VALUE_DESTRUCT(&kv);
233+
234+
return pmix1_convert_rc(rc);
235+
}
236+
199237
int pmix1_commit(void)
200238
{
201239
pmix_status_t rc;

opal/mca/pmix/pmix1xx/pmix_pmix1.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -88,31 +88,6 @@ const opal_pmix_base_module_t opal_pmix_pmix1xx_module = {
8888
pmix1_store_local
8989
};
9090

91-
int pmix1_store_local(const opal_process_name_t *proc, opal_value_t *val)
92-
{
93-
pmix_value_t kv;
94-
pmix_status_t rc;
95-
pmix_proc_t p;
96-
97-
if (NULL != proc) {
98-
/* convert the process jobid */
99-
(void)strncpy(p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
100-
p.rank = proc->vpid;
101-
} else {
102-
/* use our name */
103-
(void)strncpy(p.nspace, opal_convert_jobid_to_string(OPAL_PROC_MY_NAME.jobid), PMIX_MAX_NSLEN);
104-
p.rank = OPAL_PROC_MY_NAME.vpid;
105-
}
106-
107-
PMIX_VALUE_CONSTRUCT(&kv);
108-
pmix1_value_load(&kv, val);
109-
110-
rc = PMIx_Store_internal(&p, val->key, &kv);
111-
PMIX_VALUE_DESTRUCT(&kv);
112-
113-
return pmix1_convert_rc(rc);
114-
}
115-
11691
pmix_status_t pmix1_convert_opalrc(int rc)
11792
{
11893
switch (rc) {

0 commit comments

Comments
 (0)