Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to track PMIx v2.0.1 #3754

Merged
merged 2 commits into from
Jun 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions opal/mca/pmix/pmix2x/pmix/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# major, minor, and release are generally combined in the form
# <major>.<minor>.<release>.

major=2
major=3
minor=0
release=0

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

repo_rev=git6fb501d
repo_rev=gitaa26b56

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

# The date when this release was created

date="Jun 19, 2017"
date="Jun 26, 2017"

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

libpmix_so_version=3:0:1
libpmix_so_version=0:0:0
2 changes: 1 addition & 1 deletion opal/mca/pmix/pmix2x/pmix/autogen.pl
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ sub mca_process_framework {
$mca_found->{$framework}->{found} = 1;
opendir(DIR, $dir) ||
my_die "Can't open $dir directory";
foreach my $d (readdir(DIR)) {
foreach my $d (sort(readdir(DIR))) {
# Skip any non-directory, "base", or any dir that
# begins with "."
next
Expand Down
22 changes: 12 additions & 10 deletions opal/mca/pmix/pmix2x/pmix/include/pmix_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ typedef uint32_t pmix_rank_t;
#define PMIX_CONNECT_SYSTEM_FIRST "pmix.cnct.sys.first" // (bool) Preferentially look for a system-level PMIx server first
#define PMIX_REGISTER_NODATA "pmix.reg.nodata" // (bool) Registration is for nspace only, do not copy job data
#define PMIX_SERVER_ENABLE_MONITORING "pmix.srv.monitor" // (bool) Enable PMIx internal monitoring by server
#define PMIX_SERVER_NSPACE "pmix.srv.nspace" // (char*) Name of the nspace to use for this server
#define PMIX_SERVER_RANK "pmix.srv.rank" // (pmix_rank_t) Rank of this server


/* identification attributes */
Expand Down Expand Up @@ -936,20 +938,20 @@ typedef struct pmix_value {
PMIX_PROC_INFO_DESTRUCT(_info[_n].value.data.pinfo); \
} \
} \
} \
} else if (PMIX_BYTE_OBJECT == (m)->data.darray->type) { \
pmix_byte_object_t *_obj = \
(pmix_byte_object_t*)(m)->data.darray->array; \
for (_n=0; _n < (m)->data.darray->size; _n++) { \
if (NULL != _obj[_n].bytes) { \
free(_obj[_n].bytes); \
} else if (PMIX_BYTE_OBJECT == (m)->data.darray->type) { \
pmix_byte_object_t *_obj = \
(pmix_byte_object_t*)(m)->data.darray->array; \
for (_n=0; _n < (m)->data.darray->size; _n++) { \
if (NULL != _obj[_n].bytes) { \
free(_obj[_n].bytes); \
} \
} \
} \
} \
if (NULL != (m)->data.darray->array) { \
free((m)->data.darray->array); \
} \
free((m)->data.darray); \
if (NULL != (m)->data.darray) { \
free((m)->data.darray); \
} \
/**** DEPRECATED ****/ \
} else if (PMIX_INFO_ARRAY == (m)->type) { \
pmix_info_t *_p = (pmix_info_t*)((m)->data.array->array); \
Expand Down
2 changes: 1 addition & 1 deletion opal/mca/pmix/pmix2x/pmix/src/buffer_ops/copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ PMIX_EXPORT pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
break;
}
/* allocate space and do the copy */
switch (src->type) {
switch (src->data.darray->type) {
case PMIX_UINT8:
case PMIX_INT8:
case PMIX_BYTE:
Expand Down
1 change: 1 addition & 0 deletions opal/mca/pmix/pmix2x/pmix/src/buffer_ops/unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ pmix_status_t pmix_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest,
return ret;
}
if (NULL == tmp) {
PMIX_ERROR_LOG(PMIX_ERROR);
return PMIX_ERROR;
}
(void)strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN);
Expand Down
66 changes: 45 additions & 21 deletions opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[],
PMIX_RELEASE(cb);

pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:client get completed");
"pmix:client get completed %d", rc);

