Skip to content

Commit 15b6eaf

Browse files
author
rhc54
authored
Merge pull request #2562 from rhc54/topic/pmix2
Update the PMIx2 support to include the latest shared memory optimizations
2 parents db32d1d + 884fb7f commit 15b6eaf

32 files changed

+397
-115
lines changed

ompi/dpm/dpm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
1616
* Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights
1717
* reserved.
18-
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved
18+
* Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
1919
* Copyright (c) 2014-2016 Research Organization for Information Science
2020
* and Technology (RIST). All rights reserved.
2121
* $COPYRIGHT$
@@ -675,7 +675,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
675675

676676
/* copy over the name of the executable */
677677
app->cmd = strdup(array_of_commands[i]);
678-
opal_argv_append(&app->argc, &app->argv, app->cmd);
678+
opal_argv_append_nosize(&app->argv, app->cmd);
679679

680680
/* record the number of procs to be generated */
681681
app->maxprocs = array_of_maxprocs[i];
@@ -684,7 +684,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
684684
if (MPI_ARGVS_NULL != array_of_argv &&
685685
MPI_ARGV_NULL != array_of_argv[i]) {
686686
for (j=0; NULL != array_of_argv[i][j]; j++) {
687-
opal_argv_append(&app->argc, &app->argv, array_of_argv[i][j]);
687+
opal_argv_append_nosize(&app->argv, array_of_argv[i][j]);
688688
}
689689
}
690690

opal/mca/pmix/base/pmix_base_frame.c

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
2+
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
33
* Copyright (c) 2015-2016 Cisco Systems, Inc. All rights reserved.
44
* $COPYRIGHT$
55
*
@@ -41,12 +41,12 @@ static int opal_pmix_base_frame_register(mca_base_register_flag_t flags)
4141
{
4242
opal_pmix_base_async_modex = false;
4343
(void) mca_base_var_register("opal", "pmix", "base", "async_modex", "Use asynchronous modex mode",
44-
MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, OPAL_INFO_LVL_9,
45-
MCA_BASE_VAR_SCOPE_READONLY, &opal_pmix_base_async_modex);
44+
MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, OPAL_INFO_LVL_9,
45+
MCA_BASE_VAR_SCOPE_READONLY, &opal_pmix_base_async_modex);
4646
opal_pmix_collect_all_data = true;
4747
(void) mca_base_var_register("opal", "pmix", "base", "collect_data", "Collect all data during modex",
48-
MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, OPAL_INFO_LVL_9,
49-
MCA_BASE_VAR_SCOPE_READONLY, &opal_pmix_collect_all_data);
48+
MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, OPAL_INFO_LVL_9,
49+
MCA_BASE_VAR_SCOPE_READONLY, &opal_pmix_collect_all_data);
5050
return OPAL_SUCCESS;
5151
}
5252

@@ -74,10 +74,10 @@ static int opal_pmix_base_frame_open(mca_base_open_flag_t flags)
7474
}
7575

7676
MCA_BASE_FRAMEWORK_DECLARE(opal, pmix, "OPAL PMI Client Framework",
77-
opal_pmix_base_frame_register,
78-
opal_pmix_base_frame_open,
79-
opal_pmix_base_frame_close,
80-
mca_pmix_base_static_components, 0);
77+
opal_pmix_base_frame_register,
78+
opal_pmix_base_frame_open,
79+
opal_pmix_base_frame_close,
80+
mca_pmix_base_static_components, 0);
8181

8282
/**** PMIX FRAMEWORK OBJECTS ****/
8383
static void lkcon(opal_pmix_pdata_t *p)
@@ -91,8 +91,8 @@ static void lkdes(opal_pmix_pdata_t *p)
9191
OBJ_DESTRUCT(&p->value);
9292
}
9393
OBJ_CLASS_INSTANCE(opal_pmix_pdata_t,
94-
opal_list_item_t,
95-
lkcon, lkdes);
94+
opal_list_item_t,
95+
lkcon, lkdes);
9696

