Skip to content

Commit 8b23c66

Browse files
authored
Merge pull request #8704 from bwbarrett/backports/mca-build-as-static-by-default
v5.0: Change MCA component build style default to static
2 parents 9d05d5c + 2519897 commit 8b23c66

File tree

4 files changed

+148
-46
lines changed

4 files changed

+148
-46
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
@@ -956,20 +956,116 @@ Additionally, if a search directory is specified in the form
956956
`--disable-wrapper-runpath`.
957957

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

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

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

9741070
* `--disable-show-load-errors-by-default`:
9751071
Set the default value of the `mca_base_component_show_load_errors`
@@ -1012,11 +1108,6 @@ Additionally, if a search directory is specified in the form
10121108
these libraries for their own purposes. This option is *not*
10131109
intended for typical users of Open MPI.
10141110

1015-
* `--enable-mca-no-build=LIST`:
1016-
Comma-separated list of `<type>-<component>` pairs that will not be
1017-
built. For example, `--enable-mca-no-build=btl-portals,oob-ud` will
1018-
disable building the portals BTL and the ud OOB component.
1019-
10201111

10211112
### Networking support / options
10221113

config/opal_configure_options.m4

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,6 @@ AC_ARG_ENABLE([dlopen],
282282
Disabling dlopen implies --disable-mca-dso.
283283
(default: enabled)])])
284284
if test "$enable_dlopen" = "no" ; then
285-
enable_mca_dso=no
286-
enable_mca_static=yes
287285
OPAL_ENABLE_DLOPEN_SUPPORT=0
288286
AC_MSG_RESULT([no])
289287
else

config/opal_mca.m4

Lines changed: 37 additions & 26 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
@@ -168,14 +168,19 @@ AC_DEFUN([OPAL_MCA],[
168168
AC_MSG_CHECKING([which components should be run-time loadable])
169169
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
178-
enable_dlopen=no
181+
elif test "$enable_mca_dso" = "yes"; then
182+
DSO_all=1
183+
msg=all
179184
else
180185
DSO_all=0
181186
ifs_save="$IFS"
@@ -196,12 +201,15 @@ AC_DEFUN([OPAL_MCA],[
196201
fi
197202

198203
AC_MSG_CHECKING([which components should be static])
199-
if test "$enable_mca_static" = "yes"; then
200-
STATIC_all=1
201-
msg=all
202-
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
203208
STATIC_all=0
204209
msg=none
210+
elif test "$enable_mca_static" = "yes"; then
211+
STATIC_all=1
212+
msg=all
205213
else
206214
STATIC_all=0
207215
ifs_save="$IFS"
@@ -706,20 +714,23 @@ AC_DEFUN([MCA_COMPONENT_COMPILE_MODE],[
706714
[str="STATIC_COMPONENT=\$STATIC_$2_$3"
707715
eval $str])
708716
709-
shared_mode_override=static
710-
711-
# Setup for either shared or static
712-
if test "$STATIC_FRAMEWORK" = "1" || \
713-
test "$STATIC_COMPONENT" = "1" || \
714-
test "$STATIC_all" = "1" ; then
715-
$4="static"
716-
elif test "$shared_mode_override" = "dso" || \
717-
test "$SHARED_FRAMEWORK" = "1" || \
718-
test "$SHARED_COMPONENT" = "1" || \
719-
test "$DSO_all" = "1"; then
720-
$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
721732
else
722-
$4="static"
733+
$4=static
723734
fi
724735
725736
AC_MSG_CHECKING([for MCA component $2:$3 compile mode])

0 commit comments

Comments
 (0)