Skip to content

Commit

Permalink
Merge pull request #1801 from rhc54/topic/toolconnect
Browse files Browse the repository at this point in the history
Add support for PMIx tool connections and queries.
  • Loading branch information
rhc54 authored Jun 30, 2016
2 parents f18d660 + 6e434d6 commit 063f848
Show file tree
Hide file tree
Showing 52 changed files with 2,986 additions and 236 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ orte/test/system/pmi_abort
orte/test/system/opal_hwloc
orte/test/system/opal_db
orte/test/system/ulfm
orte/test/system/pmixtool

orte/tools/orte-checkpoint/orte-checkpoint
orte/tools/orte-checkpoint/orte-checkpoint.1
Expand Down
3 changes: 2 additions & 1 deletion opal/include/opal/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ enum {
OPAL_ERR_SERVER_NOT_AVAIL = (OPAL_ERR_BASE - 52),
OPAL_ERR_IN_PROCESS = (OPAL_ERR_BASE - 53),
OPAL_ERR_DEBUGGER_RELEASE = (OPAL_ERR_BASE - 54),
OPAL_ERR_HANDLERS_COMPLETE = (OPAL_ERR_BASE - 55)
OPAL_ERR_HANDLERS_COMPLETE = (OPAL_ERR_BASE - 55),
OPAL_ERR_PARTIAL_SUCCESS = (OPAL_ERR_BASE - 56)
};