9797
static void mdcon(opal_pmix_modex_data_t *p)
9898
{
@@ -104,38 +104,41 @@ static void mdcon(opal_pmix_modex_data_t *p)
104104
static void mddes(opal_pmix_modex_data_t *p)
105105
{
106106
if (NULL != p->blob) {
107-
free(p->blob);
107+
free(p->blob);
108108
}
109109
}
110110
OBJ_CLASS_INSTANCE(opal_pmix_modex_data_t,
111-
opal_list_item_t,
112-
mdcon, mddes);
111+
opal_list_item_t,
112+
mdcon, mddes);
113113

114114
static void apcon(opal_pmix_app_t *p)
115115
{
116116
p->cmd = NULL;
117-
p->argc = 0;
118117
p->argv = NULL;
119118
p->env = NULL;
119+
p->cwd = NULL;
120120
p->maxprocs = 0;
121121
OBJ_CONSTRUCT(&p->info, opal_list_t);
122122
}
123123
static void apdes(opal_pmix_app_t *p)
124124
{
125125
if (NULL != p->cmd) {
126-
free(p->cmd);
126+
free(p->cmd);
127127
}
128128
if (NULL != p->argv) {
129-
opal_argv_free(p->argv);
129+
opal_argv_free(p->argv);
130130
}
131131
if (NULL != p->env) {
132-
opal_argv_free(p->env);
132+
opal_argv_free(p->env);
133+
}
134+
if (NULL != p->cwd) {
135+
free(p->cwd);
133136
}
134137
OPAL_LIST_DESTRUCT(&p->info);
135138
}
136139
OBJ_CLASS_INSTANCE(opal_pmix_app_t,
137-
opal_list_item_t,
138-
apcon, apdes);
140+
opal_list_item_t,
141+
apcon, apdes);
139142

