Skip to content

Commit 7fcc175

Browse files
Ralph Castainbwbarrett
authored andcommitted
Update to track PMIx v2.0.1 (#3754)
* Update to track PMIx v2.0.1 Signed-off-by: Ralph Castain <[email protected]> (cherry picked from commit ed85512) * Track PMIx v2.0.1 Signed-off-by: Ralph Castain <[email protected]> (cherry picked from commit e6c2a8d)
1 parent 580bfb9 commit 7fcc175

File tree

10 files changed

+211
-93
lines changed

10 files changed

+211
-93
lines changed

opal/mca/pmix/pmix2x/pmix/VERSION

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# major, minor, and release are generally combined in the form
1414
# <major>.<minor>.<release>.
1515

16-
major=2
16+
major=3
1717
minor=0
1818
release=0
1919

@@ -30,7 +30,7 @@ greek=
3030
# command, or with the date (if "git describe" fails) in the form of
3131
# "date<date>".
3232

33-
repo_rev=git6fb501d
33+
repo_rev=gitaa26b56
3434

3535
# If tarball_version is not empty, it is used as the version string in
3636
# the tarball filename, regardless of all other versions listed in
@@ -44,7 +44,7 @@ tarball_version=
4444

4545
# The date when this release was created
4646

47-
date="Jun 19, 2017"
47+
date="Jun 26, 2017"
4848

4949
# The shared library version of each of PMIx's public libraries.
5050
# These versions are maintained in accordance with the "Library
@@ -75,4 +75,4 @@ date="Jun 19, 2017"
7575
# Version numbers are described in the Libtool current:revision:age
7676
# format.
7777

78-
libpmix_so_version=3:0:1
78+
libpmix_so_version=0:0:0

opal/mca/pmix/pmix2x/pmix/autogen.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ sub mca_process_framework {
191191
$mca_found->{$framework}->{found} = 1;
192192
opendir(DIR, $dir) ||
193193
my_die "Can't open $dir directory";
194-
foreach my $d (readdir(DIR)) {
194+
foreach my $d (sort(readdir(DIR))) {
195195
# Skip any non-directory, "base", or any dir that
196196
# begins with "."
197197
next

opal/mca/pmix/pmix2x/pmix/include/pmix_common.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ typedef uint32_t pmix_rank_t;
124124
#define PMIX_CONNECT_SYSTEM_FIRST "pmix.cnct.sys.first" // (bool) Preferentially look for a system-level PMIx server first
125125
#define PMIX_REGISTER_NODATA "pmix.reg.nodata" // (bool) Registration is for nspace only, do not copy job data
126126
#define PMIX_SERVER_ENABLE_MONITORING "pmix.srv.monitor" // (bool) Enable PMIx internal monitoring by server
127+
#define PMIX_SERVER_NSPACE "pmix.srv.nspace" // (char*) Name of the nspace to use for this server
128+
#define PMIX_SERVER_RANK "pmix.srv.rank" // (pmix_rank_t) Rank of this server
127129

128130

129131
/* identification attributes */
@@ -936,20 +938,20 @@ typedef struct pmix_value {
936938
PMIX_PROC_INFO_DESTRUCT(_info[_n].value.data.pinfo); \
937939
} \
938940
} \
939-
} \
940-
} else if (PMIX_BYTE_OBJECT == (m)->data.darray->type) { \
941-
pmix_byte_object_t *_obj = \
942-
(pmix_byte_object_t*)(m)->data.darray->array; \
943-
for (_n=0; _n < (m)->data.darray->size; _n++) { \
944-
if (NULL != _obj[_n].bytes) { \
945-
free(_obj[_n].bytes); \
941+
} else if (PMIX_BYTE_OBJECT == (m)->data.darray->type) { \
942+
pmix_byte_object_t *_obj = \
943+
(pmix_byte_object_t*)(m)->data.darray->array; \
944+
for (_n=0; _n < (m)->data.darray->size; _n++) { \
945+
if (NULL != _obj[_n].bytes) { \
946+
free(_obj[_n].bytes); \
947+
} \
946948
} \
947949
} \
948-
} \
949-
if (NULL != (m)->data.darray->array) { \
950950
free((m)->data.darray->array); \
951951
} \
952-
free((m)->data.darray); \
952+
if (NULL != (m)->data.darray) { \
953+
free((m)->data.darray); \
954+
} \
953955
/**** DEPRECATED ****/ \
954956
} else if (PMIX_INFO_ARRAY == (m)->type) { \
955957
pmix_info_t *_p = (pmix_info_t*)((m)->data.array->array); \

opal/mca/pmix/pmix2x/pmix/src/buffer_ops/copy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ PMIX_EXPORT pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
425425
break;
426426
}
427427
/* allocate space and do the copy */
428-
switch (src->type) {
428+
switch (src->data.darray->type) {
429429
case PMIX_UINT8:
430430
case PMIX_INT8:
431431
case PMIX_BYTE:

opal/mca/pmix/pmix2x/pmix/src/buffer_ops/unpack.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,7 @@ pmix_status_t pmix_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest,
768768
return ret;
769769
}
770770
if (NULL == tmp) {
771+
PMIX_ERROR_LOG(PMIX_ERROR);
771772
return PMIX_ERROR;
772773
}
773774
(void)strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN);

opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[],
111111
PMIX_RELEASE(cb);
112112

113113
pmix_output_verbose(2, pmix_globals.debug_output,
114-
"pmix:client get completed");
114+
"pmix:client get completed %d", rc);
115115

