Skip to content

Commit a905c7c

Browse files
authored
Merge pull request open-mpi#5106 from hjelmn/v3.1.x_pmix_2.1.x
Fix external PMIx v1.2.5 support
2 parents 01985fb + 11237bc commit a905c7c

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

opal/mca/pmix/ext1x/pmix1x.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ BEGIN_C_DECLS
3636
typedef struct {
3737
opal_pmix_base_component_t super;
3838
opal_list_t jobids;
39+
opal_list_t values;
3940
bool native_launch;
4041
} mca_pmix_ext1x_component_t;
4142

opal/mca/pmix/ext1x/pmix1x_client.c

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
33
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
4-
* Copyright (c) 2014-2017 Research Organization for Information Science
4+
* Copyright (c) 2014-2018 Research Organization for Information Science
55
* and Technology (RIST). All rights reserved.
66
* Copyright (c) 2014-2015 Mellanox Technologies, Inc.
77
* All rights reserved.
@@ -220,6 +220,7 @@ int pmix1_store_local(const opal_process_name_t *proc, opal_value_t *val)
220220
pmix_status_t rc;
221221
pmix_proc_t p;
222222
opal_pmix1_jobid_trkr_t *job, *jptr;
223+
opal_value_t *hack;
223224

224225
if (NULL != proc) {
225226
/* look thru our list of jobids and find the
@@ -232,10 +233,15 @@ int pmix1_store_local(const opal_process_name_t *proc, opal_value_t *val)
232233
}
233234
}
234235
if (NULL == job) {
235-
job = OBJ_NEW(opal_pmix1_jobid_trkr_t);
236-
(void)opal_snprintf_jobid(job->nspace, PMIX_MAX_NSLEN, proc->jobid);
237-
job->jobid = proc->jobid;
238-
opal_list_append(&mca_pmix_ext1x_component.jobids, &job->super);
236+
/* if we don't know about the job, then neither will the internal
237+
* storage routine in PMIx. In this older version of PMIx, there
238+
* is no way to insert an nspace into the client, and so we cannot
239+
* get around the problem there. Instead, we need to hold such
240+
* values locally in the component. Sadly, we cannot just use
241+
* the input val param as it might not be dynamic, so copy it here */
242+
opal_dss.copy((void**)&hack, val, OPAL_VALUE);
243+
opal_list_append(&mca_pmix_ext1x_component.values, &hack->super);
244+
return OPAL_SUCCESS;
239245
}
240246
(void)strncpy(p.nspace, job->nspace, PMIX_MAX_NSLEN);
241247
p.rank = proc->vpid;
@@ -447,6 +453,15 @@ int pmix1_get(const opal_process_name_t *proc, const char *key,
447453
}
448454
}
449455
if (NULL == job) {
456+
/* see if we have this key on our local value list */
457+
OPAL_LIST_FOREACH(ival, &mca_pmix_ext1x_component.values, opal_value_t) {
458+
if (0 == strcmp(key, ival->key)) {
459+
/* got it */
460+
opal_dss.copy((void**)val, ival, OPAL_VALUE);
461+
return OPAL_SUCCESS;
462+
}
463+
}
464+
/* otherwise, we can't find it */
450465
return OPAL_ERR_NOT_FOUND;
451466
}
452467
(void)strncpy(p.nspace, job->nspace, PMIX_MAX_NSLEN);
@@ -497,6 +512,9 @@ int pmix1_get(const opal_process_name_t *proc, const char *key,
497512
ret = OPAL_SUCCESS;
498513
} else {
499514
*val = OBJ_NEW(opal_value_t);
515+
if (NULL != key) {
516+
(*val)->key = strdup(key);
517+
}
500518
ret = pmix1_value_unload(*val, kv);
501519
PMIX_VALUE_FREE(kv, 1);
502520
}
@@ -693,7 +711,7 @@ int pmix1_lookup(opal_list_t *data, opal_list_t *info)
693711
PMIX_INFO_CREATE(pinfo, ninfo);
694712
n=0;
695713
OPAL_LIST_FOREACH(iptr, info, opal_value_t) {
696-
(void)strncpy(pinfo[n++].key, iptr->key, PMIX_MAX_KEYLEN);
714+
(void)strncpy(pinfo[n].key, iptr->key, PMIX_MAX_KEYLEN);
697715
pmix1_value_load(&pinfo[n].value, iptr);
698716
++n;
699717
}
@@ -863,7 +881,7 @@ int pmix1_unpublish(char **keys, opal_list_t *info)
863881
PMIX_INFO_CREATE(pinfo, ninfo);
864882
n=0;
865883
OPAL_LIST_FOREACH(iptr, info, opal_value_t) {
866-
(void)strncpy(pinfo[n++].key, iptr->key, PMIX_MAX_KEYLEN);
884+
(void)strncpy(pinfo[n].key, iptr->key, PMIX_MAX_KEYLEN);
867885
pmix1_value_load(&pinfo[n].value, iptr);
868886
++n;
869887
}

opal/mca/pmix/ext1x/pmix1x_component.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,14 @@ mca_pmix_ext1x_component_t mca_pmix_ext1x_component = {
7878
static int external_open(void)
7979
{
8080
OBJ_CONSTRUCT(&mca_pmix_ext1x_component.jobids, opal_list_t);
81+
OBJ_CONSTRUCT(&mca_pmix_ext1x_component.values, opal_list_t);
8182
return OPAL_SUCCESS;
8283
}
8384

8485
static int external_close(void)
8586
{
8687
OPAL_LIST_DESTRUCT(&mca_pmix_ext1x_component.jobids);
88+
OPAL_LIST_DESTRUCT(&mca_pmix_ext1x_component.values);
8789
return OPAL_SUCCESS;
8890
}
8991

0 commit comments

Comments
 (0)