return rc;
}
Expand Down Expand Up @@ -464,7 +464,7 @@ static pmix_status_t process_val(pmix_value_t *val,
}
nvals = 0;
for (n=0; n < nsize; n++) {
if (PMIX_SUCCESS != (rc = pmix_pointer_array_add(results, &info[n]))) {
if (0 > (rc = pmix_pointer_array_add(results, &info[n]))) {
return rc;
}
++nvals;
Expand Down Expand Up @@ -536,25 +536,45 @@ static void _getnbfn(int fd, short flags, void *cbdata)
/* if the rank is WILDCARD, then they want all the job-level info,
* so no need to check the modex */
if (PMIX_RANK_WILDCARD != cb->rank) {
rc = PMIX_ERR_NOT_FOUND;
#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
if (PMIX_SUCCESS == (rc = pmix_dstore_fetch(nptr->nspace, cb->rank, NULL, &val))) {
#else
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->modex, cb->rank, NULL, &val))) {
/* my own data is in the hash table, so don't bother looking
* in the dstore if that is what they want */
if (pmix_globals.myid.rank != cb->rank) {
if (PMIX_SUCCESS == (rc = pmix_dstore_fetch(nptr->nspace, cb->rank, NULL, &val))) {
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix_get[%d]: value retrieved from dstore", __LINE__);
if (PMIX_SUCCESS != (rc = process_val(val, &nvals, &results))) {
cb->value_cbfunc(rc, NULL, cb->cbdata);
/* cleanup */
if (NULL != val) {
PMIX_VALUE_RELEASE(val);
}
PMIX_RELEASE(cb);
return;
}
}
}
#endif /* PMIX_ENABLE_DSTORE */
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix_get[%d]: value retrieved from dstore", __LINE__);
if (PMIX_SUCCESS != (rc = process_val(val, &nvals, &results))) {
cb->value_cbfunc(rc, NULL, cb->cbdata);
/* cleanup */
if (NULL != val) {
PMIX_VALUE_RELEASE(val);
if (PMIX_SUCCESS != rc) {
/* if the user was asking about themselves, or we aren't using the dstore,
* then we need to check the hash table */
if (PMIX_SUCCESS == (rc = pmix_hash_fetch(&nptr->modex, cb->rank, NULL, &val))) {
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix_get[%d]: value retrieved from hash", __LINE__);
if (PMIX_SUCCESS != (rc = process_val(val, &nvals, &results))) {
cb->value_cbfunc(rc, NULL, cb->cbdata);
/* cleanup */
if (NULL != val) {
PMIX_VALUE_RELEASE(val);
}
PMIX_RELEASE(cb);
return;
}
PMIX_RELEASE(cb);
return;
PMIX_VALUE_RELEASE(val);
}
/* cleanup */
PMIX_VALUE_RELEASE(val);
} else {
}
if (PMIX_SUCCESS != rc) {
/* if we didn't find a modex for this rank, then we need
* to go get it. Thus, the caller wants -all- information for
* the specified rank, not just the job-level info. */
Expand All @@ -572,12 +592,17 @@ static void _getnbfn(int fd, short flags, void *cbdata)
PMIX_RELEASE(cb);
return;
}
/* cleanup */
PMIX_VALUE_RELEASE(val);
}
/* now let's package up the results */
PMIX_VALUE_CREATE(val, 1);
val->type = PMIX_DATA_ARRAY;
val->data.darray = (pmix_data_array_t*)malloc(sizeof(pmix_data_array_t));
if (NULL == val->data.darray) {
PMIX_VALUE_RELEASE(val);
cb->value_cbfunc(PMIX_ERR_NOMEM, NULL, cb->cbdata);
return;
}
val->data.darray->type = PMIX_INFO;
val->data.darray->size = nvals;
PMIX_INFO_CREATE(iptr, nvals);
Expand All @@ -597,14 +622,13 @@ static void _getnbfn(int fd, short flags, void *cbdata)
} else {
pmix_value_xfer(&iptr[n].value, &info->value);
}
PMIX_INFO_FREE(info, 1);
PMIX_INFO_DESTRUCT(info);
}
}
/* done with results array */
PMIX_DESTRUCT(&results);
/* return the result to the caller */
/* return the result to the caller - they are responsible for releasing it */
cb->value_cbfunc(PMIX_SUCCESS, val, cb->cbdata);
PMIX_VALUE_FREE(val, 1);
PMIX_RELEASE(cb);
return;
}
Expand Down
113 changes: 73 additions & 40 deletions opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,6 @@ static inline int _my_client(const char *nspace, pmix_rank_t rank);

static pmix_status_t initialize_server_base(pmix_server_module_t *module)
{
char *evar;

/* look for our namespace, if one was given */
if (NULL == (evar = getenv("PMIX_SERVER_NAMESPACE"))) {
/* use a fake namespace */
(void)strncpy(pmix_globals.myid.nspace, "pmix-server", PMIX_MAX_NSLEN);
} else {
(void)strncpy(pmix_globals.myid.nspace, evar, PMIX_MAX_NSLEN);
}
/* look for our rank, if one was given */
mypid = getpid();
if (NULL == (evar = getenv("PMIX_SERVER_RANK"))) {
/* use our pid */
pmix_globals.myid.rank = mypid;
} else {
pmix_globals.myid.rank = strtol(evar, NULL, 10);
}

/* setup the server-specific globals */
PMIX_CONSTRUCT(&pmix_server_globals.clients, pmix_pointer_array_t);
pmix_pointer_array_init(&pmix_server_globals.clients, 1, INT_MAX, 1);
Expand All @@ -131,7 +113,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
pmix_status_t rc;
size_t n, m;
pmix_kval_t kv;
bool protect;
bool protect, nspace_given = false, rank_given = false;
char *protected[] = {
PMIX_USERID,
PMIX_GRPID,
Expand All @@ -140,6 +122,8 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
PMIX_SERVER_SYSTEM_SUPPORT,
NULL
};
char *evar;
pmix_rank_info_t *rinfo;

PMIX_ACQUIRE_THREAD(&pmix_global_lock);

Expand All @@ -159,31 +143,22 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
return rc;
}