#define OPAL_ERR_MAX (OPAL_ERR_BASE - 100)
Expand Down
18 changes: 18 additions & 0 deletions opal/mca/pmix/ext20/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,24 @@ AC_DEFUN([MCA_opal_pmix_ext20_CONFIG],[
[AC_MSG_RESULT([no])
opal_pmix_ext20_happy=no])

# if we have 2.0, then check further to see if we have
# the PMIx_Query_info function as that is even newer
AS_IF([test "$opal_pmix_ext20_happy" = "yes"],
[AC_MSG_CHECKING([if external component is series 2.0])
OPAL_CHECK_PACKAGE([opal_pmix_ext20],
[pmix.h],
[pmix],
[PMIx_Query_info],
[-lpmix],
[$pmix_ext_install_dir],
[$pmix_ext_install_dir/lib],
[AC_MSG_RESULT([yes])
opal_pmix_query_happy=1],
[AC_MSG_RESULT([no])
opal_pmix_query_happy=0])])

AC_DEFINE_UNQUOTED([HAVE_PMIX_QUERY_FUNCTION], [$opal_pmix_query_happy],
[Whether or not the external library has the PMIx_Query_info function])
AC_SUBST(opal_pmix_ext20_CPPFLAGS)
AC_SUBST(opal_pmix_ext20_LDFLAGS)
AC_SUBST(opal_pmix_ext20_LIBS)
Expand Down
23 changes: 22 additions & 1 deletion opal/mca/pmix/ext20/pmix_ext20.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ static void _event_hdlr(int sd, short args, void *cbdata)
void pmix20_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)
{
Expand Down Expand Up @@ -559,6 +560,9 @@ opal_pmix_data_range_t pmix20_convert_range(pmix_data_range_t range) {
void pmix20_value_load(pmix_value_t *v,
opal_value_t *kv)
{
size_t n;
char nspace[PMIX_MAX_NSLEN + 1];

switch(kv->type) {
case OPAL_UNDEF:
v->type = PMIX_UNDEF;
Expand Down Expand Up @@ -650,6 +654,19 @@ void pmix20_value_load(pmix_value_t *v,
v->data.bo.size = 0;
}
break;
case OPAL_UINT32_ARRAY:
/* an array of 32-bit jobids */
v->type = PMIX_INFO_ARRAY;
v->data.array.size = kv->data.uint32_array.size;
if (0 < v->data.array.size) {
PMIX_INFO_CREATE(v->data.array.array, v->data.array.size);
for (n=0; n < v->data.array.size; n++) {
v->data.array.array[n].value.type = PMIX_STRING;
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, kv->data.uint32_array.data[n]);
v->data.array.array[n].value.data.string = strdup(nspace);
}
}
break;
default:
/* silence warnings */
break;
Expand All @@ -664,7 +681,7 @@ int pmix20_value_unload(opal_value_t *kv,

switch(v->type) {
case PMIX_UNDEF:
rc = OPAL_ERR_UNKNOWN_DATA_TYPE;
kv->type = OPAL_UNDEF;
break;
case PMIX_BOOL:
kv->type = OPAL_BOOL;
Expand Down Expand Up @@ -1143,6 +1160,10 @@ static void ocadcon(pmix20_opalcaddy_t *p)
p->spwncbfunc = NULL;
p->cbdata = NULL;
p->odmdxfunc = NULL;
#if HAVE_PMIX_QUERY_FUNCTION
p->infocbfunc = NULL;
p->toolcbfunc = NULL;
#endif
p->ocbdata = NULL;
}
static void ocaddes(pmix20_opalcaddy_t *p)
Expand Down
5 changes: 5 additions & 0 deletions opal/mca/pmix/ext20/pmix_ext20.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ typedef struct {
pmix_modex_cbfunc_t mdxcbfunc;
pmix_lookup_cbfunc_t lkupcbfunc;
pmix_spawn_cbfunc_t spwncbfunc;
#if HAVE_PMIX_QUERY_FUNCTION
pmix_info_cbfunc_t infocbfunc;
pmix_tool_connection_cbfunc_t toolcbfunc;
#endif
void *cbdata;
opal_pmix_release_cbfunc_t odmdxfunc;
void *ocbdata;
Expand Down Expand Up @@ -293,6 +297,7 @@ OPAL_MODULE_DECLSPEC int pmix20_server_notify_event(int status,
OPAL_MODULE_DECLSPEC void pmix20_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 pmix20_convert_opalrc(int rc);
Expand Down
173 changes: 172 additions & 1 deletion opal/mca/pmix/ext20/pmix_ext20_server_north.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@
pmix_data_range_t range,
pmix_info_t info[], size_t ninfo,
pmix_op_cbfunc_t cbfunc, void *cbdata);
#if HAVE_PMIX_QUERY_FUNCTION
static pmix_status_t server_query(pmix_proc_t *proct,
pmix_info_t *info, size_t ninfo,
pmix_info_t *directives, size_t ndirs,
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);
#endif

pmix_server_module_t mymodule = {
.client_connected = server_client_connected_fn,
.client_finalized = server_client_finalized_fn,
Expand All @@ -102,7 +113,11 @@
.disconnect = server_disconnect_fn,
.register_events = server_register_events,
.deregister_events = server_deregister_events,
.notify_event = server_notify_event
.notify_event = server_notify_event,
#if HAVE_PMIX_QUERY_FUNCTION
.query = server_query,
.tool_connected = server_tool_connection
#endif
};

opal_pmix_server_module_t *host_module = NULL;
Expand Down Expand Up @@ -787,3 +802,159 @@ static pmix_status_t server_notify_event(pmix_status_t code,
{
return PMIX_ERR_NOT_SUPPORTED;
}

#if HAVE_PMIX_QUERY_FUNCTION
static void _info_rel(void *cbdata)
{
pmix20_opcaddy_t *pcaddy = (pmix20_opcaddy_t*)cbdata;

OBJ_RELEASE(pcaddy);
}
static void info_cbfunc(int status,
opal_list_t *info,
void *cbdata,
opal_pmix_release_cbfunc_t release_fn,
void *release_cbdata)
{
pmix20_opalcaddy_t *opalcaddy = (pmix20_opalcaddy_t*)cbdata;
pmix20_opcaddy_t *pcaddy;
opal_value_t *kv;
size_t n;

pcaddy = OBJ_NEW(pmix20_opcaddy_t);

/* convert the status */
pcaddy->status = pmix20_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) {
PMIX_INFO_CREATE(pcaddy->info, pcaddy->ninfo);
n = 0;
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
(void)strncpy(pcaddy->info[n].key, kv->key, PMIX_MAX_KEYLEN);
pmix20_value_load(&pcaddy->info[n].value, kv);
}
}
}
/* we are done with the incoming data */
if (NULL != release_fn) {
release_fn(release_cbdata);
}

/* provide the answer downward */
if (NULL != opalcaddy->infocbfunc) {
opalcaddy->infocbfunc(pcaddy->status, pcaddy->info, pcaddy->ninfo,
opalcaddy->cbdata, _info_rel, pcaddy);
}
OBJ_RELEASE(opalcaddy);
}

static pmix_status_t server_query(pmix_proc_t *proct,
pmix_info_t *info, size_t ninfo,
pmix_info_t *directives, size_t ndirs,
pmix_info_cbfunc_t cbfunc,
void *cbdata)
{
pmix20_opalcaddy_t *opalcaddy;
opal_process_name_t requestor;
int rc;
size_t n;
opal_value_t *oinfo;

if (NULL == host_module || NULL == host_module->query) {
return PMIX_ERR_NOT_SUPPORTED;
}

/* setup the caddy */
opalcaddy = OBJ_NEW(pmix20_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 pmix20_convert_opalrc(rc);
}
requestor.vpid = proct->rank;

/* convert the info */
for (n=0; n < ninfo; n++) {
oinfo = OBJ_NEW(opal_value_t);
opal_list_append(&opalcaddy->info, &oinfo->super);
oinfo->key = strdup(info[n].key);
if (OPAL_SUCCESS != (rc = pmix20_value_unload(oinfo, &info[n].value))) {
OBJ_RELEASE(opalcaddy);
return pmix20_convert_opalrc(rc);
}
}

/* we ignore directives for now */

/* pass the call upwards */
if (OPAL_SUCCESS != (rc = host_module->query(&requestor,
&opalcaddy->info, NULL,
info_cbfunc, opalcaddy))) {
OBJ_RELEASE(opalcaddy);
}

return pmix20_convert_opalrc(rc);
}

static void toolcbfunc(int status,
opal_process_name_t proc,
void *cbdata)
{
pmix20_opalcaddy_t *opalcaddy = (pmix20_opalcaddy_t*)cbdata;
pmix_status_t rc;
pmix_proc_t p;


/* convert the status */
rc = pmix20_convert_opalrc(status);

/* convert the process name */
(void)opal_snprintf_jobid(p.nspace, PMIX_MAX_NSLEN, proc.jobid);
p.rank = proc.vpid;

/* pass it down */
if (NULL != opalcaddy->toolcbfunc) {
opalcaddy->toolcbfunc(rc, &p, opalcaddy->cbdata);
}
OBJ_RELEASE(opalcaddy);
}

static void server_tool_connection(pmix_info_t *info, size_t ninfo,
pmix_tool_connection_cbfunc_t cbfunc,
void *cbdata)
{
pmix20_opalcaddy_t *opalcaddy;
size_t n;
opal_value_t *oinfo;
int rc;
pmix_status_t err;

/* setup the caddy */
opalcaddy = OBJ_NEW(pmix20_opalcaddy_t);
opalcaddy->toolcbfunc = cbfunc;
opalcaddy->cbdata = cbdata;

/* convert the info */
for (n=0; n < ninfo; n++) {
oinfo = OBJ_NEW(opal_value_t);
opal_list_append(&opalcaddy->info, &oinfo->super);
oinfo->key = strdup(info[n].key);
if (OPAL_SUCCESS != (rc = pmix20_value_unload(oinfo, &info[n].value))) {
OBJ_RELEASE(opalcaddy);
err = pmix20_convert_opalrc(rc);
if (NULL != cbfunc) {
cbfunc(err, NULL, cbdata);
}
}
}

/* pass it up */
host_module->tool_connected(&opalcaddy->info, toolcbfunc, opalcaddy);
}
#endif
4 changes: 3 additions & 1 deletion opal/mca/pmix/pmix2x/configure.m4
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ AC_DEFUN([MCA_opal_pmix_pmix2x_CONFIG],[
opal_pmix_pmix2x_save_LDFLAGS=$LDFLAGS
opal_pmix_pmix2x_save_LIBS=$LIBS

opal_pmix_pmix2x_args="--enable-embedded-mode --with-pmix-symbol-prefix=opal_pmix_pmix2x_ --disable-visibility --with-libevent-header=\\\"opal/mca/event/$opal_event_base_include\\\" --with-hwloc-header=\\\"$opal_hwloc_base_include\\\""
opal_pmix_pmix2x_args="--without-tests-examples --with-pmix-symbol-prefix=opal_pmix_pmix2x_ --disable-visibility --enable-embedded-libevent --with-libevent-header=\\\"opal/mca/event/$opal_event_base_include\\\" --enable-embedded-hwloc --with-hwloc-header=\\\"$opal_hwloc_base_include\\\""
AS_IF([test "$enable_debug" = "yes"],
[opal_pmix_pmix2x_args="--enable-debug $opal_pmix_pmix2x_args"
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS -g"],
[opal_pmix_pmix2x_args="--disable-debug $opal_pmix_pmix2x_args"
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS"])
AS_IF([test "$with_devel_headers" = "yes"], [],
[opal_pmix_pmix2x_args="--enable-embedded-mode $opal_pmix_pmix2x_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_pmix2x_basedir/pmix],
Expand Down
5 changes: 5 additions & 0 deletions opal/mca/pmix/pmix2x/pmix/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ include src/client/Makefile.am
include src/server/Makefile.am
include src/sec/Makefile.am
include src/event/Makefile.am
include src/common/Makefile.am
include src/tool/Makefile.am

if WANT_DSTORE
include src/sm/Makefile.am
Expand All @@ -74,6 +76,9 @@ else
lib_LTLIBRARIES = libpmix.la
libpmix_la_SOURCES = $(headers) $(sources)
libpmix_la_LDFLAGS = -version-info $(libpmix_so_version)
endif

if PMIX_TESTS_EXAMPLES
SUBDIRS = . test examples
endif

Expand Down
6 changes: 3 additions & 3 deletions opal/mca/pmix/pmix2x/pmix/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ release=0
# The only requirement is that it must be entirely printable ASCII
# characters and have no white space.

greek=a1
greek=

# If repo_rev is empty, then the repository version number will be
# obtained during "make dist" via the "git describe --tags --always"
# command, or with the date (if "git describe" fails) in the form of
# "date<date>".

repo_rev=gitaf7a389
repo_rev=git4940b48

# If tarball_version is not empty, it is used as the version string in
# the tarball filename, regardless of all other versions listed in
Expand All @@ -44,7 +44,7 @@ tarball_version=

# The date when this release was created

date="Jun 16, 2016"
date="Jun 29, 2016"

# The shared library version of each of PMIx's public libraries.
# These versions are maintained in accordance with the "Library
Expand Down
Loading

0 comments on commit 063f848

Please sign in to comment.