Skip to content

Commit 384d47d

Browse files
authored
Merge pull request #10779 from jjhursey/mpi-tools-deps
Create an OPAL "core" library for internal usage
2 parents 9b87ffd + 8112e9b commit 384d47d

29 files changed

+1401
-1032
lines changed

config/opal_mca.m4

+10-2
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ AC_DEFUN([MCA_CONFIGURE_PROJECT],[
265265
# can't use a variable rename here because these need to be evaled
266266
# at auto* time.
267267
268+
AS_LITERAL_IF([$1], [],
269+
[m4_fatal([MCA_CONFIGURE_PROJECT argument must be a literal])])
270+
268271
opal_show_subtitle "Configuring MCA for $1"
269272
270273
AC_MSG_CHECKING([for frameworks for $1])
@@ -291,6 +294,7 @@ AC_DEFUN([MCA_CONFIGURE_PROJECT],[
291294
MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS=
292295
MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS=
293296
MCA_$1_FRAMEWORK_LIBS=
297+
MCA_$1_FRAMEWORK_CORE_LIBS=
294298
295299
m4_foreach(mca_framework, [mca_$1_framework_list],
296300
[m4_ifval(mca_framework,
@@ -301,14 +305,17 @@ AC_DEFUN([MCA_CONFIGURE_PROJECT],[
301305
MCA_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS="[\$(MCA_]$1[_]mca_framework[_ALL_SUBDIRS)] $MCA_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS"
302306
MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS="[\$(MCA_]$1[_]mca_framework[_DSO_SUBDIRS)] $MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS"
303307
MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS="[\$(MCA_]$1[_]mca_framework[_STATIC_SUBDIRS)] $MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS"
308+
mca_$1_framework_base_lib=
304309
], [
305310
MCA_$1_FRAMEWORKS="$MCA_$1_FRAMEWORKS mca_framework"
306311
MCA_$1_FRAMEWORKS_SUBDIRS="$MCA_$1_FRAMEWORKS_SUBDIRS [mca/]mca_framework"
307312
MCA_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS="$MCA_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS [\$(MCA_]$1[_]mca_framework[_ALL_SUBDIRS)]"
308313
MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS="$MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS [\$(MCA_]$1[_]mca_framework[_DSO_SUBDIRS)]"
309314
MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS="$MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS [\$(MCA_]$1[_]mca_framework[_STATIC_SUBDIRS)]"
310-
MCA_$1_FRAMEWORK_LIBS="$MCA_$1_FRAMEWORK_LIBS [mca/]mca_framework[/libmca_]mca_framework[.la]"])
311-
MCA_$1_FRAMEWORK_LIBS="$MCA_$1_FRAMEWORK_LIBS [\$(MCA_]$1[_]mca_framework[_STATIC_LTLIBS)]"
315+
mca_$1_framework_base_lib="[mca/]mca_framework[/libmca_]mca_framework[.la]"])
316+
m4_ifdef([MCA_]$1[_]mca_framework[_CORE_LIB],
317+
[MCA_$1_FRAMEWORK_CORE_LIBS="$MCA_$1_FRAMEWORK_CORE_LIBS ${mca_$1_framework_base_lib} [\$(MCA_]$1[_]mca_framework[_STATIC_LTLIBS)]"],
318+
[MCA_$1_FRAMEWORK_LIBS="$MCA_$1_FRAMEWORK_LIBS ${mca_$1_framework_base_lib} [\$(MCA_]$1[_]mca_framework[_STATIC_LTLIBS)]"])
312319
m4_ifdef([MCA_]$1[_]mca_framework[_CONFIG],
313320
[MCA_]$1[_]mca_framework[_CONFIG]($1, mca_framework),
314321
[MCA_CONFIGURE_FRAMEWORK($1, mca_framework, 1)])])])
@@ -324,6 +331,7 @@ AC_DEFUN([MCA_CONFIGURE_PROJECT],[
324331
AC_SUBST(MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS)
325332
AC_SUBST(MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS)
326333
AC_SUBST(MCA_$1_FRAMEWORK_LIBS)
334+
AC_SUBST(MCA_$1_FRAMEWORK_CORE_LIBS)
327335
])
328336

329337
# MCA_ORDER_COMPONENT_LIST(project_name, framework_name)

docs/developers/source-code.rst

+10
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,16 @@ Each of the three main source directories (``oshmem``, ``ompi``, and
209209
either static or shared libraries. Executables are also produced in
210210
subdirectories of some of the trees.
211211
212+
The ``libopen-pal`` top-level library is built internally in two parts:
213+
214+
* ``libopen-pal_core`` Internal "core" portion of OPAL containing the essential source and MCA needed for tools like mpicc/mpirun to link against. The "core" library is not installed.
215+
216+
* Includes the following MCA frameworks: ``backtrace``, ``dl``, ``installdirs``, ``threads``, ``timer``
217+
* Includes all of the source under ``opal/class`` and most of ``opal/util``
218+
* Includes the files suffixed with ``_core`` in ``opal/runtime``
219+
220+
* ``libopen-pal`` Includes "core" plus all of the other OPAL project sources. This is installed.
221+
212222
Each of the sub-project source directories have similar (but not
213223
identical) directory structures under them:
214224

ompi/tools/mpirun/Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ mpirun_SOURCES = \
2020
main.c
2121

2222
mpirun_LDADD = \
23-
$(top_builddir)/opal/libopen-pal.la
23+
$(top_builddir)/opal/libopen-pal_core.la
2424

2525
install-exec-hook:
2626
(cd $(DESTDIR)$(bindir); rm -f mpiexec$(EXEEXT); $(LN_S) mpirun$(EXEEXT) mpiexec$(EXEEXT))

opal/Makefile.am

+15-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
33
# University Research and Technology
44
# Corporation. All rights reserved.
5-
# Copyright (c) 2004-2009 The University of Tennessee and The University
5+
# Copyright (c) 2004-2022 The University of Tennessee and The University
66
# of Tennessee Research Foundation. All rights
77
# reserved.
88
# Copyright (c) 2004-2009 High Performance Computing Center Stuttgart,
@@ -55,26 +55,36 @@ DIST_SUBDIRS = \
5555
$(MCA_opal_FRAMEWORKS_SUBDIRS) \
5656
$(MCA_opal_FRAMEWORK_COMPONENT_ALL_SUBDIRS)
5757

58-
# Build the main OPAL library
58+
noinst_LTLIBRARIES = libopen-pal_core.la
5959
lib_LTLIBRARIES = lib@[email protected]
60+
61+
libopen_pal_core_la_SOURCES =
62+
libopen_pal_core_la_LIBADD = \
63+
mca/base/libmca_base.la \
64+
util/libopalutil_core.la \
65+
$(MCA_opal_FRAMEWORK_CORE_LIBS)
66+
libopen_pal_core_la_DEPENDENCIES = \
67+
mca/base/libmca_base.la \
68+
util/libopalutil_core.la \
69+
$(MCA_opal_FRAMEWORK_CORE_LIBS)
70+
6071
lib@OPAL_LIB_NAME@_la_SOURCES =
6172
lib@OPAL_LIB_NAME@_la_LIBADD = \
73+
libopen-pal_core.la \
6274
datatype/libdatatype.la \
63-
mca/base/libmca_base.la \
6475
util/libopalutil.la \
6576
$(LIBOPAL_GPU_LA) \
6677
$(MCA_opal_FRAMEWORK_LIBS)
6778
lib@OPAL_LIB_NAME@_la_DEPENDENCIES = \
79+
libopen-pal_core.la \
6880
datatype/libdatatype.la \
69-
mca/base/libmca_base.la \
7081
util/libopalutil.la \
7182
$(LIBOPAL_GPU_LA) \
7283
$(MCA_opal_FRAMEWORK_LIBS)
7384
lib@OPAL_LIB_NAME@_la_LDFLAGS = -version-info @libopen_pal_so_version@
7485

7586
# included subdirectory Makefile.am's and appended-to variables
7687
headers =
77-
noinst_LTLIBRARIES =
7888
dist_opaldata_DATA =
7989
lib@OPAL_LIB_NAME@_la_SOURCES += $(headers)
8090

opal/class/Makefile.am

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
44
# University Research and Technology
55
# Corporation. All rights reserved.
6-
# Copyright (c) 2004-2007 The University of Tennessee and The University
6+
# Copyright (c) 2004-2022 The University of Tennessee and The University
77
# of Tennessee Research Foundation. All rights
88
# reserved.
99
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -14,6 +14,7 @@
1414
# Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights
1515
# reserved.
1616
# Copyright (c) 2021 Nanook Consulting. All rights reserved.
17+
# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
1718
# $COPYRIGHT$
1819
#
1920
# Additional copyrights may follow
@@ -42,7 +43,7 @@ headers += \
4243
class/opal_rb_tree.h \
4344
class/opal_interval_tree.h
4445

45-
lib@OPAL_LIB_NAME@_la_SOURCES += \
46+
libopen_pal_core_la_SOURCES += \
4647
class/opal_bitmap.c \
4748
class/opal_cstring.c \
4849
class/opal_free_list.c \

opal/mca/backtrace/configure.m4

+4
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
1010
dnl University of Stuttgart. All rights reserved.
1111
dnl Copyright (c) 2004-2006 The Regents of the University of California.
1212
dnl All rights reserved.
13+
dnl Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
1314
dnl $COPYRIGHT$
1415
dnl
1516
dnl Additional copyrights may follow
1617
dnl
1718
dnl $HEADER$
1819
dnl
1920

21+
dnl need in the core library
22+
AC_DEFUN([MCA_opal_backtrace_CORE_LIB], [1])
23+
2024
dnl we only want one :)
2125
m4_define(MCA_opal_backtrace_CONFIGURE_MODE, STOP_AT_FIRST)

opal/mca/dl/configure.m4

+4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
dnl -*- shell-script -*-
22
dnl
33
dnl Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved.
4+
dnl Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
45
dnl $COPYRIGHT$
56
dnl
67
dnl Additional copyrights may follow
78
dnl
89
dnl $HEADER$
910
dnl
1011

12+
dnl need in the core library
13+
AC_DEFUN([MCA_opal_dl_CORE_LIB], [1])
14+
1115
dnl There will only be one component used in this framework, and it will
1216
dnl be selected at configure time by priority. Components must set
1317
dnl their priorities in their configure.m4 file.

opal/mca/installdirs/configure.m4

+4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
dnl -*- shell-script -*-
22
dnl
33
dnl Copyright (c) 2006-2010 Sandia National Laboratories. All rights reserved.
4+
dnl Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
45
dnl $COPYRIGHT$
56
dnl
67
dnl Additional copyrights may follow
78
dnl
89
dnl $HEADER$
910
dnl
1011

12+
dnl need in the core library
13+
AC_DEFUN([MCA_opal_installdirs_CORE_LIB], [1])
14+
1115
AC_DEFUN([MCA_opal_installdirs_CONFIGURE_MODE], [PRIORITY])

opal/mca/pmix/base/pmix_base_frame.c

+32
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/*
22
* Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
33
* Copyright (c) 2015-2016 Cisco Systems, Inc. All rights reserved.
4+
* Copyright (c) 2022 The University of Tennessee and The University
5+
* of Tennessee Research Foundation. All rights
6+
* reserved.
47
* $COPYRIGHT$
58
*
69
* Additional copyrights may follow
@@ -16,6 +19,7 @@
1619
#include "opal/mca/threads/thread_usage.h"
1720
#include "opal/util/argv.h"
1821
#include "opal/util/output.h"
22+
#include "opal/util/proc.h"
1923

2024
#include "opal/mca/pmix/base/base.h"
2125
#include "opal/mca/pmix/pmix-internal.h"
@@ -59,6 +63,32 @@ static int opal_pmix_base_frame_register(mca_base_register_flag_t flags)
5963
return OPAL_SUCCESS;
6064
}
6165

66+
static char*
67+
opal_get_proc_hostname_using_pmix(const opal_proc_t *proc)
68+
{
69+
int ret;
70+
char *hostname;
71+
72+
/* if the proc is NULL, then we can't know */
73+
if (NULL == proc) {
74+
return strdup("unknown");
75+
}
76+
77+
/* if it is my own hostname we are after, then just hand back
78+
* the value in opal_process_info */
79+
if (proc == opal_proc_local_get()) {
80+
return strdup(opal_process_info.nodename);
81+
}
82+
/* if we don't already have it, then try to get it */
83+
OPAL_MODEX_RECV_VALUE_OPTIONAL(ret, PMIX_HOSTNAME, &proc->proc_name, (char **) &hostname,
84+
PMIX_STRING);
85+
if (OPAL_SUCCESS != ret) {
86+
return strdup("unknown"); // return something so the caller doesn't segfault
87+
}
88+
/* user is not allowed to release the data */
89+
return hostname;
90+
}
91+
6292
static int opal_pmix_base_frame_close(void)
6393
{
6494
int rc;
@@ -77,6 +107,8 @@ static int opal_pmix_base_frame_open(mca_base_open_flag_t flags)
77107
opal_pmix_base.evbase = opal_sync_event_base;
78108
/* pass across the verbosity */
79109
opal_pmix_verbose_output = opal_pmix_base_framework.framework_output;
110+
/* Set the distributed name service via PMIx */
111+
opal_get_proc_hostname = opal_get_proc_hostname_using_pmix;
80112
return rc;
81113
}
82114

