Skip to content

Commit 930260c

Browse files
committed
build: Default to building MCA components in the library
Default to building MCA components into the library, rather than as dso objects, since most users are not taking advantage of per-library packaging, and this results in less stat/open/etc. calls during application startup. Clean up the static/dso selection logic for componets at the same time. Before, it was relatively hard to describe what would happen if there was a mix of --enable-mca-dso and --enable-mca-static arguments. Now, the code will first look for a component-specific argument, then a framework-level argument, then a global argument. If there is a tie, static is preferred. Update the NEWS and README.md to document the changes. Jeff Squyres wrote the original update to the README file, which was adopted to the new README.md format. Signed-off-by: Brian Barrett <bbarrett@amazon.com>
1 parent 76328f0 commit 930260c

File tree

3 files changed

+149
-41
lines changed

3 files changed

+149
-41
lines changed

NEWS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
2020
Copyright (c) 2012 University of Houston. All rights reserved.
2121
Copyright (c) 2013 NVIDIA Corporation. All rights reserved.
2222
Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
23-
Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights
23+
Copyright (c) 2018-2021 Amazon.com, Inc. or its affiliates. All Rights
2424
reserved.
2525
$COPYRIGHT$
2626

@@ -80,6 +80,8 @@ Master (not on release branches yet)
8080
Currently, this means the Open SHMEM layer will only build if
8181
a MXM or UCX library is found.
8282
- Remove all vestiges of the C/R support
83+
- Change the default component build behavior to prefer building
84+
components as part of libmpi.so instead of individual DSOs.
8385

8486
4.0.5 -- August, 2020
8587
---------------------

README.md

Lines changed: 108 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -961,20 +961,116 @@ Additionally, if a search directory is specified in the form
961961
`--disable-wrapper-runpath`.
962962

