From 3f536cb1ac63f445ab28ff3df348f9486303affc Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Sun, 18 Feb 2018 16:22:16 -0800 Subject: [PATCH] Sync to PMIx v2.1.1 Pickup several bug fixes since v2.1.0 Signed-off-by: Ralph Castain --- opal/mca/pmix/pmix2x/pmix/NEWS | 12 ++ opal/mca/pmix/pmix2x/pmix/VERSION | 8 +- .../pmix/config/pmix_check_attributes.m4 | 25 ++++- opal/mca/pmix/pmix2x/pmix/contrib/pmix.spec | 2 +- .../pmix/pmix2x/pmix/contrib/pmix_jenkins.sh | 1 - .../pmix/pmix2x/pmix/include/pmix_common.h.in | 22 ++++ .../pmix2x/pmix/src/client/pmix_client_pub.c | 14 +-- .../pmix2x/pmix/src/include/pmix_globals.h | 2 + .../src/mca/base/pmix_mca_base_var_group.c | 4 +- .../pmix2x/pmix/src/mca/gds/ds12/gds_dstore.c | 27 ++--- .../pmix/src/mca/preg/native/preg_native.c | 2 +- .../pmix/src/mca/ptl/base/ptl_base_sendrecv.c | 7 +- .../pmix/pmix2x/pmix/src/server/pmix_server.c | 29 +++-- .../pmix2x/pmix/src/server/pmix_server_get.c | 83 ++++++++++---- .../mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c | 12 ++ opal/mca/pmix/pmix2x/pmix/test/cli_stages.c | 3 +- opal/mca/pmix/pmix2x/pmix/test/cli_stages.h | 4 +- .../pmix/pmix2x/pmix/test/simple/test_pmix.c | 105 ++++++++---------- 18 files changed, 231 insertions(+), 131 deletions(-) diff --git a/opal/mca/pmix/pmix2x/pmix/NEWS b/opal/mca/pmix/pmix2x/pmix/NEWS index 70392cf787b..c37bc6edc18 100644 --- a/opal/mca/pmix/pmix2x/pmix/NEWS +++ b/opal/mca/pmix/pmix2x/pmix/NEWS @@ -21,6 +21,18 @@ example, a bug might be fixed in the master, and then moved to the current release as well as the "stable" bug fix release branch. +2.1.1 -- 23 Feb 2018 +---------------------- +- Fix direct modex when receiving new nspace +- Resolve direct modex of job-level info +- Fix a bug in attribute configuration checks +- Fix a couple of bugs in unpacking of direct modex job-level data +- Correcly handle application setup data during "instant on" launch +- add a PMIX_BYTE_OBJECT_LOAD convenience macro +- Fix two early "free" bugs +- Add an example PMI-1 client program + + 2.1.0 -- 1 Feb 2018 ---------------------- **** NOTE: This release contains the first implementation of cross-version diff --git a/opal/mca/pmix/pmix2x/pmix/VERSION b/opal/mca/pmix/pmix2x/pmix/VERSION index 0d2520e2ec9..81bcaca719b 100644 --- a/opal/mca/pmix/pmix2x/pmix/VERSION +++ b/opal/mca/pmix/pmix2x/pmix/VERSION @@ -15,7 +15,7 @@ major=2 minor=1 -release=0 +release=1 # greek is used for alpha or beta release tags. If it is non-empty, # it will be appended to the version number. It does not have to be @@ -30,7 +30,7 @@ greek= # command, or with the date (if "git describe" fails) in the form of # "date". -repo_rev=git79b2db3 +repo_rev=git30cbf9f # If tarball_version is not empty, it is used as the version string in # the tarball filename, regardless of all other versions listed in @@ -44,7 +44,7 @@ tarball_version= # The date when this release was created -date="Feb 01, 2018" +date="Feb 18, 2018" # The shared library version of each of PMIx's public libraries. # These versions are maintained in accordance with the "Library @@ -75,6 +75,6 @@ date="Feb 01, 2018" # Version numbers are described in the Libtool current:revision:age # format. -libpmix_so_version=3:10:1 +libpmix_so_version=3:11:1 libpmi_so_version=1:0:0 libpmi2_so_version=1:0:0 diff --git a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_attributes.m4 b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_attributes.m4 index bbafcc2b8b5..b5005b72c08 100644 --- a/opal/mca/pmix/pmix2x/pmix/config/pmix_check_attributes.m4 +++ b/opal/mca/pmix/pmix2x/pmix/config/pmix_check_attributes.m4 @@ -1,6 +1,6 @@ # -*- shell-script -*- # PMIx copyrights: -# Copyright (c) 2013 Intel, Inc. All rights reserved +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. # ######################### # @@ -15,7 +15,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. -# Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. # Copyright (c) 2015 Intel, Inc. All rights reserved. @@ -170,6 +170,8 @@ AC_DEFUN([PMIX_CHECK_ATTRIBUTES], [ pmix_cv___attribute__visibility=0 pmix_cv___attribute__warn_unused_result=0 pmix_cv___attribute__destructor=0 + pmix_cv___attribute__optnone=0 + pmix_cv___attribute__extension=0 else AC_MSG_RESULT([yes]) @@ -486,6 +488,21 @@ AC_DEFUN([PMIX_CHECK_ATTRIBUTES], [ ], [], []) + + _PMIX_CHECK_SPECIFIC_ATTRIBUTE([optnone], + [ + void __attribute__ ((__optnone__)) foo(void); + void foo(void) { return ; } + ], + [], + []) + + _PMIX_CHECK_SPECIFIC_ATTRIBUTE([extension], + [ + int i = __extension__ 3; + ], + [], + []) fi # Now that all the values are set, define them @@ -536,4 +553,8 @@ AC_DEFUN([PMIX_CHECK_ATTRIBUTES], [ [Whether your compiler has __attribute__ weak alias or not]) AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_DESTRUCTOR, [$pmix_cv___attribute__destructor], [Whether your compiler has __attribute__ destructor or not]) + AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_OPTNONE, [$pmix_cv___attribute__optnone], + [Whether your compiler has __attribute__ optnone or not]) + AC_DEFINE_UNQUOTED(PMIX_HAVE_ATTRIBUTE_EXTENSION, [$pmix_cv___attribute__extension], + [Whether your compiler has __attribute__ extension or not]) ]) diff --git a/opal/mca/pmix/pmix2x/pmix/contrib/pmix.spec b/opal/mca/pmix/pmix2x/pmix/contrib/pmix.spec index 2eda32a62e3..16d12b94999 100644 --- a/opal/mca/pmix/pmix2x/pmix/contrib/pmix.spec +++ b/opal/mca/pmix/pmix2x/pmix/contrib/pmix.spec @@ -192,7 +192,7 @@ Summary: An extended/exascale implementation of PMI Name: %{?_name:%{_name}}%{!?_name:pmix} -Version: 2.1.0 +Version: 2.1.1 Release: 1%{?dist} License: BSD Group: Development/Libraries diff --git a/opal/mca/pmix/pmix2x/pmix/contrib/pmix_jenkins.sh b/opal/mca/pmix/pmix2x/pmix/contrib/pmix_jenkins.sh index 870b22dac40..d8445463a0c 100755 --- a/opal/mca/pmix/pmix2x/pmix/contrib/pmix_jenkins.sh +++ b/opal/mca/pmix/pmix2x/pmix/contrib/pmix_jenkins.sh @@ -395,4 +395,3 @@ if [ -n "$JENKINS_RUN_TESTS" -a "$JENKINS_RUN_TESTS" -ne "0" ]; then set -e fi fi - diff --git a/opal/mca/pmix/pmix2x/pmix/include/pmix_common.h.in b/opal/mca/pmix/pmix2x/pmix/include/pmix_common.h.in index 77aa987370a..836ed243858 100644 --- a/opal/mca/pmix/pmix2x/pmix/include/pmix_common.h.in +++ b/opal/mca/pmix/pmix2x/pmix/include/pmix_common.h.in @@ -755,6 +755,20 @@ typedef struct pmix_byte_object { char *bytes; size_t size; } pmix_byte_object_t; +#define PMIX_BYTE_OBJECT_CREATE(m, n) \ + do { \ + (m) = (pmix_byte_object_t*)malloc((n) * sizeof(pmix_byte_object_t)); \ + if (NULL != (m)) { \ + memset((m), 0, (n)*sizeof(pmix_byte_object_t)); \ + } \ + } while(0) + +#define PMIX_BYTE_OBJECT_CONSTRUCT(m) \ + do { \ + (m)->bytes = NULL; \ + (m)->size = 0; \ + } while(0) + #define PMIX_BYTE_OBJECT_DESTRUCT(m) \ do { \ if (NULL != (m)->bytes) { \ @@ -773,6 +787,14 @@ typedef struct pmix_byte_object { free((m)); \ } while(0) +#define PMIX_BYTE_OBJECT_LOAD(b, d, s) \ + do { \ + (b)->bytes = (d); \ + (d) = NULL; \ + (b)->size = (s); \ + (s) = 0; \ + } while(0) + /**** PMIX DATA BUFFER ****/ typedef struct pmix_data_buffer { diff --git a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_pub.c b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_pub.c index 3f252865417..cee3dcaf940 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_pub.c +++ b/opal/mca/pmix/pmix2x/pmix/src/client/pmix_client_pub.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -564,8 +564,8 @@ static void wait_lookup_cbfunc(struct pmix_peer_t *pr, pmix_cb_t *cb = (pmix_cb_t*)cbdata; pmix_status_t rc, ret; int32_t cnt; - pmix_pdata_t *pdata = NULL; - size_t ndata = 0; + pmix_pdata_t *pdata; + size_t ndata; PMIX_ACQUIRE_OBJECT(cb); @@ -573,6 +573,10 @@ static void wait_lookup_cbfunc(struct pmix_peer_t *pr, "pmix:client recv callback activated with %d bytes", (NULL == buf) ? -1 : (int)buf->bytes_used); + /* set the defaults */ + pdata = NULL; + ndata = 0; + if (NULL == cb->cbfunc.lookupfn) { /* nothing we can do with this */ PMIX_RELEASE(cb); @@ -589,10 +593,6 @@ static void wait_lookup_cbfunc(struct pmix_peer_t *pr, goto report; } - /* set the defaults */ - pdata = NULL; - ndata = 0; - /* unpack the returned status */ cnt = 1; PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver, diff --git a/opal/mca/pmix/pmix2x/pmix/src/include/pmix_globals.h b/opal/mca/pmix/pmix2x/pmix/src/include/pmix_globals.h index 2541b7d3de6..a1d4802b724 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/include/pmix_globals.h +++ b/opal/mca/pmix/pmix2x/pmix/src/include/pmix_globals.h @@ -52,6 +52,8 @@ BEGIN_C_DECLS /* internal-only attributes */ #define PMIX_BFROPS_MODULE "pmix.bfrops.mod" // (char*) name of bfrops plugin in-use by a given nspace +#define PMIX_PNET_SETUP_APP "pmix.pnet.setapp" // (pmix_byte_object_t) blob containing info to be given to + // pnet framework on remote nodes /* define an internal-only process name that has * a dynamically-sized nspace field to save memory */ diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_var_group.c b/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_var_group.c index 8cef65e83c4..642c7dba455 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_var_group.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/base/pmix_mca_base_var_group.c @@ -13,7 +13,7 @@ * Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -315,7 +315,7 @@ int pmix_mca_base_var_group_component_register (const pmix_mca_base_component_t const char *description) { /* 1.7 components do not store the project */ - return group_register (NULL, component->pmix_mca_type_name, + return group_register (component->pmix_mca_project_name, component->pmix_mca_type_name, component->pmix_mca_component_name, description); } diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/gds/ds12/gds_dstore.c b/opal/mca/pmix/pmix2x/pmix/src/mca/gds/ds12/gds_dstore.c index 4e3ba090f04..e736ecca444 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/gds/ds12/gds_dstore.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/gds/ds12/gds_dstore.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2016-2017 Mellanox Technologies, Inc. * All rights reserved. @@ -2995,44 +2995,35 @@ static pmix_status_t dstore_store_modex(struct pmix_nspace_t *nspace, pmix_byte_object_t *bo) { pmix_nspace_t *ns = (pmix_nspace_t*)nspace; - pmix_server_caddy_t *scd; pmix_status_t rc = PMIX_SUCCESS; int32_t cnt; pmix_buffer_t pbkt; pmix_proc_t proc; pmix_kval_t *kv; - pmix_peer_t *peer; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%d] gds:dstore:store_modex for nspace %s", pmix_globals.myid.nspace, pmix_globals.myid.rank, ns->nspace); + /* NOTE: THE BYTE OBJECT DELIVERED HERE WAS CONSTRUCTED + * BY A SERVER, AND IS THEREFORE PACKED USING THE SERVER'S + * PEER OBJECT (WHICH IS REQUIRED TO BE THE SAME AS OUR OWN) */ + /* this is data returned via the PMIx_Fence call when * data collection was requested, so it only contains * REMOTE/GLOBAL data. The byte object contains * the rank followed by pmix_kval_t's. The list of callbacks * contains all local participants. */ - peer = NULL; - PMIX_LIST_FOREACH(scd, cbs, pmix_server_caddy_t) { - if (scd->peer->nptr == ns) { - peer = scd->peer; - break; - } - } - if (NULL == peer) { - /* we can ignore this one */ - return PMIX_SUCCESS; - } /* setup the byte object for unpacking */ PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); /* the next step unfortunately NULLs the byte object's * entries, so we need to ensure we restore them! */ - PMIX_LOAD_BUFFER(peer, &pbkt, bo->bytes, bo->size); + PMIX_LOAD_BUFFER(pmix_globals.mypeer, &pbkt, bo->bytes, bo->size); /* unload the proc that provided this data */ cnt = 1; - PMIX_BFROPS_UNPACK(rc, peer, &pbkt, &proc, &cnt, PMIX_PROC); + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &pbkt, &proc, &cnt, PMIX_PROC); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); bo->bytes = pbkt.base_ptr; @@ -3052,7 +3043,7 @@ static pmix_status_t dstore_store_modex(struct pmix_nspace_t *nspace, /* unpack the remaining values until we hit the end of the buffer */ cnt = 1; kv = PMIX_NEW(pmix_kval_t); - PMIX_BFROPS_UNPACK(rc, peer, &pbkt, kv, &cnt, PMIX_KVAL); + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &pbkt, kv, &cnt, PMIX_KVAL); while (PMIX_SUCCESS == rc) { /* store this in the hash table */ PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, &proc, PMIX_REMOTE, kv); @@ -3071,7 +3062,7 @@ static pmix_status_t dstore_store_modex(struct pmix_nspace_t *nspace, /* continue along */ kv = PMIX_NEW(pmix_kval_t); cnt = 1; - PMIX_BFROPS_UNPACK(rc, peer, &pbkt, kv, &cnt, PMIX_KVAL); + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &pbkt, kv, &cnt, PMIX_KVAL); } PMIX_RELEASE(kv); // maintain accounting if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) { diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/preg/native/preg_native.c b/opal/mca/pmix/pmix2x/pmix/src/mca/preg/native/preg_native.c index cc11453f5d8..5535296b3d0 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/preg/native/preg_native.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/preg/native/preg_native.c @@ -699,7 +699,7 @@ static pmix_status_t resolve_nodes(const char *nspace, pmix_proc_t proc; cb = PMIX_NEW(pmix_cb_t); - cb->pname.nspace = (char*)nspace; + cb->pname.nspace = strdup(nspace); PMIX_THREADSHIFT(cb, _resolve_nodes); diff --git a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c index c953a4651ff..57cc89d9fb6 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c +++ b/opal/mca/pmix/pmix2x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c @@ -122,8 +122,7 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) } /* reduce the number of local procs */ --peer->nptr->nlocalprocs; - /* now decrease the refcount - might actually free the object */ - PMIX_RELEASE(peer->info); + /* remove this client from our array */ pmix_pointer_array_set_item(&pmix_server_globals.clients, peer->index, NULL); @@ -148,6 +147,10 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) * an event. If not, then we do */ PMIX_REPORT_EVENT(err, peer, PMIX_RANGE_NAMESPACE, _notify_complete); } + /* now decrease the refcount - might actually free the object */ + PMIX_RELEASE(peer->info); + + /* Release peer info */ PMIX_RELEASE(peer); } else { /* if I am a client, there is only diff --git a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c index d8eb359109e..90a58ce9d18 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c +++ b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server.c @@ -1256,11 +1256,12 @@ static void _setup_op(pmix_status_t rc, void *cbdata) static void _setup_app(int sd, short args, void *cbdata) { pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; + pmix_buffer_t buffer; + pmix_byte_object_t blob; pmix_setup_caddy_t *fcd = NULL; pmix_status_t rc; pmix_list_t ilist; pmix_kval_t *kv; - size_t n; PMIX_ACQUIRE_OBJECT(cd); @@ -1279,21 +1280,31 @@ static void _setup_app(int sd, short args, void *cbdata) goto depart; } - /* if anything came back, construct the info array */ - if (0 < (fcd->ninfo = pmix_list_get_size(&ilist))) { - PMIX_INFO_CREATE(fcd->info, fcd->ninfo); - n = 0; + /* if anything came back, construct the blob */ + if (0 < pmix_list_get_size(&ilist)) { + PMIX_CONSTRUCT(&buffer, pmix_buffer_t); PMIX_LIST_FOREACH(kv, &ilist, pmix_kval_t) { - (void)strncpy(fcd->info[n].key, kv->key, PMIX_MAX_KEYLEN); - PMIX_BFROPS_VALUE_XFER(rc, pmix_globals.mypeer, - &fcd->info[n].value, kv->value); + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buffer, kv, 1, PMIX_KVAL); if (PMIX_SUCCESS != rc) { - PMIX_INFO_FREE(fcd->info, fcd->ninfo); + PMIX_DESTRUCT(&blob); PMIX_RELEASE(fcd); fcd = NULL; goto depart; } } + PMIX_INFO_CREATE(fcd->info, 1); + if (NULL == fcd->info) { + PMIX_DESTRUCT(&blob); + PMIX_RELEASE(fcd); + fcd = NULL; + goto depart; + } + fcd->ninfo = 1; + PMIX_BYTE_OBJECT_CONSTRUCT(&blob); + PMIX_BYTE_OBJECT_LOAD(&blob, buffer.base_ptr, buffer.bytes_used); + PMIX_DESTRUCT(&buffer); + PMIX_INFO_LOAD(&fcd->info[0], PMIX_PNET_SETUP_APP, &blob, PMIX_BYTE_OBJECT); + PMIX_BYTE_OBJECT_DESTRUCT(&blob); } depart: diff --git a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c index dfe741d3dfd..a84c3f0c5df 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c +++ b/opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_get.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Artem Y. Polyakov . @@ -761,6 +761,7 @@ static void _process_dmdx_reply(int fd, short args, void *cbdata) pmix_dmdx_request_t *dm; bool found; pmix_buffer_t pbkt; + pmix_cb_t cb; PMIX_ACQUIRE_OBJECT(caddy); @@ -783,7 +784,7 @@ static void _process_dmdx_reply(int fd, short args, void *cbdata) * processes from it running on this host - so just record it * so we know we have the data for any future requests */ nptr = PMIX_NEW(pmix_nspace_t); - (void)strncpy(nptr->nspace, caddy->lcd->proc.nspace, PMIX_MAX_NSLEN); + nptr->nspace = strdup(caddy->lcd->proc.nspace); /* add to the list */ pmix_list_append(&pmix_server_globals.nspaces, &nptr->super); } @@ -794,7 +795,12 @@ static void _process_dmdx_reply(int fd, short args, void *cbdata) * store the data first so we can immediately satisfy any future * requests. Then, rather than duplicate the resolve code here, we * will let the pmix_pending_resolve function go ahead and retrieve - * it from the GDS */ + * it from the GDS + * + * NOTE: if the data returned is NULL, then it has already been + * stored (e.g., via a register_nspace call in response to a request + * for job-level data). For now, we will retrieve it so it can + * be stored for each peer */ if (PMIX_SUCCESS == caddy->status) { /* cycle across all outstanding local requests and collect their * unique nspaces so we can store this for each one */ @@ -829,31 +835,66 @@ static void _process_dmdx_reply(int fd, short args, void *cbdata) peer = (pmix_peer_t*)pmix_pointer_array_get_item(&pmix_server_globals.clients, rinfo->peerid); } PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); - - PMIX_LOAD_BUFFER(pmix_globals.mypeer, &pbkt, caddy->data, caddy->ndata); - /* unpack and store it*/ - kv = PMIX_NEW(pmix_kval_t); - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &pbkt, kv, &cnt, PMIX_KVAL); - while (PMIX_SUCCESS == rc) { - PMIX_GDS_STORE_KV(rc, peer, &caddy->lcd->proc, PMIX_REMOTE, kv); + if (NULL == caddy->data) { + /* we assume that the data was provided via a call to + * register_nspace, so what we need to do now is simply + * transfer it across to the individual nspace storage + * components */ + PMIX_CONSTRUCT(&cb, pmix_cb_t); + PMIX_PROC_CREATE(cb.proc, 1); + if (NULL == cb.proc) { + PMIX_ERROR_LOG(PMIX_ERR_NOMEM); + PMIX_DESTRUCT(&cb); + goto complete; + } + (void)strncpy(cb.proc->nspace, nm->ns->nspace, PMIX_MAX_NSLEN); + cb.proc->rank = PMIX_RANK_WILDCARD; + cb.scope = PMIX_INTERNAL; + cb.copy = false; + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - caddy->status = rc; + PMIX_DESTRUCT(&cb); goto complete; } - PMIX_RELEASE(kv); + PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) { + PMIX_GDS_STORE_KV(rc, peer, &caddy->lcd->proc, PMIX_INTERNAL, kv); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + break; + } + } + PMIX_DESTRUCT(&cb); + } else { + PMIX_LOAD_BUFFER(pmix_globals.mypeer, &pbkt, caddy->data, caddy->ndata); + /* unpack and store it*/ kv = PMIX_NEW(pmix_kval_t); cnt = 1; PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &pbkt, kv, &cnt, PMIX_KVAL); - } - PMIX_RELEASE(kv); - pbkt.base_ptr = NULL; // protect the data - PMIX_DESTRUCT(&pbkt); - if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) { - PMIX_ERROR_LOG(rc); - caddy->status = rc; - goto complete; + while (PMIX_SUCCESS == rc) { + if (caddy->lcd->proc.rank == PMIX_RANK_WILDCARD) { + PMIX_GDS_STORE_KV(rc, peer, &caddy->lcd->proc, PMIX_INTERNAL, kv); + } else { + PMIX_GDS_STORE_KV(rc, peer, &caddy->lcd->proc, PMIX_REMOTE, kv); + } + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + caddy->status = rc; + goto complete; + } + PMIX_RELEASE(kv); + kv = PMIX_NEW(pmix_kval_t); + cnt = 1; + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &pbkt, kv, &cnt, PMIX_KVAL); + } + PMIX_RELEASE(kv); + pbkt.base_ptr = NULL; // protect the data + PMIX_DESTRUCT(&pbkt); + if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) { + PMIX_ERROR_LOG(rc); + caddy->status = rc; + goto complete; + } } } PMIX_LIST_DESTRUCT(&nspaces); diff --git a/opal/mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c b/opal/mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c index 31b1981871f..8288e6ae423 100644 --- a/opal/mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c +++ b/opal/mca/pmix/pmix2x/pmix/src/tool/pmix_tool.c @@ -328,6 +328,18 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, /* Success, so copy the nspace and rank */ (void)strncpy(proc->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); proc->rank = pmix_globals.myid.rank; + /* and into our own peer object */ + if (NULL == pmix_globals.mypeer->nptr->nspace) { + pmix_globals.mypeer->nptr->nspace = strdup(proc->nspace); + } + /* setup a rank_info object for us */ + pmix_globals.mypeer->info = PMIX_NEW(pmix_rank_info_t); + if (NULL == pmix_globals.mypeer->info) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_ERR_NOMEM; + } + pmix_globals.mypeer->info->pname.nspace = strdup(proc->nspace); + pmix_globals.mypeer->info->pname.rank = proc->rank; /* increment our init reference counter */ pmix_globals.init_cntr++; diff --git a/opal/mca/pmix/pmix2x/pmix/test/cli_stages.c b/opal/mca/pmix/pmix2x/pmix/test/cli_stages.c index c69aecbf3ec..04049ad9cc3 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/cli_stages.c +++ b/opal/mca/pmix/pmix2x/pmix/test/cli_stages.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -274,4 +274,3 @@ void errhandler_reg_callbk (pmix_status_t status, TEST_VERBOSE(("ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%lu", status, (unsigned long)errhandler_ref)); } - diff --git a/opal/mca/pmix/pmix2x/pmix/test/cli_stages.h b/opal/mca/pmix/pmix2x/pmix/test/cli_stages.h index 484b09c8bec..343af2de043 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/cli_stages.h +++ b/opal/mca/pmix/pmix2x/pmix/test/cli_stages.h @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -75,5 +75,3 @@ void op_callbk(pmix_status_t status, void errhandler_reg_callbk (pmix_status_t status, size_t errhandler_ref, void *cbdata); - - diff --git a/opal/mca/pmix/pmix2x/pmix/test/simple/test_pmix.c b/opal/mca/pmix/pmix2x/pmix/test/simple/test_pmix.c index 8ecf6c1f6b6..de1d1fc5cf8 100644 --- a/opal/mca/pmix/pmix2x/pmix/test/simple/test_pmix.c +++ b/opal/mca/pmix/pmix2x/pmix/test/simple/test_pmix.c @@ -5,63 +5,52 @@ int main(int argc, char **argv) { - pmix_proc_t myproc; - pmix_status_t rc; - - int rank; - rc = PMIx_Init(&myproc, NULL, 0); - assert(PMIX_SUCCESS == rc); - - { - pmix_value_t *value; - rc = PMIx_Get(&myproc, PMIX_RANK, NULL, 0, &value); - assert(PMIX_SUCCESS == rc); - printf("%d\n", value->type); - assert(value->type == PMIX_INT); - rank = value->data.uint32; - PMIX_VALUE_RELEASE(value); - } - - if (rank == 0 ) { - pmix_info_t *info; - PMIX_INFO_CREATE(info, 1); - snprintf(info[0].key, PMIX_MAX_KEYLEN, "magic-found"); - info[0].value.type = PMIX_STRING; - info[0].value.data.string = "yes"; - rc = PMIx_Publish(info, 1); - assert(PMIX_SUCCESS == rc); - } - - printf("I am rank %d\n", rank); - - { - bool flag; - pmix_info_t *info; - PMIX_INFO_CREATE(info, 1); - flag = true; - PMIX_INFO_LOAD(info, PMIX_COLLECT_DATA, &flag, PMIX_BOOL); - rc = PMIx_Fence(&myproc, 1, info, 1); - assert(PMIX_SUCCESS == rc); - PMIX_INFO_FREE(info, 1); - } - - if (rank == 1) { - int i; - pmix_pdata_t *pdata; - PMIX_PDATA_CREATE(pdata, 2); - snprintf(pdata[0].key, PMIX_MAX_KEYLEN, "magic-found"); - snprintf(pdata[1].key, PMIX_MAX_KEYLEN, "magic-not-found"); - rc = PMIx_Lookup(&pdata[0], 2, NULL, 0); - assert((PMIX_SUCCESS == rc) || (PMIX_ERR_NOT_FOUND == rc)); - for ( i = 0 ; i < 2 ; i++ ) - if (pdata[i].value.type == PMIX_STRING) - printf("Found[%d] %d %s\n", i, pdata[i].value.type, pdata[i].value.data.string); - else - printf("Found[%d] %d\n", i, pdata[i].value.type); - PMIX_PDATA_FREE(pdata, 1); - } - - rc = PMIx_Finalize(NULL, 0); - assert(PMIX_SUCCESS == rc); + pmix_proc_t myproc; + pmix_status_t rc; + + rc = PMIx_Init(&myproc, NULL, 0); + assert(PMIX_SUCCESS == rc); + + if (myproc.rank == 0 ) { + pmix_info_t *info; + PMIX_INFO_CREATE(info, 1); + snprintf(info[0].key, PMIX_MAX_KEYLEN, "magic-found"); + info[0].value.type = PMIX_STRING; + info[0].value.data.string = "yes"; + rc = PMIx_Publish(info, 1); + assert(PMIX_SUCCESS == rc); + } + + printf("I am rank %d\n", myproc.rank); + + { + bool flag; + pmix_info_t *info; + PMIX_INFO_CREATE(info, 1); + flag = true; + PMIX_INFO_LOAD(info, PMIX_COLLECT_DATA, &flag, PMIX_BOOL); + rc = PMIx_Fence(&myproc, 1, info, 1); + assert(PMIX_SUCCESS == rc); + PMIX_INFO_FREE(info, 1); + } + + if (myproc.rank == 1) { + int i; + pmix_pdata_t *pdata; + PMIX_PDATA_CREATE(pdata, 2); + snprintf(pdata[0].key, PMIX_MAX_KEYLEN, "magic-found"); + snprintf(pdata[1].key, PMIX_MAX_KEYLEN, "magic-not-found"); + rc = PMIx_Lookup(&pdata[0], 2, NULL, 0); + assert((PMIX_SUCCESS == rc) || (PMIX_ERR_NOT_FOUND == rc)); + for ( i = 0 ; i < 2 ; i++ ) + if (pdata[i].value.type == PMIX_STRING) + printf("Found[%d] %d %s\n", i, pdata[i].value.type, pdata[i].value.data.string); + else + printf("Found[%d] %d\n", i, pdata[i].value.type); + PMIX_PDATA_FREE(pdata, 1); + } + + rc = PMIx_Finalize(NULL, 0); + assert(PMIX_SUCCESS == rc); }