Skip to content

Commit 063f848

Browse files
author
rhc54
authored
Merge pull request #1801 from rhc54/topic/toolconnect
Add support for PMIx tool connections and queries.
2 parents f18d660 + 6e434d6 commit 063f848

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2986
-236
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ orte/test/system/pmi_abort
450450
orte/test/system/opal_hwloc
451451
orte/test/system/opal_db
452452
orte/test/system/ulfm
453+
orte/test/system/pmixtool
453454

454455
orte/tools/orte-checkpoint/orte-checkpoint
455456
orte/tools/orte-checkpoint/orte-checkpoint.1

opal/include/opal/constants.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ enum {
8282
OPAL_ERR_SERVER_NOT_AVAIL = (OPAL_ERR_BASE - 52),
8383
OPAL_ERR_IN_PROCESS = (OPAL_ERR_BASE - 53),
8484
OPAL_ERR_DEBUGGER_RELEASE = (OPAL_ERR_BASE - 54),
85-
OPAL_ERR_HANDLERS_COMPLETE = (OPAL_ERR_BASE - 55)
85+
OPAL_ERR_HANDLERS_COMPLETE = (OPAL_ERR_BASE - 55),
86+
OPAL_ERR_PARTIAL_SUCCESS = (OPAL_ERR_BASE - 56)
8687
};
8788

8889
#define OPAL_ERR_MAX (OPAL_ERR_BASE - 100)