116116
return rc;
117117
}
@@ -464,7 +464,7 @@ static pmix_status_t process_val(pmix_value_t *val,
464464
}
465465
nvals = 0;
466466
for (n=0; n < nsize; n++) {
467-
if (PMIX_SUCCESS != (rc = pmix_pointer_array_add(results, &info[n]))) {
467+
if (0 > (rc = pmix_pointer_array_add(results, &info[n]))) {
468468
return rc;
469469
}
470470
++nvals;
@@ -536,25 +536,45 @@ static void _getnbfn(int fd, short flags, void *cbdata)
536536
/* if the rank is WILDCARD, then they want all the job-level info,
537537
* so no need to check the modex */
538538
if (PMIX_RANK_WILDCARD != cb->rank) {
539+
rc = PMIX_ERR_NOT_FOUND;
539540
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
540-
if (PMIX_SUCCESS == (rc = pmix_dstore_fetch(nptr->nspace, cb->rank, NULL, &val))) {
541-
#else
542-
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->modex, cb->rank, NULL, &val))) {
541+
/* my own data is in the hash table, so don't bother looking
542+
* in the dstore if that is what they want */
543+
if (pmix_globals.myid.rank != cb->rank) {
544+
if (PMIX_SUCCESS == (rc = pmix_dstore_fetch(nptr->nspace, cb->rank, NULL, &val))) {
545+
pmix_output_verbose(2, pmix_globals.debug_output,
546+
"pmix_get[%d]: value retrieved from dstore", __LINE__);
547+
if (PMIX_SUCCESS != (rc = process_val(val, &nvals, &results))) {
548+
cb->value_cbfunc(rc, NULL, cb->cbdata);
549+
/* cleanup */
550+
if (NULL != val) {
551+
PMIX_VALUE_RELEASE(val);
552+
}
553+
PMIX_RELEASE(cb);
554+
return;
555+
}
556+
}
557+
}
543558
#endif /* PMIX_ENABLE_DSTORE */
544-
pmix_output_verbose(2, pmix_globals.debug_output,
545-
"pmix_get[%d]: value retrieved from dstore", __LINE__);
546-
if (PMIX_SUCCESS != (rc = process_val(val, &nvals, &results))) {
547-
cb->value_cbfunc(rc, NULL, cb->cbdata);
548-
/* cleanup */
549-
if (NULL != val) {
550-
PMIX_VALUE_RELEASE(val);
559+
if (PMIX_SUCCESS != rc) {
560+
/* if the user was asking about themselves, or we aren't using the dstore,
561+
* then we need to check the hash table */
562+
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->modex, cb->rank, NULL, &val))) {
563+
pmix_output_verbose(2, pmix_globals.debug_output,
564+
"pmix_get[%d]: value retrieved from hash", __LINE__);
565+
if (PMIX_SUCCESS != (rc = process_val(val, &nvals, &results))) {
566+
cb->value_cbfunc(rc, NULL, cb->cbdata);
567+
/* cleanup */
568+
if (NULL != val) {
569+
PMIX_VALUE_RELEASE(val);
570+
}
571+
PMIX_RELEASE(cb);
572+
return;
551573
}
552-
PMIX_RELEASE(cb);
553-
return;
574+
PMIX_VALUE_RELEASE(val);
554575
}
555-
/* cleanup */
556-
PMIX_VALUE_RELEASE(val);
557-
} else {
576+
}
577+
if (PMIX_SUCCESS != rc) {
558578
/* if we didn't find a modex for this rank, then we need
559579
* to go get it. Thus, the caller wants -all- information for
560580
* the specified rank, not just the job-level info. */
@@ -572,12 +592,17 @@ static void _getnbfn(int fd, short flags, void *cbdata)
572592
PMIX_RELEASE(cb);
573593
return;
574594
}
575-
/* cleanup */
576595
PMIX_VALUE_RELEASE(val);
577596
}
578597
/* now let's package up the results */
579598
PMIX_VALUE_CREATE(val, 1);
580599
val->type = PMIX_DATA_ARRAY;
600+
val->data.darray = (pmix_data_array_t*)malloc(sizeof(pmix_data_array_t));
601+
if (NULL == val->data.darray) {
602+
PMIX_VALUE_RELEASE(val);
603+
cb->value_cbfunc(PMIX_ERR_NOMEM, NULL, cb->cbdata);
604+
return;
605+
}
581606
val->data.darray->type = PMIX_INFO;
582607
val->data.darray->size = nvals;
583608
PMIX_INFO_CREATE(iptr, nvals);
@@ -597,14 +622,13 @@ static void _getnbfn(int fd, short flags, void *cbdata)
597622
} else {
598623
pmix_value_xfer(&iptr[n].value, &info->value);
599624
}
600-
PMIX_INFO_FREE(info, 1);
625+
PMIX_INFO_DESTRUCT(info);
601626
}
602627
}
603628
/* done with results array */
604629
PMIX_DESTRUCT(&results);
605-
/* return the result to the caller */
630+
/* return the result to the caller - they are responsible for releasing it */
606631
cb->value_cbfunc(PMIX_SUCCESS, val, cb->cbdata);
607-
PMIX_VALUE_FREE(val, 1);
608632
PMIX_RELEASE(cb);
609633
return;
610634
}

opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c

Lines changed: 73 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,6 @@ static inline int _my_client(const char *nspace, pmix_rank_t rank);
8787

8888
static pmix_status_t initialize_server_base(pmix_server_module_t *module)
8989
{
90-
char *evar;
91-
92-
/* look for our namespace, if one was given */
93-
if (NULL == (evar = getenv("PMIX_SERVER_NAMESPACE"))) {
94-
/* use a fake namespace */
95-
(void)strncpy(pmix_globals.myid.nspace, "pmix-server", PMIX_MAX_NSLEN);
96-
} else {
97-
(void)strncpy(pmix_globals.myid.nspace, evar, PMIX_MAX_NSLEN);
98-
}
99-
/* look for our rank, if one was given */
100-
mypid = getpid();
101-
if (NULL == (evar = getenv("PMIX_SERVER_RANK"))) {
102-
/* use our pid */
103-
pmix_globals.myid.rank = mypid;
104-
} else {
105-
pmix_globals.myid.rank = strtol(evar, NULL, 10);
106-
}
107-
10890
/* setup the server-specific globals */
10991
PMIX_CONSTRUCT(&pmix_server_globals.clients, pmix_pointer_array_t);
11092
pmix_pointer_array_init(&pmix_server_globals.clients, 1, INT_MAX, 1);
@@ -131,7 +113,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
131113
pmix_status_t rc;
132114
size_t n, m;
133115
pmix_kval_t kv;
134-
bool protect;
116+
bool protect, nspace_given = false, rank_given = false;
135117
char *protected[] = {
136118
PMIX_USERID,
137119
PMIX_GRPID,
@@ -140,6 +122,8 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
140122
PMIX_SERVER_SYSTEM_SUPPORT,
141123
NULL
142124
};
125+
char *evar;
126+
pmix_rank_info_t *rinfo;
143127

144128
PMIX_ACQUIRE_THREAD(&pmix_global_lock);
145129

@@ -159,31 +143,22 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
159143
return rc;
160144
}
161145

