Skip to content

Commit c7d6a1e

Browse files
committed
Encode help-*.txt file contents into C source code
Encode the show_help text files into memory so that we don't have to find and open text files on-the-fly. This helps with relocation, although not strictly necessary. Biggest advantage is that we can supply show_help output from the very beginning, even if we haven't identified the text file directory. Enable access to the new system by PRRTE via a new API by which PRRTE can register its own in-memory array of help messages. Default to the internal PMIx array if show_help has yet to be initialized. Add a new "INMEMHELP" capability flag so that PRRTE can verify this PMIx version's support. Note that PRRTE will be updated so that the master branch and all release branches beginning with v4.0 can require it to build. Based on open-mpi/ompi#13144. Signed-off-by: Ralph Castain <[email protected]>
1 parent c4694cb commit c7d6a1e

Some content is hidden

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

76 files changed

+1229
-619
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ src/tools/wrapper/pmixcc
143143

144144

145145
src/util/keyval/keyval_lex.c
146-
src/util/showhelp/showhelp_lex.c
146+
src/util/pmix_show_help_content.c
147147

148148
test/pmi2_client
149149
test/pmi_client

config/pmix.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,7 @@ AC_DEFUN([PMIX_DO_AM_CONDITIONALS],[
13871387
AM_CONDITIONAL(NEED_LIBPMIX, [test "$pmix_need_libpmix" = "1"])
13881388
AM_CONDITIONAL([PMIX_HAVE_JANSSON], [test "x$pmix_check_jansson_happy" = "xyes"])
13891389
AM_CONDITIONAL([PMIX_HAVE_CURL], [test "x$pmix_check_curl_happy" = "xyes"])
1390+
AM_CONDITIONAL([PMIX_PICKY_COMPILERS], [test "$WANT_PICKY_COMPILER" = "1"])
13901391
])
13911392
pmix_did_am_conditionals=yes
13921393
])dnl

contrib/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Copyright (c) 2013-2016 Los Alamos National Security, Inc. All rights
1616
# reserved.
1717
# Copyright (c) 2013-2020 Intel, Inc. All rights reserved.
18-
# Copyright (c) 2022-2023 Nanook Consulting All rights reserved.
18+
# Copyright (c) 2022-2025 Nanook Consulting All rights reserved.
1919
# Copyright (c) 2024 Research Organization for Information Science
2020
# and Technology (RIST). All rights reserved.
2121
# $COPYRIGHT$

contrib/construct_dictionary.py

Lines changed: 24 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Copyright (c) 2020 Intel, Inc. All rights reserved.
44
# Copyright (c) 2020-2022 Cisco Systems, Inc. All rights reserved
5-
# Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
5+
# Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
66
# Copyright (c) 2022 Triad National Security, LLC. All rights reserved.
77
# $COPYRIGHT$
88
#
@@ -11,11 +11,9 @@
1111
# by tools to interpret user input
1212
#
1313

14-
from __future__ import print_function
1514
import os
16-
import os.path
1715
import sys
18-
from optparse import OptionParser, OptionGroup
16+
import argparse
1917

2018
index = 0
2119

@@ -240,7 +238,7 @@ def harvest_constants(options, path, constants):
240238
return 0
241239

242240

