Skip to content

Commit

Permalink
Simplify the PMIx_get processing:
Browse files Browse the repository at this point in the history
If the key starts with “pmix”, then it is a PMIx-namespace key and can only be in the data provided at startup (which is stored in the “internal" hash table). Otherwise, it is data that was PMix_Put and is in the “modex” hash table. PMIx job-level data is stored in the “internal” hash table against rank=PMIX_RANK_WILDCARD.

This reduces all calls to PMIx_Get to a single hash-table lookup
  • Loading branch information
Ralph Castain committed Jul 18, 2016
1 parent d130079 commit df77d18
Showing 1 changed file with 21 additions and 37 deletions.
58 changes: 21 additions & 37 deletions src/client/pmix_client_get.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,11 @@ static void _getnbfn(int fd, short flags, void *cbdata)
goto request;
}

/* if the key is NULL, then we have to check both the job-data
* and the modex tables. If we don't yet have the modex data,
* then we are going to have to go get it. So let's check that
* case first */
/* The NULL==key scenario only pertains to cases where legacy
* PMI methods are being employed. In this case, we have to check
* both the job-data and the modex tables. If we don't yet have
* the modex data, then we are going to have to go get it. So let's
* check that case first */
if (NULL == cb->key) {
PMIX_CONSTRUCT(&results, pmix_pointer_array_t);
pmix_pointer_array_init(&results, 2, INT_MAX, 1);
Expand Down Expand Up @@ -451,9 +452,7 @@ static void _getnbfn(int fd, short flags, void *cbdata)
}
} else {
/* if we didn't find a modex for this rank, then we need
* to go get it. Recall that the NULL==key scenario only
* pertains to cases where legacy PMI methods are being
* employed. Thus, the caller wants -all- information for
* to go get it. Thus, the caller wants -all- information for
* the specified rank, not just the job-level info. */
goto request;
}
Expand Down Expand Up @@ -505,43 +504,28 @@ static void _getnbfn(int fd, short flags, void *cbdata)
return;
}

/* the requested data could be in the job-data table, so let's
* just check there first. */
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->internal, PMIX_RANK_WILDCARD, cb->key, &val))) {
/* found it - we are in an event, so we can
* just execute the callback */
cb->value_cbfunc(rc, val, cb->cbdata);
/* cleanup */
if (NULL != val) {
PMIX_VALUE_RELEASE(val);
/* if the key is in the PMIx namespace, then they are looking for data
* that was provided at startup */
if (0 == strncmp(cb->key, "pmix", 4)) {
/* should be in the internal hash table. */
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->internal, cb->rank, cb->key, &val))) {
/* found it - we are in an event, so we can
* just execute the callback */
cb->value_cbfunc(rc, val, cb->cbdata);
/* cleanup */
if (NULL != val) {
PMIX_VALUE_RELEASE(val);
}
PMIX_RELEASE(cb);
return;
}
PMIX_RELEASE(cb);
return;
}
if (PMIX_RANK_WILDCARD == cb->rank) {
/* can't be anywhere else */
cb->value_cbfunc(PMIX_ERR_NOT_FOUND, NULL, cb->cbdata);
PMIX_RELEASE(cb);
return;
}

/* it could still be in the job-data table, only stored under its own
* rank and not WILDCARD - e.g., this is true of data returned about
* ourselves during startup */
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->internal, cb->rank, cb->key, &val))) {
/* found it - we are in an event, so we can
* just execute the callback */
cb->value_cbfunc(rc, val, cb->cbdata);
/* cleanup */
if (NULL != val) {
PMIX_VALUE_RELEASE(val);
}
PMIX_RELEASE(cb);
return;
}

/* not finding it is not an error - it could be in the
* modex hash table, so check it */
/* otherwise, the data must be something they "put" */
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
if (PMIX_SUCCESS == (rc = pmix_dstore_fetch(nptr->nspace, cb->rank, cb->key, &val))) {
#else
Expand Down

0 comments on commit df77d18

Please sign in to comment.