opal/mca/pmix/ext20/configure.m4

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,24 @@ AC_DEFUN([MCA_opal_pmix_ext20_CONFIG],[
5959
[AC_MSG_RESULT([no])
6060
opal_pmix_ext20_happy=no])
6161

62+
# if we have 2.0, then check further to see if we have
63+
# the PMIx_Query_info function as that is even newer
64+
AS_IF([test "$opal_pmix_ext20_happy" = "yes"],
65+
[AC_MSG_CHECKING([if external component is series 2.0])
66+
OPAL_CHECK_PACKAGE([opal_pmix_ext20],
67+
[pmix.h],
68+
[pmix],
69+
[PMIx_Query_info],
70+
[-lpmix],
71+
[$pmix_ext_install_dir],
72+
[$pmix_ext_install_dir/lib],
73+
[AC_MSG_RESULT([yes])
74+
opal_pmix_query_happy=1],
75+
[AC_MSG_RESULT([no])
76+
opal_pmix_query_happy=0])])
77+
78+
AC_DEFINE_UNQUOTED([HAVE_PMIX_QUERY_FUNCTION], [$opal_pmix_query_happy],
79+
[Whether or not the external library has the PMIx_Query_info function])
6280
AC_SUBST(opal_pmix_ext20_CPPFLAGS)
6381
AC_SUBST(opal_pmix_ext20_LDFLAGS)
6482
AC_SUBST(opal_pmix_ext20_LIBS)

opal/mca/pmix/ext20/pmix_ext20.c

100644100755
Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ static void _event_hdlr(int sd, short args, void *cbdata)
350350
void pmix20_event_hdlr(size_t evhdlr_registration_id,
351351
pmix_status_t status, const pmix_proc_t *source,
352352
pmix_info_t info[], size_t ninfo,
353+
pmix_info_t results[], size_t nresults,
353354
pmix_event_notification_cbfunc_fn_t cbfunc,
354355
void *cbdata)
355356
{
@@ -559,6 +560,9 @@ opal_pmix_data_range_t pmix20_convert_range(pmix_data_range_t range) {
559560
void pmix20_value_load(pmix_value_t *v,
560561
opal_value_t *kv)
561562
{
563+
size_t n;
564+
char nspace[PMIX_MAX_NSLEN + 1];
565+
562566
switch(kv->type) {
563567
case OPAL_UNDEF:
564568
v->type = PMIX_UNDEF;
@@ -650,6 +654,19 @@ void pmix20_value_load(pmix_value_t *v,
650654
v->data.bo.size = 0;
651655
}
652656
break;
657+
case OPAL_UINT32_ARRAY:
658+
/* an array of 32-bit jobids */
659+
v->type = PMIX_INFO_ARRAY;
660+
v->data.array.size = kv->data.uint32_array.size;
661+
if (0 < v->data.array.size) {
662+
PMIX_INFO_CREATE(v->data.array.array, v->data.array.size);
663+
for (n=0; n < v->data.array.size; n++) {
664+
v->data.array.array[n].value.type = PMIX_STRING;
665+
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, kv->data.uint32_array.data[n]);
666+
v->data.array.array[n].value.data.string = strdup(nspace);
667+
}
668+
}
669+
break;
653670
default:
654671
/* silence warnings */
655672
break;
@@ -664,7 +681,7 @@ int pmix20_value_unload(opal_value_t *kv,
664681

665682
switch(v->type) {
666683
case PMIX_UNDEF:
667-
rc = OPAL_ERR_UNKNOWN_DATA_TYPE;
684+
kv->type = OPAL_UNDEF;
668685
break;
669686
case PMIX_BOOL:
670687
kv->type = OPAL_BOOL;
@@ -1143,6 +1160,10 @@ static void ocadcon(pmix20_opalcaddy_t *p)
11431160
p->spwncbfunc = NULL;
11441161
p->cbdata = NULL;
11451162
p->odmdxfunc = NULL;
1163+
#if HAVE_PMIX_QUERY_FUNCTION
1164+
p->infocbfunc = NULL;
1165+
p->toolcbfunc = NULL;
1166+
#endif
11461167
p->ocbdata = NULL;
11471168
}
11481169
static void ocaddes(pmix20_opalcaddy_t *p)

opal/mca/pmix/ext20/pmix_ext20.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ typedef struct {
130130
pmix_modex_cbfunc_t mdxcbfunc;
131131
pmix_lookup_cbfunc_t lkupcbfunc;
132132
pmix_spawn_cbfunc_t spwncbfunc;
133+
#if HAVE_PMIX_QUERY_FUNCTION
134+
pmix_info_cbfunc_t infocbfunc;
135+
pmix_tool_connection_cbfunc_t toolcbfunc;
136+
#endif
133137
void *cbdata;
134138
opal_pmix_release_cbfunc_t odmdxfunc;
135139
void *ocbdata;
@@ -293,6 +297,7 @@ OPAL_MODULE_DECLSPEC int pmix20_server_notify_event(int status,
293297
OPAL_MODULE_DECLSPEC void pmix20_event_hdlr(size_t evhdlr_registration_id,
294298
pmix_status_t status, const pmix_proc_t *source,
295299
pmix_info_t info[], size_t ninfo,
300+
pmix_info_t results[], size_t nresults,
296301
pmix_event_notification_cbfunc_fn_t cbfunc,
297302
void *cbdata);
298303
OPAL_MODULE_DECLSPEC pmix_status_t pmix20_convert_opalrc(int rc);

opal/mca/pmix/ext20/pmix_ext20_server_north.c

100644100755
Lines changed: 172 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,17 @@
8888
pmix_data_range_t range,
8989
pmix_info_t info[], size_t ninfo,
9090
pmix_op_cbfunc_t cbfunc, void *cbdata);
91+
#if HAVE_PMIX_QUERY_FUNCTION
92+
static pmix_status_t server_query(pmix_proc_t *proct,
93+
pmix_info_t *info, size_t ninfo,
94+
pmix_info_t *directives, size_t ndirs,
95+
pmix_info_cbfunc_t cbfunc,
96+
void *cbdata);
97+
static void server_tool_connection(pmix_info_t *info, size_t ninfo,
98+
pmix_tool_connection_cbfunc_t cbfunc,
99+
void *cbdata);
100+
#endif
101+
91102
pmix_server_module_t mymodule = {
92103
.client_connected = server_client_connected_fn,
93104
.client_finalized = server_client_finalized_fn,
@@ -102,7 +113,11 @@
102113
.disconnect = server_disconnect_fn,
103114
.register_events = server_register_events,
104115
.deregister_events = server_deregister_events,
105-
.notify_event = server_notify_event
116+
.notify_event = server_notify_event,
117+
#if HAVE_PMIX_QUERY_FUNCTION
118+
.query = server_query,
119+
.tool_connected = server_tool_connection
120+
#endif
106121
};
107122

108123
opal_pmix_server_module_t *host_module = NULL;
@@ -787,3 +802,159 @@ static pmix_status_t server_notify_event(pmix_status_t code,
787802
{
788803
return PMIX_ERR_NOT_SUPPORTED;
789804
}
805+
806+
#if HAVE_PMIX_QUERY_FUNCTION
807+
static void _info_rel(void *cbdata)
808+
{
809+
pmix20_opcaddy_t *pcaddy = (pmix20_opcaddy_t*)cbdata;
810+
811+
OBJ_RELEASE(pcaddy);
812+
}
813+
static void info_cbfunc(int status,
814+
opal_list_t *info,
815+
void *cbdata,
816+
opal_pmix_release_cbfunc_t release_fn,
817+
void *release_cbdata)
818+
{
819+
pmix20_opalcaddy_t *opalcaddy = (pmix20_opalcaddy_t*)cbdata;
820+
pmix20_opcaddy_t *pcaddy;
821+
opal_value_t *kv;
822+
size_t n;
823+
824+
pcaddy = OBJ_NEW(pmix20_opcaddy_t);
825+
826+
/* convert the status */
827+
pcaddy->status = pmix20_convert_opalrc(status);
828+
829+
/* convert the list to a pmix_info_t array */
830+
if (NULL != info) {
831+
pcaddy->ninfo = opal_list_get_size(info);
832+
if (0 < pcaddy->ninfo) {
833+
PMIX_INFO_CREATE(pcaddy->info, pcaddy->ninfo);
834+
n = 0;
835+
OPAL_LIST_FOREACH(kv, info, opal_value_t) {
836+
(void)strncpy(pcaddy->info[n].key, kv->key, PMIX_MAX_KEYLEN);
837+
pmix20_value_load(&pcaddy->info[n].value, kv);
838+
}
839+
}
840+
}
841+
/* we are done with the incoming data */
842+
if (NULL != release_fn) {
843+
release_fn(release_cbdata);
844+
}
845+
846+
/* provide the answer downward */
847+
if (NULL != opalcaddy->infocbfunc) {
848+
opalcaddy->infocbfunc(pcaddy->status, pcaddy->info, pcaddy->ninfo,
849+
opalcaddy->cbdata, _info_rel, pcaddy);
850+
}
851+
OBJ_RELEASE(opalcaddy);
852+
}
853+
854+
static pmix_status_t server_query(pmix_proc_t *proct,
855+
pmix_info_t *info, size_t ninfo,
856+
pmix_info_t *directives, size_t ndirs,
857+
pmix_info_cbfunc_t cbfunc,
858+
void *cbdata)
859+
{
860+
pmix20_opalcaddy_t *opalcaddy;
861+
opal_process_name_t requestor;
862+
int rc;
863+
size_t n;
864+
opal_value_t *oinfo;
865+
866+
if (NULL == host_module || NULL == host_module->query) {
867+
return PMIX_ERR_NOT_SUPPORTED;
868+
}
869+
870+
/* setup the caddy */
871+
opalcaddy = OBJ_NEW(pmix20_opalcaddy_t);
872+
opalcaddy->infocbfunc = cbfunc;
873+
opalcaddy->cbdata = cbdata;
874+
875+
/* convert the requestor */
876+
if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&requestor.jobid, proct->nspace))) {
877+
OBJ_RELEASE(opalcaddy);
878+
return pmix20_convert_opalrc(rc);
879+
}
880+
requestor.vpid = proct->rank;
881+
882+
/* convert the info */
883+
for (n=0; n < ninfo; n++) {
884+
oinfo = OBJ_NEW(opal_value_t);
885+
opal_list_append(&opalcaddy->info, &oinfo->super);
886+
oinfo->key = strdup(info[n].key);
887+
if (OPAL_SUCCESS != (rc = pmix20_value_unload(oinfo, &info[n].value))) {
888+
OBJ_RELEASE(opalcaddy);
889+
return pmix20_convert_opalrc(rc);
890+
}
891+
}
892+
893+
/* we ignore directives for now */
894+
895+
/* pass the call upwards */
896+
if (OPAL_SUCCESS != (rc = host_module->query(&requestor,
897+
&opalcaddy->info, NULL,
898+
info_cbfunc, opalcaddy))) {
899+
OBJ_RELEASE(opalcaddy);
900+
}
901+
902+
return pmix20_convert_opalrc(rc);
903+
}
904+
905+
static void toolcbfunc(int status,
906+
opal_process_name_t proc,
907+
void *cbdata)
908+
{
909+
pmix20_opalcaddy_t *opalcaddy = (pmix20_opalcaddy_t*)cbdata;
910+
pmix_status_t rc;
911+
pmix_proc_t p;
912+
913+
914+
/* convert the status */
915+
rc = pmix20_convert_opalrc(status);
916+
917+
/* convert the process name */
918+
(void)opal_snprintf_jobid(p.nspace, PMIX_MAX_NSLEN, proc.jobid);
919+
p.rank = proc.vpid;
920+
921+
/* pass it down */
922+
if (NULL != opalcaddy->toolcbfunc) {
923+
opalcaddy->toolcbfunc(rc, &p, opalcaddy->cbdata);
924+
}
925+
OBJ_RELEASE(opalcaddy);
926+
}
927+
928+
static void server_tool_connection(pmix_info_t *info, size_t ninfo,
929+
pmix_tool_connection_cbfunc_t cbfunc,
930+
void *cbdata)
931+
{
932+
pmix20_opalcaddy_t *opalcaddy;
933+
size_t n;
934+
opal_value_t *oinfo;
935+
int rc;
936+
pmix_status_t err;
937+
938+
/* setup the caddy */
939+
opalcaddy = OBJ_NEW(pmix20_opalcaddy_t);
940+
opalcaddy->toolcbfunc = cbfunc;
941+
opalcaddy->cbdata = cbdata;
942+
943+
/* convert the info */
944+
for (n=0; n < ninfo; n++) {
945+
oinfo = OBJ_NEW(opal_value_t);
946+
opal_list_append(&opalcaddy->info, &oinfo->super);
947+
oinfo->key = strdup(info[n].key);
948+
if (OPAL_SUCCESS != (rc = pmix20_value_unload(oinfo, &info[n].value))) {
949+
OBJ_RELEASE(opalcaddy);
950+
err = pmix20_convert_opalrc(rc);
951+
if (NULL != cbfunc) {
952+
cbfunc(err, NULL, cbdata);
953+
}
954+
}
955+
}
956+
957+
/* pass it up */
958+
host_module->tool_connected(&opalcaddy->info, toolcbfunc, opalcaddy);
959+
}
960+
#endif

opal/mca/pmix/pmix2x/configure.m4

100644100755
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@ AC_DEFUN([MCA_opal_pmix_pmix2x_CONFIG],[
4141
opal_pmix_pmix2x_save_LDFLAGS=$LDFLAGS
4242
opal_pmix_pmix2x_save_LIBS=$LIBS
4343

44-
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\\\""
44+
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\\\""
4545
AS_IF([test "$enable_debug" = "yes"],
4646
[opal_pmix_pmix2x_args="--enable-debug $opal_pmix_pmix2x_args"
4747
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS -g"],
4848
[opal_pmix_pmix2x_args="--disable-debug $opal_pmix_pmix2x_args"
4949
CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS"])
50+
AS_IF([test "$with_devel_headers" = "yes"], [],
51+
[opal_pmix_pmix2x_args="--enable-embedded-mode $opal_pmix_pmix2x_args"])
5052
CPPFLAGS="-I$OPAL_TOP_SRCDIR -I$OPAL_TOP_BUILDDIR -I$OPAL_TOP_SRCDIR/opal/include -I$OPAL_TOP_BUILDDIR/opal/include $CPPFLAGS"
5153

5254
OPAL_CONFIG_SUBDIR([$opal_pmix_pmix2x_basedir/pmix],

opal/mca/pmix/pmix2x/pmix/Makefile.am

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ include src/client/Makefile.am
5858
include src/server/Makefile.am
5959
include src/sec/Makefile.am
6060
include src/event/Makefile.am
61+
include src/common/Makefile.am
62+
include src/tool/Makefile.am
6163

6264
if WANT_DSTORE
6365
include src/sm/Makefile.am
@@ -74,6 +76,9 @@ else
7476
lib_LTLIBRARIES = libpmix.la
7577
libpmix_la_SOURCES = $(headers) $(sources)
7678
libpmix_la_LDFLAGS = -version-info $(libpmix_so_version)
79+
endif
80+
81+
if PMIX_TESTS_EXAMPLES
7782
SUBDIRS = . test examples
7883
endif
7984

opal/mca/pmix/pmix2x/pmix/VERSION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ release=0
2323
# The only requirement is that it must be entirely printable ASCII
2424
# characters and have no white space.
2525

26-
greek=a1
26+
greek=
2727

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

33-
repo_rev=gitaf7a389
33+
repo_rev=git4940b48
3434

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

4545
# The date when this release was created
4646

47-
date="Jun 16, 2016"
47+
date="Jun 29, 2016"
4848

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

0 commit comments

Comments
 (0)