963963
* `--enable-dlopen`:
964-
Build all of Open MPI's components as standalone Dynamic Shared
965-
Objects (DSO's) that are loaded at run-time (this is the default).
966-
The opposite of this option, `--disable-dlopen`, causes two things:
964+
Enable loading of Open MPI components as standalone Dynamic
965+
Shared Objects (DSOs) that are loaded at run-time. This option is
966+
enabled by default.
967967

968-
1. All of Open MPI's components will be built as part of Open MPI's
969-
normal libraries (e.g., `libmpi`).
970-
1. Open MPI will not attempt to open any DSO's at run-time.
968+
The opposite of this option, --disable-dlopen, causes the following:
971969

972-
Note that this option does *not* imply that OMPI's libraries will be
973-
built as static objects (e.g., `libmpi.a`). It only specifies the
974-
location of OMPI's components: standalone DSOs or folded into the
975-
Open MPI libraries. You can control whether Open MPI's libraries
976-
are build as static or dynamic via `--enable|disable-static` and
977-
`--enable|disable-shared`.
970+
1. Open MPI will not attempt to open any DSOs at run-time.
971+
1. configure behaves as if the --enable-mca-static argument was set.
972+
1. configure will ignore the --enable-mca-dso argument.
973+
974+
See the description of --enable-mca-static / --enable-mca-dso for
975+
more information.
976+
977+
Note that this option does *not* change how Open MPI's libraries
978+
(libmpi, for example) will be built. You can change whether Open
979+
MPI builds static or dynamic libraries via the
980+
--enable|disable-static and --enable|disable-shared arguments.
981+
982+
* `--enable-mca-dso[=LIST]` and `--enable-mca-static[=LIST]`
983+
These two options, along with --enable-mca-no-build, govern the
984+
behavior of how Open MPI's frameworks and components are built.
985+
986+
The --enable-mca-dso option specifies which frameworks and/or
987+
components are built as Dynamic Shared Objects (DSOs).
988+
Specifically, DSOs are built as "plugins" outside of the core Open
989+
MPI libraries, and are loaded by Open MPI at run time.
990+
991+
The --enable-mca-static option specifies which frameworks and/or
992+
components are built as part of the core Open MPI libraries (i.e.,
993+
they are not built as DSOs, and therefore do not need to be
994+
separately discovered and opened at run time).
995+
996+
Both options can be used one of two ways:
997+
998+
1. --enable-mca-OPTION (with no value)
999+
1. --enable-mca-OPTION=LIST
1000+
1001+
--enable-mca-OPTION=no or --disable-mca-OPTION are both legal
1002+
options, but have no impact on the selection logic described below.
1003+
Only affirmative options change the selection process.
1004+
1005+
LIST is a comma-delimited list of Open MPI frameworks and/or
1006+
framework+component tuples. Examples:
1007+
1008+
* "btl" specifies the entire BTL framework
1009+
* "btl-tcp" specifies just the TCP component in the BTL framework
1010+
* "mtl,btl-tcp" specifies the entire MTL framework and the TCP
1011+
component in the BTL framework
1012+
1013+
Open MPI's configure script uses the values of these two options
1014+
when evaluating each component to determine how it should be built
1015+
by evaluating these conditions in order:
1016+
1017+
1. If an individual component's build behavior has been specified
1018+
via these two options, configure uses that behavior.
1019+
1. Otherwise, if the component is in a framework whose build
1020+
behavior has been specified via these two options, configure uses
1021+
that behavior.
1022+
1. Otherwise, configure uses the global default build behavior.
1023+
1024+
At each level of the selection process, if the component is
1025+
specified to be built as both a static and dso component, the static
1026+
option will win.
1027+
1028+
Note that as of Open MPI v5.0.0, configure's global default is to
1029+
build all components as static (i.e., part of the Open MPI core
1030+
libraries, not as DSO's). Prior to Open MPI v5.0.0, the global
1031+
default behavior was to build most components as DSOs.
1032+
1033+
Also note that if the --disable-dlopen option is specified, then
1034+
Open MPI will not be able to search for DSOs at run time, and the
1035+
value of the --enable-mca-dso option will be silently ignored.
1036+
1037+
Some examples:
1038+
1039+
1. Default to building all components as static (i.e., as part of
1040+
the Open MPI core libraries -- no DSOs):
1041+
1042+
$ ./configure
1043+
1044+
1. Build all components as static, except the TCP BTL, which will be
1045+
built as a DSO:
1046+
1047+
$ ./configure --enable-mca-dso=btl-tcp
1048+
1049+
1. Build all components as static, except all BTL components, which
1050+
will be built as DSOs:
1051+
1052+
$ ./configure --enable-mca-dso=btl
1053+
1054+
1. Build all components as static, except all MTL components and the
1055+
TCP BTL component, which will be built as DSOs:
1056+
1057+
$ ./configure --enable-mca-dso=mtl,btl-tcp
1058+
1059+
1. Build all BTLs as static, except the TCP BTL, as the
1060+
<framework-component> option is more specific than the
1061+
<framework> option:
1062+
1063+
$ ./configure --enable-mca-dso=btl --enable-mca-static=btl-tcp
1064+
1065+
1. Build the TCP BTL as static, because the static option at the
1066+
same level always wins:
1067+
1068+
$ ./configure --enable-mca-dso=btl-tcp --enable-mca-static=btl-tcp
1069+
1070+
* `--enable-mca-no-build=LIST`:
1071+
Comma-separated list of `<framework>-<component>` pairs that will not be
1072+
built. For example, `--enable-mca-no-build=btl-portals,oob-ud` will
1073+
disable building the portals BTL and the ud OOB component.
9781074

9791075
* `--disable-show-load-errors-by-default`:
9801076
Set the default value of the `mca_base_component_show_load_errors`
@@ -1017,11 +1113,6 @@ Additionally, if a search directory is specified in the form
10171113
these libraries for their own purposes. This option is *not*
10181114
intended for typical users of Open MPI.
10191115

1020-
* `--enable-mca-no-build=LIST`:
1021-
Comma-separated list of `<type>-<component>` pairs that will not be
1022-
built. For example, `--enable-mca-no-build=btl-portals,oob-ud` will
1023-
disable building the portals BTL and the ud OOB component.
1024-
10251116

10261117
### Networking support / options
10271118

config/opal_mca.m4

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dnl Copyright (c) 2004-2005 The Regents of the University of California.
1212
dnl All rights reserved.
1313
dnl Copyright (c) 2010-2016 Cisco Systems, Inc. All rights reserved.
1414
dnl Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
15-
dnl Copyright (c) 2018 Amazon.com, Inc. or its affiliates.
15+
dnl Copyright (c) 2018-2021 Amazon.com, Inc. or its affiliates.
1616
dnl All Rights reserved.
1717
dnl $COPYRIGHT$
1818
dnl
@@ -68,16 +68,16 @@ AC_DEFUN([OPAL_MCA],[
6868
type-component pairs that will be built as
6969
run-time loadable components (as opposed to
7070
statically linked in), if supported on this
71-
platform. The default is to build all components
72-
as DSOs.])])
71+
platform.])])
7372
AC_ARG_ENABLE([mca-static],
7473
[AS_HELP_STRING([--enable-mca-static=LIST],
7574
[Comma-separated list of types and/or
7675
type-component pairs that will be built statically
7776
linked into the library. The default (if DSOs are
7877
supported) is to build all components as DSOs.
7978
Enabling a component as static disables it
80-
building as a DSO.])])
79+
building as a DSO. The default is to build all
80+
components staticly.])])
8181
AC_ARG_ENABLE([mca-direct],
8282
[AS_HELP_STRING([--enable-mca-direct=LIST],
8383
[Comma-separated list of type-component pairs that
@@ -166,15 +166,21 @@ AC_DEFUN([OPAL_MCA],[
166166
# resolution (prefer static) is done in the big loop below
167167
#
168168
AC_MSG_CHECKING([which components should be run-time loadable])
169-
if test "$enable_static" != "no" || test "$OPAL_ENABLE_DLOPEN_SUPPORT" = 0; then
169+
if test "$enable_static" != "no"; then
170170
DSO_all=0
171-
msg=none
172-
elif test -z "$enable_mca_dso" || test "$enable_mca_dso" = "yes"; then
173-
DSO_all=1
174-
msg=all
171+
msg="none (static libraries built)"
172+
elif test "$OPAL_ENABLE_DLOPEN_SUPPORT" = 0; then
173+
DSO_all=0
174+
msg="none (dlopen disabled)"
175+
elif test -z "$enable_mca_dso"; then
176+
DSO_all=0
177+
msg=default
175178
elif test "$enable_mca_dso" = "no"; then
176179
DSO_all=0
177180
msg=none
181+
elif test "$enable_mca_dso" = "yes"; then
182+
DSO_all=1
183+
msg=all
178184
else
179185
DSO_all=0
180186
ifs_save="$IFS"
@@ -195,12 +201,15 @@ AC_DEFUN([OPAL_MCA],[
195201
fi
196202

197203
AC_MSG_CHECKING([which components should be static])
198-
if test "$enable_mca_static" = "yes"; then
199-
STATIC_all=1
200-
msg=all
201-
elif test -z "$enable_mca_static" || test "$enable_mca_static" = "no"; then
204+
if test -z "$enable_mca_static" ; then
205+
STATIC_all=0
206+
msg=default
207+
elif test "$enable_mca_static" = "no"; then
202208
STATIC_all=0
203209
msg=none
210+
elif test "$enable_mca_static" = "yes"; then
211+
STATIC_all=1
212+
msg=all
204213
else
205214
STATIC_all=0
206215
ifs_save="$IFS"
@@ -705,17 +714,23 @@ AC_DEFUN([MCA_COMPONENT_COMPILE_MODE],[
705714
[str="STATIC_COMPONENT=\$STATIC_$2_$3"
706715
eval $str])
707716
708-
# Setup for either shared or static
709-
if test "$STATIC_FRAMEWORK" = "1" || \
710-
test "$STATIC_COMPONENT" = "1" || \
711-
test "$STATIC_all" = "1" ; then
712-
$4="static"
713-
elif test "$SHARED_FRAMEWORK" = "1" || \
714-
test "$SHARED_COMPONENT" = "1" || \
715-
test "$DSO_all" = "1"; then
716-
$4="dso"
717+
# Look for the most specific specifier between static/dso. If
718+
# there is a tie (either neither or both specified), prefer
719+
# static.
720+
if test "$STATIC_COMPONENT" = "1"; then
721+
$4=static
722+
elif test "SHARED_COMPONENT" = "1"; then
723+
$4=dso
724+
elif test "$STATIC_FRAMEWORK" = "1"; then
725+
$4=static
726+
elif test "$SHARED_FRAMEWORK" = "1"; then
727+
$4=dso
728+
elif test "$STATIC_all" = "1"; then
729+
$4=static
730+
elif test "$DSO_all" = "1"; then
731+
$4=dso
717732
else
718-
$4="static"
733+
$4=static
719734
fi
720735
721736
AC_MSG_CHECKING([for MCA component $2:$3 compile mode])

0 commit comments

Comments
 (0)