#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
if (PMIX_SUCCESS != (rc = pmix_dstore_init(info, ninfo))) {
PMIX_RELEASE_THREAD(&pmix_global_lock);
return rc;
}
#endif /* PMIX_ENABLE_DSTORE */

/* setup the wildcard recv for inbound messages from clients */
req = PMIX_NEW(pmix_ptl_posted_recv_t);
req->tag = UINT32_MAX;
req->cbfunc = server_message_handler;
/* add it to the end of the list of recvs */
pmix_list_append(&pmix_ptl_globals.posted_recvs, &req->super);

if (PMIX_SUCCESS != pmix_ptl_base_start_listening(info, ninfo)) {
pmix_show_help("help-pmix-server.txt", "listener-thread-start", true);
PMIX_RELEASE_THREAD(&pmix_global_lock);
return PMIX_ERR_INIT;
}

/* check the info keys for info we
* need to provide to every client */
* need to provide to every client and
* directives aimed at us */
if (NULL != info) {
PMIX_CONSTRUCT(&kv, pmix_kval_t);
for (n=0; n < ninfo; n++) {
if (0 == strncmp(info[n].key, PMIX_SERVER_NSPACE, PMIX_MAX_KEYLEN)) {
(void)strncpy(pmix_globals.myid.nspace, info[n].value.data.string, PMIX_MAX_NSLEN);
nspace_given = true;
continue;
}
if (0 == strncmp(info[n].key, PMIX_SERVER_RANK, PMIX_MAX_KEYLEN)) {
pmix_globals.myid.rank = info[n].value.data.rank;
rank_given = true;
continue;
}
/* check the list of protected keys */
protect = false;
for (m=0; NULL != protected[m]; m++) {
Expand Down Expand Up @@ -215,6 +190,64 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
PMIX_DESTRUCT(&kv);
}

if (!nspace_given) {
/* look for our namespace, if one was given */
if (NULL == (evar = getenv("PMIX_SERVER_NAMESPACE"))) {
/* use a fake namespace */
(void)strncpy(pmix_globals.myid.nspace, "pmix-server", PMIX_MAX_NSLEN);
} else {
(void)strncpy(pmix_globals.myid.nspace, evar, PMIX_MAX_NSLEN);
}
}
if (!rank_given) {
/* look for our rank, if one was given */
mypid = getpid();
if (NULL == (evar = getenv("PMIX_SERVER_RANK"))) {
/* use our pid */
pmix_globals.myid.rank = mypid;
} else {
pmix_globals.myid.rank = strtol(evar, NULL, 10);
}
}

/* copy it into mypeer entries */
if (NULL == pmix_globals.mypeer->info) {
rinfo = PMIX_NEW(pmix_rank_info_t);
pmix_globals.mypeer->info = rinfo;
} else {
rinfo = pmix_globals.mypeer->info;
}
if (NULL == rinfo->nptr) {
rinfo->nptr = PMIX_NEW(pmix_nspace_t);
/* ensure our own nspace is first on the list */
PMIX_RETAIN(rinfo->nptr);
rinfo->nptr->server = PMIX_NEW(pmix_server_nspace_t);
pmix_list_prepend(&pmix_globals.nspaces, &rinfo->nptr->super);
}
(void)strncpy(rinfo->nptr->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN);
rinfo->rank = pmix_globals.myid.rank;


#if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1)
if (PMIX_SUCCESS != (rc = pmix_dstore_init(info, ninfo))) {
PMIX_RELEASE_THREAD(&pmix_global_lock);
return rc;
}
#endif /* PMIX_ENABLE_DSTORE */

/* setup the wildcard recv for inbound messages from clients */
req = PMIX_NEW(pmix_ptl_posted_recv_t);
req->tag = UINT32_MAX;
req->cbfunc = server_message_handler;
/* add it to the end of the list of recvs */
pmix_list_append(&pmix_ptl_globals.posted_recvs, &req->super);

if (PMIX_SUCCESS != pmix_ptl_base_start_listening(info, ninfo)) {
pmix_show_help("help-pmix-server.txt", "listener-thread-start", true);
PMIX_RELEASE_THREAD(&pmix_global_lock);
return PMIX_ERR_INIT;
}

/* get our available security modules */
security_mode = pmix_psec.get_available_modules();

Expand Down
Loading