diff --git a/opal/mca/pmix/pmix3x/pmix/VERSION b/opal/mca/pmix/pmix3x/pmix/VERSION index c1c4f43914..055bc93b6f 100644 --- a/opal/mca/pmix/pmix3x/pmix/VERSION +++ b/opal/mca/pmix/pmix3x/pmix/VERSION @@ -30,7 +30,7 @@ greek= # command, or with the date (if "git describe" fails) in the form of # "date". -repo_rev=git1a2327c +repo_rev=gitdb5d380 # 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="Jan 12, 2018" +date="Jan 25, 2018" # The shared library version of each of PMIx's public libraries. # These versions are maintained in accordance with the "Library diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/pmix-valgrind.supp b/opal/mca/pmix/pmix3x/pmix/contrib/pmix-valgrind.supp index ba8a28d5c6..5c2fb6ef6e 100644 --- a/opal/mca/pmix/pmix3x/pmix/contrib/pmix-valgrind.supp +++ b/opal/mca/pmix/pmix3x/pmix/contrib/pmix-valgrind.supp @@ -1,6 +1,6 @@ # -*- text -*- # -# Copyright (c) 2015 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c index a5930d7280..7c3d08acfc 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c @@ -262,7 +262,6 @@ static void notification_fn(size_t evhdlr_registration_id, { pmix_lock_t *reglock = (pmix_lock_t*)cbdata; -pmix_output(0, "RELEASE RECVD"); if (NULL != cbfunc) { cbfunc(PMIX_EVENT_ACTION_COMPLETE, NULL, 0, NULL, NULL, cbdata); } @@ -632,7 +631,6 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, PMIX_POST_OBJECT(®lock); PMIx_Register_event_handler(&code, 1, NULL, 0, notification_fn, NULL, (void*)®lock); - pmix_output(0, "WAITING FOR RELEASE"); /* wait for it to arrive */ PMIX_WAIT_THREAD(®lock); PMIX_DESTRUCT_LOCK(®lock); diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_pub.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_pub.c index 3f25286541..cee3dcaf94 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_pub.c +++ b/opal/mca/pmix/pmix3x/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/pmix3x/pmix/src/common/pmix_data.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_data.c index 69263a556b..a377fadcdf 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_data.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_data.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007-2012 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -37,18 +37,19 @@ #include "src/mca/bfrops/bfrops.h" #include "src/include/pmix_globals.h" -#define PMIX_EMBED_DATA_BUFFER(b, db) \ - do { \ - (b)->base_ptr = (db)->base_ptr; \ - (b)->pack_ptr = (db)->pack_ptr; \ - (b)->unpack_ptr = (db)->unpack_ptr; \ - (b)->bytes_allocated = (db)->bytes_allocated; \ - (b)->bytes_used = (db)->bytes_used; \ - (db)->base_ptr = NULL; \ - (db)->pack_ptr = NULL; \ - (db)->unpack_ptr = NULL; \ - (db)->bytes_allocated = 0; \ - (db)->bytes_used = 0; \ +#define PMIX_EMBED_DATA_BUFFER(b, db) \ + do { \ + (b)->type = pmix_globals.mypeer->nptr->compat.type; \ + (b)->base_ptr = (db)->base_ptr; \ + (b)->pack_ptr = (db)->pack_ptr; \ + (b)->unpack_ptr = (db)->unpack_ptr; \ + (b)->bytes_allocated = (db)->bytes_allocated; \ + (b)->bytes_used = (db)->bytes_used; \ + (db)->base_ptr = NULL; \ + (db)->pack_ptr = NULL; \ + (db)->unpack_ptr = NULL; \ + (db)->bytes_allocated = 0; \ + (db)->bytes_used = 0; \ } while (0) #define PMIX_EXTRACT_DATA_BUFFER(b, db) \ diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.c new file mode 100644 index 0000000000..d284978dec --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.c @@ -0,0 +1,175 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2016 IBM Corporation. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include "src/threads/threads.h" +#include "src/util/argv.h" +#include "src/util/error.h" +#include "src/util/output.h" +#include "src/mca/bfrops/bfrops.h" +#include "src/mca/ptl/ptl.h" + +#include "src/client/pmix_client_ops.h" +#include "src/server/pmix_server_ops.h" +#include "src/include/pmix_globals.h" + +static void msgcbfunc(struct pmix_peer_t *peer, + pmix_ptl_hdr_t *hdr, + pmix_buffer_t *buf, void *cbdata) +{ + pmix_shift_caddy_t *cd = (pmix_shift_caddy_t*)cbdata; + int32_t m; + pmix_status_t rc, status; + + /* unpack the return status */ + m=1; + PMIX_BFROPS_UNPACK(rc, peer, buf, &status, &m, PMIX_STATUS); + if (PMIX_SUCCESS == rc && PMIX_SUCCESS == status) { + /* store the request on our list - we are in an event, and + * so this is safe */ + pmix_list_append(&pmix_globals.iof_requests, &cd->iofreq->super); + } else if (PMIX_SUCCESS != rc) { + status = rc; + PMIX_RELEASE(cd->iofreq); + } + + pmix_output_verbose(2, pmix_client_globals.iof_output, + "pmix:iof_register returned status %s", PMIx_Error_string(status)); + + if (NULL != cd->cbfunc.opcbfn) { + cd->cbfunc.opcbfn(status, cd->cbdata); + } + PMIX_RELEASE(cd); +} + +PMIX_EXPORT pmix_status_t PMIx_IOF_register(const pmix_proc_t procs[], size_t nprocs, + const pmix_info_t directives[], size_t ndirs, + pmix_iof_channel_t channel, pmix_iof_cbfunc_t cbfunc, + pmix_hdlr_reg_cbfunc_t regcbfunc, void *regcbdata) +{ + pmix_shift_caddy_t *cd; + pmix_cmd_t cmd = PMIX_IOF_CMD; + pmix_buffer_t *msg; + pmix_status_t rc; + + PMIX_ACQUIRE_THREAD(&pmix_global_lock); + + pmix_output_verbose(2, pmix_client_globals.iof_output, + "pmix:iof_register"); + + if (pmix_globals.init_cntr <= 0) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_ERR_INIT; + } + + /* if we are a server, we cannot do this */ + if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_ERR_NOT_SUPPORTED; + } + + /* if we aren't connected, don't attempt to send */ + if (!pmix_globals.connected) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_ERR_UNREACH; + } + PMIX_RELEASE_THREAD(&pmix_global_lock); + + /* send this request to the server */ + cd = PMIX_NEW(pmix_shift_caddy_t); + if (NULL == cd) { + return PMIX_ERR_NOMEM; + } + cd->cbfunc.hdlrregcbfn = regcbfunc; + cd->cbdata = regcbdata; + /* setup the request item */ + cd->iofreq = PMIX_NEW(pmix_iof_req_t); + if (NULL == cd->iofreq) { + PMIX_RELEASE(cd); + return PMIX_ERR_NOMEM; + } + /* retain the channels and cbfunc */ + cd->iofreq->channels = channel; + cd->iofreq->cbfunc = cbfunc; + /* we don't need the source specifications - only the + * server cares as it will filter against them */ + + /* setup the registration cmd */ + msg = PMIX_NEW(pmix_buffer_t); + if (NULL == msg) { + PMIX_RELEASE(cd->iofreq); + PMIX_RELEASE(cd); + return PMIX_ERR_NOMEM; + } + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, &cmd, 1, PMIX_COMMAND); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto cleanup; + } + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, &nprocs, 1, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto cleanup; + } + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, procs, nprocs, PMIX_PROC); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto cleanup; + } + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, &ndirs, 1, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto cleanup; + } + if (0 < ndirs) { + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, directives, ndirs, PMIX_INFO); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto cleanup; + } + } + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, &channel, 1, PMIX_IOF_CHANNEL); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto cleanup; + } + + pmix_output_verbose(2, pmix_client_globals.iof_output, + "pmix:iof_request sending to server"); + PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, + msg, msgcbfunc, (void*)cd); + + cleanup: + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + PMIX_RELEASE(cd->iofreq); + PMIX_RELEASE(cd); + } + return rc; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_security.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_security.c new file mode 100644 index 0000000000..52091e14c5 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_security.c @@ -0,0 +1,420 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2016 IBM Corporation. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include "src/threads/threads.h" +#include "src/util/argv.h" +#include "src/util/error.h" +#include "src/util/output.h" +#include "src/mca/bfrops/bfrops.h" +#include "src/mca/psec/psec.h" +#include "src/mca/ptl/ptl.h" + +#include "src/client/pmix_client_ops.h" +#include "src/server/pmix_server_ops.h" +#include "src/include/pmix_globals.h" + +static void getcbfunc(struct pmix_peer_t *peer, + pmix_ptl_hdr_t *hdr, + pmix_buffer_t *buf, void *cbdata) +{ + pmix_query_caddy_t *cd = (pmix_query_caddy_t*)cbdata; + pmix_status_t rc, status; + int cnt; + pmix_byte_object_t cred; + pmix_info_t *info = NULL; + size_t ninfo = 0; + + pmix_output_verbose(2, pmix_globals.debug_output, + "pmix:security cback from server with %d bytes", + (int)buf->bytes_used); + + /* a zero-byte buffer indicates that this recv is being + * completed due to a lost connection */ + if (PMIX_BUFFER_IS_EMPTY(buf)) { + /* release the caller */ + if (NULL != cd->credcbfunc) { + cd->credcbfunc(PMIX_ERR_COMM_FAILURE, NULL, NULL, 0, cd->cbdata); + } + PMIX_RELEASE(cd); + return; + } + + /* unpack the status */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, peer, buf, &status, &cnt, PMIX_STATUS); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto complete; + } + if (PMIX_SUCCESS != status) { + goto complete; + } + + /* unpack the credential */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, peer, buf, &cred, &cnt, PMIX_BYTE_OBJECT); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto complete; + } + + /* unpack any returned info */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, peer, buf, &ninfo, &cnt, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto complete; + } + if (0 < ninfo) { + PMIX_INFO_CREATE(info, ninfo); + cnt = ninfo; + PMIX_BFROPS_UNPACK(rc, peer, buf, info, &cnt, PMIX_INFO); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto complete; + } + } + + complete: + pmix_output_verbose(2, pmix_globals.debug_output, + "pmix:security cback from server releasing"); + /* release the caller */ + if (NULL != cd->credcbfunc) { + cd->credcbfunc(status, &cred, info, ninfo, cd->cbdata); + } + PMIX_BYTE_OBJECT_DESTRUCT(&cred); + if (NULL != info) { + PMIX_INFO_FREE(info, ninfo); + } + PMIX_RELEASE(cd); +} + +PMIX_EXPORT pmix_status_t PMIx_Get_credential(const pmix_info_t info[], size_t ninfo, + pmix_credential_cbfunc_t cbfunc, void *cbdata) +{ + pmix_buffer_t *msg; + pmix_cmd_t cmd = PMIX_GET_CREDENTIAL_CMD; + pmix_status_t rc; + pmix_query_caddy_t *cb; + pmix_byte_object_t cred; + pmix_info_t *results = NULL; + size_t nresults = 0; + + PMIX_ACQUIRE_THREAD(&pmix_global_lock); + + pmix_output_verbose(2, pmix_globals.debug_output, + "pmix: Get_credential called with %d info", (int)ninfo); + + if (pmix_globals.init_cntr <= 0) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_ERR_INIT; + } + + /* if we are the server */ + if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + /* if the host doesn't support this operation, + * see if we can generate it ourselves */ + if (NULL == pmix_host_server.get_credential) { + PMIX_BYTE_OBJECT_CONSTRUCT(&cred); + PMIX_PSEC_CREATE_CRED(rc, pmix_globals.mypeer, info, ninfo, + &results, &nresults, &cred); + if (PMIX_SUCCESS == rc) { + /* pass it back in the callback function */ + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, &cred, results, nresults, cbdata); + if (NULL != results) { + PMIX_INFO_FREE(results, nresults); + } + PMIX_BYTE_OBJECT_DESTRUCT(&cred); + } + } + return rc; + } + /* the host is available, so let them try to create it */ + pmix_output_verbose(2, pmix_globals.debug_output, + "pmix:get_credential handed to RM"); + rc = pmix_host_server.get_credential(&pmix_globals.myid, + info, ninfo, + cbfunc, cbdata); + return rc; + } + + /* if we are a client or tool and we aren't connected, see + * if one of our internal plugins is capable of meeting the request */ + if (!pmix_globals.connected) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + PMIX_BYTE_OBJECT_CONSTRUCT(&cred); + PMIX_PSEC_CREATE_CRED(rc, pmix_globals.mypeer, info, ninfo, + &results, &nresults, &cred); + if (PMIX_SUCCESS == rc) { + /* pass it back in the callback function */ + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, &cred, results, nresults, cbdata); + if (NULL != results) { + PMIX_INFO_FREE(results, nresults); + } + PMIX_BYTE_OBJECT_DESTRUCT(&cred); + } + } + return rc; + } + PMIX_RELEASE_THREAD(&pmix_global_lock); + + /* if we are a client, then relay this request to the server */ + msg = PMIX_NEW(pmix_buffer_t); + /* pack the cmd */ + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, &cmd, 1, PMIX_COMMAND); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return rc; + } + + /* pack the directives */ + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, &ninfo, 1, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return rc; + } + if (0 < ninfo) { + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, info, ninfo, PMIX_INFO); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return rc; + } + } + + /* create a callback object as we need to pass it to the + * recv routine so we know which callback to use when + * the return message is recvd */ + cb = PMIX_NEW(pmix_query_caddy_t); + cb->credcbfunc = cbfunc; + cb->cbdata = cbdata; + + /* push the message into our event base to send to the server */ + PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, + msg, getcbfunc, (void*)cb); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(msg); + PMIX_RELEASE(cb); + } + + return rc; +} + +static void valid_cbfunc(struct pmix_peer_t *peer, + pmix_ptl_hdr_t *hdr, + pmix_buffer_t *buf, void *cbdata) +{ + pmix_query_caddy_t *cd = (pmix_query_caddy_t*)cbdata; + pmix_status_t rc, status; + int cnt; + pmix_info_t *info = NULL; + size_t ninfo = 0; + + pmix_output_verbose(2, pmix_globals.debug_output, + "pmix:security cback from server with %d bytes", + (int)buf->bytes_used); + + /* a zero-byte buffer indicates that this recv is being + * completed due to a lost connection */ + if (PMIX_BUFFER_IS_EMPTY(buf)) { + /* release the caller */ + if (NULL != cd->validcbfunc) { + cd->validcbfunc(PMIX_ERR_COMM_FAILURE, NULL, 0, cd->cbdata); + } + PMIX_RELEASE(cd); + return; + } + + /* unpack the status */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, peer, buf, &status, &cnt, PMIX_STATUS); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto complete; + } + if (PMIX_SUCCESS != status) { + goto complete; + } + + /* unpack any returned info */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, peer, buf, &ninfo, &cnt, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto complete; + } + if (0 < ninfo) { + PMIX_INFO_CREATE(info, ninfo); + cnt = ninfo; + PMIX_BFROPS_UNPACK(rc, peer, buf, info, &cnt, PMIX_INFO); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto complete; + } + } + + complete: + pmix_output_verbose(2, pmix_globals.debug_output, + "pmix:security cback from server releasing"); + /* release the caller */ + if (NULL != cd->validcbfunc) { + cd->validcbfunc(status, info, ninfo, cd->cbdata); + } + if (NULL != info) { + PMIX_INFO_FREE(info, ninfo); + } + PMIX_RELEASE(cd); +} + +PMIX_EXPORT pmix_status_t PMIx_Validate_credential(const pmix_byte_object_t *cred, + const pmix_info_t directives[], size_t ndirs, + pmix_validation_cbfunc_t cbfunc, void *cbdata) +{ + pmix_buffer_t *msg; + pmix_cmd_t cmd = PMIX_VALIDATE_CRED_CMD; + pmix_status_t rc; + pmix_query_caddy_t *cb; + pmix_info_t *results = NULL; + size_t nresults = 0; + + PMIX_ACQUIRE_THREAD(&pmix_global_lock); + + pmix_output_verbose(2, pmix_globals.debug_output, + "pmix: monitor called"); + + if (pmix_globals.init_cntr <= 0) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_ERR_INIT; + } + + /* if we are the server */ + if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + /* if the host doesn't support this operation, + * see if we can validate it ourselves */ + if (NULL == pmix_host_server.validate_credential) { + PMIX_PSEC_VALIDATE_CRED(rc, pmix_globals.mypeer, + directives, ndirs, + &results, &nresults, cred); + if (PMIX_SUCCESS == rc) { + /* pass it back in the callback function */ + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, results, nresults, cbdata); + if (NULL != results) { + PMIX_INFO_FREE(results, nresults); + } + } + } + return rc; + } + /* the host is available, so let them try to validate it */ + pmix_output_verbose(2, pmix_globals.debug_output, + "pmix:get_credential handed to RM"); + rc = pmix_host_server.validate_credential(&pmix_globals.myid, cred, + directives, ndirs, cbfunc, cbdata); + return rc; + } + + /* if we are a client or tool and we aren't connected, see + * if one of our internal plugins is capable of meeting the request */ + if (!pmix_globals.connected) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + PMIX_PSEC_VALIDATE_CRED(rc, pmix_globals.mypeer, + directives, ndirs, + &results, &nresults, cred); + if (PMIX_SUCCESS == rc) { + /* pass it back in the callback function */ + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, results, nresults, cbdata); + if (NULL != results) { + PMIX_INFO_FREE(results, nresults); + } + } + } + return rc; + } + PMIX_RELEASE_THREAD(&pmix_global_lock); + + /* if we are a client, then relay this request to the server */ + msg = PMIX_NEW(pmix_buffer_t); + /* pack the cmd */ + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, &cmd, 1, PMIX_COMMAND); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return rc; + } + + /* pack the credential */ + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, cred, 1, PMIX_BYTE_OBJECT); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return rc; + } + + /* pack the directives */ + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, &ndirs, 1, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return rc; + } + if (0 < ndirs) { + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, directives, ndirs, PMIX_INFO); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return rc; + } + } + + /* create a callback object as we need to pass it to the + * recv routine so we know which callback to use when + * the return message is recvd */ + cb = PMIX_NEW(pmix_query_caddy_t); + cb->validcbfunc = cbfunc; + cb->cbdata = cbdata; + + /* push the message into our event base to send to the server */ + PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, + msg, valid_cbfunc, (void*)cb); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(msg); + PMIX_RELEASE(cb); + } + + return rc; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.c index 0f1a19a3cc..f613090e50 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.c @@ -13,7 +13,7 @@ * Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -558,7 +558,7 @@ int pmix_mca_base_var_cache_files(bool rel_path_search) if (NULL != pmix_mca_base_var_file_prefix) { resolve_relative_paths(&pmix_mca_base_var_file_prefix, pmix_mca_base_param_file_path, rel_path_search, &pmix_mca_base_var_files, PMIX_ENV_SEP); } - read_files (pmix_mca_base_var_files, &pmix_mca_base_var_file_values, PMIX_ENV_SEP); + read_files (pmix_mca_base_var_files, &pmix_mca_base_var_file_values, ','); if (NULL != pmix_mca_base_envar_file_prefix) { resolve_relative_paths(&pmix_mca_base_envar_file_prefix, pmix_mca_base_param_file_path, rel_path_search, &pmix_mca_base_envar_files, ','); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_pack.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_pack.c index 47ea7d8507..28e08f8910 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_pack.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_pack.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/Makefile.am new file mode 100644 index 0000000000..14438eac7f --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/Makefile.am @@ -0,0 +1,50 @@ +# -*- makefile -*- +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. +# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +headers = bfrop_pmix3.h +sources = \ + bfrop_pmix3_component.c \ + bfrop_pmix3.c + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +if MCA_BUILD_pmix_bfrops_v3_DSO +lib = +lib_sources = +component = mca_bfrops_v3.la +component_sources = $(headers) $(sources) +else +lib = libmca_bfrops_v3.la +lib_sources = $(headers) $(sources) +component = +component_sources = +endif + +mcacomponentdir = $(pmixlibdir) +mcacomponent_LTLIBRARIES = $(component) +mca_bfrops_v3_la_SOURCES = $(component_sources) +mca_bfrops_v3_la_LDFLAGS = -module -avoid-version + +noinst_LTLIBRARIES = $(lib) +libmca_bfrops_v3_la_SOURCES = $(lib_sources) +libmca_bfrops_v3_la_LDFLAGS = -module -avoid-version diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3.c new file mode 100644 index 0000000000..c1fa8277c9 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3.c @@ -0,0 +1,456 @@ +/* + * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2011 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2010-2011 Oak Ridge National Labs. All rights reserved. + * Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + */ + +#include + +#include "src/mca/bfrops/base/base.h" +#include "bfrop_pmix3.h" + +static pmix_status_t init(void); +static void finalize(void); +static pmix_status_t pmix3_pack(pmix_buffer_t *buffer, + const void *src, int num_vals, + pmix_data_type_t type); +static pmix_status_t pmix3_unpack(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +static pmix_status_t pmix3_copy(void **dest, void *src, + pmix_data_type_t type); +static pmix_status_t pmix3_print(char **output, char *prefix, + void *src, pmix_data_type_t type); +static pmix_status_t register_type(const char *name, + pmix_data_type_t type, + pmix_bfrop_pack_fn_t pack, + pmix_bfrop_unpack_fn_t unpack, + pmix_bfrop_copy_fn_t copy, + pmix_bfrop_print_fn_t print); +static const char* data_type_string(pmix_data_type_t type); + +pmix_bfrops_module_t pmix_bfrops_pmix3_module = { + .version = "v3", + .init = init, + .finalize = finalize, + .pack = pmix3_pack, + .unpack = pmix3_unpack, + .copy = pmix3_copy, + .print = pmix3_print, + .copy_payload = pmix_bfrops_base_copy_payload, + .value_xfer = pmix_bfrops_base_value_xfer, + .value_load = pmix_bfrops_base_value_load, + .value_unload = pmix_bfrops_base_value_unload, + .value_cmp = pmix_bfrops_base_value_cmp, + .register_type = register_type, + .data_type_string = data_type_string +}; + +static pmix_status_t init(void) +{ + /* some standard types don't require anything special */ + PMIX_REGISTER_TYPE("PMIX_BOOL", PMIX_BOOL, + pmix_bfrops_base_pack_bool, + pmix_bfrops_base_unpack_bool, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_bool, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_BYTE", PMIX_BYTE, + pmix_bfrops_base_pack_byte, + pmix_bfrops_base_unpack_byte, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_byte, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_STRING", PMIX_STRING, + pmix_bfrops_base_pack_string, + pmix_bfrops_base_unpack_string, + pmix_bfrops_base_copy_string, + pmix_bfrops_base_print_string, + &mca_bfrops_v3_component.types); + + /* Register the rest of the standard generic types to point to internal functions */ + PMIX_REGISTER_TYPE("PMIX_SIZE", PMIX_SIZE, + pmix_bfrops_base_pack_sizet, + pmix_bfrops_base_unpack_sizet, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_size, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_PID", PMIX_PID, + pmix_bfrops_base_pack_pid, + pmix_bfrops_base_unpack_pid, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_pid, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_INT", PMIX_INT, + pmix_bfrops_base_pack_int, + pmix_bfrops_base_unpack_int, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_int, + &mca_bfrops_v3_component.types); + + /* Register all the standard fixed types to point to base functions */ + PMIX_REGISTER_TYPE("PMIX_INT8", PMIX_INT8, + pmix_bfrops_base_pack_byte, + pmix_bfrops_base_unpack_byte, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_int8, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_INT16", PMIX_INT16, + pmix_bfrops_base_pack_int16, + pmix_bfrops_base_unpack_int16, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_int16, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_INT32", PMIX_INT32, + pmix_bfrops_base_pack_int32, + pmix_bfrops_base_unpack_int32, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_int32, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_INT64", PMIX_INT64, + pmix_bfrops_base_pack_int64, + pmix_bfrops_base_unpack_int64, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_int64, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_UINT", PMIX_UINT, + pmix_bfrops_base_pack_int, + pmix_bfrops_base_unpack_int, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_uint, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_UINT8", PMIX_UINT8, + pmix_bfrops_base_pack_byte, + pmix_bfrops_base_unpack_byte, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_uint8, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_UINT16", PMIX_UINT16, + pmix_bfrops_base_pack_int16, + pmix_bfrops_base_unpack_int16, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_uint16, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_UINT32", PMIX_UINT32, + pmix_bfrops_base_pack_int32, + pmix_bfrops_base_unpack_int32, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_uint32, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_UINT64", PMIX_UINT64, + pmix_bfrops_base_pack_int64, + pmix_bfrops_base_unpack_int64, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_uint64, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_FLOAT", PMIX_FLOAT, + pmix_bfrops_base_pack_float, + pmix_bfrops_base_unpack_float, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_float, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_DOUBLE", PMIX_DOUBLE, + pmix_bfrops_base_pack_double, + pmix_bfrops_base_unpack_double, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_double, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_TIMEVAL", PMIX_TIMEVAL, + pmix_bfrops_base_pack_timeval, + pmix_bfrops_base_unpack_timeval, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_timeval, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_TIME", PMIX_TIME, + pmix_bfrops_base_pack_time, + pmix_bfrops_base_unpack_time, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_time, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_STATUS", PMIX_STATUS, + pmix_bfrops_base_pack_status, + pmix_bfrops_base_unpack_status, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_status, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_VALUE", PMIX_VALUE, + pmix_bfrops_base_pack_value, + pmix_bfrops_base_unpack_value, + pmix_bfrops_base_copy_value, + pmix_bfrops_base_print_value, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_PROC", PMIX_PROC, + pmix_bfrops_base_pack_proc, + pmix_bfrops_base_unpack_proc, + pmix_bfrops_base_copy_proc, + pmix_bfrops_base_print_proc, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_APP", PMIX_APP, + pmix_bfrops_base_pack_app, + pmix_bfrops_base_unpack_app, + pmix_bfrops_base_copy_app, + pmix_bfrops_base_print_app, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_INFO", PMIX_INFO, + pmix_bfrops_base_pack_info, + pmix_bfrops_base_unpack_info, + pmix_bfrops_base_copy_info, + pmix_bfrops_base_print_info, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_PDATA", PMIX_PDATA, + pmix_bfrops_base_pack_pdata, + pmix_bfrops_base_unpack_pdata, + pmix_bfrops_base_copy_pdata, + pmix_bfrops_base_print_pdata, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_BUFFER", PMIX_BUFFER, + pmix_bfrops_base_pack_buf, + pmix_bfrops_base_unpack_buf, + pmix_bfrops_base_copy_buf, + pmix_bfrops_base_print_buf, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_BYTE_OBJECT", PMIX_BYTE_OBJECT, + pmix_bfrops_base_pack_bo, + pmix_bfrops_base_unpack_bo, + pmix_bfrops_base_copy_bo, + pmix_bfrops_base_print_bo, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_KVAL", PMIX_KVAL, + pmix_bfrops_base_pack_kval, + pmix_bfrops_base_unpack_kval, + pmix_bfrops_base_copy_kval, + pmix_bfrops_base_print_kval, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_MODEX", PMIX_MODEX, + pmix_bfrops_base_pack_modex, + pmix_bfrops_base_unpack_modex, + pmix_bfrops_base_copy_modex, + pmix_bfrops_base_print_modex, + &mca_bfrops_v3_component.types); + + /* these are fixed-sized values and can be done by base */ + PMIX_REGISTER_TYPE("PMIX_PERSIST", PMIX_PERSIST, + pmix_bfrops_base_pack_persist, + pmix_bfrops_base_unpack_persist, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_persist, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_POINTER", PMIX_POINTER, + pmix_bfrops_base_pack_ptr, + pmix_bfrops_base_unpack_ptr, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_ptr, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_SCOPE", PMIX_SCOPE, + pmix_bfrops_base_pack_scope, + pmix_bfrops_base_unpack_scope, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_std_copy, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_DATA_RANGE", PMIX_DATA_RANGE, + pmix_bfrops_base_pack_range, + pmix_bfrops_base_unpack_range, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_ptr, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_COMMAND", PMIX_COMMAND, + pmix_bfrops_base_pack_cmd, + pmix_bfrops_base_unpack_cmd, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_cmd, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_INFO_DIRECTIVES", PMIX_INFO_DIRECTIVES, + pmix_bfrops_base_pack_info_directives, + pmix_bfrops_base_unpack_info_directives, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_info_directives, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_DATA_TYPE", PMIX_DATA_TYPE, + pmix_bfrops_base_pack_datatype, + pmix_bfrops_base_unpack_datatype, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_datatype, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_PROC_STATE", PMIX_PROC_STATE, + pmix_bfrops_base_pack_pstate, + pmix_bfrops_base_unpack_pstate, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_pstate, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_PROC_INFO", PMIX_PROC_INFO, + pmix_bfrops_base_pack_pinfo, + pmix_bfrops_base_unpack_pinfo, + pmix_bfrops_base_copy_pinfo, + pmix_bfrops_base_print_pinfo, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_DATA_ARRAY", PMIX_DATA_ARRAY, + pmix_bfrops_base_pack_darray, + pmix_bfrops_base_unpack_darray, + pmix_bfrops_base_copy_darray, + pmix_bfrops_base_print_darray, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_PROC_RANK", PMIX_PROC_RANK, + pmix_bfrops_base_pack_rank, + pmix_bfrops_base_unpack_rank, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_rank, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_QUERY", PMIX_QUERY, + pmix_bfrops_base_pack_query, + pmix_bfrops_base_unpack_query, + pmix_bfrops_base_copy_query, + pmix_bfrops_base_print_query, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_COMPRESSED_STRING", + PMIX_COMPRESSED_STRING, + pmix_bfrops_base_pack_bo, + pmix_bfrops_base_unpack_bo, + pmix_bfrops_base_copy_bo, + pmix_bfrops_base_print_bo, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_ALLOC_DIRECTIVE", + PMIX_ALLOC_DIRECTIVE, + pmix_bfrops_base_pack_alloc_directive, + pmix_bfrops_base_unpack_alloc_directive, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_alloc_directive, + &mca_bfrops_v3_component.types); + + PMIX_REGISTER_TYPE("PMIX_IOF_CHANNEL", + PMIX_IOF_CHANNEL, + pmix_bfrops_base_pack_iof_channel, + pmix_bfrops_base_unpack_iof_channel, + pmix_bfrops_base_std_copy, + pmix_bfrops_base_print_iof_channel, + &mca_bfrops_v3_component.types); + + /**** DEPRECATED ****/ + PMIX_REGISTER_TYPE("PMIX_INFO_ARRAY", PMIX_INFO_ARRAY, + pmix_bfrops_base_pack_array, + pmix_bfrops_base_unpack_array, + pmix_bfrops_base_copy_array, + pmix_bfrops_base_print_array, + &mca_bfrops_v3_component.types); + /********************/ + + + return PMIX_SUCCESS; +} + +static void finalize(void) +{ + int n; + pmix_bfrop_type_info_t *info; + + for (n=0; n < mca_bfrops_v3_component.types.size; n++) { + if (NULL != (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&mca_bfrops_v3_component.types, n))) { + PMIX_RELEASE(info); + pmix_pointer_array_set_item(&mca_bfrops_v3_component.types, n, NULL); + } + } +} + +static pmix_status_t pmix3_pack(pmix_buffer_t *buffer, + const void *src, int num_vals, + pmix_data_type_t type) +{ + /* kick the process off by passing this in to the base */ + return pmix_bfrops_base_pack(&mca_bfrops_v3_component.types, + buffer, src, num_vals, type); +} + +static pmix_status_t pmix3_unpack(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) +{ + /* kick the process off by passing this in to the base */ + return pmix_bfrops_base_unpack(&mca_bfrops_v3_component.types, + buffer, dest, num_vals, type); +} + +static pmix_status_t pmix3_copy(void **dest, void *src, + pmix_data_type_t type) +{ + return pmix_bfrops_base_copy(&mca_bfrops_v3_component.types, + dest, src, type); +} + +static pmix_status_t pmix3_print(char **output, char *prefix, + void *src, pmix_data_type_t type) +{ + return pmix_bfrops_base_print(&mca_bfrops_v3_component.types, + output, prefix, src, type); +} + +static pmix_status_t register_type(const char *name, pmix_data_type_t type, + pmix_bfrop_pack_fn_t pack, + pmix_bfrop_unpack_fn_t unpack, + pmix_bfrop_copy_fn_t copy, + pmix_bfrop_print_fn_t print) +{ + PMIX_REGISTER_TYPE(name, type, + pack, unpack, + copy, print, + &mca_bfrops_v3_component.types); + return PMIX_SUCCESS; +} + +static const char* data_type_string(pmix_data_type_t type) +{ + return pmix_bfrops_base_data_type_string(&mca_bfrops_v3_component.types, type); +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3.h b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3.h new file mode 100644 index 0000000000..ee6e86cead --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2006 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef PMIX_BFROPS_PMIX3_H +#define PMIX_BFROPS_PMIX3_H + +#include "src/mca/bfrops/bfrops.h" + +BEGIN_C_DECLS + +/* the component must be visible data for the linker to find it */ + PMIX_EXPORT extern pmix_bfrops_base_component_t mca_bfrops_v3_component; + +extern pmix_bfrops_module_t pmix_bfrops_pmix3_module; + +END_C_DECLS + +#endif /* PMIX_BFROPS_PMIX3_H */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3_component.c new file mode 100644 index 0000000000..265b2ded1d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3_component.c @@ -0,0 +1,99 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennbfropsee and The University + * of Tennbfropsee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2015 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + * These symbols are in a file by themselves to provide nice linker + * semantics. Since linkers generally pull in symbols by object + * files, keeping these symbols as the only symbols in this file + * prevents utility programs such as "ompi_info" from having to import + * entire components just to query their version and parameters. + */ + +#include +#include +#include "src/include/types.h" +#include "src/include/pmix_globals.h" + +#include "src/util/error.h" +#include "src/server/pmix_server_ops.h" +#include "src/mca/bfrops/base/base.h" +#include "bfrop_pmix3.h" + +extern pmix_bfrops_module_t pmix_bfrops_pmix3_module; + +static pmix_status_t component_open(void); +static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority); +static pmix_status_t component_close(void); +static pmix_bfrops_module_t* assign_module(void); + +/* + * Instantiate the public struct with all of our public information + * and pointers to our public functions in it + */ +pmix_bfrops_base_component_t mca_bfrops_v3_component = { + .base = { + PMIX_BFROPS_BASE_VERSION_1_0_0, + + /* Component name and version */ + .pmix_mca_component_name = "v3", + PMIX_MCA_BASE_MAKE_VERSION(component, PMIX_MAJOR_VERSION, PMIX_MINOR_VERSION, + PMIX_RELEASE_VERSION), + + /* Component open and close functions */ + .pmix_mca_open_component = component_open, + .pmix_mca_close_component = component_close, + .pmix_mca_query_component = component_query, + }, + .priority = 40, + .assign_module = assign_module +}; + + +pmix_status_t component_open(void) +{ + /* setup the types array */ + PMIX_CONSTRUCT(&mca_bfrops_v3_component.types, pmix_pointer_array_t); + pmix_pointer_array_init(&mca_bfrops_v3_component.types, 32, INT_MAX, 16); + + return PMIX_SUCCESS; +} + + +pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority) +{ + + *priority = mca_bfrops_v3_component.priority; + *module = (pmix_mca_base_module_t *)&pmix_bfrops_pmix3_module; + return PMIX_SUCCESS; +} + + +pmix_status_t component_close(void) +{ + PMIX_DESTRUCT(&mca_bfrops_v3_component.types); + return PMIX_SUCCESS; +} + +static pmix_bfrops_module_t* assign_module(void) +{ + pmix_output_verbose(10, pmix_bfrops_base_framework.framework_output, + "bfrops:pmix3x assigning module"); + return &pmix_bfrops_pmix3_module; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c index 02607a15bb..1a22226b7f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c +++ b/opal/mca/pmix/pmix3x/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,7 +2995,6 @@ 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; diff --git a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c index 3f39aa3caa..31020c56a8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c @@ -248,6 +248,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, pmix_info_t ginfo; size_t n; pmix_ptl_posted_recv_t *rcv; + pmix_proc_t wildcard; PMIX_ACQUIRE_THREAD(&pmix_global_lock); @@ -378,9 +379,15 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, return rc; } } - /* Success, so copy the nspace and rank */ + /* Success, so copy the nspace and rank to the proc struct they gave us */ (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); + } + (void)strncpy(pmix_globals.mypeer->info->pname.nspace, proc->nspace, PMIX_MAX_NSLEN); + pmix_globals.mypeer->info->pname.rank = proc->rank; /* increment our init reference counter */ pmix_globals.init_cntr++; @@ -390,6 +397,8 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, * datastore with typical job-related info. No point * in having the server generate these as we are * obviously a singleton, and so the values are well-known */ + (void)strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); + wildcard.rank = pmix_globals.myid.rank; /* the jobid is just our nspace */ kptr = PMIX_NEW(pmix_kval_t); @@ -398,7 +407,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, kptr->value->type = PMIX_STRING; kptr->value->data.string = strdup(pmix_globals.myid.nspace); PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, + &wildcard, PMIX_INTERNAL, kptr); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); @@ -430,7 +439,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, kptr->value->type = PMIX_UINT32; kptr->value->data.uint32 = 0; PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, + &wildcard, PMIX_INTERNAL, kptr); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); @@ -446,7 +455,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, kptr->value->type = PMIX_UINT32; kptr->value->data.uint32 = 1; PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, + &wildcard, PMIX_INTERNAL, kptr); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); @@ -462,7 +471,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, kptr->value->type = PMIX_STRING; kptr->value->data.string = strdup("0"); PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, + &wildcard, PMIX_INTERNAL, kptr); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); @@ -478,7 +487,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, kptr->value->type = PMIX_UINT32; kptr->value->data.uint32 = 0; PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, + &wildcard, PMIX_INTERNAL, kptr); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); @@ -494,7 +503,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, kptr->value->type = PMIX_UINT32; kptr->value->data.uint32 = 1; PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, + &wildcard, PMIX_INTERNAL, kptr); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); @@ -510,7 +519,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, kptr->value->type = PMIX_UINT32; kptr->value->data.uint32 = 1; PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, + &wildcard, PMIX_INTERNAL, kptr); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); @@ -526,7 +535,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, kptr->value->type = PMIX_UINT32; kptr->value->data.uint32 = 1; PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, + &wildcard, PMIX_INTERNAL, kptr); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); @@ -543,7 +552,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, kptr->value->type = PMIX_UINT32; kptr->value->data.uint32 = 1; PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, + &wildcard, PMIX_INTERNAL, kptr); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); @@ -666,7 +675,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, kptr->value->type = PMIX_STRING; kptr->value->data.string = strdup(hostname); PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, + &wildcard, PMIX_INTERNAL, kptr); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); @@ -683,7 +692,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, kptr->value->type = PMIX_STRING; kptr->value->data.string = strdup("0"); PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, + &wildcard, PMIX_INTERNAL, kptr); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c index 3348ae29f8..585bf0751b 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c @@ -969,6 +969,7 @@ static void wait_signal_callback(int fd, short event, void *arg) /* we are already in an event, so it is safe to access the list */ PMIX_LIST_FOREACH(t2, &children, wait_tracker_t) { if (pid == t2->pid) { + t2->exit_code = status; /* found it! */ if (0 != status && 0 == exit_code) { exit_code = status; diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simptimeout.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simptimeout.c new file mode 100644 index 0000000000..7d39063356 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simptimeout.c @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2011 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2006-2013 Los Alamos National Security, LLC. + * All rights reserved. + * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + */ + +#include +#include + +#include +#include +#include +#include + +#include "src/class/pmix_object.h" +#include "src/util/output.h" +#include "src/util/printf.h" + +#define MAXCNT 1 + +static volatile bool completed = false; +static pmix_proc_t myproc; + +static void notification_fn(size_t evhdlr_registration_id, + pmix_status_t status, + const pmix_proc_t *source, + pmix_info_t info[], size_t ninfo, + pmix_info_t results[], size_t nresults, + pmix_event_notification_cbfunc_fn_t cbfunc, + void *cbdata) +{ + pmix_output(0, "Client %s:%d NOTIFIED with status %s", myproc.nspace, myproc.rank, PMIx_Error_string(status)); + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata); + } + completed = true; +} + +static void errhandler_reg_callbk(pmix_status_t status, + size_t errhandler_ref, + void *cbdata) +{ + volatile bool *active = (volatile bool*)cbdata; + + pmix_output(0, "Client: ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%lu", + status, (unsigned long)errhandler_ref); + *active = false; +} + + +int main(int argc, char **argv) +{ + int rc; + pmix_value_t value; + pmix_value_t *val = &value; + pmix_proc_t proc, newproc; + uint32_t nprocs, n; + volatile bool active; + pmix_info_t info; + + /* init us */ + if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Init failed: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + exit(rc); + } + pmix_output(0, "Client ns %s rank %d: Running", myproc.nspace, myproc.rank); + + /* test something */ + (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); + proc.rank = PMIX_RANK_WILDCARD; + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get failed: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + exit(rc); + } + PMIX_VALUE_RELEASE(val); + + /* register our errhandler */ + active = true; + PMIx_Register_event_handler(NULL, 0, NULL, 0, + notification_fn, errhandler_reg_callbk, (void*)&active); + while (active) { + usleep(10); + } + + /* get our universe size */ + (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); + proc.rank = PMIX_RANK_WILDCARD; + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get universe size failed: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + goto done; + } + nprocs = val->data.uint32; + PMIX_VALUE_RELEASE(val); + pmix_output(0, "Client %s:%d universe size %d", myproc.nspace, myproc.rank, nprocs); + + /* if we are rank=0, then do a fence with timeout */ + if (0 == myproc.rank) { + PMIX_INFO_CONSTRUCT(&info); + n = 1; + PMIX_INFO_LOAD(&info, PMIX_TIMEOUT, &n, PMIX_UINT32); + PMIX_PROC_CONSTRUCT(&proc); + (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); + proc.rank = PMIX_RANK_WILDCARD; + pmix_output(0, "TEST FENCE TIMEOUT"); + if (PMIX_ERR_TIMEOUT != (rc = PMIx_Fence(&proc, 1, &info, 1))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Fence did not timeout: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + goto done; + } + pmix_output(0, "FENCE TIMEOUT SUCCEEDED"); + + /* check timeout on connect */ + pmix_output(0, "TEST CONNECT TIMEOUT"); + if (PMIX_ERR_TIMEOUT != (rc = PMIx_Connect(&proc, 1, &info, 1, newproc.nspace, &newproc.rank))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Connect did not timeout: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + goto done; + } + pmix_output(0, "CONNECT TIMEOUT SUCCEEDED"); + + /* check timeout on Get */ + proc.rank = 1; + pmix_output(0, "TEST GET TIMEOUT"); + if (PMIX_ERR_TIMEOUT == (rc = PMIx_Get(&proc, "1234", &info, 1, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get did not timeout: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + goto done; + } + pmix_output(0, "GET TIMEOUT SUCCEEDED"); + + } else { + sleep(5); + } + + done: + /* finalize us */ + pmix_output(0, "Client ns %s rank %d: Finalizing", myproc.nspace, myproc.rank); + if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) { + fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %s\n", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + } else { + fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank); + } + fflush(stderr); + return(rc); +}