Merge pull request #3873 from ggouaillardet/topic/pmix_info_create_zero
pmix: do not invoke PMIX_INFO_CREATE() with a zero size
Этот коммит содержится в:
Коммит
49d68f4343
@ -14,12 +14,17 @@
|
||||
dist_opaldata_DATA = help-pmix-ext2x.txt
|
||||
|
||||
sources = \
|
||||
pmix2x.h \
|
||||
pmix2x_component.c \
|
||||
pmix2x.c \
|
||||
pmix2x_client.c \
|
||||
pmix2x_server_south.c \
|
||||
pmix2x_server_north.c
|
||||
ext2x_local.c
|
||||
|
||||
nodist_headers = \
|
||||
ext2x.h
|
||||
|
||||
nodist_sources = \
|
||||
ext2x.c \
|
||||
ext2x_client.c \
|
||||
ext2x_component.c \
|
||||
ext2x_server_north.c \
|
||||
ext2x_server_south.c
|
||||
|
||||
# Make the output library in this directory, and name it either
|
||||
# mca_<type>_<name>.la (for DSO builds) or libmca_<type>_<name>.la
|
||||
@ -33,9 +38,23 @@ component_noinst = libmca_pmix_ext2x.la
|
||||
component_install =
|
||||
endif
|
||||
|
||||
#
|
||||
# Generate ext2x sources from the pmix2x component
|
||||
#
|
||||
$(nodist_headers):
|
||||
pmix2xname=`echo $@ | sed -e s/ext2x/pmix2x/g` ; \
|
||||
$(SED) 's/pmix2x/ext2x/g' $(top_srcdir)/opal/mca/pmix/pmix2x/$$pmix2xname > $@
|
||||
|
||||
$(sources): $(nodist_headers)
|
||||
|
||||
$(nodist_sources): $(nodist_headers)
|
||||
pmix2xname=`echo $@ | sed -e s/ext2x/pmix2x/g` ; \
|
||||
$(SED) 's/pmix2x/ext2x/g' $(top_srcdir)/opal/mca/pmix/pmix2x/$$pmix2xname > $@
|
||||
|
||||
mcacomponentdir = $(opallibdir)
|
||||
mcacomponent_LTLIBRARIES = $(component_install)
|
||||
mca_pmix_ext2x_la_SOURCES = $(sources)
|
||||
nodist_mca_pmix_ext2x_la_SOURCES = $(nodist_sources)
|
||||
mca_pmix_ext2x_la_CFLAGS = $(opal_pmix_ext2x_CFLAGS)
|
||||
mca_pmix_ext2x_la_CPPFLAGS =$(opal_pmix_ext2x_CPPFLAGS)
|
||||
mca_pmix_ext2x_la_LDFLAGS = -module -avoid-version $(opal_pmix_ext2x_LDFLAGS)
|
||||
@ -48,3 +67,6 @@ libmca_pmix_ext2x_la_CFLAGS = $(opal_pmix_ext2x_CFLAGS)
|
||||
libmca_pmix_ext2x_la_CPPFLAGS = $(opal_pmix_ext2x_CPPFLAGS)
|
||||
libmca_pmix_ext2x_la_LDFLAGS = -module -avoid-version $(opal_pmix_ext2x_LDFLAGS)
|
||||
libmca_pmix_ext2x_la_LIBADD = $(opal_pmix_ext2x_LIBS)
|
||||
|
||||
clean-local:
|
||||
$(RM) -f $(nodist_sources) $(nodist_headers)
|
||||
|
27
opal/mca/pmix/ext2x/ext2x_local.c
Обычный файл
27
opal/mca/pmix/ext2x/ext2x_local.c
Обычный файл
@ -0,0 +1,27 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014-2015 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "opal_config.h"
|
||||
#include "opal/constants.h"
|
||||
|
||||
#include "ext2x.h"
|
||||
|
||||
int opal_pmix_ext2x_check_evars(void)
|
||||
{
|
||||
/* a dummy function */
|
||||
return OPAL_SUCCESS;
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1,332 +0,0 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef MCA_PMIX_EXT2X_H
|
||||
#define MCA_PMIX_EXT2X_H
|
||||
|
||||
#include "opal_config.h"
|
||||
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "opal/mca/mca.h"
|
||||
#include "opal/mca/event/event.h"
|
||||
#include "opal/util/proc.h"
|
||||
|
||||
#include "opal/mca/pmix/base/base.h"
|
||||
#include "pmix_server.h"
|
||||
#include "pmix_common.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
#ifdef OPAL_C_HAVE_VISIBILITY
|
||||
#define PMIX_HAVE_VISIBILITY 1
|
||||
#else
|
||||
#undef PMIX_HAVE_VISIBILITY
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
opal_pmix_base_component_t super;
|
||||
opal_list_t jobids;
|
||||
bool native_launch;
|
||||
size_t evindex;
|
||||
opal_list_t events;
|
||||
int cache_size;
|
||||
opal_list_t cache;
|
||||
opal_list_t dmdx;
|
||||
bool silence_warning;
|
||||
} mca_pmix_ext2x_component_t;
|
||||
|
||||
OPAL_DECLSPEC extern mca_pmix_ext2x_component_t mca_pmix_ext2x_component;
|
||||
|
||||
OPAL_DECLSPEC extern const opal_pmix_base_module_t opal_pmix_ext2x_module;
|
||||
|
||||
/**** INTERNAL OBJECTS ****/
|
||||
typedef struct {
|
||||
opal_list_item_t super;
|
||||
opal_jobid_t jobid;
|
||||
char nspace[PMIX_MAX_NSLEN + 1];
|
||||
} opal_ext2x_jobid_trkr_t;
|
||||
OBJ_CLASS_DECLARATION(opal_ext2x_jobid_trkr_t);
|
||||
|
||||
typedef struct {
|
||||
opal_list_item_t super;
|
||||
opal_pmix_lock_t lock;
|
||||
size_t index;
|
||||
opal_pmix_notification_fn_t handler;
|
||||
void *cbdata;
|
||||
} opal_ext2x_event_t;
|
||||
OBJ_CLASS_DECLARATION(opal_ext2x_event_t);
|
||||
|
||||
typedef struct {
|
||||
opal_list_item_t super;
|
||||
char *nspace;
|
||||
pmix_modex_cbfunc_t cbfunc;
|
||||
void *cbdata;
|
||||
} opal_ext2x_dmx_trkr_t;
|
||||
OBJ_CLASS_DECLARATION(opal_ext2x_dmx_trkr_t);
|
||||
|
||||
typedef struct {
|
||||
opal_object_t super;
|
||||
opal_event_t ev;
|
||||
pmix_status_t status;
|
||||
char *nspace;
|
||||
pmix_proc_t p;
|
||||
pmix_proc_t *procs;
|
||||
size_t nprocs;
|
||||
pmix_pdata_t *pdata;
|
||||
size_t npdata;
|
||||
pmix_proc_t *error_procs;
|
||||
size_t nerror_procs;
|
||||
pmix_info_t *info;
|
||||
size_t ninfo;
|
||||
pmix_app_t *apps;
|
||||
size_t sz;
|
||||
opal_pmix_lock_t lock;
|
||||
opal_list_t *codes;
|
||||
pmix_status_t *pcodes;
|
||||
size_t ncodes;
|
||||
pmix_query_t *queries;
|
||||
size_t nqueries;
|
||||
opal_ext2x_event_t *event;
|
||||
opal_pmix_op_cbfunc_t opcbfunc;
|
||||
opal_pmix_modex_cbfunc_t mdxcbfunc;
|
||||
opal_pmix_value_cbfunc_t valcbfunc;
|
||||
opal_pmix_lookup_cbfunc_t lkcbfunc;
|
||||
opal_pmix_spawn_cbfunc_t spcbfunc;
|
||||
opal_pmix_evhandler_reg_cbfunc_t evregcbfunc;
|
||||
opal_pmix_info_cbfunc_t qcbfunc;
|
||||
void *cbdata;
|
||||
} ext2x_opcaddy_t;
|
||||
OBJ_CLASS_DECLARATION(ext2x_opcaddy_t);
|
||||
|
||||
typedef struct {
|
||||
opal_object_t super;
|
||||
opal_list_t procs;
|
||||
opal_list_t info;
|
||||
opal_list_t apps;
|
||||
pmix_op_cbfunc_t opcbfunc;
|
||||
pmix_dmodex_response_fn_t dmdxfunc;
|
||||
pmix_modex_cbfunc_t mdxcbfunc;
|
||||
pmix_lookup_cbfunc_t lkupcbfunc;
|
||||
pmix_spawn_cbfunc_t spwncbfunc;
|
||||
pmix_info_cbfunc_t infocbfunc;
|
||||
pmix_tool_connection_cbfunc_t toolcbfunc;
|
||||
void *cbdata;
|
||||
opal_pmix_release_cbfunc_t odmdxfunc;
|
||||
void *ocbdata;
|
||||
} ext2x_opalcaddy_t;
|
||||
OBJ_CLASS_DECLARATION(ext2x_opalcaddy_t);
|
||||
|
||||
typedef struct {
|
||||
opal_object_t super;
|
||||
opal_event_t ev;
|
||||
opal_pmix_lock_t lock;
|
||||
const char *msg;
|
||||
char *strings;
|
||||
size_t id;
|
||||
int status;
|
||||
opal_process_name_t pname;
|
||||
opal_jobid_t jobid;
|
||||
const opal_process_name_t *source;
|
||||
opal_pmix_data_range_t range;
|
||||
bool nondefault;
|
||||
size_t handler;
|
||||
opal_value_t *val;
|
||||
opal_list_t *event_codes;
|
||||
opal_list_t *info;
|
||||
opal_list_t results;
|
||||
opal_pmix_notification_fn_t evhandler;
|
||||
opal_pmix_evhandler_reg_cbfunc_t cbfunc;
|
||||
opal_pmix_op_cbfunc_t opcbfunc;
|
||||
pmix_event_notification_cbfunc_fn_t pmixcbfunc;
|
||||
opal_pmix_value_cbfunc_t valcbfunc;
|
||||
opal_pmix_lookup_cbfunc_t lkcbfunc;
|
||||
void *cbdata;
|
||||
} ext2x_threadshift_t;
|
||||
OBJ_CLASS_DECLARATION(ext2x_threadshift_t);
|
||||
|
||||
#define OPAL_PMIX_OP_THREADSHIFT(e, fn, cb, cd) \
|
||||
do { \
|
||||
ext2x_threadshift_t *_cd; \
|
||||
_cd = OBJ_NEW(ext2x_threadshift_t); \
|
||||
_cd->handler = (e); \
|
||||
_cd->opcbfunc = (cb); \
|
||||
_cd->cbdata = (cd); \
|
||||
opal_event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
|
||||
-1, EV_WRITE, (fn), (_cd)); \
|
||||
OPAL_POST_OBJECT(_cd); \
|
||||
opal_event_active(&((_cd)->ev), EV_WRITE, 1); \
|
||||
} while(0)
|
||||
|
||||
#define OPAL_PMIX_THREADSHIFT(e, i, eh, fn, cb, cd) \
|
||||
do { \
|
||||
ext2x_threadshift_t *_cd; \
|
||||
_cd = OBJ_NEW(ext2x_threadshift_t); \
|
||||
_cd->event_codes = (e); \
|
||||
_cd->info = (i); \
|
||||
_cd->evhandler = (eh); \
|
||||
_cd->cbfunc = (cb); \
|
||||
_cd->cbdata = (cd); \
|
||||
opal_event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
|
||||
-1, EV_WRITE, (fn), (_cd)); \
|
||||
OPAL_POST_OBJECT(_cd); \
|
||||
opal_event_active(&((_cd)->ev), EV_WRITE, 1); \
|
||||
} while(0)
|
||||
|
||||
#define OPAL_PMIX_NOTIFY_THREADSHIFT(s, sr, r, i, fn, cb, cd) \
|
||||
do { \
|
||||
ext2x_threadshift_t *_cd; \
|
||||
_cd = OBJ_NEW(ext2x_threadshift_t); \
|
||||
_cd->status = (s); \
|
||||
_cd->source = (sr); \
|
||||
_cd->range = (r); \
|
||||
_cd->info = (i); \
|
||||
_cd->opcbfunc = (cb); \
|
||||
_cd->cbdata = (cd); \
|
||||
opal_event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
|
||||
-1, EV_WRITE, (fn), (_cd)); \
|
||||
OPAL_POST_OBJECT(_cd); \
|
||||
opal_event_active(&((_cd)->ev), EV_WRITE, 1); \
|
||||
} while(0)
|
||||
|
||||
#define OPAL_PMIX2X_THREADSHIFT(p, cb) \
|
||||
do { \
|
||||
opal_event_assign(&((p)->ev), opal_pmix_base.evbase, \
|
||||
-1, EV_WRITE, (cb), (p)); \
|
||||
OPAL_POST_OBJECT(p); \
|
||||
opal_event_active(&((p)->ev), EV_WRITE, 1); \
|
||||
} while(0)
|
||||
|
||||
/**** CLIENT FUNCTIONS ****/
|
||||
OPAL_MODULE_DECLSPEC int ext2x_client_init(opal_list_t *ilist);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_client_finalize(void);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_initialized(void);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_abort(int flag, const char *msg,
|
||||
opal_list_t *procs);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_commit(void);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_fence(opal_list_t *procs, int collect_data);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_fencenb(opal_list_t *procs, int collect_data,
|
||||
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_put(opal_pmix_scope_t scope,
|
||||
opal_value_t *val);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_get(const opal_process_name_t *proc, const char *key,
|
||||
opal_list_t *info, opal_value_t **val);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_getnb(const opal_process_name_t *proc, const char *key,
|
||||
opal_list_t *info,
|
||||
opal_pmix_value_cbfunc_t cbfunc, void *cbdata);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_publish(opal_list_t *info);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_publishnb(opal_list_t *info,
|
||||
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_lookup(opal_list_t *data, opal_list_t *info);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_lookupnb(char **keys, opal_list_t *info,
|
||||
opal_pmix_lookup_cbfunc_t cbfunc, void *cbdata);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_unpublish(char **keys, opal_list_t *info);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_unpublishnb(char **keys, opal_list_t *info,
|
||||
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_spawn(opal_list_t *job_info, opal_list_t *apps, opal_jobid_t *jobid);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_spawnnb(opal_list_t *job_info, opal_list_t *apps,
|
||||
opal_pmix_spawn_cbfunc_t cbfunc, void *cbdata);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_connect(opal_list_t *procs);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_connectnb(opal_list_t *procs,
|
||||
opal_pmix_op_cbfunc_t cbfunc,
|
||||
void *cbdata);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_disconnect(opal_list_t *procs);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_disconnectnb(opal_list_t *procs,
|
||||
opal_pmix_op_cbfunc_t cbfunc,
|
||||
void *cbdata);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_resolve_peers(const char *nodename, opal_jobid_t jobid,
|
||||
opal_list_t *procs);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_resolve_nodes(opal_jobid_t jobid, char **nodelist);
|
||||
|
||||
/**** TOOL FUNCTIONS ****/
|
||||
OPAL_MODULE_DECLSPEC int ext2x_tool_init(opal_list_t *info);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_tool_fini(void);
|
||||
|
||||
/**** COMMON FUNCTIONS ****/
|
||||
OPAL_MODULE_DECLSPEC int ext2x_store_local(const opal_process_name_t *proc,
|
||||
opal_value_t *val);
|
||||
|
||||
/**** SERVER SOUTHBOUND FUNCTIONS ****/
|
||||
OPAL_MODULE_DECLSPEC int ext2x_server_init(opal_pmix_server_module_t *module,
|
||||
opal_list_t *info);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_server_finalize(void);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_server_gen_regex(const char *input, char **regex);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_server_gen_ppn(const char *input, char **ppn);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_server_register_nspace(opal_jobid_t jobid,
|
||||
int nlocalprocs,
|
||||
opal_list_t *info,
|
||||
opal_pmix_op_cbfunc_t cbfunc,
|
||||
void *cbdata);
|
||||
OPAL_MODULE_DECLSPEC void ext2x_server_deregister_nspace(opal_jobid_t jobid,
|
||||
opal_pmix_op_cbfunc_t cbfunc,
|
||||
void *cbdata);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_server_register_client(const opal_process_name_t *proc,
|
||||
uid_t uid, gid_t gid,
|
||||
void *server_object,
|
||||
opal_pmix_op_cbfunc_t cbfunc,
|
||||
void *cbdata);
|
||||
OPAL_MODULE_DECLSPEC void ext2x_server_deregister_client(const opal_process_name_t *proc,
|
||||
opal_pmix_op_cbfunc_t cbfunc,
|
||||
void *cbdata);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_server_setup_fork(const opal_process_name_t *proc, char ***env);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_server_dmodex(const opal_process_name_t *proc,
|
||||
opal_pmix_modex_cbfunc_t cbfunc, void *cbdata);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_server_notify_event(int status,
|
||||
const opal_process_name_t *source,
|
||||
opal_list_t *info,
|
||||
opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
|
||||
|
||||
/**** COMPONENT UTILITY FUNCTIONS ****/
|
||||
OPAL_MODULE_DECLSPEC void ext2x_event_hdlr(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);
|
||||
OPAL_MODULE_DECLSPEC pmix_status_t ext2x_convert_opalrc(int rc);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_convert_rc(pmix_status_t rc);
|
||||
|
||||
OPAL_MODULE_DECLSPEC opal_vpid_t ext2x_convert_rank(pmix_rank_t rank);
|
||||
OPAL_MODULE_DECLSPEC pmix_rank_t ext2x_convert_opalrank(opal_vpid_t vpid);
|
||||
|
||||
OPAL_MODULE_DECLSPEC opal_pmix_scope_t ext2x_convert_scope(pmix_scope_t scope);
|
||||
OPAL_MODULE_DECLSPEC pmix_scope_t ext2x_convert_opalscope(opal_pmix_scope_t scope);
|
||||
|
||||
OPAL_MODULE_DECLSPEC pmix_data_range_t ext2x_convert_opalrange(opal_pmix_data_range_t range);
|
||||
OPAL_MODULE_DECLSPEC opal_pmix_data_range_t ext2x_convert_range(pmix_data_range_t range);
|
||||
|
||||
OPAL_MODULE_DECLSPEC opal_pmix_persistence_t ext2x_convert_persist(pmix_persistence_t scope);
|
||||
OPAL_MODULE_DECLSPEC pmix_persistence_t ext2x_convert_opalpersist(opal_pmix_persistence_t scope);
|
||||
|
||||
OPAL_MODULE_DECLSPEC void ext2x_value_load(pmix_value_t *v,
|
||||
opal_value_t *kv);
|
||||
OPAL_MODULE_DECLSPEC int ext2x_value_unload(opal_value_t *kv,
|
||||
const pmix_value_t *v);
|
||||
|
||||
OPAL_MODULE_DECLSPEC opal_pmix_alloc_directive_t ext2x_convert_allocdir(pmix_alloc_directive_t dir);
|
||||
|
||||
OPAL_MODULE_DECLSPEC char* ext2x_convert_jobid(opal_jobid_t jobid);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* MCA_PMIX_EXTERNAL_H */
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2016 Cisco Systems, 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 "opal_config.h"
|
||||
|
||||
#include "opal/constants.h"
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "opal/util/proc.h"
|
||||
#include "opal/mca/pmix/pmix.h"
|
||||
#include "pmix2x.h"
|
||||
|
||||
/*
|
||||
* Public string showing the pmix external component version number
|
||||
*/
|
||||
const char *opal_pmix_ext2x_component_version_string =
|
||||
"OPAL ext2x MCA component version " OPAL_VERSION;
|
||||
|
||||
/*
|
||||
* Local function
|
||||
*/
|
||||
static int external_register(void);
|
||||
static int external_open(void);
|
||||
static int external_close(void);
|
||||
static int external_component_query(mca_base_module_t **module, int *priority);
|
||||
|
||||
|
||||
/*
|
||||
* Instantiate the public struct with all of our public information
|
||||
* and pointers to our public functions in it
|
||||
*/
|
||||
|
||||
mca_pmix_ext2x_component_t mca_pmix_ext2x_component = {
|
||||
{
|
||||
/* First, the mca_component_t struct containing meta information
|
||||
about the component itself */
|
||||
|
||||
.base_version = {
|
||||
/* Indicate that we are a pmix v1.1.0 component (which also
|
||||
implies a specific MCA version) */
|
||||
|
||||
OPAL_PMIX_BASE_VERSION_2_0_0,
|
||||
|
||||
/* Component name and version */
|
||||
|
||||
.mca_component_name = "ext2x",
|
||||
MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
|
||||
OPAL_RELEASE_VERSION),
|
||||
|
||||
/* Component open and close functions */
|
||||
|
||||
.mca_open_component = external_open,
|
||||
.mca_close_component = external_close,
|
||||
.mca_query_component = external_component_query,
|
||||
.mca_register_component_params = external_register
|
||||
},
|
||||
/* Next the MCA v1.0.0 component meta data */
|
||||
.base_data = {
|
||||
/* The component is checkpoint ready */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
}
|
||||
},
|
||||
.native_launch = false
|
||||
};
|
||||
|
||||
static int external_register(void)
|
||||
{
|
||||
mca_base_component_t *component = &mca_pmix_ext2x_component.super.base_version;
|
||||
|
||||
mca_pmix_ext2x_component.silence_warning = false;
|
||||
(void) mca_base_component_var_register (component, "silence_warning",
|
||||
"Silence warning about PMIX_INSTALL_PREFIX",
|
||||
MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
|
||||
OPAL_INFO_LVL_4,
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
&mca_pmix_ext2x_component.silence_warning);
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
static int external_open(void)
|
||||
{
|
||||
mca_pmix_ext2x_component.evindex = 0;
|
||||
OBJ_CONSTRUCT(&mca_pmix_ext2x_component.jobids, opal_list_t);
|
||||
OBJ_CONSTRUCT(&mca_pmix_ext2x_component.events, opal_list_t);
|
||||
OBJ_CONSTRUCT(&mca_pmix_ext2x_component.dmdx, opal_list_t);
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
static int external_close(void)
|
||||
{
|
||||
OPAL_LIST_DESTRUCT(&mca_pmix_ext2x_component.jobids);
|
||||
OPAL_LIST_DESTRUCT(&mca_pmix_ext2x_component.events);
|
||||
OPAL_LIST_DESTRUCT(&mca_pmix_ext2x_component.dmdx);
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int external_component_query(mca_base_module_t **module, int *priority)
|
||||
{
|
||||
char *t, *id;
|
||||
|
||||
/* see if a PMIx server is present */
|
||||
if (NULL != (t = getenv("PMIX_SERVER_URI")) ||
|
||||
NULL != (id = getenv("PMIX_ID"))) {
|
||||
/* if PMIx is present, then we are a client and need to use it */
|
||||
*priority = 100;
|
||||
} else {
|
||||
/* we could be a server, so we still need to be considered */
|
||||
*priority = 5;
|
||||
}
|
||||
*module = (mca_base_module_t *)&opal_pmix_ext2x_module;
|
||||
return OPAL_SUCCESS;
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1,556 +0,0 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "opal_config.h"
|
||||
#include "opal/constants.h"
|
||||
#include "opal/types.h"
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "opal/dss/dss.h"
|
||||
#include "opal/mca/event/event.h"
|
||||
#include "opal/mca/hwloc/base/base.h"
|
||||
#include "opal/runtime/opal.h"
|
||||
#include "opal/runtime/opal_progress_threads.h"
|
||||
#include "opal/threads/threads.h"
|
||||
#include "opal/util/argv.h"
|
||||
#include "opal/util/error.h"
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/util/opal_environ.h"
|
||||
#include "opal/util/proc.h"
|
||||
#include "opal/util/show_help.h"
|
||||
#include "opal/mca/pmix/base/base.h"
|
||||
#include "pmix2x.h"
|
||||
|
||||
#include "pmix.h"
|
||||
#include "pmix_server.h"
|
||||
|
||||
/**** S.O.U.T.H.B.O.U.N.D I.N.T.E.R.F.A.C.E.S ****/
|
||||
|
||||
/* These are the interfaces used by the OMPI/ORTE/OPAL layer to call
|
||||
* down into the embedded PMIx server. */
|
||||
|
||||
extern pmix_server_module_t mymodule;
|
||||
extern opal_pmix_server_module_t *host_module;
|
||||
static char *dbgvalue=NULL;
|
||||
|
||||
static void errreg_cbfunc (pmix_status_t status,
|
||||
size_t errhandler_ref,
|
||||
void *cbdata)
|
||||
{
|
||||
opal_ext2x_event_t *ev = (opal_ext2x_event_t*)cbdata;
|
||||
|
||||
OPAL_ACQUIRE_OBJECT(ev);
|
||||
ev->index = errhandler_ref;
|
||||
opal_output_verbose(5, opal_pmix_base_framework.framework_output,
|
||||
"PMIX server errreg_cbfunc - error handler registered status=%d, reference=%lu",
|
||||
status, (unsigned long)errhandler_ref);
|
||||
OPAL_POST_OBJECT(ev);
|
||||
OPAL_PMIX_WAKEUP_THREAD(&ev->lock);
|
||||
}
|
||||
|
||||
static void opcbfunc(pmix_status_t status, void *cbdata)
|
||||
{
|
||||
ext2x_opcaddy_t *op = (ext2x_opcaddy_t*)cbdata;
|
||||
|
||||
OPAL_ACQUIRE_OBJECT(op);
|
||||
|
||||
if (NULL != op->opcbfunc) {
|
||||
op->opcbfunc(ext2x_convert_rc(status), op->cbdata);
|
||||
}
|
||||
OBJ_RELEASE(op);
|
||||
}
|
||||
|
||||
static void lkcbfunc(pmix_status_t status, void *cbdata)
|
||||
{
|
||||
opal_pmix_lock_t *lk = (opal_pmix_lock_t*)cbdata;
|
||||
|
||||
OPAL_POST_OBJECT(lk);
|
||||
OPAL_PMIX_WAKEUP_THREAD(lk);
|
||||
}
|
||||
|
||||
int ext2x_server_init(opal_pmix_server_module_t *module,
|
||||
opal_list_t *info)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
int dbg;
|
||||
opal_value_t *kv;
|
||||
pmix_info_t *pinfo;
|
||||
size_t sz, n;
|
||||
opal_ext2x_event_t *event;
|
||||
opal_ext2x_jobid_trkr_t *job;
|
||||
opal_pmix_lock_t lk;
|
||||
|
||||
OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
if (0 == opal_pmix_base.initialized) {
|
||||
if (0 < (dbg = opal_output_get_verbosity(opal_pmix_base_framework.framework_output))) {
|
||||
asprintf(&dbgvalue, "PMIX_DEBUG=%d", dbg);
|
||||
putenv(dbgvalue);
|
||||
}
|
||||
}
|
||||
++opal_pmix_base.initialized;
|
||||
|
||||
/* convert the list to an array of pmix_info_t */
|
||||
if (NULL != info) {
|
||||
sz = opal_list_get_size(info) + 2;
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&pinfo[n].value, kv);
|
||||
++n;
|
||||
}
|
||||
} else {
|
||||
sz = 2;
|
||||
PMIX_INFO_CREATE(pinfo, 2);
|
||||
}
|
||||
|
||||
/* insert ourselves into our list of jobids - it will be the
|
||||
* first, and so we'll check it first */
|
||||
job = OBJ_NEW(opal_ext2x_jobid_trkr_t);
|
||||
(void)opal_snprintf_jobid(job->nspace, PMIX_MAX_NSLEN, OPAL_PROC_MY_NAME.jobid);
|
||||
job->jobid = OPAL_PROC_MY_NAME.jobid;
|
||||
opal_list_append(&mca_pmix_ext2x_component.jobids, &job->super);
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
/* add our nspace and rank to the array going down to the PMIx server */
|
||||
PMIX_INFO_LOAD(&pinfo[sz-2], PMIX_SERVER_NSPACE, job->nspace, PMIX_STRING);
|
||||
PMIX_INFO_LOAD(&pinfo[sz-1], PMIX_SERVER_RANK, &OPAL_PROC_MY_NAME.vpid, PMIX_PROC_RANK);
|
||||
if (PMIX_SUCCESS != (rc = PMIx_server_init(&mymodule, pinfo, sz))) {
|
||||
PMIX_INFO_FREE(pinfo, sz);
|
||||
return ext2x_convert_rc(rc);
|
||||
}
|
||||
PMIX_INFO_FREE(pinfo, sz);
|
||||
|
||||
/* record the host module */
|
||||
host_module = module;
|
||||
|
||||
/* register the default event handler */
|
||||
event = OBJ_NEW(opal_ext2x_event_t);
|
||||
opal_list_append(&mca_pmix_ext2x_component.events, &event->super);
|
||||
PMIX_INFO_CREATE(pinfo, 1);
|
||||
PMIX_INFO_LOAD(&pinfo[0], PMIX_EVENT_HDLR_NAME, "OPAL-PMIX-2X-SERVER-DEFAULT", PMIX_STRING);
|
||||
PMIx_Register_event_handler(NULL, 0, pinfo, 1, ext2x_event_hdlr, errreg_cbfunc, (void*)event);
|
||||
OPAL_PMIX_WAIT_THREAD(&event->lock);
|
||||
PMIX_INFO_FREE(pinfo, 1);
|
||||
|
||||
/* as we might want to use some client-side functions, be sure
|
||||
* to register our own nspace */
|
||||
OPAL_PMIX_CONSTRUCT_LOCK(&lk);
|
||||
PMIX_INFO_CREATE(pinfo, 1);
|
||||
PMIX_INFO_LOAD(&pinfo[0], PMIX_REGISTER_NODATA, NULL, PMIX_BOOL);
|
||||
PMIx_server_register_nspace(job->nspace, 1, pinfo, 1, lkcbfunc, (void*)&lk);
|
||||
OPAL_PMIX_WAIT_THREAD(&lk);
|
||||
OPAL_PMIX_DESTRUCT_LOCK(&lk);
|
||||
PMIX_INFO_FREE(pinfo, 1);
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
static void dereg_cbfunc(pmix_status_t st, void *cbdata)
|
||||
{
|
||||
opal_ext2x_event_t *ev = (opal_ext2x_event_t*)cbdata;
|
||||
OPAL_PMIX_WAKEUP_THREAD(&ev->lock);
|
||||
}
|
||||
|
||||
int ext2x_server_finalize(void)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
opal_ext2x_event_t *event, *ev2;
|
||||
|
||||
OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock);
|
||||
--opal_pmix_base.initialized;
|
||||
|
||||
if (0 < opal_pmix_base.initialized) {
|
||||
/* deregister all event handlers */
|
||||
OPAL_LIST_FOREACH_SAFE(event, ev2, &mca_pmix_ext2x_component.events, opal_ext2x_event_t) {
|
||||
OPAL_PMIX_DESTRUCT_LOCK(&event->lock);
|
||||
OPAL_PMIX_CONSTRUCT_LOCK(&event->lock);
|
||||
PMIx_Deregister_event_handler(event->index, dereg_cbfunc, (void*)event);
|
||||
OPAL_PMIX_WAIT_THREAD(&event->lock);
|
||||
opal_list_remove_item(&mca_pmix_ext2x_component.events, &event->super);
|
||||
OBJ_RELEASE(event);
|
||||
}
|
||||
}
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
rc = PMIx_server_finalize();
|
||||
return ext2x_convert_rc(rc);
|
||||
}
|
||||
|
||||
int ext2x_server_gen_regex(const char *input, char **regex)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
|
||||
OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock);
|
||||
if (0 >= opal_pmix_base.initialized) {
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
return OPAL_ERR_NOT_INITIALIZED;
|
||||
}
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
rc = PMIx_generate_regex(input, regex);
|
||||
return ext2x_convert_rc(rc);
|
||||
}
|
||||
|
||||
|
||||
int ext2x_server_gen_ppn(const char *input, char **ppn)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
|
||||
OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock);
|
||||
if (0 >= opal_pmix_base.initialized) {
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
return OPAL_ERR_NOT_INITIALIZED;
|
||||
}
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
rc = PMIx_generate_ppn(input, ppn);
|
||||
return ext2x_convert_rc(rc);
|
||||
}
|
||||
|
||||
int ext2x_server_register_nspace(opal_jobid_t jobid,
|
||||
int nlocalprocs,
|
||||
opal_list_t *info,
|
||||
opal_pmix_op_cbfunc_t cbfunc,
|
||||
void *cbdata)
|
||||
{
|
||||
opal_value_t *kv, *k2;
|
||||
pmix_info_t *pinfo = NULL, *pmap;
|
||||
size_t sz, szmap, m, n;
|
||||
char nspace[PMIX_MAX_NSLEN];
|
||||
pmix_status_t rc;
|
||||
opal_list_t *pmapinfo;
|
||||
opal_ext2x_jobid_trkr_t *job;
|
||||
opal_pmix_lock_t lock;
|
||||
int ret;
|
||||
|
||||
OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock);
|
||||
if (0 >= opal_pmix_base.initialized) {
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
return OPAL_ERR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
/* convert the jobid */
|
||||
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);
|
||||
|
||||
/* store this job in our list of known nspaces */
|
||||
job = OBJ_NEW(opal_ext2x_jobid_trkr_t);
|
||||
(void)strncpy(job->nspace, nspace, PMIX_MAX_NSLEN);
|
||||
job->jobid = jobid;
|
||||
opal_list_append(&mca_pmix_ext2x_component.jobids, &job->super);
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
/* convert the list to an array of pmix_info_t */
|
||||
if (NULL != info) {
|
||||
sz = opal_list_get_size(info);
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
if (0 == strcmp(kv->key, OPAL_PMIX_PROC_DATA)) {
|
||||
pinfo[n].value.type = PMIX_DATA_ARRAY;
|
||||
/* the value contains a list of values - convert
|
||||
* that list to another array */
|
||||
pmapinfo = (opal_list_t*)kv->data.ptr;
|
||||
szmap = opal_list_get_size(pmapinfo);
|
||||
PMIX_INFO_CREATE(pmap, szmap);
|
||||
pinfo[n].value.data.darray = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t));
|
||||
pinfo[n].value.data.darray->type = PMIX_INFO;
|
||||
pinfo[n].value.data.darray->array = (struct pmix_info_t*)pmap;
|
||||
pinfo[n].value.data.darray->size = szmap;
|
||||
m = 0;
|
||||
OPAL_LIST_FOREACH(k2, pmapinfo, opal_value_t) {
|
||||
(void)strncpy(pmap[m].key, k2->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&pmap[m].value, k2);
|
||||
++m;
|
||||
}
|
||||
OPAL_LIST_RELEASE(pmapinfo);
|
||||
} else {
|
||||
ext2x_value_load(&pinfo[n].value, kv);
|
||||
}
|
||||
++n;
|
||||
}
|
||||
} else {
|
||||
sz = 0;
|
||||
pinfo = NULL;
|
||||
}
|
||||
|
||||
OPAL_PMIX_CONSTRUCT_LOCK(&lock);
|
||||
rc = PMIx_server_register_nspace(nspace, nlocalprocs, pinfo, sz,
|
||||
lkcbfunc, (void*)&lock);
|
||||
if (PMIX_SUCCESS == rc) {
|
||||
OPAL_PMIX_WAIT_THREAD(&lock);
|
||||
}
|
||||
OPAL_PMIX_DESTRUCT_LOCK(&lock);
|
||||
|
||||
if (NULL != pinfo) {
|
||||
PMIX_INFO_FREE(pinfo, sz);
|
||||
}
|
||||
|
||||
ret = ext2x_convert_rc(rc);
|
||||
|
||||
/* release the caller */
|
||||
if (NULL != cbfunc) {
|
||||
cbfunc(ret, cbdata);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ext2x_server_deregister_nspace(opal_jobid_t jobid,
|
||||
opal_pmix_op_cbfunc_t cbfunc,
|
||||
void *cbdata)
|
||||
{
|
||||
opal_ext2x_jobid_trkr_t *jptr;
|
||||
opal_pmix_lock_t lock;
|
||||
|
||||
OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock);
|
||||
if (0 >= opal_pmix_base.initialized) {
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
/* release the caller */
|
||||
if (NULL != cbfunc) {
|
||||
cbfunc(OPAL_ERR_NOT_INITIALIZED, cbdata);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* if we don't already have it, we can ignore this */
|
||||
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext2x_component.jobids, opal_ext2x_jobid_trkr_t) {
|
||||
if (jptr->jobid == jobid) {
|
||||
/* found it - tell the server to deregister */
|
||||
OPAL_PMIX_CONSTRUCT_LOCK(&lock);
|
||||
PMIx_server_deregister_nspace(jptr->nspace, lkcbfunc, (void*)&lock);
|
||||
OPAL_PMIX_WAIT_THREAD(&lock);
|
||||
OPAL_PMIX_DESTRUCT_LOCK(&lock);
|
||||
/* now get rid of it from our list */
|
||||
opal_list_remove_item(&mca_pmix_ext2x_component.jobids, &jptr->super);
|
||||
OBJ_RELEASE(jptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
/* release the caller */
|
||||
if (NULL != cbfunc) {
|
||||
cbfunc(OPAL_SUCCESS, cbdata);
|
||||
}
|
||||
}
|
||||
|
||||
int ext2x_server_register_client(const opal_process_name_t *proc,
|
||||
uid_t uid, gid_t gid,
|
||||
void *server_object,
|
||||
opal_pmix_op_cbfunc_t cbfunc,
|
||||
void *cbdata)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
pmix_proc_t p;
|
||||
opal_pmix_lock_t lock;
|
||||
|
||||
OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock);
|
||||
if (0 >= opal_pmix_base.initialized) {
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
return OPAL_ERR_NOT_INITIALIZED;
|
||||
}
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
/* convert the jobid */
|
||||
(void)opal_snprintf_jobid(p.nspace, PMIX_MAX_NSLEN, proc->jobid);
|
||||
p.rank = ext2x_convert_opalrank(proc->vpid);
|
||||
|
||||
OPAL_PMIX_CONSTRUCT_LOCK(&lock);
|
||||
rc = PMIx_server_register_client(&p, uid, gid, server_object,
|
||||
lkcbfunc, (void*)&lock);
|
||||
if (PMIX_SUCCESS == rc) {
|
||||
OPAL_PMIX_WAIT_THREAD(&lock);
|
||||
}
|
||||
OPAL_PMIX_DESTRUCT_LOCK(&lock);
|
||||
return ext2x_convert_rc(rc);
|
||||
}
|
||||
|
||||
/* tell the local PMIx server to cleanup this client as it is
|
||||
* done executing */
|
||||
void ext2x_server_deregister_client(const opal_process_name_t *proc,
|
||||
opal_pmix_op_cbfunc_t cbfunc,
|
||||
void *cbdata)
|
||||
{
|
||||
opal_ext2x_jobid_trkr_t *jptr;
|
||||
pmix_proc_t p;
|
||||
opal_pmix_lock_t lock;
|
||||
|
||||
OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock);
|
||||
if (0 >= opal_pmix_base.initialized) {
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
if (NULL != cbfunc) {
|
||||
cbfunc(OPAL_ERR_NOT_INITIALIZED, cbdata);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* if we don't already have it, we can ignore this */
|
||||
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext2x_component.jobids, opal_ext2x_jobid_trkr_t) {
|
||||
if (jptr->jobid == proc->jobid) {
|
||||
/* found it - tell the server to deregister */
|
||||
(void)strncpy(p.nspace, jptr->nspace, PMIX_MAX_NSLEN);
|
||||
p.rank = ext2x_convert_opalrank(proc->vpid);
|
||||
OPAL_PMIX_CONSTRUCT_LOCK(&lock);
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
PMIx_server_deregister_client(&p, lkcbfunc, (void*)&lock);
|
||||
OPAL_PMIX_WAIT_THREAD(&lock);
|
||||
OPAL_PMIX_DESTRUCT_LOCK(&lock);
|
||||
OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock);
|
||||
break;
|
||||
}
|
||||
}
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
if (NULL != cbfunc) {
|
||||
cbfunc(OPAL_SUCCESS, cbdata);
|
||||
}
|
||||
}
|
||||
|
||||
/* have the local PMIx server setup the environment for this client */
|
||||
int ext2x_server_setup_fork(const opal_process_name_t *proc, char ***env)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
pmix_proc_t p;
|
||||
|
||||
OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock);
|
||||
if (0 >= opal_pmix_base.initialized) {
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
return OPAL_ERR_NOT_INITIALIZED;
|
||||
}
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
/* convert the jobid */
|
||||
(void)opal_snprintf_jobid(p.nspace, PMIX_MAX_NSLEN, proc->jobid);
|
||||
p.rank = ext2x_convert_opalrank(proc->vpid);
|
||||
|
||||
rc = PMIx_server_setup_fork(&p, env);
|
||||
return ext2x_convert_rc(rc);
|
||||
}
|
||||
|
||||
/* this is the call back up from the embedded PMIx server that
|
||||
* will contain the returned data. Note that the embedded server
|
||||
* "owns" the data and will free it upon return from this function */
|
||||
static void dmdx_response(pmix_status_t status, char *data, size_t sz, void *cbdata)
|
||||
{
|
||||
int rc;
|
||||
ext2x_opcaddy_t *op = (ext2x_opcaddy_t*)cbdata;
|
||||
|
||||
rc = ext2x_convert_rc(status);
|
||||
if (NULL != op->mdxcbfunc) {
|
||||
op->mdxcbfunc(rc, data, sz, op->cbdata, NULL, NULL);
|
||||
}
|
||||
OBJ_RELEASE(op);
|
||||
}
|
||||
|
||||
/* request modex data for a local proc from the PMIx server */
|
||||
int ext2x_server_dmodex(const opal_process_name_t *proc,
|
||||
opal_pmix_modex_cbfunc_t cbfunc, void *cbdata)
|
||||
{
|
||||
ext2x_opcaddy_t *op;
|
||||
pmix_status_t rc;
|
||||
|
||||
OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock);
|
||||
if (0 >= opal_pmix_base.initialized) {
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
return OPAL_ERR_NOT_INITIALIZED;
|
||||
}
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
/* setup the caddy */
|
||||
op = OBJ_NEW(ext2x_opcaddy_t);
|
||||
op->mdxcbfunc = cbfunc;
|
||||
op->cbdata = cbdata;
|
||||
|
||||
/* convert the jobid */
|
||||
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
|
||||
op->p.rank = ext2x_convert_opalrank(proc->vpid);
|
||||
|
||||
/* find the internally-cached data for this proc */
|
||||
rc = PMIx_server_dmodex_request(&op->p, dmdx_response, op);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
OBJ_RELEASE(op);
|
||||
}
|
||||
return ext2x_convert_rc(rc);
|
||||
}
|
||||
|
||||
/* tell the PMIx server to notify its local clients of an event */
|
||||
int ext2x_server_notify_event(int status,
|
||||
const opal_process_name_t *source,
|
||||
opal_list_t *info,
|
||||
opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
|
||||
{
|
||||
opal_value_t *kv;
|
||||
pmix_info_t *pinfo;
|
||||
size_t sz, n;
|
||||
pmix_status_t rc;
|
||||
ext2x_opcaddy_t *op;
|
||||
|
||||
OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock);
|
||||
if (0 >= opal_pmix_base.initialized) {
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
return OPAL_ERR_NOT_INITIALIZED;
|
||||
}
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
/* convert the list to an array of pmix_info_t */
|
||||
if (NULL != info) {
|
||||
sz = opal_list_get_size(info);
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
ext2x_value_load(&pinfo[n].value, kv);
|
||||
++n;
|
||||
}
|
||||
} else {
|
||||
sz = 0;
|
||||
pinfo = NULL;
|
||||
}
|
||||
/* setup the caddy */
|
||||
op = OBJ_NEW(ext2x_opcaddy_t);
|
||||
op->info = pinfo;
|
||||
op->sz = sz;
|
||||
op->opcbfunc = cbfunc;
|
||||
op->cbdata = cbdata;
|
||||
/* convert the jobid */
|
||||
if (NULL == source) {
|
||||
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, OPAL_JOBID_INVALID);
|
||||
op->p.rank = ext2x_convert_opalrank(OPAL_VPID_INVALID);
|
||||
} else {
|
||||
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, source->jobid);
|
||||
op->p.rank = ext2x_convert_opalrank(source->vpid);
|
||||
}
|
||||
|
||||
|
||||
rc = ext2x_convert_opalrc(status);
|
||||
/* the range must be nonlocal so the server will pass
|
||||
* the event down to its local clients */
|
||||
rc = PMIx_Notify_event(rc, &op->p, PMIX_RANGE_SESSION,
|
||||
pinfo, sz, opcbfunc, op);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
OBJ_RELEASE(op);
|
||||
}
|
||||
return ext2x_convert_rc(rc);
|
||||
}
|
@ -22,6 +22,7 @@ sources = \
|
||||
pmix2x_component.c \
|
||||
pmix2x.c \
|
||||
pmix2x_client.c \
|
||||
pmix2x_local.c \
|
||||
pmix2x_server_south.c \
|
||||
pmix2x_server_north.c
|
||||
|
||||
|
@ -194,10 +194,8 @@ static void return_local_event_hdlr(int status, opal_list_t *results,
|
||||
if (NULL != cd->pmixcbfunc) {
|
||||
op = OBJ_NEW(pmix2x_opcaddy_t);
|
||||
|
||||
if (NULL != results) {
|
||||
if (NULL != results && 0 < (op->ninfo = opal_list_get_size(results))) {
|
||||
/* convert the list of results to an array of info */
|
||||
op->ninfo = opal_list_get_size(results);
|
||||
if (0 < op->ninfo) {
|
||||
PMIX_INFO_CREATE(op->info, op->ninfo);
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(kv, cd->info, opal_value_t) {
|
||||
@ -206,7 +204,6 @@ static void return_local_event_hdlr(int status, opal_list_t *results,
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* convert the status */
|
||||
pstatus = pmix2x_convert_opalrc(status);
|
||||
/* call the library's callback function */
|
||||
@ -815,6 +812,7 @@ void pmix2x_value_load(pmix_value_t *v,
|
||||
v->data.darray = (pmix_data_array_t*)malloc(sizeof(pmix_data_array_t));
|
||||
v->data.darray->type = PMIX_INFO;
|
||||
v->data.darray->size = opal_list_get_size(list);
|
||||
if (0 < v->data.darray->size) {
|
||||
PMIX_INFO_CREATE(info, v->data.darray->size);
|
||||
v->data.darray->array = info;
|
||||
n=0;
|
||||
@ -823,6 +821,9 @@ void pmix2x_value_load(pmix_value_t *v,
|
||||
pmix2x_value_load(&info[n].value, val);
|
||||
++n;
|
||||
}
|
||||
} else {
|
||||
v->data.darray->array = NULL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* silence warnings */
|
||||
@ -1066,9 +1067,7 @@ static void register_handler(opal_list_t *event_codes,
|
||||
}
|
||||
|
||||
/* convert the list of info to an array of pmix_info_t */
|
||||
if (NULL != info) {
|
||||
op->ninfo = opal_list_get_size(info);
|
||||
if (0 < op->ninfo) {
|
||||
if (NULL != info && 0 < (op->ninfo = opal_list_get_size(info))) {
|
||||
PMIX_INFO_CREATE(op->info, op->ninfo);
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
@ -1077,7 +1076,6 @@ static void register_handler(opal_list_t *event_codes,
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* register the event */
|
||||
op->event = OBJ_NEW(opal_pmix2x_event_t);
|
||||
@ -1180,9 +1178,7 @@ static int notify_event(int status,
|
||||
prange = pmix2x_convert_opalrange(range);
|
||||
|
||||
/* convert the list of info */
|
||||
if (NULL != info) {
|
||||
op->ninfo = opal_list_get_size(info);
|
||||
if (0 < op->ninfo) {
|
||||
if (NULL != info && 0 < (op->ninfo = opal_list_get_size(info))) {
|
||||
PMIX_INFO_CREATE(op->info, op->ninfo);
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
@ -1191,7 +1187,6 @@ static int notify_event(int status,
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ask the library to notify our clients */
|
||||
pstatus = PMIx_Notify_event(pstatus, pptr, prange, op->info, op->ninfo, notify_complete, op);
|
||||
@ -1392,113 +1387,6 @@ opal_pmix_alloc_directive_t pmix2x_convert_allocdir(pmix_alloc_directive_t dir)
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
opal_list_item_t super;
|
||||
char *opalname;
|
||||
char *opalvalue;
|
||||
char *pmixname;
|
||||
char *pmixvalue;
|
||||
bool mismatched;
|
||||
} opal_pmix_evar_t;
|
||||
static void econ(opal_pmix_evar_t *p)
|
||||
{
|
||||
p->opalname = NULL;
|
||||
p->opalvalue = NULL;
|
||||
p->pmixname = NULL;
|
||||
p->pmixvalue = NULL;
|
||||
p->mismatched = false;
|
||||
}
|
||||
static OBJ_CLASS_INSTANCE(opal_pmix_evar_t,
|
||||
opal_list_item_t,
|
||||
econ, NULL);
|
||||
struct known_value {
|
||||
char *opalname;
|
||||
char *pmixname;
|
||||
};
|
||||
|
||||
static struct known_value known_values[] = {
|
||||
{"OPAL_PREFIX", "PMIX_INSTALL_PREFIX"},
|
||||
{"OPAL_EXEC_PREFIX", "PMIX_EXEC_PREFIX"},
|
||||
{"OPAL_BINDIR", "PMIX_BINDIR"},
|
||||
{"OPAL_SBINDIR", "PMIX_SBINDIR"},
|
||||
{"OPAL_LIBEXECDIR", "PMIX_LIBEXECDIR"},
|
||||
{"OPAL_DATAROOTDIR", "PMIX_DATAROOTDIR"},
|
||||
{"OPAL_DATADIR", "PMIX_DATADIR"},
|
||||
{"OPAL_SYSCONFDIR", "PMIX_SYSCONFDIR"},
|
||||
{"OPAL_SHAREDSTATEDIR", "PMIX_SHAREDSTATEDIR"},
|
||||
{"OPAL_LOCALSTATEDIR", "PMIX_LOCALSTATEDIR"},
|
||||
{"OPAL_LIBDIR", "PMIX_LIBDIR"},
|
||||
{"OPAL_INCLUDEDIR", "PMIX_INCLUDEDIR"},
|
||||
{"OPAL_INFODIR", "PMIX_INFODIR"},
|
||||
{"OPAL_MANDIR", "PMIX_MANDIR"},
|
||||
{"OPAL_PKGDATADIR", "PMIX_PKGDATADIR"},
|
||||
{"OPAL_PKGLIBDIR", "PMIX_PKGLIBDIR"},
|
||||
{"OPAL_PKGINCLUDEDIR", "PMIX_PKGINCLUDEDIR"}
|
||||
};
|
||||
|
||||
|
||||
int opal_pmix_pmix2x_check_evars(void)
|
||||
{
|
||||
opal_list_t values;
|
||||
int nvals, i;
|
||||
opal_pmix_evar_t *evar;
|
||||
bool mismatched = false;
|
||||
char *tmp=NULL, *tmp2;
|
||||
|
||||
OBJ_CONSTRUCT(&values, opal_list_t);
|
||||
nvals = sizeof(known_values) / sizeof(struct known_value);
|
||||
for (i=0; i < nvals; i++) {
|
||||
evar = OBJ_NEW(opal_pmix_evar_t);
|
||||
evar->opalname = known_values[i].opalname;
|
||||
evar->opalvalue = getenv(evar->opalname);
|
||||
evar->pmixname = known_values[i].pmixname;
|
||||
evar->pmixvalue = getenv(evar->pmixname);
|
||||
/* if the OPAL value is not set and the PMIx value is,
|
||||
* then that is a problem. Likewise, if both are set
|
||||
* and are different, then that is also a problem. Note that
|
||||
* it is okay for the OPAL value to be set and the PMIx
|
||||
* value to not be set */
|
||||
if ((NULL == evar->opalvalue && NULL != evar->pmixvalue) ||
|
||||
(NULL != evar->opalvalue && NULL != evar->pmixvalue &&
|
||||
0 != strcmp(evar->opalvalue, evar->pmixvalue))) {
|
||||
evar->mismatched = true;
|
||||
mismatched = true;
|
||||
}
|
||||
opal_list_append(&values, &evar->super);
|
||||
}
|
||||
if (!mismatched) {
|
||||
/* transfer any OPAL values that were set - we already verified
|
||||
* that the equivalent PMIx value, if present, matches, so
|
||||
* don't overwrite it */
|
||||
OPAL_LIST_FOREACH(evar, &values, opal_pmix_evar_t) {
|
||||
if (NULL != evar->opalvalue && NULL == evar->pmixvalue) {
|
||||
opal_setenv(evar->pmixname, evar->opalvalue, true, &environ);
|
||||
}
|
||||
}
|
||||
OPAL_LIST_DESTRUCT(&values);
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
/* we have at least one mismatch somewhere, so print out the table */
|
||||
OPAL_LIST_FOREACH(evar, &values, opal_pmix_evar_t) {
|
||||
if (evar->mismatched) {
|
||||
if (NULL == tmp) {
|
||||
asprintf(&tmp, " %s: %s\n %s: %s",
|
||||
evar->opalname, (NULL == evar->opalvalue) ? "NULL" : evar->opalvalue,
|
||||
evar->pmixname, (NULL == evar->pmixvalue) ? "NULL" : evar->pmixvalue);
|
||||
} else {
|
||||
asprintf(&tmp2, "%s\n\n %s: %s\n %s: %s", tmp,
|
||||
evar->opalname, (NULL == evar->opalvalue) ? "NULL" : evar->opalvalue,
|
||||
evar->pmixname, (NULL == evar->pmixvalue) ? "NULL" : evar->pmixvalue);
|
||||
free(tmp);
|
||||
tmp = tmp2;
|
||||
}
|
||||
}
|
||||
}
|
||||
opal_show_help("help-pmix-pmix2x.txt", "evars", true, tmp);
|
||||
free(tmp);
|
||||
return OPAL_ERR_SILENT;
|
||||
}
|
||||
|
||||
/**** INSTANTIATE INTERNAL CLASSES ****/
|
||||
OBJ_CLASS_INSTANCE(opal_pmix2x_jobid_trkr_t,
|
||||
opal_list_item_t,
|
||||
|
155
opal/mca/pmix/pmix2x/pmix2x_local.c
Обычный файл
155
opal/mca/pmix/pmix2x/pmix2x_local.c
Обычный файл
@ -0,0 +1,155 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014-2015 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "opal_config.h"
|
||||
#include "opal/constants.h"
|
||||
#include "opal/types.h"
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "opal/dss/dss.h"
|
||||
#include "opal/mca/event/event.h"
|
||||
#include "opal/mca/hwloc/base/base.h"
|
||||
#include "opal/runtime/opal.h"
|
||||
#include "opal/runtime/opal_progress_threads.h"
|
||||
#include "opal/threads/threads.h"
|
||||
#include "opal/util/argv.h"
|
||||
#include "opal/util/error.h"
|
||||
#include "opal/util/opal_environ.h"
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/util/proc.h"
|
||||
#include "opal/util/show_help.h"
|
||||
|
||||
#include "pmix2x.h"
|
||||
#include "opal/mca/pmix/base/base.h"
|
||||
#include "opal/mca/pmix/pmix_types.h"
|
||||
|
||||
#include <pmix_common.h>
|
||||
#include <pmix.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
opal_list_item_t super;
|
||||
char *opalname;
|
||||
char *opalvalue;
|
||||
char *pmixname;
|
||||
char *pmixvalue;
|
||||
bool mismatched;
|
||||
} opal_pmix_evar_t;
|
||||
static void econ(opal_pmix_evar_t *p)
|
||||
{
|
||||
p->opalname = NULL;
|
||||
p->opalvalue = NULL;
|
||||
p->pmixname = NULL;
|
||||
p->pmixvalue = NULL;
|
||||
p->mismatched = false;
|
||||
}
|
||||
static OBJ_CLASS_INSTANCE(opal_pmix_evar_t,
|
||||
opal_list_item_t,
|
||||
econ, NULL);
|
||||
struct known_value {
|
||||
char *opalname;
|
||||
char *pmixname;
|
||||
};
|
||||
|
||||
static struct known_value known_values[] = {
|
||||
{"OPAL_PREFIX", "PMIX_INSTALL_PREFIX"},
|
||||
{"OPAL_EXEC_PREFIX", "PMIX_EXEC_PREFIX"},
|
||||
{"OPAL_BINDIR", "PMIX_BINDIR"},
|
||||
{"OPAL_SBINDIR", "PMIX_SBINDIR"},
|
||||
{"OPAL_LIBEXECDIR", "PMIX_LIBEXECDIR"},
|
||||
{"OPAL_DATAROOTDIR", "PMIX_DATAROOTDIR"},
|
||||
{"OPAL_DATADIR", "PMIX_DATADIR"},
|
||||
{"OPAL_SYSCONFDIR", "PMIX_SYSCONFDIR"},
|
||||
{"OPAL_SHAREDSTATEDIR", "PMIX_SHAREDSTATEDIR"},
|
||||
{"OPAL_LOCALSTATEDIR", "PMIX_LOCALSTATEDIR"},
|
||||
{"OPAL_LIBDIR", "PMIX_LIBDIR"},
|
||||
{"OPAL_INCLUDEDIR", "PMIX_INCLUDEDIR"},
|
||||
{"OPAL_INFODIR", "PMIX_INFODIR"},
|
||||
{"OPAL_MANDIR", "PMIX_MANDIR"},
|
||||
{"OPAL_PKGDATADIR", "PMIX_PKGDATADIR"},
|
||||
{"OPAL_PKGLIBDIR", "PMIX_PKGLIBDIR"},
|
||||
{"OPAL_PKGINCLUDEDIR", "PMIX_PKGINCLUDEDIR"}
|
||||
};
|
||||
|
||||
|
||||
int opal_pmix_pmix2x_check_evars(void)
|
||||
{
|
||||
opal_list_t values;
|
||||
int nvals, i;
|
||||
opal_pmix_evar_t *evar;
|
||||
bool mismatched = false;
|
||||
char *tmp=NULL, *tmp2;
|
||||
|
||||
OBJ_CONSTRUCT(&values, opal_list_t);
|
||||
nvals = sizeof(known_values) / sizeof(struct known_value);
|
||||
for (i=0; i < nvals; i++) {
|
||||
evar = OBJ_NEW(opal_pmix_evar_t);
|
||||
evar->opalname = known_values[i].opalname;
|
||||
evar->opalvalue = getenv(evar->opalname);
|
||||
evar->pmixname = known_values[i].pmixname;
|
||||
evar->pmixvalue = getenv(evar->pmixname);
|
||||
/* if the OPAL value is not set and the PMIx value is,
|
||||
* then that is a problem. Likewise, if both are set
|
||||
* and are different, then that is also a problem. Note that
|
||||
* it is okay for the OPAL value to be set and the PMIx
|
||||
* value to not be set */
|
||||
if ((NULL == evar->opalvalue && NULL != evar->pmixvalue) ||
|
||||
(NULL != evar->opalvalue && NULL != evar->pmixvalue &&
|
||||
0 != strcmp(evar->opalvalue, evar->pmixvalue))) {
|
||||
evar->mismatched = true;
|
||||
mismatched = true;
|
||||
}
|
||||
opal_list_append(&values, &evar->super);
|
||||
}
|
||||
if (!mismatched) {
|
||||
/* transfer any OPAL values that were set - we already verified
|
||||
* that the equivalent PMIx value, if present, matches, so
|
||||
* don't overwrite it */
|
||||
OPAL_LIST_FOREACH(evar, &values, opal_pmix_evar_t) {
|
||||
if (NULL != evar->opalvalue && NULL == evar->pmixvalue) {
|
||||
opal_setenv(evar->pmixname, evar->opalvalue, true, &environ);
|
||||
}
|
||||
}
|
||||
OPAL_LIST_DESTRUCT(&values);
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
/* we have at least one mismatch somewhere, so print out the table */
|
||||
OPAL_LIST_FOREACH(evar, &values, opal_pmix_evar_t) {
|
||||
if (evar->mismatched) {
|
||||
if (NULL == tmp) {
|
||||
asprintf(&tmp, " %s: %s\n %s: %s",
|
||||
evar->opalname, (NULL == evar->opalvalue) ? "NULL" : evar->opalvalue,
|
||||
evar->pmixname, (NULL == evar->pmixvalue) ? "NULL" : evar->pmixvalue);
|
||||
} else {
|
||||
asprintf(&tmp2, "%s\n\n %s: %s\n %s: %s", tmp,
|
||||
evar->opalname, (NULL == evar->opalvalue) ? "NULL" : evar->opalvalue,
|
||||
evar->pmixname, (NULL == evar->pmixvalue) ? "NULL" : evar->pmixvalue);
|
||||
free(tmp);
|
||||
tmp = tmp2;
|
||||
}
|
||||
}
|
||||
}
|
||||
opal_show_help("help-pmix-pmix2x.txt", "evars", true, tmp);
|
||||
free(tmp);
|
||||
return OPAL_ERR_SILENT;
|
||||
}
|
@ -921,9 +921,7 @@ static void info_cbfunc(int status,
|
||||
pcaddy->status = pmix2x_convert_opalrc(status);
|
||||
|
||||
/* convert the list to a pmix_info_t array */
|
||||
if (NULL != info) {
|
||||
pcaddy->ninfo = opal_list_get_size(info);
|
||||
if (0 < pcaddy->ninfo) {
|
||||
if (NULL != info && 0 < (pcaddy->ninfo = opal_list_get_size(info))) {
|
||||
PMIX_INFO_CREATE(pcaddy->info, pcaddy->ninfo);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
@ -931,7 +929,6 @@ static void info_cbfunc(int status,
|
||||
pmix2x_value_load(&pcaddy->info[n].value, kv);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* we are done with the incoming data */
|
||||
if (NULL != release_fn) {
|
||||
release_fn(release_cbdata);
|
||||
|
@ -117,18 +117,15 @@ int pmix2x_server_init(opal_pmix_server_module_t *module,
|
||||
++opal_pmix_base.initialized;
|
||||
|
||||
/* convert the list to an array of pmix_info_t */
|
||||
if (NULL != info) {
|
||||
sz = opal_list_get_size(info) + 2;
|
||||
sz = 2 + ((NULL==info)?0:opal_list_get_size(info));
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
if (NULL != info) {
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
(void)strncpy(pinfo[n].key, kv->key, PMIX_MAX_KEYLEN);
|
||||
pmix2x_value_load(&pinfo[n].value, kv);
|
||||
++n;
|
||||
}
|
||||
} else {
|
||||
sz = 2;
|
||||
PMIX_INFO_CREATE(pinfo, 2);
|
||||
}
|
||||
|
||||
/* insert ourselves into our list of jobids - it will be the
|
||||
@ -268,8 +265,7 @@ int pmix2x_server_register_nspace(opal_jobid_t jobid,
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
/* convert the list to an array of pmix_info_t */
|
||||
if (NULL != info) {
|
||||
sz = opal_list_get_size(info);
|
||||
if (NULL != info && 0 < (sz = opal_list_get_size(info))) {
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
@ -280,6 +276,7 @@ int pmix2x_server_register_nspace(opal_jobid_t jobid,
|
||||
* that list to another array */
|
||||
pmapinfo = (opal_list_t*)kv->data.ptr;
|
||||
szmap = opal_list_get_size(pmapinfo);
|
||||
if (0 < szmap) {
|
||||
PMIX_INFO_CREATE(pmap, szmap);
|
||||
pinfo[n].value.data.darray = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t));
|
||||
pinfo[n].value.data.darray->type = PMIX_INFO;
|
||||
@ -291,6 +288,7 @@ int pmix2x_server_register_nspace(opal_jobid_t jobid,
|
||||
pmix2x_value_load(&pmap[m].value, k2);
|
||||
++m;
|
||||
}
|
||||
}
|
||||
OPAL_LIST_RELEASE(pmapinfo);
|
||||
} else {
|
||||
pmix2x_value_load(&pinfo[n].value, kv);
|
||||
@ -520,8 +518,7 @@ int pmix2x_server_notify_event(int status,
|
||||
OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock);
|
||||
|
||||
/* convert the list to an array of pmix_info_t */
|
||||
if (NULL != info) {
|
||||
sz = opal_list_get_size(info);
|
||||
if (NULL != info && 0 < (sz = opal_list_get_size(info))) {
|
||||
PMIX_INFO_CREATE(pinfo, sz);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user