opal/mca/threads/configure.m4

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ dnl
2222
dnl $HEADER$
2323
dnl
2424

25+
dnl need in the core library
26+
AC_DEFUN([MCA_opal_threads_CORE_LIB], [1])
27+
2528
dnl we only want one :)
2629
m4_define(MCA_opal_threads_CONFIGURE_MODE, STOP_AT_FIRST)
2730

opal/mca/timer/configure.m4

+4
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ dnl University of Stuttgart. All rights reserved.
1111
dnl Copyright (c) 2004-2005 The Regents of the University of California.
1212
dnl All rights reserved.
1313
dnl Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
14+
dnl Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
1415
dnl $COPYRIGHT$
1516
dnl
1617
dnl Additional copyrights may follow
1718
dnl
1819
dnl $HEADER$
1920
dnl
2021

22+
dnl need in the core library
23+
AC_DEFUN([MCA_opal_timer_CORE_LIB], [1])
24+
2125
dnl we only want one :)
2226
m4_define(MCA_opal_timer_CONFIGURE_MODE, STOP_AT_FIRST)
2327

opal/runtime/Makefile.am

+10-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
44
# University Research and Technology
55
# Corporation. All rights reserved.
6-
# Copyright (c) 2004-2020 The University of Tennessee and The University
6+
# Copyright (c) 2004-2022 The University of Tennessee and The University
77
# of Tennessee Research Foundation. All rights
88
# reserved.
99
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -14,6 +14,7 @@
1414
# All rights reserved.
1515
# Copyright (c) 2014 Intel, Inc. All rights reserved
1616
# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
17+
# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
1718
# $COPYRIGHT$
1819
#
1920
# Additional copyrights may follow
@@ -35,12 +36,18 @@ headers += \
3536
runtime/opal.h \
3637
runtime/opal_info_support.h \
3738
runtime/opal_params.h \
39+
runtime/opal_params_core.h \
3840
runtime/opal_progress_threads.h
3941

42+
libopen_pal_core_la_SOURCES += \
43+
runtime/opal_params_core.c \
44+
runtime/opal_finalize_core.c \
45+
runtime/opal_init_core.c \
46+
runtime/opal_info_support.c
47+
4048
lib@OPAL_LIB_NAME@_la_SOURCES += \
49+
runtime/opal_params.c \
4150
runtime/opal_progress.c \
4251
runtime/opal_finalize.c \
4352
runtime/opal_init.c \
44-
runtime/opal_params.c \
45-
runtime/opal_info_support.c \
4653
runtime/opal_progress_threads.c

0 commit comments

Comments
 (0)