Skip to content

Commit 01a653d

Browse files
author
Ralph Castain
committed
Remove a debug print in comm_cid.c. Update PMIx2 to include the revised PMIx_Get logic for higher performance by reducing the number of hash table lookups. Fix a bug where requests for data from a proc in another nspace could hang, or result in "not found".
Remove stale file reference Restore autogen pass thru pmix Remove generated file
1 parent 19a1837 commit 01a653d

File tree

18 files changed

+212
-199
lines changed

18 files changed

+212
-199
lines changed

ompi/communicator/comm_cid.c

100755100644
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,6 @@ static int ompi_comm_allreduce_pmix_reduce_complete (ompi_comm_request_t *reques
877877
* needs to be reworked to take advantage of it. */
878878
OPAL_PMIX_EXCHANGE(rc, &info, &pdat, 60);
879879
OBJ_DESTRUCT(&info);
880-
fprintf (stderr, "OPAL_PMIX_EXCHANGE returned %d\n", rc);
881880
if (OPAL_SUCCESS != rc) {
882881
OBJ_DESTRUCT(&pdat);
883882
return rc;

opal/mca/pmix/pmix2x/pmix/VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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=git92df386
33+
repo_rev=git4e10e9d
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="Jul 05, 2016"
47+
date="Jul 19, 2016"
4848

4949
# The shared library version of each of PMIx's public libraries.
5050
# These versions are maintained in accordance with the "Library

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

Lines changed: 65 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -296,39 +296,46 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr,
296296

297297
cnt = 1;
298298
if (PMIX_SUCCESS == (rc = pmix_bfrop.unpack(buf, &bptr, &cnt, PMIX_BUFFER))) {
299-
cnt = 1;
300-
cur_kval = PMIX_NEW(pmix_kval_t);
301-
while (PMIX_SUCCESS == (rc = pmix_bfrop.unpack(bptr, cur_kval, &cnt, PMIX_KVAL))) {
302-
pmix_output_verbose(2, pmix_globals.debug_output,
303-
"pmix: unpacked key %s", cur_kval->key);
304-
if (PMIX_SUCCESS != (rc = pmix_hash_store(&nptr->modex, cur_rank, cur_kval))) {
305-
PMIX_ERROR_LOG(rc);
306-
}
307-
if (NULL != cb->key && 0 == strcmp(cb->key, cur_kval->key)) {
299+
/* if the rank is WILDCARD, then this is an nspace blob */
300+
if (PMIX_RANK_WILDCARD == cur_rank) {
301+
pmix_client_process_nspace_blob(cb->nspace, bptr);
302+
} else {
303+
cnt = 1;
304+
cur_kval = PMIX_NEW(pmix_kval_t);
305+
while (PMIX_SUCCESS == (rc = pmix_bfrop.unpack(bptr, cur_kval, &cnt, PMIX_KVAL))) {
308306
pmix_output_verbose(2, pmix_globals.debug_output,
309-
"pmix: found requested value");
310-
if (PMIX_SUCCESS != (rc = pmix_bfrop.copy((void**)&val, cur_kval->value, PMIX_VALUE))) {
307+
"pmix: unpacked key %s", cur_kval->key);
308+
if (PMIX_SUCCESS != (rc = pmix_hash_store(&nptr->modex, cur_rank, cur_kval))) {
311309
PMIX_ERROR_LOG(rc);
312-
PMIX_RELEASE(cur_kval);
313-
val = NULL;
314-
goto done;
315310
}
311+
if (NULL != cb->key && 0 == strcmp(cb->key, cur_kval->key)) {
312+
pmix_output_verbose(2, pmix_globals.debug_output,
313+
"pmix: found requested value");
314+
if (PMIX_SUCCESS != (rc = pmix_bfrop.copy((void**)&val, cur_kval->value, PMIX_VALUE))) {
315+
PMIX_ERROR_LOG(rc);
316+
PMIX_RELEASE(cur_kval);
317+
val = NULL;
318+
goto done;
319+
}
320+
}
321+
PMIX_RELEASE(cur_kval); // maintain acctg - hash_store does a retain
322+
cnt = 1;
323+
cur_kval = PMIX_NEW(pmix_kval_t);
316324
}
317-
PMIX_RELEASE(cur_kval); // maintain acctg - hash_store does a retain
318325
cnt = 1;
319-
cur_kval = PMIX_NEW(pmix_kval_t);
326+
PMIX_RELEASE(cur_kval);
320327
}
321-
cnt = 1;
322-
PMIX_RELEASE(cur_kval);
323328
}
324329
PMIX_RELEASE(bptr); // free's the data region
325-
if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) {
330+
if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc &&
331+
PMIX_SUCCESS != rc) {
326332
PMIX_ERROR_LOG(rc);
327333
rc = PMIX_ERR_SILENT; // avoid error-logging twice
328334
break;
329335
}
330336
}
331-
if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) {
337+
if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc &&
338+
PMIX_SUCCESS != rc) {
332339
PMIX_ERROR_LOG(rc);
333340
} else {
334341
rc = PMIX_SUCCESS;
@@ -409,10 +416,11 @@ static void _getnbfn(int fd, short flags, void *cbdata)
409416
goto request;
410417
}
411418

412-
/* if the key is NULL, then we have to check both the job-data
413-
* and the modex tables. If we don't yet have the modex data,
414-
* then we are going to have to go get it. So let's check that
415-
* case first */
419+
/* The NULL==key scenario only pertains to cases where legacy
420+
* PMI methods are being employed. In this case, we have to check
421+
* both the job-data and the modex tables. If we don't yet have
422+
* the modex data, then we are going to have to go get it. So let's
423+
* check that case first */
416424
if (NULL == cb->key) {
417425
PMIX_CONSTRUCT(&results, pmix_pointer_array_t);
418426
pmix_pointer_array_init(&results, 2, INT_MAX, 1);
@@ -451,9 +459,7 @@ static void _getnbfn(int fd, short flags, void *cbdata)
451459
}
452460
} else {
453461
/* if we didn't find a modex for this rank, then we need
454-
* to go get it. Recall that the NULL==key scenario only
455-
* pertains to cases where legacy PMI methods are being
456-
* employed. Thus, the caller wants -all- information for
462+
* to go get it. Thus, the caller wants -all- information for
457463
* the specified rank, not just the job-level info. */
458464
goto request;
459465
}
@@ -505,43 +511,26 @@ static void _getnbfn(int fd, short flags, void *cbdata)
505511
return;
506512
}
507513

