Merge pull request #3664 from rhc54/topic/ext2
Get the pmix/ext2x component to work. Fix a minor problem in the libevent external component.
Этот коммит содержится в:
Коммит
88b5ec3597
3
opal/mca/event/external/event_external_component.c
поставляемый
3
opal/mca/event/external/event_external_component.c
поставляемый
@ -5,6 +5,7 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2017 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -86,7 +87,7 @@ static int event_external_register (void) {
|
||||
event_module_include = "poll";
|
||||
#endif
|
||||
|
||||
avail = opal_argv_join(all_available_eventops, ',');
|
||||
avail = opal_argv_join((char**)all_available_eventops, ',');
|
||||
asprintf( &help_msg,
|
||||
"Comma-delimited list of libevent subsystems "
|
||||
"to use (%s -- available on your platform)",
|
||||
|
4
opal/mca/event/external/external.h
поставляемый
4
opal/mca/event/external/external.h
поставляемый
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
|
||||
* Copyright (c) 2015 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
@ -75,6 +75,8 @@ OPAL_DECLSPEC int opal_event_finalize(void);
|
||||
|
||||
#define opal_event_set(b, x, fd, fg, cb, arg) event_assign((x), (b), (fd), (fg), (event_callback_fn) (cb), (arg))
|
||||
|
||||
#define opal_event_assign(x, b, fd, fg, cb, arg) event_assign((x), (b), (fd), (fg), (event_callback_fn) (cb), (arg))
|
||||
|
||||
#define opal_event_add(ev, tv) event_add((ev), (tv))
|
||||
|
||||
#define opal_event_del(ev) event_del((ev))
|
||||
|
@ -12,8 +12,8 @@
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2011-2013 Los Alamos National Security, LLC.
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2010-2016 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2010-2017 Cisco Systems, Inc. All rights reserved.
|
||||
# Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
# Copyright (c) 2015-2016 Research Organization for Information Science
|
||||
# and Technology (RIST). All rights reserved.
|
||||
# $COPYRIGHT$
|
||||
@ -28,7 +28,59 @@
|
||||
AC_DEFUN([MCA_opal_pmix_ext2x_CONFIG],[
|
||||
AC_CONFIG_FILES([opal/mca/pmix/ext2x/Makefile])
|
||||
|
||||
# check to see
|
||||
OPAL_VAR_SCOPE_PUSH([PMIX_VERSION opal_pmix_ext2x_save_CPPFLAGS opal_pmix_pmix2_save_CFLAGS opal_pmix_ext2x_save_LDFLAGS opal_pmix_ext2x_save_LIBS opal_pmix_ext2x_basedir opal_pmix_ext2x_args opal_pmix_ext2x_happy opal_pmix_ext2x_sm_flag pmix_ext2x_status_filename])
|
||||
|
||||
opal_pmix_ext2x_basedir=opal/mca/pmix/ext2x
|
||||
|
||||
opal_pmix_ext2x_save_CFLAGS=$CFLAGS
|
||||
opal_pmix_ext2x_save_CPPFLAGS=$CPPFLAGS
|
||||
opal_pmix_ext2x_save_LDFLAGS=$LDFLAGS
|
||||
opal_pmix_ext2x_save_LIBS=$LIBS
|
||||
|
||||
AC_ARG_ENABLE([pmix-dstore],
|
||||
[AC_HELP_STRING([--enable-pmix-dstore],
|
||||
[Enable PMIx shared memory data store (default: enabled)])])
|
||||
AC_MSG_CHECKING([if PMIx shared memory data store is enabled])
|
||||
if test "$enable_pmix_dstore" != "no"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
opal_pmix_ext2x_sm_flag=--enable-dstore
|
||||
else
|
||||
AC_MSG_RESULT([no (disabled)])
|
||||
opal_pmix_ext2x_sm_flag=--disable-dstore
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([pmix-timing],
|
||||
[AC_HELP_STRING([--enable-pmix-timing],
|
||||
[Enable PMIx timing measurements (default: disabled)])])
|
||||
AC_MSG_CHECKING([if PMIx timing is enabled])
|
||||
if test "$enable_pmix_timing" == "yes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
opal_pmix_ext2x_timing_flag=--enable-pmix-timing
|
||||
else
|
||||
AC_MSG_RESULT([no (disabled)])
|
||||
opal_pmix_ext2x_timing_flag=--disable-pmix-timing
|
||||
fi
|
||||
|
||||
opal_pmix_ext2x_args="--with-pmix-symbol-rename=OPAL_MCA_PMIX2X_ $opal_pmix_ext2x_sm_flag $opal_pmix_ext2x_timing_flag --without-tests-examples --disable-pmix-backward-compatibility --disable-visibility --enable-embedded-libevent --with-libevent-header=\\\"opal/mca/event/$opal_event_base_include\\\" --enable-embedded-mode"
|
||||
AS_IF([test "$enable_debug" = "yes"],
|
||||
[opal_pmix_ext2x_args="--enable-debug $opal_pmix_ext2x_args"
|
||||
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS -g"],
|
||||
[opal_pmix_ext2x_args="--disable-debug $opal_pmix_ext2x_args"
|
||||
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS"])
|
||||
AS_IF([test "$with_devel_headers" = "yes"],
|
||||
[opal_pmix_ext2x_args="--with-devel-headers $opal_pmix_ext2x_args"],
|
||||
[opal_pmix_ext2x_args=$opal_pmix_ext2x_args])
|
||||
CPPFLAGS="-I$OPAL_TOP_SRCDIR -I$OPAL_TOP_BUILDDIR -I$OPAL_TOP_SRCDIR/opal/include -I$OPAL_TOP_BUILDDIR/opal/include $CPPFLAGS"
|
||||
|
||||
OPAL_CONFIG_SUBDIR([$opal_pmix_ext2x_basedir/pmix],
|
||||
[$opal_pmix_ext2x_args $opal_subdir_args 'CFLAGS=$CFLAGS' 'CPPFLAGS=$CPPFLAGS'],
|
||||
[opal_pmix_ext2x_happy=1], [opal_pmix_ext2x_happy=0])
|
||||
|
||||
CFLAGS=$opal_pmix_ext2x_save_CFLAGS
|
||||
CPPFLAGS=$opal_pmix_ext2x_save_CPPFLAGS
|
||||
LDFLAGS=$opal_pmix_ext2x_save_LDFLAGS
|
||||
LIBS=$opal_pmix_ext2x_save_LIBS
|
||||
|
||||
# if we are linking to an external v2.x library. If not, then
|
||||
# do not use this component.
|
||||
AC_MSG_CHECKING([if external v2.x component is to be used])
|
||||
@ -45,16 +97,24 @@ AC_DEFUN([MCA_opal_pmix_ext2x_CONFIG],[
|
||||
pmix_ext2x_WRAPPER_EXTRA_LIBS=$opal_external_pmix_LIBS],
|
||||
[AC_MSG_RESULT([no - disqualifying this component])
|
||||
opal_pmix_ext2x_happy=0])],
|
||||
[AC_MSG_RESULT([no - disqualifying this component])
|
||||
opal_pmix_ext2x_happy=0])
|
||||
[AC_MSG_RESULT([no])
|
||||
opal_pmix_ext2x_happy=0])
|
||||
|
||||
AC_SUBST([opal_pmix_ext2x_LIBS])
|
||||
AC_SUBST([opal_pmix_ext2x_CPPFLAGS])
|
||||
AC_SUBST([opal_pmix_ext2x_LDFLAGS])
|
||||
AC_SUBST([opal_pmix_ext2x_DEPENDENCIES])
|
||||
|
||||
AC_MSG_CHECKING([PMIx extra wrapper CPPFLAGS])
|
||||
AC_MSG_RESULT([$pmix_ext2x_WRAPPER_EXTRA_CPPFLAGS])
|
||||
AC_MSG_CHECKING([PMIx extra wrapper LDFLAGS])
|
||||
AC_MSG_RESULT([$pmix_ext2x_WRAPPER_EXTRA_LDFLAGS])
|
||||
AC_MSG_CHECKING([PMIx extra wrapper LIBS])
|
||||
AC_MSG_RESULT([$pmix_ext2x_WRAPPER_EXTRA_LIBS])
|
||||
|
||||
AS_IF([test $opal_pmix_ext2x_happy -eq 1],
|
||||
[$1],
|
||||
[$2])
|
||||
|
||||
OPAL_VAR_SCOPE_POP
|
||||
])dnl
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1,9 +1,12 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* 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
|
||||
@ -39,11 +42,10 @@ typedef struct {
|
||||
opal_list_t jobids;
|
||||
bool native_launch;
|
||||
size_t evindex;
|
||||
opal_list_t single_events;
|
||||
opal_list_t multi_events;
|
||||
opal_list_t default_events;
|
||||
opal_list_t events;
|
||||
int cache_size;
|
||||
opal_list_t cache;
|
||||
opal_list_t dmdx;
|
||||
} mca_pmix_ext2x_component_t;
|
||||
|
||||
OPAL_DECLSPEC extern mca_pmix_ext2x_component_t mca_pmix_ext2x_component;
|
||||
@ -61,42 +63,18 @@ OBJ_CLASS_DECLARATION(opal_pmix2x_jobid_trkr_t);
|
||||
typedef struct {
|
||||
opal_list_item_t super;
|
||||
size_t index;
|
||||
int code;
|
||||
opal_pmix_notification_fn_t handler;
|
||||
} opal_pmix2x_single_event_t;
|
||||
OBJ_CLASS_DECLARATION(opal_pmix2x_single_event_t);
|
||||
void *cbdata;
|
||||
} opal_pmix2x_event_t;
|
||||
OBJ_CLASS_DECLARATION(opal_pmix2x_event_t);
|
||||
|
||||
typedef struct {
|
||||
opal_list_item_t super;
|
||||
size_t index;
|
||||
int *codes;
|
||||
size_t ncodes;
|
||||
opal_pmix_notification_fn_t handler;
|
||||
} opal_pmix2x_multi_event_t;
|
||||
OBJ_CLASS_DECLARATION(opal_pmix2x_multi_event_t);
|
||||
|
||||
typedef struct {
|
||||
opal_list_item_t super;
|
||||
size_t index;
|
||||
opal_pmix_notification_fn_t handler;
|
||||
} opal_pmix2x_default_event_t;
|
||||
OBJ_CLASS_DECLARATION(opal_pmix2x_default_event_t);
|
||||
|
||||
typedef struct {
|
||||
opal_list_item_t super;
|
||||
int status;
|
||||
bool nondefault;
|
||||
opal_process_name_t source;
|
||||
pmix_data_range_t range;
|
||||
opal_list_t *info;
|
||||
opal_list_t results;
|
||||
opal_pmix2x_single_event_t *sing;
|
||||
opal_pmix2x_multi_event_t *multi;
|
||||
opal_pmix2x_default_event_t *def;
|
||||
opal_pmix_op_cbfunc_t final_cbfunc;
|
||||
void *final_cbdata;
|
||||
} opal_pmix2x_event_chain_t;
|
||||
OBJ_CLASS_DECLARATION(opal_pmix2x_event_chain_t);
|
||||
char *nspace;
|
||||
pmix_modex_cbfunc_t cbfunc;
|
||||
void *cbdata;
|
||||
} opal_pmix2x_dmx_trkr_t;
|
||||
OBJ_CLASS_DECLARATION(opal_pmix2x_dmx_trkr_t);
|
||||
|
||||
typedef struct {
|
||||
opal_object_t super;
|
||||
@ -111,11 +89,19 @@ typedef struct {
|
||||
pmix_app_t *apps;
|
||||
size_t sz;
|
||||
volatile bool active;
|
||||
opal_list_t *codes;
|
||||
pmix_status_t *pcodes;
|
||||
size_t ncodes;
|
||||
pmix_query_t *queries;
|
||||
size_t nqueries;
|
||||
opal_pmix2x_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;
|
||||
} pmix2x_opcaddy_t;
|
||||
OBJ_CLASS_DECLARATION(pmix2x_opcaddy_t);
|
||||
@ -152,28 +138,15 @@ typedef struct {
|
||||
size_t handler;
|
||||
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;
|
||||
void *cbdata;
|
||||
} pmix2x_threadshift_t;
|
||||
OBJ_CLASS_DECLARATION(pmix2x_threadshift_t);
|
||||
|
||||
#define OPAL_PMIX_OPCD_THREADSHIFT(i, s, sr, if, nif, fn, cb, cd) \
|
||||
do { \
|
||||
pmix2x_opalcaddy_t *_cd; \
|
||||
_cd = OBJ_NEW(pmix2x_opalcaddy_t); \
|
||||
_cd->id = (i); \
|
||||
_cd->status = (s); \
|
||||
_cd->source = (sr); \
|
||||
_cd->info = (i); \
|
||||
_cd->evcbfunc = (cb); \
|
||||
_cd->cbdata = (cd); \
|
||||
event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
|
||||
-1, EV_WRITE, (fn), (_cd)); \
|
||||
event_active(&((_cd)->ev), EV_WRITE, 1); \
|
||||
} while(0)
|
||||
|
||||
#define OPAL_PMIX_OP_THREADSHIFT(e, fn, cb, cd) \
|
||||
do { \
|
||||
pmix2x_threadshift_t *_cd; \
|
||||
@ -181,9 +154,10 @@ OBJ_CLASS_DECLARATION(pmix2x_threadshift_t);
|
||||
_cd->handler = (e); \
|
||||
_cd->opcbfunc = (cb); \
|
||||
_cd->cbdata = (cd); \
|
||||
event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
|
||||
-1, EV_WRITE, (fn), (_cd)); \
|
||||
event_active(&((_cd)->ev), EV_WRITE, 1); \
|
||||
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) \
|
||||
@ -195,9 +169,10 @@ OBJ_CLASS_DECLARATION(pmix2x_threadshift_t);
|
||||
_cd->evhandler = (eh); \
|
||||
_cd->cbfunc = (cb); \
|
||||
_cd->cbdata = (cd); \
|
||||
event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
|
||||
-1, EV_WRITE, (fn), (_cd)); \
|
||||
event_active(&((_cd)->ev), EV_WRITE, 1); \
|
||||
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) \
|
||||
@ -210,9 +185,10 @@ OBJ_CLASS_DECLARATION(pmix2x_threadshift_t);
|
||||
_cd->info = (i); \
|
||||
_cd->opcbfunc = (cb); \
|
||||
_cd->cbdata = (cd); \
|
||||
event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
|
||||
opal_event_assign(&((_cd)->ev), opal_pmix_base.evbase, \
|
||||
-1, EV_WRITE, (fn), (_cd)); \
|
||||
event_active(&((_cd)->ev), EV_WRITE, 1); \
|
||||
OPAL_POST_OBJECT(_cd); \
|
||||
opal_event_active(&((_cd)->ev), EV_WRITE, 1); \
|
||||
} while(0)
|
||||
|
||||
/**** CLIENT FUNCTIONS ****/
|
||||
@ -301,7 +277,7 @@ OPAL_MODULE_DECLSPEC void pmix2x_event_hdlr(size_t evhdlr_registration_id,
|
||||
OPAL_MODULE_DECLSPEC pmix_status_t pmix2x_convert_opalrc(int rc);
|
||||
OPAL_MODULE_DECLSPEC int pmix2x_convert_rc(pmix_status_t rc);
|
||||
|
||||
OPAL_MODULE_DECLSPEC opal_vpid_t pmix2x_convert_rank(int rank);
|
||||
OPAL_MODULE_DECLSPEC opal_vpid_t pmix2x_convert_rank(pmix_rank_t rank);
|
||||
OPAL_MODULE_DECLSPEC pmix_rank_t pmix2x_convert_opalrank(opal_vpid_t vpid);
|
||||
|
||||
OPAL_MODULE_DECLSPEC opal_pmix_scope_t pmix2x_convert_scope(pmix_scope_t scope);
|
||||
@ -318,6 +294,8 @@ OPAL_MODULE_DECLSPEC void pmix2x_value_load(pmix_value_t *v,
|
||||
OPAL_MODULE_DECLSPEC int pmix2x_value_unload(opal_value_t *kv,
|
||||
const pmix_value_t *v);
|
||||
|
||||
OPAL_MODULE_DECLSPEC opal_pmix_alloc_directive_t pmix2x_convert_allocdir(pmix_alloc_directive_t dir);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /* MCA_PMIX_EXTERNAL_H */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* -*- 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
|
||||
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014-2015 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
@ -27,6 +27,7 @@
|
||||
#endif
|
||||
|
||||
#include "opal/hash_string.h"
|
||||
#include "opal/threads/threads.h"
|
||||
#include "opal/util/argv.h"
|
||||
#include "opal/util/proc.h"
|
||||
|
||||
@ -36,13 +37,15 @@
|
||||
|
||||
static pmix_proc_t my_proc;
|
||||
static char *dbgvalue=NULL;
|
||||
static size_t errhdler_ref = 0;
|
||||
static volatile bool regactive;
|
||||
static bool initialized = false;
|
||||
|
||||
#define PMIX_WAIT_FOR_COMPLETION(a) \
|
||||
do { \
|
||||
while ((a)) { \
|
||||
usleep(10); \
|
||||
} \
|
||||
OPAL_ACQUIRE_OBJECT(a); \
|
||||
} while (0)
|
||||
|
||||
|
||||
@ -50,10 +53,16 @@ static void errreg_cbfunc (pmix_status_t status,
|
||||
size_t errhandler_ref,
|
||||
void *cbdata)
|
||||
{
|
||||
errhdler_ref = errhandler_ref;
|
||||
opal_pmix2x_event_t *event = (opal_pmix2x_event_t*)cbdata;
|
||||
|
||||
OPAL_ACQUIRE_OBJECT(event);
|
||||
|
||||
event->index = errhandler_ref;
|
||||
opal_output_verbose(5, opal_pmix_base_framework.framework_output,
|
||||
"PMIX client errreg_cbfunc - error handler registered status=%d, reference=%lu",
|
||||
status, (unsigned long)errhandler_ref);
|
||||
regactive = false;
|
||||
OPAL_POST_OBJECT(regactive);
|
||||
}
|
||||
|
||||
int pmix2x_client_init(opal_list_t *ilist)
|
||||
@ -62,19 +71,52 @@ int pmix2x_client_init(opal_list_t *ilist)
|
||||
pmix_status_t rc;
|
||||
int dbg;
|
||||
opal_pmix2x_jobid_trkr_t *job;
|
||||
opal_pmix2x_event_t *event;
|
||||
pmix_info_t *pinfo;
|
||||
size_t ninfo, n;
|
||||
opal_value_t *ival;
|
||||
|
||||
opal_output_verbose(1, opal_pmix_base_framework.framework_output,
|
||||
"PMIx_client init");
|
||||
|
||||
if (0 < (dbg = opal_output_get_verbosity(opal_pmix_base_framework.framework_output))) {
|
||||
asprintf(&dbgvalue, "PMIX_DEBUG=%d", dbg);
|
||||
putenv(dbgvalue);
|
||||
if (!initialized) {
|
||||
if (0 < (dbg = opal_output_get_verbosity(opal_pmix_base_framework.framework_output))) {
|
||||
asprintf(&dbgvalue, "PMIX_DEBUG=%d", dbg);
|
||||
putenv(dbgvalue);
|
||||
}
|
||||
}
|
||||
|
||||
rc = PMIx_Init(&my_proc, NULL, 0);
|
||||
/* convert the incoming list to info structs */
|
||||
if (NULL != ilist) {
|
||||
ninfo = opal_list_get_size(ilist);
|
||||
if (0 < ninfo) {
|
||||
PMIX_INFO_CREATE(pinfo, ninfo);
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(ival, ilist, opal_value_t) {
|
||||
(void)strncpy(pinfo[n].key, ival->key, PMIX_MAX_KEYLEN);
|
||||
pmix2x_value_load(&pinfo[n].value, ival);
|
||||
++n;
|
||||
}
|
||||
} else {
|
||||
pinfo = NULL;
|
||||
}
|
||||
} else {
|
||||
pinfo = NULL;
|
||||
ninfo = 0;
|
||||
}
|
||||
|
||||
rc = PMIx_Init(&my_proc, pinfo, ninfo);
|
||||
if (PMIX_SUCCESS != rc) {
|
||||
return pmix2x_convert_rc(rc);
|
||||
}
|
||||
if (0 < ninfo) {
|
||||
PMIX_INFO_FREE(pinfo, ninfo);
|
||||
|
||||
}
|
||||
if (initialized) {
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
initialized = true;
|
||||
|
||||
/* store our jobid and rank */
|
||||
if (NULL != getenv(OPAL_MCA_PREFIX"orte_launch")) {
|
||||
@ -98,7 +140,15 @@ int pmix2x_client_init(opal_list_t *ilist)
|
||||
opal_proc_set_name(&pname);
|
||||
|
||||
/* register the default event handler */
|
||||
PMIx_Register_event_handler(NULL, 0, NULL, 0, pmix2x_event_hdlr, errreg_cbfunc, NULL);
|
||||
event = OBJ_NEW(opal_pmix2x_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-DEFAULT", PMIX_STRING);
|
||||
regactive = true;
|
||||
PMIx_Register_event_handler(NULL, 0, pinfo, 1, pmix2x_event_hdlr, errreg_cbfunc, event);
|
||||
PMIX_WAIT_FOR_COMPLETION(regactive);
|
||||
PMIX_INFO_FREE(pinfo, 1);
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
|
||||
}
|
||||
@ -106,12 +156,16 @@ int pmix2x_client_init(opal_list_t *ilist)
|
||||
int pmix2x_client_finalize(void)
|
||||
{
|
||||
pmix_status_t rc;
|
||||
opal_pmix2x_event_t *event;
|
||||
|
||||
opal_output_verbose(1, opal_pmix_base_framework.framework_output,
|
||||
"PMIx_client finalize");
|
||||
|
||||
/* deregister the default event handler */
|
||||
PMIx_Deregister_event_handler(errhdler_ref, NULL, NULL);
|
||||
/* deregister all event handlers */
|
||||
OPAL_LIST_FOREACH(event, &mca_pmix_ext2x_component.events, opal_pmix2x_event_t) {
|
||||
PMIx_Deregister_event_handler(event->index, NULL, NULL);
|
||||
}
|
||||
/* the list will be destructed when the component is finalized */
|
||||
|
||||
rc = PMIx_Finalize(NULL, 0);
|
||||
return pmix2x_convert_rc(rc);
|
||||
@ -122,7 +176,7 @@ int pmix2x_initialized(void)
|
||||
opal_output_verbose(1, opal_pmix_base_framework.framework_output,
|
||||
"PMIx_client initialized");
|
||||
|
||||
return PMIx_Initialized();
|
||||
return initialized;
|
||||
}
|
||||
|
||||
int pmix2x_abort(int flag, const char *msg,
|
||||
@ -192,7 +246,6 @@ int pmix2x_store_local(const opal_process_name_t *proc, opal_value_t *val)
|
||||
}
|
||||
}
|
||||
if (NULL == job) {
|
||||
OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND);
|
||||
return OPAL_ERR_NOT_FOUND;
|
||||
}
|
||||
(void)strncpy(p.nspace, job->nspace, PMIX_MAX_NSLEN);
|
||||
@ -224,6 +277,7 @@ static void opcbfunc(pmix_status_t status, void *cbdata)
|
||||
{
|
||||
pmix2x_opcaddy_t *op = (pmix2x_opcaddy_t*)cbdata;
|
||||
|
||||
OPAL_ACQUIRE_OBJECT(op);
|
||||
if (NULL != op->opcbfunc) {
|
||||
op->opcbfunc(pmix2x_convert_rc(status), op->cbdata);
|
||||
}
|
||||
@ -473,6 +527,8 @@ static void val_cbfunc(pmix_status_t status,
|
||||
int rc;
|
||||
opal_value_t val, *v=NULL;
|
||||
|
||||
OPAL_ACQUIRE_OBJECT(op);
|
||||
|
||||
rc = pmix2x_convert_opalrc(status);
|
||||
if (PMIX_SUCCESS == status && NULL != kv) {
|
||||
rc = pmix2x_value_unload(&val, kv);
|
||||
@ -720,6 +776,8 @@ static void lk_cbfunc(pmix_status_t status,
|
||||
size_t n;
|
||||
opal_pmix2x_jobid_trkr_t *job, *jptr;
|
||||
|
||||
OPAL_ACQUIRE_OBJECT(op);
|
||||
|
||||
/* this is in the PMIx local thread - need to threadshift to
|
||||
* our own thread as we will be accessing framework-global
|
||||
* lists and objects */
|
||||
@ -769,7 +827,7 @@ static void lk_cbfunc(pmix_status_t status,
|
||||
}
|
||||
r = &results;
|
||||
}
|
||||
release:
|
||||
release:
|
||||
/* execute the callback */
|
||||
op->lkcbfunc(rc, r, op->cbdata);
|
||||
|
||||
@ -946,6 +1004,8 @@ static void spcbfunc(pmix_status_t status,
|
||||
opal_jobid_t jobid=OPAL_JOBID_INVALID;
|
||||
opal_pmix2x_jobid_trkr_t *job;
|
||||
|
||||
OPAL_ACQUIRE_OBJECT(op);
|
||||
|
||||
/* this is in the PMIx local thread - need to threadshift to
|
||||
* our own thread as we will be accessing framework-global
|
||||
* lists and objects */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
||||
* 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.
|
||||
@ -28,7 +28,7 @@
|
||||
* Public string showing the pmix external component version number
|
||||
*/
|
||||
const char *opal_pmix_ext2x_component_version_string =
|
||||
"OPAL ext2x MCA component version " OPAL_VERSION;
|
||||
"OPAL pmix2x MCA component version " OPAL_VERSION;
|
||||
|
||||
/*
|
||||
* Local function
|
||||
@ -36,7 +36,6 @@ const char *opal_pmix_ext2x_component_version_string =
|
||||
static int external_open(void);
|
||||
static int external_close(void);
|
||||
static int external_component_query(mca_base_module_t **module, int *priority);
|
||||
static int external_register(void);
|
||||
|
||||
|
||||
/*
|
||||
@ -66,7 +65,6 @@ mca_pmix_ext2x_component_t mca_pmix_ext2x_component = {
|
||||
.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 = {
|
||||
@ -77,27 +75,12 @@ mca_pmix_ext2x_component_t mca_pmix_ext2x_component = {
|
||||
.native_launch = false
|
||||
};
|
||||
|
||||
static int external_register(void)
|
||||
{
|
||||
mca_pmix_ext2x_component.cache_size = 256;
|
||||
mca_base_component_var_register(&mca_pmix_ext2x_component.super.base_version,
|
||||
"cache_size", "Size of the ring buffer cache for events",
|
||||
MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_5,
|
||||
MCA_BASE_VAR_SCOPE_CONSTANT,
|
||||
&mca_pmix_ext2x_component.cache_size);
|
||||
|
||||
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.single_events, opal_list_t);
|
||||
OBJ_CONSTRUCT(&mca_pmix_ext2x_component.multi_events, opal_list_t);
|
||||
OBJ_CONSTRUCT(&mca_pmix_ext2x_component.default_events, opal_list_t);
|
||||
OBJ_CONSTRUCT(&mca_pmix_ext2x_component.cache, 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;
|
||||
}
|
||||
@ -105,10 +88,8 @@ static int external_open(void)
|
||||
static int external_close(void)
|
||||
{
|
||||
OPAL_LIST_DESTRUCT(&mca_pmix_ext2x_component.jobids);
|
||||
OPAL_LIST_DESTRUCT(&mca_pmix_ext2x_component.single_events);
|
||||
OPAL_LIST_DESTRUCT(&mca_pmix_ext2x_component.multi_events);
|
||||
OPAL_LIST_DESTRUCT(&mca_pmix_ext2x_component.default_events);
|
||||
OPAL_LIST_DESTRUCT(&mca_pmix_ext2x_component.cache);
|
||||
OPAL_LIST_DESTRUCT(&mca_pmix_ext2x_component.events);
|
||||
OPAL_LIST_DESTRUCT(&mca_pmix_ext2x_component.dmdx);
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
||||
* 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.
|
||||
@ -29,6 +29,7 @@
|
||||
#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"
|
||||
@ -45,63 +46,73 @@
|
||||
/* These are the interfaces used by the embedded PMIx server
|
||||
* to call up into ORTE for service requests */
|
||||
|
||||
static pmix_status_t server_client_connected_fn(const pmix_proc_t *proc, void* server_object,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_client_finalized_fn(const pmix_proc_t *proc, void* server_object,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_abort_fn(const pmix_proc_t *proc, void *server_object,
|
||||
int status, const char msg[],
|
||||
pmix_proc_t procs[], size_t nprocs,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_fencenb_fn(const pmix_proc_t procs[], size_t nprocs,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
char *data, size_t ndata,
|
||||
pmix_modex_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *proc,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_modex_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_publish_fn(const pmix_proc_t *proc,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_lookup_fn(const pmix_proc_t *proc, char **keys,
|
||||
static pmix_status_t server_client_connected_fn(const pmix_proc_t *proc, void* server_object,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_client_finalized_fn(const pmix_proc_t *proc, void* server_object,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_abort_fn(const pmix_proc_t *proc, void *server_object,
|
||||
int status, const char msg[],
|
||||
pmix_proc_t procs[], size_t nprocs,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_fencenb_fn(const pmix_proc_t procs[], size_t nprocs,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_lookup_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_unpublish_fn(const pmix_proc_t *proc, char **keys,
|
||||
char *data, size_t ndata,
|
||||
pmix_modex_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *proc,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_modex_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_publish_fn(const pmix_proc_t *proc,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_lookup_fn(const pmix_proc_t *proc, char **keys,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_lookup_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_unpublish_fn(const pmix_proc_t *proc, char **keys,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_spawn_fn(const pmix_proc_t *proc,
|
||||
const pmix_info_t job_info[], size_t ninfo,
|
||||
const pmix_app_t apps[], size_t napps,
|
||||
pmix_spawn_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_connect_fn(const pmix_proc_t procs[], size_t nprocs,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_disconnect_fn(const pmix_proc_t procs[], size_t nprocs,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_spawn_fn(const pmix_proc_t *proc,
|
||||
const pmix_info_t job_info[], size_t ninfo,
|
||||
const pmix_app_t apps[], size_t napps,
|
||||
pmix_spawn_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_connect_fn(const pmix_proc_t procs[], size_t nprocs,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_disconnect_fn(const pmix_proc_t procs[], size_t nprocs,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_register_events(pmix_status_t *codes, size_t ncodes,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_deregister_events(pmix_status_t *codes, size_t ncodes,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_notify_event(pmix_status_t code,
|
||||
const pmix_proc_t *source,
|
||||
pmix_data_range_t range,
|
||||
pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_query(pmix_proc_t *proct,
|
||||
pmix_query_t *queryies, size_t nqueries,
|
||||
pmix_info_cbfunc_t cbfunc,
|
||||
static pmix_status_t server_register_events(pmix_status_t *codes, size_t ncodes,
|
||||
const pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_deregister_events(pmix_status_t *codes, size_t ncodes,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_notify_event(pmix_status_t code,
|
||||
const pmix_proc_t *source,
|
||||
pmix_data_range_t range,
|
||||
pmix_info_t info[], size_t ninfo,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
static pmix_status_t server_query(pmix_proc_t *proct,
|
||||
pmix_query_t *queryies, size_t nqueries,
|
||||
pmix_info_cbfunc_t cbfunc,
|
||||
void *cbdata);
|
||||
static void server_tool_connection(pmix_info_t *info, size_t ninfo,
|
||||
pmix_tool_connection_cbfunc_t cbfunc,
|
||||
void *cbdata);
|
||||
static void server_tool_connection(pmix_info_t *info, size_t ninfo,
|
||||
pmix_tool_connection_cbfunc_t cbfunc,
|
||||
void *cbdata);
|
||||
static void server_log(const pmix_proc_t *client,
|
||||
const pmix_info_t data[], size_t ndata,
|
||||
const pmix_info_t directives[], size_t ndirs,
|
||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||
|
||||
pmix_server_module_t mymodule = {
|
||||
static pmix_status_t server_allocate(const pmix_proc_t *client,
|
||||
pmix_alloc_directive_t directive,
|
||||
const pmix_info_t data[], size_t ndata,
|
||||
pmix_info_cbfunc_t cbfunc, void *cbdata);
|
||||
|
||||
static pmix_status_t server_job_control(const pmix_proc_t *requestor,
|
||||
const pmix_proc_t targets[], size_t ntargets,
|
||||
const pmix_info_t directives[], size_t ndirs,
|
||||
pmix_info_cbfunc_t cbfunc, void *cbdata);
|
||||
|
||||
pmix_server_module_t mymodule = {
|
||||
.client_connected = server_client_connected_fn,
|
||||
.client_finalized = server_client_finalized_fn,
|
||||
.abort = server_abort_fn,
|
||||
@ -118,7 +129,11 @@ static void server_log(const pmix_proc_t *client,
|
||||
.notify_event = server_notify_event,
|
||||
.query = server_query,
|
||||
.tool_connected = server_tool_connection,
|
||||
.log = server_log
|
||||
.log = server_log,
|
||||
.allocate = server_allocate,
|
||||
.job_control = server_job_control
|
||||
/* we do not support monitoring, but use the
|
||||
* PMIx internal monitoring capability */
|
||||
};
|
||||
|
||||
opal_pmix_server_module_t *host_module = NULL;
|
||||
@ -128,6 +143,7 @@ static void opal_opcbfunc(int status, void *cbdata)
|
||||
{
|
||||
pmix2x_opalcaddy_t *opalcaddy = (pmix2x_opalcaddy_t*)cbdata;
|
||||
|
||||
OPAL_ACQUIRE_OBJECT(opalcaddy);
|
||||
if (NULL != opalcaddy->opcbfunc) {
|
||||
opalcaddy->opcbfunc(pmix2x_convert_opalrc(status), opalcaddy->cbdata);
|
||||
}
|
||||
@ -252,6 +268,7 @@ static void opmdx_response(int status, const char *data, size_t sz, void *cbdata
|
||||
{
|
||||
pmix_status_t rc;
|
||||
pmix2x_opalcaddy_t *opalcaddy = (pmix2x_opalcaddy_t*)cbdata;
|
||||
opal_pmix2x_dmx_trkr_t *dmdx;
|
||||
|
||||
rc = pmix2x_convert_rc(status);
|
||||
if (NULL != opalcaddy->mdxcbfunc) {
|
||||
@ -259,6 +276,13 @@ static void opmdx_response(int status, const char *data, size_t sz, void *cbdata
|
||||
opalcaddy->ocbdata = relcbdata;
|
||||
opalcaddy->mdxcbfunc(rc, data, sz, opalcaddy->cbdata,
|
||||
_data_release, opalcaddy);
|
||||
/* if we were collecting all data, then check for any pending
|
||||
* dmodx requests that we cached and notify them that the
|
||||
* data has arrived */
|
||||
while (NULL != (dmdx = (opal_pmix2x_dmx_trkr_t*)opal_list_remove_first(&mca_pmix_ext2x_component.dmdx))) {
|
||||
dmdx->cbfunc(PMIX_SUCCESS, NULL, 0, dmdx->cbdata, NULL, NULL);
|
||||
OBJ_RELEASE(dmdx);
|
||||
}
|
||||
} else {
|
||||
OBJ_RELEASE(opalcaddy);
|
||||
}
|
||||
@ -278,7 +302,6 @@ static pmix_status_t server_fencenb_fn(const pmix_proc_t procs[], size_t nprocs,
|
||||
if (NULL == host_module || NULL == host_module->fence_nb) {
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
/* setup the caddy */
|
||||
opalcaddy = OBJ_NEW(pmix2x_opalcaddy_t);
|
||||
opalcaddy->mdxcbfunc = cbfunc;
|
||||
@ -324,6 +347,7 @@ static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *p,
|
||||
opal_process_name_t proc;
|
||||
opal_value_t *iptr;
|
||||
size_t n;
|
||||
opal_pmix2x_dmx_trkr_t *dmdx;
|
||||
|
||||
if (NULL == host_module || NULL == host_module->direct_modex) {
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
@ -340,6 +364,21 @@ static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *p,
|
||||
opalcaddy->mdxcbfunc = cbfunc;
|
||||
opalcaddy->cbdata = cbdata;
|
||||
|
||||
/* this function should only get called if we are in an async modex.
|
||||
* If we are also collecting data, then the fence_nb will eventually
|
||||
* complete and return all the required data down to the pmix
|
||||
* server beneath us. Thus, we only need to track the dmodex_req
|
||||
* and ensure that the release gets called once the data has
|
||||
* arrived - this will trigger the pmix server to tell the
|
||||
* client that the data is available */
|
||||
if (opal_pmix_base_async_modex && opal_pmix_collect_all_data) {
|
||||
dmdx = OBJ_NEW(opal_pmix2x_dmx_trkr_t);
|
||||
dmdx->cbfunc = cbfunc;
|
||||
dmdx->cbdata = cbdata;
|
||||
opal_list_append(&mca_pmix_ext2x_component.dmdx, &dmdx->super);
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
||||
/* convert the array of pmix_info_t to the list of info */
|
||||
for (n=0; n < ninfo; n++) {
|
||||
iptr = OBJ_NEW(opal_value_t);
|
||||
@ -1016,6 +1055,7 @@ static void server_log(const pmix_proc_t *proct,
|
||||
/* convert the data */
|
||||
for (n=0; n < ndata; n++) {
|
||||
oinfo = OBJ_NEW(opal_value_t);
|
||||
oinfo->key = strdup(data[n].key);
|
||||
/* we "borrow" the info field of the caddy as we and the
|
||||
* server function both agree on what will be there */
|
||||
opal_list_append(&opalcaddy->info, &oinfo->super);
|
||||
@ -1051,3 +1091,117 @@ static void server_log(const pmix_proc_t *proct,
|
||||
&opalcaddy->apps,
|
||||
opal_opcbfunc, opalcaddy);
|
||||
}
|
||||
|
||||
static pmix_status_t server_allocate(const pmix_proc_t *proct,
|
||||
pmix_alloc_directive_t directive,
|
||||
const pmix_info_t data[], size_t ndata,
|
||||
pmix_info_cbfunc_t cbfunc, void *cbdata)
|
||||
{
|
||||
pmix2x_opalcaddy_t *opalcaddy;
|
||||
opal_process_name_t requestor;
|
||||
int rc;
|
||||
size_t n;
|
||||
opal_value_t *oinfo;
|
||||
opal_pmix_alloc_directive_t odir;
|
||||
|
||||
if (NULL == host_module || NULL == host_module->allocate) {
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
/* setup the caddy */
|
||||
opalcaddy = OBJ_NEW(pmix2x_opalcaddy_t);
|
||||
opalcaddy->infocbfunc = cbfunc;
|
||||
opalcaddy->cbdata = cbdata;
|
||||
|
||||
/* convert the requestor */
|
||||
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&requestor.jobid, proct->nspace))) {
|
||||
OBJ_RELEASE(opalcaddy);
|
||||
return pmix2x_convert_opalrc(rc);
|
||||
}
|
||||
requestor.vpid = pmix2x_convert_rank(proct->rank);
|
||||
|
||||
/* convert the directive */
|
||||
odir = pmix2x_convert_allocdir(directive);
|
||||
|
||||
/* convert the data */
|
||||
for (n=0; n < ndata; n++) {
|
||||
oinfo = OBJ_NEW(opal_value_t);
|
||||
opal_list_append(&opalcaddy->info, &oinfo->super);
|
||||
if (OPAL_SUCCESS != (rc = pmix2x_value_unload(oinfo, &data[n].value))) {
|
||||
OBJ_RELEASE(opalcaddy);
|
||||
return pmix2x_convert_opalrc(rc);
|
||||
}
|
||||
}
|
||||
|
||||
/* pass the call upwards */
|
||||
if (OPAL_SUCCESS != (rc = host_module->allocate(&requestor, odir,
|
||||
&opalcaddy->info,
|
||||
info_cbfunc, opalcaddy))) {
|
||||
OBJ_RELEASE(opalcaddy);
|
||||
return pmix2x_convert_opalrc(rc);
|
||||
}
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
static pmix_status_t server_job_control(const pmix_proc_t *proct,
|
||||
const pmix_proc_t targets[], size_t ntargets,
|
||||
const pmix_info_t directives[], size_t ndirs,
|
||||
pmix_info_cbfunc_t cbfunc, void *cbdata)
|
||||
{
|
||||
pmix2x_opalcaddy_t *opalcaddy;
|
||||
opal_process_name_t requestor;
|
||||
int rc;
|
||||
size_t n;
|
||||
opal_value_t *oinfo;
|
||||
opal_namelist_t *nm;
|
||||
|
||||
if (NULL == host_module || NULL == host_module->job_control) {
|
||||
return PMIX_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
/* setup the caddy */
|
||||
opalcaddy = OBJ_NEW(pmix2x_opalcaddy_t);
|
||||
opalcaddy->infocbfunc = cbfunc;
|
||||
opalcaddy->cbdata = cbdata;
|
||||
|
||||
/* convert the requestor */
|
||||
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&requestor.jobid, proct->nspace))) {
|
||||
OBJ_RELEASE(opalcaddy);
|
||||
return pmix2x_convert_opalrc(rc);
|
||||
}
|
||||
requestor.vpid = pmix2x_convert_rank(proct->rank);
|
||||
|
||||
/* convert the targets */
|
||||
for (n=0; n < ntargets; n++) {
|
||||
nm = OBJ_NEW(opal_namelist_t);
|
||||
opal_list_append(&opalcaddy->procs, &nm->super);
|
||||
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&nm->name.jobid, targets[n].nspace))) {
|
||||
OBJ_RELEASE(opalcaddy);
|
||||
return pmix2x_convert_opalrc(rc);
|
||||
}
|
||||
nm->name.vpid = pmix2x_convert_rank(targets[n].rank);
|
||||
}
|
||||
|
||||
/* convert the directives */
|
||||
for (n=0; n < ndirs; n++) {
|
||||
oinfo = OBJ_NEW(opal_value_t);
|
||||
opal_list_append(&opalcaddy->info, &oinfo->super);
|
||||
if (OPAL_SUCCESS != (rc = pmix2x_value_unload(oinfo, &directives[n].value))) {
|
||||
OBJ_RELEASE(opalcaddy);
|
||||
return pmix2x_convert_opalrc(rc);
|
||||
}
|
||||
}
|
||||
|
||||
/* pass the call upwards */
|
||||
if (OPAL_SUCCESS != (rc = host_module->job_control(&requestor,
|
||||
&opalcaddy->procs,
|
||||
&opalcaddy->info,
|
||||
info_cbfunc, opalcaddy))) {
|
||||
OBJ_RELEASE(opalcaddy);
|
||||
return pmix2x_convert_opalrc(rc);
|
||||
}
|
||||
|
||||
return PMIX_SUCCESS;
|
||||
}
|
||||
|
@ -1,12 +1,14 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
||||
* 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 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
|
||||
@ -30,6 +32,7 @@
|
||||
#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"
|
||||
@ -56,6 +59,7 @@ static size_t errhdler_ref = 0;
|
||||
while ((a)) { \
|
||||
usleep(10); \
|
||||
} \
|
||||
OPAL_ACQUIRE_OBJECT(a); \
|
||||
} while (0)
|
||||
|
||||
static void errreg_cbfunc (pmix_status_t status,
|
||||
@ -64,10 +68,12 @@ static void errreg_cbfunc (pmix_status_t status,
|
||||
{
|
||||
volatile bool *active = (volatile bool*)cbdata;
|
||||
|
||||
OPAL_ACQUIRE_OBJECT(active);
|
||||
errhdler_ref = 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(active);
|
||||
*active = false;
|
||||
}
|
||||
|
||||
@ -75,11 +81,14 @@ static void opcbfunc(pmix_status_t status, void *cbdata)
|
||||
{
|
||||
pmix2x_opcaddy_t *op = (pmix2x_opcaddy_t*)cbdata;
|
||||
|
||||
OPAL_ACQUIRE_OBJECT(op);
|
||||
|
||||
if (NULL != op->opcbfunc) {
|
||||
op->opcbfunc(pmix2x_convert_rc(status), op->cbdata);
|
||||
}
|
||||
if (op->active) {
|
||||
op->status = status;
|
||||
OPAL_POST_OBJECT(op);
|
||||
op->active = false;
|
||||
} else {
|
||||
OBJ_RELEASE(op);
|
||||
@ -90,6 +99,7 @@ static void op2cbfunc(pmix_status_t status, void *cbdata)
|
||||
{
|
||||
volatile bool *active = (volatile bool*)cbdata;
|
||||
|
||||
OPAL_POST_OBJECT(active);
|
||||
*active = false;
|
||||
}
|
||||
|
||||
@ -142,14 +152,20 @@ int pmix2x_server_init(opal_pmix_server_module_t *module,
|
||||
|
||||
/* register the default event handler */
|
||||
active = true;
|
||||
PMIx_Register_event_handler(NULL, 0, NULL, 0, pmix2x_event_hdlr, errreg_cbfunc, (void*)&active);
|
||||
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, pmix2x_event_hdlr, errreg_cbfunc, (void*)&active);
|
||||
PMIX_WAIT_FOR_COMPLETION(active);
|
||||
PMIX_INFO_FREE(pinfo, 1);
|
||||
|
||||
/* as we might want to use some client-side functions, be sure
|
||||
* to register our own nspace */
|
||||
PMIX_INFO_CREATE(pinfo, 1);
|
||||
PMIX_INFO_LOAD(&pinfo[0], PMIX_REGISTER_NODATA, NULL, PMIX_BOOL);
|
||||
active = true;
|
||||
PMIx_server_register_nspace(job->nspace, 1, NULL, 0, op2cbfunc, (void*)&active);
|
||||
PMIx_server_register_nspace(job->nspace, 1, pinfo, 1, op2cbfunc, (void*)&active);
|
||||
PMIX_WAIT_FOR_COMPLETION(active);
|
||||
PMIX_INFO_FREE(pinfo, 1);
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
@ -157,6 +173,7 @@ int pmix2x_server_init(opal_pmix_server_module_t *module,
|
||||
static void fincb(pmix_status_t status, void *cbdata)
|
||||
{
|
||||
volatile bool *active = (volatile bool*)cbdata;
|
||||
OPAL_POST_OBJECT(active);
|
||||
*active = false;
|
||||
}
|
||||
|
||||
@ -203,6 +220,8 @@ static void _reg_nspace(int sd, short args, void *cbdata)
|
||||
opal_pmix2x_jobid_trkr_t *job;
|
||||
pmix2x_opcaddy_t op;
|
||||
|
||||
OPAL_ACQUIRE_OBJECT(cd);
|
||||
|
||||
/* we must threadshift this request as we might not be in an event
|
||||
* and we are going to access framework-global lists/objects */
|
||||
|
||||
@ -291,9 +310,10 @@ int pmix2x_server_register_nspace(opal_jobid_t jobid,
|
||||
if (NULL == cbfunc) {
|
||||
_reg_nspace(0, 0, cd);
|
||||
} else {
|
||||
event_assign(&cd->ev, opal_pmix_base.evbase,
|
||||
-1, EV_WRITE, _reg_nspace, cd);
|
||||
event_active(&cd->ev, EV_WRITE, 1);
|
||||
opal_event_assign(&cd->ev, opal_pmix_base.evbase,
|
||||
-1, EV_WRITE, _reg_nspace, cd);
|
||||
OPAL_POST_OBJECT(cd);
|
||||
opal_event_active(&cd->ev, EV_WRITE, 1);
|
||||
}
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
@ -303,10 +323,12 @@ static void tdcbfunc(pmix_status_t status, void *cbdata)
|
||||
{
|
||||
pmix2x_threadshift_t *cd = (pmix2x_threadshift_t*)cbdata;
|
||||
|
||||
OPAL_ACQUIRE_OBJECT(cd);
|
||||
if (NULL != cd->opcbfunc) {
|
||||
cd->opcbfunc(pmix2x_convert_rc(status), cd->cbdata);
|
||||
}
|
||||
if (cd->active) {
|
||||
OPAL_POST_OBJECT(cd);
|
||||
cd->active = false;
|
||||
} else {
|
||||
OBJ_RELEASE(cd);
|
||||
@ -318,6 +340,7 @@ static void _dereg_nspace(int sd, short args, void *cbdata)
|
||||
pmix2x_threadshift_t *cd = (pmix2x_threadshift_t*)cbdata;
|
||||
opal_pmix2x_jobid_trkr_t *jptr;
|
||||
|
||||
OPAL_ACQUIRE_OBJECT(cd);
|
||||
/* if we don't already have it, we can ignore this */
|
||||
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext2x_component.jobids, opal_pmix2x_jobid_trkr_t) {
|
||||
if (jptr->jobid == cd->jobid) {
|
||||
@ -351,9 +374,10 @@ void pmix2x_server_deregister_nspace(opal_jobid_t jobid,
|
||||
if (NULL == cbfunc) {
|
||||
_dereg_nspace(0, 0, cd);
|
||||
} else {
|
||||
event_assign(&cd->ev, opal_pmix_base.evbase,
|
||||
opal_event_assign(&cd->ev, opal_pmix_base.evbase,
|
||||
-1, EV_WRITE, _dereg_nspace, cd);
|
||||
event_active(&cd->ev, EV_WRITE, 1);
|
||||
OPAL_POST_OBJECT(cd);
|
||||
opal_event_active(&cd->ev, EV_WRITE, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -389,6 +413,7 @@ static void _dereg_client(int sd, short args, void *cbdata)
|
||||
opal_pmix2x_jobid_trkr_t *jptr;
|
||||
pmix_proc_t p;
|
||||
|
||||
OPAL_ACQUIRE_OBJECT(cd);
|
||||
/* if we don't already have it, we can ignore this */
|
||||
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext2x_component.jobids, opal_pmix2x_jobid_trkr_t) {
|
||||
if (jptr->jobid == cd->source->jobid) {
|
||||
@ -421,9 +446,10 @@ void pmix2x_server_deregister_client(const opal_process_name_t *proc,
|
||||
if (NULL == cbfunc) {
|
||||
_dereg_client(0, 0, cd);
|
||||
} else {
|
||||
event_assign(&cd->ev, opal_pmix_base.evbase,
|
||||
opal_event_assign(&cd->ev, opal_pmix_base.evbase,
|
||||
-1, EV_WRITE, _dereg_client, cd);
|
||||
event_active(&cd->ev, EV_WRITE, 1);
|
||||
OPAL_POST_OBJECT(cd);
|
||||
opal_event_active(&cd->ev, EV_WRITE, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "opal/mca/event/event.h"
|
||||
#include "opal/mca/pmix/pmix.h"
|
||||
#include "opal/util/argv.h"
|
||||
|
||||
#include "orte/orted/pmix/pmix_server_internal.h"
|
||||
#include "orte/runtime/orte_data_server.h"
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user