140143
static void qcon(opal_pmix_query_t *p)
141144
{

opal/mca/pmix/pmix2x/configure.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ AC_DEFUN([MCA_opal_pmix_pmix2x_CONFIG],[
4141
[AC_HELP_STRING([--enable-pmix-dstore],
4242
[Enable PMIx shared memory data store (default: disabled)])])
4343
AC_MSG_CHECKING([if PMIx shared memory data store is enabled])
44-
if test "$enable_pmix2_dstore" != "no"; then
44+
if test "$enable_pmix_dstore" != "no"; then
4545
AC_MSG_RESULT([yes])
4646
opal_pmix_pmix2x_sm_flag=--enable-dstore
4747
else

opal/mca/pmix/pmix2x/pmix/VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ greek=
3030
# command, or with the date (if "git describe" fails) in the form of
3131
# "date<date>".
3232

33-
repo_rev=git22b754e
33+
repo_rev=git9089b99
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="Dec 06, 2016"
47+
date="Dec 13, 2016"
4848

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

opal/mca/pmix/pmix2x/pmix/config/pmix.m4

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,11 @@ AC_DEFUN([PMIX_SETUP_CORE],[
328328
netdb.h ucred.h])
329329

330330
AC_CHECK_HEADERS([sys/mount.h], [], [],
331-
[AC_INCLUDES_DEFAULT
332-
#if HAVE_SYS_PARAM_H
333-
#include <sys/param.h>
334-
#endif
335-
])
331+
[AC_INCLUDES_DEFAULT
332+
#if HAVE_SYS_PARAM_H
333+
#include <sys/param.h>
334+
#endif
335+
])
336336

337337
AC_CHECK_HEADERS([sys/sysctl.h], [], [],
338338
[AC_INCLUDES_DEFAULT
@@ -358,6 +358,7 @@ AC_DEFUN([PMIX_SETUP_CORE],[
358358
#endif
359359
])
360360

361+
361362
# Note that sometimes we have <stdbool.h>, but it doesn't work (e.g.,
362363
# have both Portland and GNU installed; using pgcc will find GNU's
363364
# <stdbool.h>, which all it does -- by standard -- is define "bool" to

opal/mca/pmix/pmix2x/pmix/examples/dynamic.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ int main(int argc, char **argv)
9595
exit(1);
9696
}
9797
app->maxprocs = 2;
98-
app->argc = 1;
9998
app->argv = (char**)malloc(2 * sizeof(char*));
10099
if (0 > asprintf(&app->argv[0], "%s/client", dir)) {
101100
exit(1);

opal/mca/pmix/pmix2x/pmix/include/pmix_common.h

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ typedef uint32_t pmix_rank_t;
155155
#define PMIX_TDIR_RMCLEAN "pmix.tdir.rmclean" // (bool) Resource Manager will clean session directories
156156

157157
/* information about relative ranks as assigned by the RM */
158+
#define PMIX_NSPACE "pmix.nspace" // (char*) nspace of a job
158159
#define PMIX_JOBID "pmix.jobid" // (char*) jobid assigned by scheduler
159160
#define PMIX_APPNUM "pmix.appnum" // (uint32_t) app number within the job
160161
#define PMIX_RANK "pmix.rank" // (pmix_rank_t) process rank within the job
@@ -275,16 +276,20 @@ typedef uint32_t pmix_rank_t;
275276
// returns (pmix_data_array_t) an array of pmix_proc_info_t for
276277
// procs in job on same node
277278
#define PMIX_QUERY_AUTHORIZATIONS "pmix.qry.auths" // return operations tool is authorized to perform"
279+
#define PMIX_QUERY_SPAWN_SUPPORT "pmix.qry.spawn" // return a comma-delimited list of supported spawn attributes
280+
#define PMIX_QUERY_DEBUG_SUPPORT "pmix.qry.debug" // return a comma-delimited list of supported debug attributes
278281

279282
/* log attributes */
280283
#define PMIX_LOG_STDERR "pmix.log.stderr" // (bool) log data to stderr
281284
#define PMIX_LOG_STDOUT "pmix.log.stdout" // (bool) log data to stdout
282285
#define PMIX_LOG_SYSLOG "pmix.log.syslog" // (bool) log data to syslog - defaults to ERROR priority unless
283286
// modified by directive
284287
/* debugger attributes */
285-
#define PMIX_SPAWN_UNDER_DEBUGGER "pmix.dbg.pause" // (bool) job is being spawned under debugger - instruct it to pause on start
286-
#define PMIX_JOB_BEING_DEBUGGED "pmix.dbg.job" // (char*) nspace of the job to be debugged - the RM/PMIx server are
287-
// to provide the job-level info of that job to each debugger daemon
288+
#define PMIX_DEBUG_STOP_ON_EXEC "pmix.dbg.exec" // (bool) job is being spawned under debugger - instruct it to pause on start
289+
#define PMIX_DEBUG_STOP_IN_INIT "pmix.dbg.init" // (bool) instruct job to stop during PMIx init
290+
#define PMIX_DEBUG_WAIT_FOR_NOTIFY "pmix.dbg.notify" // (bool) block at desired point until receiving debugger release notification
291+
#define PMIX_DEBUG_JOB "pmix.dbg.job" // (char*) nspace of the job to be debugged - the RM/PMIx server are
292+
#define PMIX_DEBUG_WAITING_FOR_NOTIFY "pmix.dbg.waiting" // (bool) job to be debugged is waiting for a release
288293

289294
/**** PROCESS STATE DEFINITIONS ****/
290295
typedef uint8_t pmix_proc_state_t;
@@ -581,18 +586,17 @@ typedef struct pmix_proc_info {
581586

582587

583588
/**** PMIX VALUE STRUCT ****/
589+
typedef struct pmix_info_t pmix_info_t;
590+
584591
typedef struct pmix_data_array {
585592
pmix_data_type_t type;
586593
size_t size;
587594
void *array;
588595
} pmix_data_array_t;
589596

590-
/**** DEPRECATED ****/
591-
struct pmix_info;
592-
593597
typedef struct pmix_info_array {
594598
size_t size;
595-
struct pmix_info *array;
599+
pmix_info_t *array;
596600
} pmix_info_array_t;
597601
/********************/
598602

@@ -754,23 +758,29 @@ typedef struct pmix_value {
754758
} \
755759
} while (0)
756760

757-
/* expose two functions that are resolved in the
761+
/* expose some functions that are resolved in the
758762
* PMIx library, but part of a header that
759763
* includes internal functions - we don't
760764
* want to expose the entire header here
761765
*/
762766
void pmix_value_load(pmix_value_t *v, void *data, pmix_data_type_t type);
763767
pmix_status_t pmix_value_xfer(pmix_value_t *kv, pmix_value_t *src);
768+
pmix_status_t pmix_argv_append_nosize(char ***argv, const char *arg);
769+
pmix_status_t pmix_setenv(const char *name, const char *value,
770+
bool overwrite, char ***env);
764771

765-
772+
#define PMIX_ARGV_APPEND(a, b) \
773+
pmix_argv_append_nosize(&(a), (b))
774+
#define PMIX_SETENV(a, b, c) \
775+
pmix_setenv((a), (b), true, (c))
766776

767777

768778
/**** PMIX INFO STRUCT ****/
769-
typedef struct pmix_info {
779+
struct pmix_info_t {
770780
char key[PMIX_MAX_KEYLEN+1]; // ensure room for the NULL terminator
771781
pmix_info_directives_t flags; // bit-mask of flags
772782
pmix_value_t value;
773-
} pmix_info_t;
783+
};
774784

775785
/* utility macros for working with pmix_info_t structs */
776786
#define PMIX_INFO_CREATE(m, n) \
@@ -874,9 +884,9 @@ typedef struct pmix_pdata {
874884
/**** PMIX APP STRUCT ****/
875885
typedef struct pmix_app {
876886
char *cmd;
877-
int argc;
878887
char **argv;
879888
char **env;
889+
char *cwd;
880890
int maxprocs;
881891
pmix_info_t *info;
882892
size_t ninfo;
@@ -916,6 +926,9 @@ typedef struct pmix_app {
916926
} \
917927
free((m)->env); \
918928
} \
929+
if (NULL != (m)->cwd) { \
930+
free((m)->cwd); \
931+
} \
919932
if (NULL != (m)->info) { \
920933
for (_ii=0; _ii < (m)->ninfo; _ii++) { \
921934
PMIX_INFO_DESTRUCT(&(m)->info[_ii]); \

opal/mca/pmix/pmix2x/pmix/src/buffer_ops/copy.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,13 +557,15 @@ PMIX_EXPORT pmix_status_t pmix_value_xfer(pmix_value_t *p, pmix_value_t *src)
557557
if (NULL != sa[n].cmd) {
558558
pa[n].cmd = strdup(sa[n].cmd);
559559
}
560-
pa[n].argc = sa[n].argc;
561560
if (NULL != sa[n].argv) {
562561
pa[n].argv = pmix_argv_copy(sa[n].argv);
563562
}
564563
if (NULL != sa[n].env) {
565564
pa[n].env = pmix_argv_copy(sa[n].env);
566565
}
566+
if (NULL != sa[n].cwd) {
567+
pa[n].cwd = strdup(sa[n].cwd);
568+
}
567569
pa[n].maxprocs = sa[n].maxprocs;
568570
if (0 < sa[n].ninfo && NULL != sa[n].info) {
569571
PMIX_INFO_CREATE(pa[n].info, sa[n].ninfo);
@@ -844,9 +846,11 @@ pmix_status_t pmix_bfrop_copy_app(pmix_app_t **dest, pmix_app_t *src,
844846

845847
*dest = (pmix_app_t*)malloc(sizeof(pmix_app_t));
846848
(*dest)->cmd = strdup(src->cmd);
847-
(*dest)->argc = src->argc;
848849
(*dest)->argv = pmix_argv_copy(src->argv);
849850
(*dest)->env = pmix_argv_copy(src->env);
851+
if (NULL != src->cwd) {
852+
(*dest)->cwd = strdup(src->cwd);
853+
}
850854
(*dest)->maxprocs = src->maxprocs;
851855
(*dest)->ninfo = src->ninfo;
852856
(*dest)->info = (pmix_info_t*)malloc(src->ninfo * sizeof(pmix_info_t));
@@ -1174,13 +1178,15 @@ pmix_status_t pmix_bfrop_copy_darray(pmix_data_array_t **dest,
11741178
if (NULL != sa[n].cmd) {
11751179
pa[n].cmd = strdup(sa[n].cmd);
11761180
}
1177-
pa[n].argc = sa[n].argc;
11781181
if (NULL != sa[n].argv) {
11791182
pa[n].argv = pmix_argv_copy(sa[n].argv);
11801183
}
11811184
if (NULL != sa[n].env) {
11821185
pa[n].env = pmix_argv_copy(sa[n].env);
11831186
}
1187+
if (NULL != sa[n].cwd) {
1188+
pa[n].cwd = strdup(sa[n].cwd);
1189+
}
11841190
pa[n].maxprocs = sa[n].maxprocs;
11851191
if (0 < sa[n].ninfo && NULL != sa[n].info) {
11861192
PMIX_INFO_CREATE(pa[n].info, sa[n].ninfo);

opal/mca/pmix/pmix2x/pmix/src/buffer_ops/pack.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,10 +753,11 @@ pmix_status_t pmix_bfrop_pack_app(pmix_buffer_t *buffer, const void *src,
753753
return ret;
754754
}
755755
/* argv */
756-
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int(buffer, &app[i].argc, 1, PMIX_INT))) {
756+
nvals = pmix_argv_count(app[i].argv);
757+
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int(buffer, &nvals, 1, PMIX_INT32))) {
757758
return ret;
758759
}
759-
for (j=0; j < app[i].argc; j++) {
760+
for (j=0; j < nvals; j++) {
760761
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &app[i].argv[j], 1, PMIX_STRING))) {
761762
return ret;
762763
}
@@ -771,6 +772,10 @@ pmix_status_t pmix_bfrop_pack_app(pmix_buffer_t *buffer, const void *src,
771772
return ret;
772773
}
773774
}
775+
/* cwd */
776+
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_string(buffer, &app[i].cwd, 1, PMIX_STRING))) {
777+
return ret;
778+
}
774779
/* maxprocs */
775780
if (PMIX_SUCCESS != (ret = pmix_bfrop_pack_int(buffer, &app[i].maxprocs, 1, PMIX_INT))) {
776781
return ret;

opal/mca/pmix/pmix2x/pmix/src/buffer_ops/unpack.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -939,11 +939,11 @@ pmix_status_t pmix_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest,
939939
}
940940
/* unpack argc */
941941
m=1;
942-
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int(buffer, &ptr[i].argc, &m, PMIX_INT))) {
942+
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int(buffer, &nval, &m, PMIX_INT32))) {
943943
return ret;
944944
}
945945
/* unpack argv */
946-
for (k=0; k < ptr[i].argc; k++) {
946+
for (k=0; k < nval; k++) {
947947
m=1;
948948
tmp = NULL;
949949
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) {
@@ -972,6 +972,11 @@ pmix_status_t pmix_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest,
972972
pmix_argv_append_nosize(&ptr[i].env, tmp);
973973
free(tmp);
974974
}
975+
/* unpack cwd */
976+
m=1;
977+
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &ptr[i].cwd, &m, PMIX_STRING))) {
978+
return ret;
979+
}
975980
/* unpack maxprocs */
976981
m=1;
977982
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int(buffer, &ptr[i].maxprocs, &m, PMIX_INT))) {

0 commit comments

Comments
 (0)