508-
/* the requested data could be in the job-data table, so let's
509-
* just check there first. */
510-
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->internal, PMIX_RANK_WILDCARD, cb->key, &val))) {
511-
/* found it - we are in an event, so we can
512-
* just execute the callback */
513-
cb->value_cbfunc(rc, val, cb->cbdata);
514-
/* cleanup */
515-
if (NULL != val) {
516-
PMIX_VALUE_RELEASE(val);
517-
}
518-
PMIX_RELEASE(cb);
519-
return;
520-
}
521-
if (PMIX_RANK_WILDCARD == cb->rank) {
522-
/* can't be anywhere else */
523-
cb->value_cbfunc(PMIX_ERR_NOT_FOUND, NULL, cb->cbdata);
524-
PMIX_RELEASE(cb);
525-
return;
526-
}
527-
528-
/* it could still be in the job-data table, only stored under its own
529-
* rank and not WILDCARD - e.g., this is true of data returned about
530-
* ourselves during startup */
531-
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->internal, cb->rank, cb->key, &val))) {
532-
/* found it - we are in an event, so we can
533-
* just execute the callback */
534-
cb->value_cbfunc(rc, val, cb->cbdata);
535-
/* cleanup */
536-
if (NULL != val) {
537-
PMIX_VALUE_RELEASE(val);
514+
/* if the key is in the PMIx namespace, then they are looking for data
515+
* that was provided at startup */
516+
if (0 == strncmp(cb->key, "pmix", 4)) {
517+
/* should be in the internal hash table. */
518+
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->internal, cb->rank, cb->key, &val))) {
519+
/* found it - we are in an event, so we can
520+
* just execute the callback */
521+
cb->value_cbfunc(rc, val, cb->cbdata);
522+
/* cleanup */
523+
if (NULL != val) {
524+
PMIX_VALUE_RELEASE(val);
525+
}
526+
PMIX_RELEASE(cb);
527+
return;
538528
}
539-
PMIX_RELEASE(cb);
540-
return;
529+
/* if we don't have it, go request it */
530+
goto request;
541531
}
542532

