Merge pull request #4278 from rhc54/topic/pup
Sync to PMIx master to pickup a little bug fix
Этот коммит содержится в:
Коммит
98aee5407f
@ -30,7 +30,7 @@ greek=
|
||||
# command, or with the date (if "git describe" fails) in the form of
|
||||
# "date<date>".
|
||||
|
||||
repo_rev=git9cf5d19
|
||||
repo_rev=git9d9df02
|
||||
|
||||
# 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="Sep 25, 2017"
|
||||
date="Sep 27, 2017"
|
||||
|
||||
# The shared library version of each of PMIx's public libraries.
|
||||
# These versions are maintained in accordance with the "Library
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_builddir)/src/include -I$(top_builddir)/include -I$(top_builddir)/include/pmix
|
||||
|
||||
noinst_PROGRAMS = client dmodex dynamic fault pub tool debugger debuggerd alloc jctrl
|
||||
noinst_PROGRAMS = client client2 dmodex dynamic fault pub tool debugger debuggerd alloc jctrl
|
||||
if !WANT_HIDDEN
|
||||
# these examples use internal symbols
|
||||
# use --disable-visibility
|
||||
@ -32,6 +32,10 @@ client_SOURCES = client.c
|
||||
client_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
client_LDADD = $(top_builddir)/src/libpmix.la
|
||||
|
||||
client2_SOURCES = client2.c
|
||||
client2_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
client2_LDADD = $(top_builddir)/src/libpmix.la
|
||||
|
||||
debugger_SOURCES = debugger.c
|
||||
debugger_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS)
|
||||
debugger_LDADD = $(top_builddir)/src/libpmix.la
|
||||
|
223
opal/mca/pmix/pmix2x/pmix/examples/client2.c
Обычный файл
223
opal/mca/pmix/pmix2x/pmix/examples/client2.c
Обычный файл
@ -0,0 +1,223 @@
|
||||
/*
|
||||
* 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-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <pmix.h>
|
||||
|
||||
static pmix_proc_t myproc;
|
||||
|
||||
/* this is the event notification function we pass down below
|
||||
* when registering for general events - i.e.,, the default
|
||||
* handler. We don't technically need to register one, but it
|
||||
* is usually good practice to catch any events that occur */
|
||||
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)
|
||||
{
|
||||
if (NULL != cbfunc) {
|
||||
cbfunc(PMIX_EVENT_ACTION_COMPLETE, NULL, 0, NULL, NULL, cbdata);
|
||||
}
|
||||
}
|
||||
|
||||
/* event handler registration is done asynchronously because it
|
||||
* may involve the PMIx server registering with the host RM for
|
||||
* external events. So we provide a callback function that returns
|
||||
* the status of the request (success or an error), plus a numerical index
|
||||
* to the registered event. The index is used later on to deregister
|
||||
* an event handler - if we don't explicitly deregister it, then the
|
||||
* PMIx server will do so when it see us exit */
|
||||
static void evhandler_reg_callbk(pmix_status_t status,
|
||||
size_t evhandler_ref,
|
||||
void *cbdata)
|
||||
{
|
||||
volatile int *active = (volatile int*)cbdata;
|
||||
|
||||
if (PMIX_SUCCESS != status) {
|
||||
fprintf(stderr, "Client %s:%d EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n",
|
||||
myproc.nspace, myproc.rank, status, (unsigned long)evhandler_ref);
|
||||
}
|
||||
*active = status;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int rc;
|
||||
pmix_value_t value;
|
||||
pmix_value_t *val, *vptr;
|
||||
pmix_proc_t proc;
|
||||
uint32_t nprocs, n, k;
|
||||
pmix_info_t *info;
|
||||
bool flag;
|
||||
volatile int active;
|
||||
pmix_data_array_t da, *dptr;
|
||||
|
||||
/* init us - note that the call to "init" includes the return of
|
||||
* any job-related info provided by the RM. This includes any
|
||||
* debugger flag instructing us to stop-in-init. If such a directive
|
||||
* is included, then the process will be stopped in this call until
|
||||
* the "debugger release" notification arrives */
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
exit(0);
|
||||
}
|
||||
fprintf(stderr, "Client ns %s rank %d: Running\n", myproc.nspace, myproc.rank);
|
||||
|
||||
|
||||
/* register our default event handler - again, this isn't strictly
|
||||
* required, but is generally good practice */
|
||||
active = -1;
|
||||
PMIx_Register_event_handler(NULL, 0, NULL, 0,
|
||||
notification_fn, evhandler_reg_callbk, (void*)&active);
|
||||
while (-1 == active) {
|
||||
sleep(1);
|
||||
}
|
||||
if (0 != active) {
|
||||
fprintf(stderr, "[%s:%d] Default handler registration failed\n", myproc.nspace, myproc.rank);
|
||||
exit(active);
|
||||
}
|
||||
|
||||
/* job-related info is found in our nspace, assigned to the
|
||||
* wildcard rank as it doesn't relate to a specific rank. Setup
|
||||
* a name to retrieve such values */
|
||||
PMIX_PROC_CONSTRUCT(&proc);
|
||||
(void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN);
|
||||
proc.rank = PMIX_RANK_WILDCARD;
|
||||
|
||||
/* get our job size */
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
goto done;
|
||||
}
|
||||
nprocs = val->data.uint32;
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
fprintf(stderr, "Client %s:%d job size %d\n", myproc.nspace, myproc.rank, nprocs);
|
||||
|
||||
/* put a data array of pmix_value's */
|
||||
val = (pmix_value_t*)malloc(32 * sizeof(pmix_value_t));
|
||||
for (n=0; n < 32; n++) {
|
||||
val[n].type = PMIX_UINT64;
|
||||
val[n].data.uint64 = 2*n;
|
||||
}
|
||||
da.type = PMIX_VALUE;
|
||||
da.size = 32;
|
||||
da.array = val;
|
||||
value.type = PMIX_DATA_ARRAY;
|
||||
value.data.darray = &da;
|
||||
rc = PMIx_Put(PMIX_GLOBAL, "test-key", &value);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Put failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
goto done;
|
||||
}
|
||||
free(val);
|
||||
|
||||
/* push the data to our PMIx server */
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Commit())) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Commit failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* call fence to synchronize with our peers - instruct
|
||||
* the fence operation to collect and return all "put"
|
||||
* data from our peers */
|
||||
PMIX_INFO_CREATE(info, 1);
|
||||
flag = true;
|
||||
PMIX_INFO_LOAD(info, PMIX_COLLECT_DATA, &flag, PMIX_BOOL);
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, info, 1))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
goto done;
|
||||
}
|
||||
PMIX_INFO_FREE(info, 1);
|
||||
|
||||
/* check the returned data */
|
||||
for (n=0; n < nprocs; n++) {
|
||||
proc.rank = n;
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, "test-key", NULL, 0, &val))) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get on rank %u failed: %d\n",
|
||||
myproc.nspace, myproc.rank, proc.rank, rc);
|
||||
goto done;
|
||||
}
|
||||
if (PMIX_DATA_ARRAY != val->type) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get on rank %u returned wrong type: %d\n",
|
||||
myproc.nspace, myproc.rank, proc.rank, val->type);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
goto done;
|
||||
}
|
||||
dptr = val->data.darray;
|
||||
if (NULL == dptr) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %d returned NULL array\n",
|
||||
myproc.nspace, myproc.rank, proc.rank);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
goto done;
|
||||
}
|
||||
if (PMIX_VALUE != dptr->type) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %d returned wrong array value type %d\n",
|
||||
myproc.nspace, myproc.rank, proc.rank, dptr->type);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
goto done;
|
||||
}
|
||||
if (32 != dptr->size) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %d returned wrong array value size %d\n",
|
||||
myproc.nspace, myproc.rank, proc.rank, (int)dptr->size);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
goto done;
|
||||
}
|
||||
vptr = (pmix_value_t*)dptr->array;
|
||||
for (k=0; k < 32; k++) {
|
||||
if (PMIX_UINT64 != vptr[k].type) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %d returned wrong type: %d\n",
|
||||
myproc.nspace, myproc.rank, proc.rank, vptr[k].type);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
goto done;
|
||||
}
|
||||
if (2*k != vptr[k].data.uint64) {
|
||||
fprintf(stderr, "Client ns %s rank %d: PMIx_Get %d returned wrong value: %lu\n",
|
||||
myproc.nspace, myproc.rank, proc.rank, (unsigned long)vptr[k].data.uint64);
|
||||
PMIX_VALUE_RELEASE(val);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
/* finalize us */
|
||||
fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank);
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) {
|
||||
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc);
|
||||
} else {
|
||||
fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank);
|
||||
}
|
||||
fflush(stderr);
|
||||
return(0);
|
||||
}
|
@ -990,6 +990,11 @@ pmix_status_t pmix_bfrops_base_pack_darray(pmix_buffer_t *buffer, const void *sr
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_VALUE:
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_value(buffer, p[i].array, p[i].size, PMIX_QUERY))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_ALLOC_DIRECTIVE:
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_alloc_directive(buffer, p[i].array, p[i].size, PMIX_ALLOC_DIRECTIVE))) {
|
||||
return ret;
|
||||
|
@ -1515,6 +1515,15 @@ pmix_status_t pmix_bfrops_base_unpack_darray(pmix_buffer_t *buffer, void *dest,
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
case PMIX_VALUE:
|
||||
ptr[i].array = (pmix_value_t*)malloc(m * sizeof(pmix_value_t));
|
||||
if (NULL == ptr[i].array) {
|
||||
return PMIX_ERR_NOMEM;
|
||||
}
|
||||
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_value(buffer, ptr[i].array, &m, ptr[i].type))) {
|
||||
return ret;
|
||||
}
|
||||
break;
|
||||
/**** DEPRECATED ****/
|
||||
case PMIX_INFO_ARRAY:
|
||||
ptr[i].array = (pmix_info_array_t*)malloc(m * sizeof(pmix_info_array_t));
|
||||
|
@ -707,7 +707,7 @@ pmix_status_t pmix12_bfrop_pack_app(pmix_buffer_t *buffer, const void *src,
|
||||
pmix_app_t *app;
|
||||
int32_t i, j, nvals;
|
||||
pmix_status_t ret;
|
||||
int argc;
|
||||
int argc=0;
|
||||
|
||||
app = (pmix_app_t *) src;
|
||||
|
||||
|
@ -222,6 +222,8 @@ static inline void _esh_ns_track_cleanup(void);
|
||||
static inline void _esh_sessions_cleanup(void);
|
||||
static inline void _esh_ns_map_cleanup(void);
|
||||
static inline int _esh_dir_del(const char *dirname);
|
||||
static inline void _client_compat_save(pmix_peer_t *peer);
|
||||
static inline pmix_peer_t * _client_peer(void);
|
||||
|
||||
static inline int _my_client(const char *nspace, pmix_rank_t rank);
|
||||
|
||||
@ -296,6 +298,7 @@ static size_t _data_segment_size = 0;
|
||||
static size_t _lock_segment_size = 0;
|
||||
static uid_t _jobuid;
|
||||
static char _setjobuid = 0;
|
||||
static pmix_peer_t *_clients_peer = NULL;
|
||||
|
||||
static pmix_value_array_t *_session_array = NULL;
|
||||
static pmix_value_array_t *_ns_map_array = NULL;
|
||||
@ -499,28 +502,6 @@ static inline void _rwlock_release(session_t *s) {
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline const char *_unique_id(void)
|
||||
{
|
||||
static const char *str = NULL;
|
||||
if (!str) {
|
||||
/* see: pmix_server.c initialize_server_base()
|
||||
* to get format of uri
|
||||
*/
|
||||
if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) {
|
||||
static char buf[100];
|
||||
snprintf(buf, sizeof(buf) - 1, "pmix-%d", getpid());
|
||||
str = buf;
|
||||
} else {
|
||||
str = getenv("PMIX_SERVER_URI");
|
||||
if (str) {
|
||||
str = strrchr(str, '/');
|
||||
}
|
||||
str = (str ? str + 1 : "$$$");
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static inline int _esh_dir_del(const char *path)
|
||||
{
|
||||
DIR *dir;
|
||||
@ -1642,7 +1623,7 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t
|
||||
datadesc = ns_info->data_seg;
|
||||
/* pack value to the buffer */
|
||||
PMIX_CONSTRUCT(&buffer, pmix_buffer_t);
|
||||
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buffer, kval->value, 1, PMIX_VALUE);
|
||||
PMIX_BFROPS_PACK(rc, _client_peer(), &buffer, kval->value, 1, PMIX_VALUE);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
goto exit;
|
||||
@ -2128,6 +2109,10 @@ static void dstore_finalize(void)
|
||||
free(_base_path);
|
||||
_base_path = NULL;
|
||||
}
|
||||
if (NULL != _clients_peer) {
|
||||
PMIX_RELEASE(_clients_peer->nptr);
|
||||
PMIX_RELEASE(_clients_peer);
|
||||
}
|
||||
}
|
||||
|
||||
static pmix_status_t _dstore_store(const char *nspace,
|
||||
@ -2483,11 +2468,11 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank,
|
||||
uint8_t *data_ptr = ESH_DATA_PTR(addr);
|
||||
size_t data_size = ESH_DATA_SIZE(addr, data_ptr);
|
||||
PMIX_CONSTRUCT(&buffer, pmix_buffer_t);
|
||||
PMIX_LOAD_BUFFER(pmix_globals.mypeer, &buffer, data_ptr, data_size);
|
||||
PMIX_LOAD_BUFFER(_client_peer(), &buffer, data_ptr, data_size);
|
||||
int cnt = 1;
|
||||
/* unpack value for this key from the buffer. */
|
||||
PMIX_VALUE_CONSTRUCT(&val);
|
||||
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &buffer, &val, &cnt, PMIX_VALUE);
|
||||
PMIX_BFROPS_UNPACK(rc, _client_peer(), &buffer, &val, &cnt, PMIX_VALUE);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
goto done;
|
||||
@ -2510,16 +2495,16 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank,
|
||||
uint8_t *data_ptr = ESH_DATA_PTR(addr);
|
||||
size_t data_size = ESH_DATA_SIZE(addr, data_ptr);
|
||||
PMIX_CONSTRUCT(&buffer, pmix_buffer_t);
|
||||
PMIX_LOAD_BUFFER(pmix_globals.mypeer, &buffer, data_ptr, data_size);
|
||||
PMIX_LOAD_BUFFER(_client_peer(), &buffer, data_ptr, data_size);
|
||||
int cnt = 1;
|
||||
/* unpack value for this key from the buffer. */
|
||||
PMIX_VALUE_CONSTRUCT(&val);
|
||||
PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &buffer, &val, &cnt, PMIX_VALUE);
|
||||
PMIX_BFROPS_UNPACK(rc, _client_peer(), &buffer, &val, &cnt, PMIX_VALUE);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
goto done;
|
||||
}
|
||||
PMIX_BFROPS_COPY(rc, pmix_globals.mypeer, (void**)kvs, &val, PMIX_VALUE);
|
||||
PMIX_BFROPS_COPY(rc, _client_peer(), (void**)kvs, &val, PMIX_VALUE);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
goto done;
|
||||
@ -2948,42 +2933,72 @@ static pmix_status_t _store_job_info(pmix_proc_t *proc)
|
||||
pmix_cb_t cb;
|
||||
pmix_kval_t *kv;
|
||||
pmix_buffer_t buf;
|
||||
pmix_kval_t *kv2 = NULL;
|
||||
pmix_kval_t *kv2 = NULL, *kvp;
|
||||
pmix_status_t rc = PMIX_SUCCESS;
|
||||
|
||||
kv2 = PMIX_NEW(pmix_kval_t);
|
||||
PMIX_VALUE_CREATE(kv2->value, 1);
|
||||
kv2->value->type = PMIX_BYTE_OBJECT;
|
||||
|
||||
PMIX_CONSTRUCT(&buf, pmix_buffer_t);
|
||||
PMIX_CONSTRUCT(&cb, pmix_cb_t);
|
||||
PMIX_CONSTRUCT(&buf, pmix_buffer_t);
|
||||
kvp = PMIX_NEW(pmix_kval_t);
|
||||
PMIX_VALUE_CREATE(kvp->value, 1);
|
||||
kvp->value->type = PMIX_BYTE_OBJECT;
|
||||
|
||||
cb.proc = proc;
|
||||
cb.scope = PMIX_INTERNAL;
|
||||
cb.copy = false;
|
||||
|
||||
PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
if (rc == PMIX_ERR_PROC_ENTRY_NOT_FOUND) {
|
||||
/* there is no error if no data for job info */
|
||||
rc = PMIX_SUCCESS;
|
||||
}
|
||||
goto exit;
|
||||
}
|
||||
|
||||
PMIX_CONSTRUCT(&buf, pmix_buffer_t);
|
||||
PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) {
|
||||
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, kv, 1, PMIX_KVAL);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
goto exit;
|
||||
if (!PMIX_PROC_IS_V21(_client_peer()) && 0 != strncmp("pmix.", kv->key, 4) &&
|
||||
kv->value->type == PMIX_DATA_ARRAY) {
|
||||
pmix_info_t *info;
|
||||
size_t size, i;
|
||||
info = kv->value->data.darray->array;
|
||||
size = kv->value->data.darray->size;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
if (0 == strcmp(PMIX_LOCAL_PEERS, info[i].key)) {
|
||||
kv2 = PMIX_NEW(pmix_kval_t);
|
||||
kv2->key = strdup(kv->key);
|
||||
PMIX_VALUE_XFER(rc, kv2->value, &info[i].value);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
PMIX_RELEASE(kv2);
|
||||
goto exit;
|
||||
}
|
||||
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, kv2, 1, PMIX_KVAL);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
PMIX_RELEASE(kv2);
|
||||
goto exit;
|
||||
}
|
||||
PMIX_RELEASE(kv2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, kv, 1, PMIX_KVAL);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
PMIX_UNLOAD_BUFFER(&buf, kv2->value->data.bo.bytes, kv2->value->data.bo.size);
|
||||
|
||||
if (PMIX_SUCCESS != (rc = _dstore_store(proc->nspace, proc->rank, kv2))) {
|
||||
PMIX_UNLOAD_BUFFER(&buf, kvp->value->data.bo.bytes, kvp->value->data.bo.size);
|
||||
if (PMIX_SUCCESS != (rc = _dstore_store(proc->nspace, proc->rank, kvp))) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
exit:
|
||||
PMIX_RELEASE(kv2);
|
||||
PMIX_RELEASE(kvp);
|
||||
PMIX_DESTRUCT(&cb);
|
||||
PMIX_DESTRUCT(&buf);
|
||||
return rc;
|
||||
@ -3005,6 +3020,7 @@ static pmix_status_t dstore_register_job_info(struct pmix_peer_t *pr,
|
||||
peer->info->pname.nspace, peer->info->pname.rank);
|
||||
|
||||
if (0 == ns->ndelivered) { // don't store twice
|
||||
_client_compat_save(peer);
|
||||
(void)strncpy(proc.nspace, ns->nspace, PMIX_MAX_NSLEN);
|
||||
proc.rank = PMIX_RANK_WILDCARD;
|
||||
rc = _store_job_info(&proc);
|
||||
@ -3050,3 +3066,24 @@ static pmix_status_t dstore_store_job_info(const char *nspace, pmix_buffer_t *b
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void _client_compat_save(pmix_peer_t *peer)
|
||||
{
|
||||
pmix_nspace_t *nptr = NULL;
|
||||
|
||||
if (NULL == _clients_peer) {
|
||||
_clients_peer = PMIX_NEW(pmix_peer_t);
|
||||
nptr = PMIX_NEW(pmix_nspace_t);
|
||||
_clients_peer->nptr = nptr;
|
||||
}
|
||||
_clients_peer->nptr->compat = peer->nptr->compat;
|
||||
_clients_peer->proc_type = peer->proc_type;
|
||||
}
|
||||
|
||||
static inline pmix_peer_t * _client_peer(void)
|
||||
{
|
||||
if (NULL == _clients_peer) {
|
||||
return pmix_client_globals.myserver;
|
||||
}
|
||||
return _clients_peer;
|
||||
}
|
||||
|
@ -107,7 +107,9 @@ static int _mmap_segment_create(pmix_pshmem_seg_t *sm_seg, const char *file_name
|
||||
rc = PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
map_memory:
|
||||
#ifdef HAVE_POSIX_FALLOCATE
|
||||
map_memory:
|
||||
#endif
|
||||
if (MAP_FAILED == (seg_addr = mmap(NULL, size,
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED,
|
||||
sm_seg->seg_id, 0))) {
|
||||
|
@ -87,8 +87,6 @@ static void server_message_handler(struct pmix_peer_t *pr,
|
||||
pmix_ptl_hdr_t *hdr,
|
||||
pmix_buffer_t *buf, void *cbdata);
|
||||
|
||||
static inline int _my_client(const char *nspace, pmix_rank_t rank);
|
||||
|
||||
PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
|
||||
pmix_info_t info[], size_t ninfo)
|
||||
{
|
||||
@ -1916,13 +1914,23 @@ static void _cnct(int sd, short args, void *cbdata)
|
||||
}
|
||||
}
|
||||
PMIX_DESTRUCT(&cb);
|
||||
PMIX_UNLOAD_BUFFER(&pbkt, bo.bytes, bo.size);
|
||||
PMIX_BFROPS_PACK(rc, cd->peer, reply, &bo, 1, PMIX_BYTE_OBJECT);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
PMIX_RELEASE(reply);
|
||||
PMIX_DESTRUCT(&pbkt);
|
||||
goto cleanup;
|
||||
if (PMIX_PROC_IS_V21(cd->peer)) {
|
||||
PMIX_UNLOAD_BUFFER(&pbkt, bo.bytes, bo.size);
|
||||
PMIX_BFROPS_PACK(rc, cd->peer, reply, &bo, 1, PMIX_BYTE_OBJECT);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
PMIX_RELEASE(reply);
|
||||
PMIX_DESTRUCT(&pbkt);
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
PMIX_BFROPS_PACK(rc, cd->peer, reply, &pbkt, 1, PMIX_BUFFER);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
PMIX_ERROR_LOG(rc);
|
||||
PMIX_RELEASE(reply);
|
||||
PMIX_DESTRUCT(&pbkt);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
PMIX_DESTRUCT(&pbkt);
|
||||
}
|
||||
@ -2339,21 +2347,3 @@ static void server_message_handler(struct pmix_peer_t *pr,
|
||||
PMIX_SERVER_QUEUE_REPLY(peer, hdr->tag, reply);
|
||||
}
|
||||
}
|
||||
|
||||
static inline int _my_client(const char *nspace, pmix_rank_t rank)
|
||||
{
|
||||
pmix_peer_t *peer;
|
||||
int i;
|
||||
int local = 0;
|
||||
|
||||
for (i = 0; i < pmix_server_globals.clients.size; i++) {
|
||||
if (NULL != (peer = (pmix_peer_t *)pmix_pointer_array_get_item(&pmix_server_globals.clients, i))) {
|
||||
if (0 == strcmp(peer->info->pname.nspace, nspace) && peer->info->pname.rank == rank) {
|
||||
local = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return local;
|
||||
}
|
||||
|
@ -93,11 +93,6 @@ int main(int argc, char **argv)
|
||||
info[0].value.type = PMIX_STRING;
|
||||
info[0].value.data.string = strdup(params.gds_mode);
|
||||
ninfo = 1;
|
||||
{
|
||||
int delay = 0;
|
||||
while(delay)
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, info, ninfo))) {
|
||||
TEST_ERROR(("Client ns %s rank %d: PMIx_Init failed: %d", params.nspace, params.rank, rc));
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user