162-
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
163-
if (PMIX_SUCCESS != (rc = pmix_dstore_init(info, ninfo))) {
164-
PMIX_RELEASE_THREAD(&pmix_global_lock);
165-
return rc;
166-
}
167-
#endif /* PMIX_ENABLE_DSTORE */
168-
169-
/* setup the wildcard recv for inbound messages from clients */
170-
req = PMIX_NEW(pmix_ptl_posted_recv_t);
171-
req->tag = UINT32_MAX;
172-
req->cbfunc = server_message_handler;
173-
/* add it to the end of the list of recvs */
174-
pmix_list_append(&pmix_ptl_globals.posted_recvs, &req->super);
175-
176-
if (PMIX_SUCCESS != pmix_ptl_base_start_listening(info, ninfo)) {
177-
pmix_show_help("help-pmix-server.txt", "listener-thread-start", true);
178-
PMIX_RELEASE_THREAD(&pmix_global_lock);
179-
return PMIX_ERR_INIT;
180-
}
181-
182146
/* check the info keys for info we
183-
* need to provide to every client */
147+
* need to provide to every client and
148+
* directives aimed at us */
184149
if (NULL != info) {
185150
PMIX_CONSTRUCT(&kv, pmix_kval_t);
186151
for (n=0; n < ninfo; n++) {
152+
if (0 == strncmp(info[n].key, PMIX_SERVER_NSPACE, PMIX_MAX_KEYLEN)) {
153+
(void)strncpy(pmix_globals.myid.nspace, info[n].value.data.string, PMIX_MAX_NSLEN);
154+
nspace_given = true;
155+
continue;
156+
}
157+
if (0 == strncmp(info[n].key, PMIX_SERVER_RANK, PMIX_MAX_KEYLEN)) {
158+
pmix_globals.myid.rank = info[n].value.data.rank;
159+
rank_given = true;
160+
continue;
161+
}
187162
/* check the list of protected keys */
188163
protect = false;
189164
for (m=0; NULL != protected[m]; m++) {
@@ -215,6 +190,64 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
215190
PMIX_DESTRUCT(&kv);
216191
}
217192

193+
if (!nspace_given) {
194+
/* look for our namespace, if one was given */
195+
if (NULL == (evar = getenv("PMIX_SERVER_NAMESPACE"))) {
196+
/* use a fake namespace */
197+
(void)strncpy(pmix_globals.myid.nspace, "pmix-server", PMIX_MAX_NSLEN);
198+
} else {
199+
(void)strncpy(pmix_globals.myid.nspace, evar, PMIX_MAX_NSLEN);
200+
}
201+
}
202+
if (!rank_given) {
203+
/* look for our rank, if one was given */
204+
mypid = getpid();
205+
if (NULL == (evar = getenv("PMIX_SERVER_RANK"))) {
206+
/* use our pid */
207+
pmix_globals.myid.rank = mypid;
208+
} else {
209+
pmix_globals.myid.rank = strtol(evar, NULL, 10);
210+
}
211+
}
212+
213+
/* copy it into mypeer entries */
214+
if (NULL == pmix_globals.mypeer->info) {
215+
rinfo = PMIX_NEW(pmix_rank_info_t);
216+
pmix_globals.mypeer->info = rinfo;
217+
} else {
218+
rinfo = pmix_globals.mypeer->info;
219+
}
220+
if (NULL == rinfo->nptr) {
221+
rinfo->nptr = PMIX_NEW(pmix_nspace_t);
222+
/* ensure our own nspace is first on the list */
223+
PMIX_RETAIN(rinfo->nptr);
224+
rinfo->nptr->server = PMIX_NEW(pmix_server_nspace_t);
225+
pmix_list_prepend(&pmix_globals.nspaces, &rinfo->nptr->super);
226+
}
227+
(void)strncpy(rinfo->nptr->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN);
228+
rinfo->rank = pmix_globals.myid.rank;
229+
230+
231+
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
232+
if (PMIX_SUCCESS != (rc = pmix_dstore_init(info, ninfo))) {
233+
PMIX_RELEASE_THREAD(&pmix_global_lock);
234+
return rc;
235+
}
236+
#endif /* PMIX_ENABLE_DSTORE */
237+
238+
/* setup the wildcard recv for inbound messages from clients */
239+
req = PMIX_NEW(pmix_ptl_posted_recv_t);
240+
req->tag = UINT32_MAX;
241+
req->cbfunc = server_message_handler;
242+
/* add it to the end of the list of recvs */
243+
pmix_list_append(&pmix_ptl_globals.posted_recvs, &req->super);
244+
245+
if (PMIX_SUCCESS != pmix_ptl_base_start_listening(info, ninfo)) {
246+
pmix_show_help("help-pmix-server.txt", "listener-thread-start", true);
247+
PMIX_RELEASE_THREAD(&pmix_global_lock);
248+
return PMIX_ERR_INIT;
249+
}
250+
218251
/* get our available security modules */
219252
security_mode = pmix_psec.get_available_modules();
220253

0 commit comments

Comments
 (0)