543-
/* not finding it is not an error - it could be in the
544-
* modex hash table, so check it */
533+
/* otherwise, the data must be something they "put" */
545534
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
546535
if (PMIX_SUCCESS == (rc = pmix_dstore_fetch(nptr->nspace, cb->rank, cb->key, &val))) {
547536
#else
@@ -606,6 +595,16 @@ static void _getnbfn(int fd, short flags, void *cbdata)
606595
}
607596
}
608597

598+
/* if we are seeking "pmix" data for our own nspace, then we must fail
599+
* as it was provided at startup - any updates would have come via
600+
* event notifications */
601+
if (0 == strncmp(cb->key, "pmix", 4) &&
602+
0 == strncmp(cb->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN)) {
603+
cb->value_cbfunc(PMIX_ERR_NOT_FOUND, NULL, cb->cbdata);
604+
PMIX_RELEASE(cb);
605+
return;
606+
}
607+
609608
/* see if we already have a request in place with the server for data from
610609
* this nspace:rank. If we do, then no need to ask again as the
611610
* request will return _all_ data from that proc */
@@ -628,6 +627,11 @@ static void _getnbfn(int fd, short flags, void *cbdata)
628627
return;
629628
}
630629

630+
pmix_output_verbose(2, pmix_globals.debug_output,
631+
"%s:%d REQUESTING DATA FROM SERVER FOR %s:%d KEY %s",
632+
pmix_globals.myid.nspace, pmix_globals.myid.rank,
633+
cb->nspace, cb->rank, cb->key);
634+
631635
/* create a callback object as we need to pass it to the
632636
* recv routine so we know which callback to use when
633637
* the return message is recvd */

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -983,10 +983,9 @@ PMIX_EXPORT pmix_status_t PMIx_server_setup_fork(const pmix_proc_t *proc, char *
983983
pmix_setenv("PMIX_RANK", rankstr, true, env);
984984
/* pass our rendezvous info */
985985
PMIX_LIST_FOREACH(lt, &pmix_server_globals.listeners, pmix_listener_t) {
986-
if (NULL == lt->uri) {
987-
continue;
986+
if (NULL != lt->uri && NULL != lt->varname) {
987+
pmix_setenv(lt->varname, lt->uri, true, env);
988988
}
989-
pmix_setenv(lt->varname, lt->uri, true, env);
990989
}
991990
/* pass our active security mode */
992991
pmix_setenv("PMIX_SECURITY_MODE", security_mode, true, env);

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

Lines changed: 48 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ static void dmdx_cbfunc(pmix_status_t status, const char *data,
8888
size_t ndata, void *cbdata,
8989
pmix_release_cbfunc_t relfn, void *relcbdata);
9090
static pmix_status_t _satisfy_request(pmix_nspace_t *ns, int rank,
91+
pmix_server_caddy_t *cd,
9192
pmix_modex_cbfunc_t cbfunc, void *cbdata, bool *scope);
9293
static pmix_status_t create_local_tracker(char nspace[], int rank,
9394
pmix_info_t info[], size_t ninfo,
@@ -110,6 +111,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf,
110111
pmix_modex_cbfunc_t cbfunc,
111112
void *cbdata)
112113
{
114+
pmix_server_caddy_t *cd = (pmix_server_caddy_t*)cbdata;
113115
int32_t cnt;
114116
pmix_status_t rc;
115117
int rank;
@@ -120,6 +122,9 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf,
120122
size_t ninfo=0;
121123
pmix_dmdx_local_t *lcd;
122124
bool local;
125+
pmix_buffer_t pbkt;
126+
char *data;
127+
size_t sz;
123128

124129
pmix_output_verbose(2, pmix_globals.debug_output,
125130
"recvd GET");
@@ -166,9 +171,11 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf,
166171
}
167172

168173
pmix_output_verbose(2, pmix_globals.debug_output,
169-
"%s:%d EXECUTE GET FOR %s:%d",
174+
"%s:%d EXECUTE GET FOR %s:%d ON BEHALF OF %s:%d",
170175
pmix_globals.myid.nspace,
171-
pmix_globals.myid.rank, nspace, rank);
176+
pmix_globals.myid.rank, nspace, rank,
177+
cd->peer->info->nptr->nspace,
178+
cd->peer->info->rank);
172179

173180
if (NULL == nptr || NULL == nptr->server) {
174181
/* this is for an nspace we don't know about yet, so
@@ -179,6 +186,20 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf,
179186
return rc;
180187
}
181188

189+
/* if the rank is wildcard, then they are asking for the job-level
190+
* info for this nspace - provide it */
191+
if (PMIX_RANK_WILDCARD == rank) {
192+
PMIX_CONSTRUCT(&pbkt, pmix_buffer_t);
193+
pmix_bfrop.pack(&pbkt, &rank, 1, PMIX_INT);
194+
/* the client is expecting this to arrive as a byte object
195+
* containing a buffer, so package it accordingly */
196+
pmix_bfrop.pack(&pbkt, &nptr->server->job_info, 1, PMIX_BUFFER);
197+
PMIX_UNLOAD_BUFFER(&pbkt, data, sz);
198+
PMIX_DESTRUCT(&pbkt);
199+
cbfunc(PMIX_SUCCESS, data, sz, cbdata, relfn, data);
200+
return PMIX_SUCCESS;
201+
}
202+
182203
/* We have to wait for all local clients to be registered before
183204
* we can know whether this request is for data from a local or a
184205
* remote client because one client might ask for data about another
@@ -194,27 +215,13 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf,
194215
}
195216

196217
/* see if we already have this data */
197-
rc = _satisfy_request(nptr, rank, cbfunc, cbdata, &local);
218+
rc = _satisfy_request(nptr, rank, cd, cbfunc, cbdata, &local);
198219
if( PMIX_SUCCESS == rc ){
199220
/* request was successfully satisfied */
200221
PMIX_INFO_FREE(info, ninfo);
201222
return rc;
202223
}
203224

204-
/* do not force dmodex logic for non-specific ranks
205-
* let return not found status instead of doing fence with
206-
* data exchange. User can make a decision to do such call getting
207-
* not found status
208-
*/
209-
if (PMIX_RANK_UNDEF == rank || PMIX_RANK_WILDCARD == rank) {
210-
pmix_output_verbose(2, pmix_globals.debug_output,
211-
"%s:%d not found data for namespace = %s, rank = %d "
212-
"(do not request resource manager server for non-specified rank)",
213-
pmix_globals.myid.nspace,
214-
pmix_globals.myid.rank, nspace, rank);
215-
return PMIX_ERR_NOT_FOUND;
216-
}
217-
218225
/* If we get here, then we don't have the data at this time. Check
219226
* to see if we already have a pending request for the data - if
220227
* we do, then we can just wait for it to arrive */
@@ -355,7 +362,7 @@ void pmix_pending_nspace_requests(pmix_nspace_t *nptr)
355362
}
356363
}
357364

