Skip to content

Commit 3e5ceca

Browse files
authored
Merge pull request flux-framework#4865 from garlick/upmi_plugin
enable broker bootstrap methods to be provided by dso plugins, and drop compiled-in pmix support
2 parents 5bde4a7 + 738e27c commit 3e5ceca

31 files changed

+986
-802
lines changed

config/x_ac_pmix.m4

Lines changed: 0 additions & 12 deletions
This file was deleted.

configure.ac

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@ AS_IF([test "x$enable_content_s3" = "xyes"], [
416416

417417
AM_CONDITIONAL([ENABLE_CONTENT_S3], [test "x$enable_content_s3" = "xyes"])
418418

419-
X_AC_PMIX
420419

421420
##
422421
# Check for systemd

doc/man7/flux-broker-attributes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ broker.critical-ranks [Updates: C]
9696
is raised when a failing node or other error occurs affecting any rank
9797
in this set. Default: rank 0 plus any other overlay network routers.
9898

99+
broker.boot-method [Updates: C]
100+
A URI representing the method used to bootstrap Flux. Valid values are
101+
``config`` (boot via TOML config file), ``simple`` (use the PMI-1 simple
102+
wire protocol), ``libpmi[:path]`` (use a PMI-1 shared library), or
103+
``single`` (standalone size=1). Additional boot methods may be provided
104+
by plugins.
105+
99106
broker.pid
100107
The process id of the local broker.
101108

src/broker/Makefile.am

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ AM_CPPFLAGS = \
99
-I$(top_srcdir)/src/include \
1010
-I$(top_srcdir)/src/common/libccan \
1111
-I$(top_builddir)/src/common/libflux \
12-
$(PMIX_CFLAGS) \
1312
$(ZMQ_CFLAGS) \
1413
$(LIBUUID_CFLAGS) \
1514
$(JANSSON_CFLAGS) \
@@ -74,12 +73,13 @@ flux_broker_LDADD = \
7473
$(top_builddir)/src/common/libflux-core.la \
7574
$(top_builddir)/src/common/libzmqutil/libzmqutil.la \
7675
$(top_builddir)/src/common/libpmi/libupmi.la \
76+
$(top_builddir)/src/common/libpmi/libpmi_client.la \
77+
$(top_builddir)/src/common/libpmi/libpmi_common.la \
7778
$(top_builddir)/src/common/libflux-internal.la \
7879
$(top_builddir)/src/common/libflux-optparse.la \
7980
$(ZMQ_LIBS) \
8081
$(LIBUUID_LIBS) \
8182
$(JANSSON_LIBS) \
82-
$(PMIX_LIBS) \
8383
$(LIBDL)
8484

8585
flux_broker_LDFLAGS =
@@ -96,12 +96,10 @@ test_ldadd = \
9696
$(top_builddir)/src/common/libtestutil/libtestutil.la \
9797
$(top_builddir)/src/common/libflux-core.la \
9898
$(top_builddir)/src/common/libzmqutil/libzmqutil.la \
99-
$(top_builddir)/src/common/libpmi/libpmi_client.la \
10099
$(top_builddir)/src/common/libflux-internal.la \
101100
$(top_builddir)/src/common/libtap/libtap.la \
102101
$(ZMQ_LIBS) \
103-
$(JANSSON_LIBS) \
104-
$(PMIX_LIBS)
102+
$(JANSSON_LIBS)
105103

106104
test_ldflags = \
107105
-no-install

src/broker/boot_config.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,19 @@ int boot_config_geturibyrank (json_t *hosts,
481481
return 0;
482482
}
483483

484+
static int set_broker_boot_method_attr (attr_t *attrs, const char *value)
485+
{
486+
(void)attr_delete (attrs, "broker.boot-method", true);
487+
if (attr_add (attrs,
488+
"broker.boot-method",
489+
value,
490+
ATTR_IMMUTABLE) < 0) {
491+
log_err ("setattr broker.boot-method");
492+
return -1;
493+
}
494+
return 0;
495+
}
496+
484497
int boot_config (flux_t *h, struct overlay *overlay, attr_t *attrs)
485498
{
486499
struct boot_conf conf;
@@ -629,6 +642,8 @@ int boot_config (flux_t *h, struct overlay *overlay, attr_t *attrs)
629642
log_err ("setattr instance-level 0");
630643
goto error;
631644
}
645+
if (set_broker_boot_method_attr (attrs, "config") < 0)
646+
goto error;
632647
json_decref (hosts);
633648
topology_decref (topo);
634649
return 0;

src/broker/boot_pmi.c

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,19 @@ static int set_hostlist_attr (attr_t *attrs, struct hostlist *hl)
186186
return rc;
187187
}
188188

189+
static int set_broker_boot_method_attr (attr_t *attrs, const char *value)
190+
{
191+
(void)attr_delete (attrs, "broker.boot-method", true);
192+
if (attr_add (attrs,
193+
"broker.boot-method",
194+
value,
195+
ATTR_IMMUTABLE) < 0) {
196+
log_err ("setattr broker.boot-method");
197+
return -1;
198+
}
199+
return 0;
200+
}
201+
189202
static void trace_upmi (void *arg, const char *text)
190203
{
191204
fprintf (stderr, "boot_pmi: %s\n", text);
@@ -209,15 +222,18 @@ int boot_pmi (struct overlay *overlay, attr_t *attrs)
209222
const char *uri;
210223
int i;
211224
int upmi_flags = UPMI_LIBPMI_NOFLUX;
225+
const char *upmi_method;
212226

213227
// N.B. overlay_create() sets the tbon.topo attribute
214228
if (attr_get (attrs, "tbon.topo", &topo_uri, NULL) < 0) {
215229
log_msg ("error fetching tbon.topo attribute");
216230
return -1;
217231
}
232+
if (attr_get (attrs, "broker.boot-method", &upmi_method, NULL) < 0)
233+
upmi_method = NULL;
218234
if (getenv ("FLUX_PMI_DEBUG"))
219235
upmi_flags |= UPMI_TRACE;
220-
if (!(upmi = upmi_create (NULL,
236+
if (!(upmi = upmi_create (upmi_method,
221237
upmi_flags,
222238
trace_upmi,
223239
NULL,
@@ -434,12 +450,14 @@ int boot_pmi (struct overlay *overlay, attr_t *attrs)
434450
}
435451

436452
done:
437-
if (upmi_finalize (upmi, &error) < 0) {
438-
log_msg ("%s: finalize: %s", upmi_describe (upmi), error.text);
453+
if (set_hostlist_attr (attrs, hl) < 0) {
454+
log_err ("setattr hostlist");
439455
goto error;
440456
}
441-
if (set_hostlist_attr (attrs, hl) < 0) {
442-
log_err ("failed to set hostlist attribute to PMI-derived value");
457+
if (set_broker_boot_method_attr (attrs, upmi_describe (upmi)) < 0)
458+
goto error;
459+
if (upmi_finalize (upmi, &error) < 0) {
460+
log_msg ("%s: finalize: %s", upmi_describe (upmi), error.text);
443461
goto error;
444462
}
445463
free (bizcard);

src/broker/broker.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ int main (int argc, char *argv[])
197197
struct sigaction old_sigact_term;
198198
flux_msg_handler_t **handlers = NULL;
199199
const flux_conf_t *conf;
200+
const char *method;
200201

201202
memset (&ctx, 0, sizeof (ctx));
202203
log_init (argv[0]);
@@ -325,14 +326,20 @@ int main (int argc, char *argv[])
325326
* Default method is pmi.
326327
* If [bootstrap] is defined in configuration, use static configuration.
327328
*/
328-
if (flux_conf_unpack (conf, NULL, "{s:{}}", "bootstrap") == 0) {
329-
if (boot_config (ctx.h, ctx.overlay, ctx.attrs) < 0) {
329+
if (attr_get (ctx.attrs, "broker.boot-method", &method, NULL) < 0) {
330+
if (flux_conf_unpack (conf, NULL, "{s:{}}", "bootstrap") == 0)
331+
method = "config";
332+
else
333+
method = NULL;
334+
}
335+
if (!method || !streq (method, "config")) {
336+
if (boot_pmi (ctx.overlay, ctx.attrs) < 0) {
330337
log_msg ("bootstrap failed");
331338
goto cleanup;
332339
}
333340
}
334-
else { // PMI
335-
if (boot_pmi (ctx.overlay, ctx.attrs) < 0) {
341+
else {
342+
if (boot_config (ctx.h, ctx.overlay, ctx.attrs) < 0) {
336343
log_msg ("bootstrap failed");
337344
goto cleanup;
338345
}

src/broker/doc/bootstrap.md

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,12 @@ trace on stderr from the start command.
6868

6969
#### Booting Flux as a job in a foreign resource manager
7070

71-
The code in `pmiutil.c` attempts to adapt the broker's PMI client to different
72-
situations if the PMI-1 wire protocol is not available. Its logic is roughly:
73-
1. if `PMI_FD` is set, use the PMI-1 wire protocol (for bootstrap under Flux)
74-
2. if configured with `--enable-pmix-bootstrap`, and `PMIX_SERVER_URI`
75-
or `PMIX_SERVER_URI2` is set, use PMIx
76-
3. if `libpmi.so` can be dynamically loaded, use PMI-1 (a specific library
77-
name/path may be forced by setting `PMI_LIBRARY`)
78-
4. assume singleton (rank = 0, size = 1)
79-
80-
The following symbols must be defined in the PMI library for option 3 to be
81-
successful:
82-
* `PMI_Init()`, `PMI_Finalize()`
83-
* `PMI_Get_size()`, `PMI_Get_rank()`
84-
* `PMI_Barrier()`
85-
* `PMI_KVS_Get_my_name()`,
86-
* `PMI_KVS_Put()`, `PMI_KVS_Commit()`, `PMI_KVS_Get()`
71+
The code in `boot_pmi.c` (using libpmi/upmi.c) attempts to adapt the broker's
72+
PMI client to different situations if the PMI-1 wire protocol is not available.
73+
It tries the following in order (unless configured otherwise):
74+
1. simple PMI wire protocol
75+
2. find a PMI-1 library
76+
3. assume singleton (rank = 0, size = 1)
8777

8878
### Config File
8979

src/broker/runat.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,6 @@ static const char *env_blocklist[] = {
7575
"PMI_FD",
7676
"PMI_RANK",
7777
"PMI_SIZE",
78-
#ifdef HAVE_LIBPMIX
79-
"PMIX_NAMESPACE",
80-
"PMIX_VERSION",
81-
"PMIX_SERVER_URI41",
82-
"PMIX_RANK",
83-
"PMIX_SERVER_URI21",
84-
"PMIX_GDS_MODULE",
85-
"PMIX_SECURITY_MODE",
86-
"PMIX_HOSTNAME",
87-
"PMIX_BFROP_BUFFER_TYPE",
88-
"PMIX_SERVER_TMPDIR",
89-
"PMIX_SYSTEM_TMPDIR",
90-
"PMIX_SERVER_URI4",
91-
"PMIX_MCA_psec",
92-
"PMIX_SERVER_URI3",
93-
"PMIX_SERVER_URI2",
94-
"PMIX_SERVER_URI",
95-
#endif
9678
NULL,
9779
};
9880

src/cmd/Makefile.am

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ fluxcmd_ldadd = \
2121
$(top_builddir)/src/common/libkvs/libkvs.la \
2222
$(top_builddir)/src/common/librlist/librlist.la \
2323
$(top_builddir)/src/common/libpmi/libupmi.la \
24+
$(top_builddir)/src/common/libpmi/libpmi_client.la \
25+
$(top_builddir)/src/common/libpmi/libpmi_common.la \
2426
$(top_builddir)/src/common/libflux-internal.la \
2527
$(top_builddir)/src/common/libflux-core.la \
2628
$(top_builddir)/src/common/libflux-optparse.la \
@@ -122,6 +124,7 @@ fluxcmd_PROGRAMS = \
122124
flux_start_LDADD = \
123125
$(fluxcmd_ldadd) \
124126
$(top_builddir)/src/common/libpmi/libpmi_server.la \
127+
$(top_builddir)/src/common/libpmi/libpmi_common.la \
125128
$(top_builddir)/src/common/libczmqcontainers/libczmqcontainers.la
126129

127130
flux_job_LDADD = \

src/cmd/builtin/version.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
#if HAVE_CONFIG_H
1212
# include <config.h>
1313
#endif
14-
#if HAVE_LIBPMIX
15-
# include <pmix.h>
16-
#endif
1714
#include <hwloc.h>
1815
#include <zmq.h>
1916

@@ -66,12 +63,6 @@ static int cmd_version (optparse_t *p, int ac, char *av[])
6663
#endif
6764
#if HAVE_LIBSYSTEMD
6865
printf ("+systemd");
69-
#endif
70-
#if HAVE_LIBPMIX
71-
printf ("+pmix-bootstrap==%ld.%ld.%ld",
72-
PMIX_VERSION_MAJOR,
73-
PMIX_VERSION_MINOR,
74-
PMIX_VERSION_RELEASE);
7566
#endif
7667
printf ("+hwloc==%d.%d.%d",
7768
HWLOC_API_VERSION >> 16 & 0x000000ff,

src/common/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ flux_libpmi_la_LIBADD = \
168168
libflux-taskmap.la \
169169
libflux-idset.la \
170170
$(builddir)/libpmi/libpmi_client.la \
171+
$(builddir)/libpmi/libpmi_common.la \
171172
$(builddir)/libutil/aux.lo
172173
flux_libpmi_la_LDFLAGS = \
173174
-Wl,--version-script=$(srcdir)/libpmi.map \
@@ -181,6 +182,7 @@ flux_libpmi2_la_LIBADD = \
181182
libflux-taskmap.la \
182183
libflux-idset.la \
183184
$(builddir)/libpmi/libpmi_client.la \
185+
$(builddir)/libpmi/libpmi_common.la \
184186
$(builddir)/libutil/aux.lo
185187
flux_libpmi2_la_LDFLAGS = \
186188
-Wl,--version-script=$(srcdir)/libpmi2.map \

src/common/libflux/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ installed_conf_cppflags = \
3131
-DINSTALLED_SHELL_PLUGINPATH=\"$(fluxlibdir)/shell/plugins\" \
3232
-DINSTALLED_SHELL_INITRC=\"$(fluxrcdir)/shell/initrc.lua\" \
3333
-DINSTALLED_JOBTAP_PLUGINPATH=\"$(fluxlibdir)/job-manager/plugins\" \
34+
-DINSTALLED_UPMI_PLUGINPATH=\"$(fluxlibdir)/upmi/plugins\" \
3435
-DINSTALLED_CMDHELP_PATTERN=\"${datadir}/flux/help.d/*.json\" \
3536
-DINSTALLED_NO_DOCS_PATH=\"${datadir}/flux/.nodocs\" \
3637
-DINSTALLED_RUNDIR=\"${runstatedir}/flux\" \
@@ -52,6 +53,7 @@ intree_conf_cppflags = \
5253
-DINTREE_SHELL_PLUGINPATH=\"$(abs_top_builddir)/src/shell/plugins\" \
5354
-DINTREE_SHELL_INITRC=\"$(abs_top_srcdir)/src/shell/initrc.lua\" \
5455
-DINTREE_JOBTAP_PLUGINPATH=\"$(abs_top_builddir)/src/modules/job-manager/plugins/.libs\" \
56+
-DINTREE_UPMI_PLUGINPATH=\"$(abs_top_builddir)/src/common/libpmi/plugins/.libs\" \
5557
-DINTREE_CMDHELP_PATTERN=\"${abs_top_builddir}/etc/flux/help.d/*.json\" \
5658
-DINTREE_NO_DOCS_PATH=\"${abs_top_builddir}/etc/flux/.nodocs\" \
5759
-DINTREE_BINDIR=\"${abs_top_builddir}/src/cmd\"

src/common/libflux/conf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ static struct builtin builtin_tab[] = {
6262
{ "shell_initrc", INSTALLED_SHELL_INITRC, INTREE_SHELL_INITRC },
6363
{ "jobtap_pluginpath",
6464
INSTALLED_JOBTAP_PLUGINPATH,INTREE_JOBTAP_PLUGINPATH },
65+
{ "upmi_pluginpath",INSTALLED_UPMI_PLUGINPATH, INTREE_UPMI_PLUGINPATH },
6566
{ "no_docs_path", INSTALLED_NO_DOCS_PATH, INTREE_NO_DOCS_PATH },
6667
{ "rundir", INSTALLED_RUNDIR, NULL },
6768
{ "bindir", INSTALLED_BINDIR, INTREE_BINDIR },

0 commit comments

Comments
 (0)