243-
def _write_header(options, base_path, num_elements):
241+
def _write_header(options, num_elements):
244242
contents = '''/*
245243
* This file is autogenerated by construct_dictionary.py.
246244
* Do not edit this file by hand.
@@ -268,7 +266,7 @@ def _write_header(options, base_path, num_elements):
268266
constants = sys.stdout
269267
outpath = None
270268
else:
271-
outpath = os.path.join(base_path, "pmix_dictionary.h")
269+
outpath = os.path.join(options.out, "pmix_dictionary.h")
272270
try:
273271
constants = open(outpath, "w+")
274272
except Exception as e:
@@ -281,44 +279,26 @@ def _write_header(options, base_path, num_elements):
281279

282280

283281
def main():
284-
parser = OptionParser("usage: %prog [options]")
285-
debugGroup = OptionGroup(parser, "Debug Options")
286-
debugGroup.add_option("--dryrun",
287-
action="store_true", dest="dryrun", default=False,
288-
help="Show output to screen")
289-
parser.add_option_group(debugGroup)
290-
291-
(options, args) = parser.parse_args()
292-
293-
# Find the top-level PMIx source tree dir.
294-
# Start with the location of this script, which we know is in
295-
# $top_srcdir/contrib.
296-
top_src_dir = os.path.dirname(sys.argv[0])
297-
top_src_dir = os.path.join(top_src_dir, "..")
298-
top_src_dir = os.path.abspath(top_src_dir)
299-
300-
# Sanity check
301-
checkfile = os.path.join(top_src_dir, "VERSION")
302-
if not os.path.exists(checkfile):
303-
print("ERROR: Could not find top source directory for Open PMIx")
304-
return 1
305-
306-
source_include_dir = os.path.join(top_src_dir, "include")
307-
308-
# This script is invoked from src/include/Makefile.am, and
309-
# therefore the cwd will be $(builddir)/src/include. Verify this
310-
# by checking for a file that we know should be in there.
311-
build_src_include_dir = os.getcwd()
312-
checkfile = os.path.join(build_src_include_dir, "pmix_config.h")
313-
if not os.path.exists(checkfile):
314-
print("ERROR: Could not find build directory for Open PMIx")
315-
return 1
316-
317-
if options.dryrun:
282+
parser = argparse.ArgumentParser(description="Generate attribute dictionary.")
283+
parser.add_argument("--root",
284+
required=True,
285+
help="Root directory of code tree")
286+
parser.add_argument("--out",
287+
required=True,
288+
help="Output C file")
289+
parser.add_argument("--dryrun",
290+
action="store_true",
291+
help="Do not write out resulting file")
292+
293+
args = parser.parse_args()
294+
295+
source_include_dir = os.path.join(args.root, "include")
296+
297+
if args.dryrun:
318298
constants = sys.stdout
319299
outpath = None
320300
else:
321-
outpath = os.path.join(build_src_include_dir, "pmix_dictionary.c")
301+
outpath = os.path.join(args.out, "pmix_dictionary.c")
322302
try:
323303
constants = open(outpath, "w+")
324304
except Exception as e:
@@ -341,7 +321,7 @@ def main():
341321
# looking for constants and typedefs
342322

343323
# pmix_common.h.in is in the src tree
344-
rc = harvest_constants(options,
324+
rc = harvest_constants(args,
345325
os.path.join(source_include_dir, "pmix_common.h.in"),
346326
constants)
347327
if 0 != rc:
@@ -353,7 +333,7 @@ def main():
353333
constants.write(",\n")
354334

355335
# pmix_deprecated.h is in the source tree
356-
rc = harvest_constants(options,
336+
rc = harvest_constants(args,
357337
os.path.join(source_include_dir, "pmix_deprecated.h"),
358338
constants)
359339
if 0 != rc:
@@ -369,7 +349,7 @@ def main():
369349
constants.close()
370350

371351
# write the header
372-
return _write_header(options, build_src_include_dir, index)
352+
return _write_header(args, index)
373353

374354

375355
if __name__ == '__main__':

include/pmix_version.h.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,16 @@
3939
/* Individual capability flags */
4040
#define PMIX_CAP_BASE 1
4141
#define PMIX_CAP_LTO 2
42+
#define PMIX_CAP_INMEMHELP 3
4243

4344

4445
/* These are the capabilities that this version of OpenPMIx has.
4546
* For now, we just define/use a "base" marker as a starting
4647
* point
4748
*/
4849
#define PMIX_CAPABILITIES \
49-
(PMIX_CAP_BASE | PMIX_CAP_LTO)
50+
(PMIX_CAP_BASE | \
51+
PMIX_CAP_LTO | \
52+
PMIX_CAP_INMEMHELP)
5053

5154
#endif

src/Makefile.am

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# Copyright (c) 2013-2020 Intel, Inc. All rights reserved.
1515
# Copyright (c) 2021 Amazon.com, Inc. or its affiliates.
1616
# All Rights reserved.
17-
# Copyright (c) 2021-2022 Nanook Consulting All rights reserved.
17+
# Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
1818
# $COPYRIGHT$
1919
#
2020
# Additional copyrights may follow
@@ -46,7 +46,6 @@ headers =
4646
sources =
4747
nodist_headers =
4848
EXTRA_DIST =
49-
dist_pmixdata_DATA =
5049
nobase_pmix_HEADERS =
5150
pmixdir = $(pmixincludedir)/$(subdir)
5251

src/common/Makefile.include

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
#
33
# Copyright (c) 2015-2019 Intel, Inc. All rights reserved.
44
# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
5-
# Copyright (c) 2023-2024 Nanook Consulting All rights reserved.
5+
# Copyright (c) 2023-2025 Nanook Consulting All rights reserved.
66
# $COPYRIGHT$
77
#
88
# Additional copyrights may follow
99
#
1010
# $HEADER$
1111
#
1212

13-
dist_pmixdata_DATA += \
13+
EXTRA_DIST += \
1414
common/help-pfexec-base.txt
1515

1616
sources += \

src/common/pfexec_linux.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static int write_help_msg(int fd, pmix_pfexec_pipe_err_msg_t *msg, const char *f
243243
return PMIX_ERR_BAD_PARAM;
244244
}
245245

246-
str = pmix_show_help_vstring(file, topic, true, ap);
246+
str = pmix_show_help_vstring("pmix", file, topic, true, ap);
247247

248248
msg->file_str_len = (int) strlen(file);
249249
if (msg->file_str_len > PMIX_PFEXEC_MAX_FILE_LEN) {
@@ -493,7 +493,7 @@ static pmix_status_t do_parent(pmix_app_t *app, pmix_pfexec_child_t *child, int
493493
}
494494

495495
/* Print out what we got. We already have a rendered string,
496-
so use pmix_show_help_norender(). */
496+
so just print it. */
497497
if (msg.msg_str_len > 0) {
498498
fprintf(stderr, "%s\n", str);
499499
free(str);

src/common/pmix_pfexec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ static pmix_status_t do_parent(pmix_app_t *app, pmix_pfexec_child_t *child, int
11621162
}
11631163

11641164
/* Print out what we got. We already have a rendered string,
1165-
so use pmix_show_help_norender(). */
1165+
so just print it. */
11661166
if (msg.msg_str_len > 0) {
11671167
fprintf(stderr, "%s\n", str);
11681168
free(str);

src/hwloc/Makefile.include

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# -*- makefile -*-
22
#
33
# Copyright (c) 2016 Intel, Inc. All rights reserved.
4-
# Copyright (c) 2021 Nanook Consulting. All rights reserved.
4+
# Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
55
# $COPYRIGHT$
66
#
77
# Additional copyrights may follow
88
#
99
# $HEADER$
1010

11-
dist_pmixdata_DATA += hwloc/help-ploc.txt
11+
EXTRA_DIST += hwloc/help-ploc.txt
1212

1313
headers += \
1414
hwloc/pmix_hwloc.h

src/include/Makefile.am

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# Copyright (c) 2007-2022 Cisco Systems, Inc. All rights reserved
1515
# Copyright (c) 2017 Research Organization for Information Science
1616
# and Technology (RIST). All rights reserved.
17-
# Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
17+
# Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
1818
# Copyright (c) 2022-2023 Triad National Security, LLC. All rights reserved.
1919
# $COPYRIGHT$
2020
#
@@ -42,6 +42,8 @@
4242
# file corruption issue is an acceptable tradeoff.
4343
.NOTPARALLEL:
4444

45+
include $(top_srcdir)/Makefile.openpmix-rules
46+
4547
AM_CFLAGS = \
4648
-DPMIX_PROXY_VERSION_STRING="\"@PMIX_VERSION@\"" \
4749
-DPMIX_PROXY_BUGREPORT_STRING="\"@PMIX_PROXY_BUGREPORT_STRING@\""
@@ -85,14 +87,17 @@ libpmixglobal_gen = \
8587
pmix_event_strings.h \
8688
pmix_event_strings.c
8789

90+
8891
# Need to ensure that pmix_dictionary.h and pmix_dictionary.c are built first --
8992
# before any other targets.
9093
BUILT_SOURCES = $(libpmixglobal_gen)
9194

92-
$(libpmixglobal_gen): $(top_srcdir)/include/pmix_common.h.in \
93-
$(top_srcdir)/include/pmix_deprecated.h \
94-
$(top_srcdir)/src/common/pmix_attributes.c
95-
$(PYTHON) $(top_srcdir)/contrib/construct_dictionary.py
96-
$(PYTHON) $(top_srcdir)/contrib/construct_event_strings.py
95+
$(libpmixglobal_gen): $(abs_top_srcdir)/include/pmix_common.h.in \
96+
$(abs_top_srcdir)/include/pmix_deprecated.h \
97+
$(abs_top_srcdir)/src/common/pmix_attributes.c
98+
$(PMIX_V_GEN) $(PYTHON) $(abs_top_srcdir)/contrib/construct_dictionary.py \
99+
--root $(abs_top_srcdir) \
100+
--out .
101+
$(PMIX_V_GEN) $(PYTHON) $(abs_top_srcdir)/contrib/construct_event_strings.py
97102

98103
MAINTAINERCLEANFILES = $(libpmixglobal_gen)

src/include/pmix_globals.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,20 @@ typedef struct {
9595
} pmix_namelist_t;
9696
PMIX_CLASS_DECLARATION(pmix_namelist_t);
9797

98+
/* define structs for holding entries in the
99+
* show-help matrix */
100+
typedef struct {
101+
const char *topic;
102+
const char **content;
103+
} pmix_show_help_entry_t;
104+
105+
typedef struct {
106+
const char *filename;
107+
pmix_show_help_entry_t *entries;
108+
} pmix_show_help_file_t;
109+
110+
PMIX_EXPORT extern pmix_show_help_file_t pmix_show_help_data[];
111+
98112
/* define a struct for holding entries in the
99113
* dictionary of attributes */
100114
typedef struct {

src/mca/base/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# All rights reserved.
1212
# Copyright (c) 2010-2016 Cisco Systems, Inc. All rights reserved.
1313
# Copyright (c) 2017-2018 Intel, Inc. All rights reserved.
14-
# Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
14+
# Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
1515
# $COPYRIGHT$
1616
#
1717
# Additional copyrights may follow
@@ -27,7 +27,7 @@ AM_CPPFLAGS = \
2727

2828
noinst_LTLIBRARIES = libpmix_mca_base.la
2929

30-
dist_pmixdata_DATA = help-pmix-mca-base.txt help-pmix-mca-var.txt
30+
EXTRA_DIST = help-pmix-mca-base.txt help-pmix-mca-var.txt
3131

3232
# Source code files
3333

src/mca/base/pmix_mca_base_component_repository.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Copyright (c) 2015 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* Copyright (c) 2016-2020 Intel, Inc. All rights reserved.
19-
* Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
19+
* Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
2020
* $COPYRIGHT$
2121
*
2222
* Additional copyrights may follow

src/mca/base/pmix_mca_base_var.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
1515
* reserved.
1616
* Copyright (c) 2016-2020 Intel, Inc. All rights reserved.
17-
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
17+
* Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
1818
* $COPYRIGHT$
1919
*
2020
* Additional copyrights may follow

src/mca/bfrops/base/bfrop_base_select.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Copyright (c) 2016-2020 Intel, Inc. All rights reserved.
1313
* Copyright (c) 2020 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
15-
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
15+
* Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
1616
* $COPYRIGHT$
1717
*
1818
* Additional copyrights may follow

src/mca/gds/base/gds_base_select.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Copyright (c) 2016-2020 Intel, Inc. All rights reserved.
1313
* Copyright (c) 2020 Research Organization for Information Science
1414
* and Technology (RIST). All rights reserved.
15-
* Copyright (c) 2021-2022 Nanook Consulting. All rights reserved.
15+
* Copyright (c) 2021-2025 Nanook Consulting All rights reserved.
1616
* $COPYRIGHT$
1717
*
1818
* Additional copyrights may follow

src/mca/gds/shmem2/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# Copyright (c) 2013-2020 Intel, Inc. All rights reserved.
1515
# Copyright (c) 2017 Research Organization for Information Science
1616
# and Technology (RIST). All rights reserved.
17-
# Copyright (c) 2022-2024 Nanook Consulting All rights reserved.
17+
# Copyright (c) 2022-2025 Nanook Consulting All rights reserved.
1818
# Copyright (c) 2022-2023 Triad National Security, LLC. All rights reserved.
1919
# $COPYRIGHT$
2020
#
@@ -25,7 +25,7 @@
2525

2626
AM_CPPFLAGS = $(gds_shmem2_CPPFLAGS)
2727

28-
dist_pmixdata_DATA = help-gds-shmem2.txt
28+
EXTRA_DIST = help-gds-shmem2.txt
2929

3030
headers = \
3131
gds_shmem2.h \

src/mca/gds/shmem2/gds_shmem2.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,10 +1046,9 @@ shmem2_attach(
10461046
// This type of error occurs when we
10471047
// didn't map to the requested address.
10481048
if (PMIX_ERR_NOT_AVAILABLE == rc) {
1049-
pmix_show_help(
1050-
"help-gds-shmem2.txt",
1051-
"shmem2-segment-attach:address-mismatch",
1052-
true, (size_t)req_addr, (size_t)shmem2->hdr_address
1049+
pmix_show_help("help-gds-shmem2.txt",
1050+
"shmem2-segment-attach:address-mismatch",
1051+
true, (size_t)req_addr, (size_t)shmem2->hdr_address
10531052
);
10541053
rc = PMIX_ERROR;
10551054
}

0 commit comments

Comments
 (0)