358-
static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, int rank,
365+
static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, int rank, pmix_server_caddy_t *cd,
359366
pmix_modex_cbfunc_t cbfunc, void *cbdata, bool *scope)
360367
{
361368
pmix_status_t rc;
@@ -364,7 +371,7 @@ static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, int rank,
364371
size_t sz;
365372
int cur_rank;
366373
int found = 0;
367-
pmix_buffer_t pbkt;
374+
pmix_buffer_t pbkt, *pbptr;
368375
void *last;
369376
pmix_hash_table_t *hts[3];
370377
pmix_hash_table_t **htptr;
@@ -404,6 +411,27 @@ static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, int rank,
404411
* having been committed */
405412
htptr = hts;
406413
PMIX_CONSTRUCT(&pbkt, pmix_buffer_t);
414+
415+
/* if they are asking about a rank from an nspace different
416+
* from their own, then include a copy of the job-level info */
417+
if (NULL != cd &&
418+
0 != strncmp(nptr->nspace, cd->peer->info->nptr->nspace, PMIX_MAX_NSLEN)) {
419+
cur_rank = PMIX_RANK_WILDCARD;
420+
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(&pbkt, &cur_rank, 1, PMIX_INT))) {
421+
PMIX_ERROR_LOG(rc);
422+
cbfunc(rc, NULL, 0, cbdata, relfn, data);
423+
return rc;
424+
}
425+
/* the client is expecting this to arrive as a byte object
426+
* containing a buffer, so package it accordingly */
427+
pbptr = &nptr->server->job_info;
428+
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(&pbkt, &pbptr, 1, PMIX_BUFFER))) {
429+
PMIX_ERROR_LOG(rc);
430+
cbfunc(rc, NULL, 0, cbdata, relfn, data);
431+
return rc;
432+
}
433+
}
434+
407435
while (NULL != *htptr) {
408436
cur_rank = rank;
409437
if (PMIX_RANK_UNDEF == rank) {
@@ -494,7 +522,7 @@ pmix_status_t pmix_pending_resolve(pmix_nspace_t *nptr, int rank,
494522
/* run through all the requests to this rank */
495523
PMIX_LIST_FOREACH(req, &lcd->loc_reqs, pmix_dmdx_request_t) {
496524
pmix_status_t rc;
497-
rc = _satisfy_request(nptr, rank, req->cbfunc, req->cbdata, NULL);
525+
rc = _satisfy_request(nptr, rank, NULL, req->cbfunc, req->cbdata, NULL);
498526
if( PMIX_SUCCESS != rc ){
499527
/* if we can't satisfy this particular request (missing key?) */
500528
req->cbfunc(rc, NULL, 0, req->cbdata, NULL, NULL);

opal/mca/pmix/pmix2x/pmix/test/pmix_client.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
7373
pmix_value_t *val = &value;
7474
test_params params;
7575
INIT_TEST_PARAMS(params);
76-
pmix_proc_t myproc;
76+
pmix_proc_t myproc, proc;
7777

7878
parse_cmd(argc, argv, &params);
7979

@@ -102,7 +102,9 @@ int main(int argc, char **argv)
102102
}
103103
TEST_VERBOSE((" Client ns %s rank %d: PMIx_Init success", myproc.nspace, myproc.rank));
104104

105-
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc,PMIX_UNIV_SIZE,NULL, 0,&val))) {
105+
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
106+
proc.rank = PMIX_RANK_WILDCARD;
107+
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) {
106108
TEST_ERROR(("rank %d: PMIx_Get universe size failed: %d", myproc.rank, rc));
107109
FREE_TEST_PARAMS(params);
108110
exit(0);

opal/mca/pmix/pmix2x/pmix/test/simple/simpclient.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ int main(int argc, char **argv)
101101
}
102102

103103
/* get our universe size */
104-
if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, PMIX_UNIV_SIZE, NULL, 0, &val))) {
104+
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
105+
proc.rank = PMIX_RANK_WILDCARD;
106+
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) {
105107
pmix_output(0, "Client ns %s rank %d: PMIx_Get universe size failed: %d", myproc.nspace, myproc.rank, rc);
106108
goto done;
107109
}

0 commit comments

Comments
 (0)