Skip to content

v5: Create an OPAL "core" library for internal usage #10809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions config/opal_mca.m4
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ AC_DEFUN([MCA_CONFIGURE_PROJECT],[
# can't use a variable rename here because these need to be evaled
# at auto* time.

AS_LITERAL_IF([$1], [],
[m4_fatal([MCA_CONFIGURE_PROJECT argument must be a literal])])

opal_show_subtitle "Configuring MCA for $1"

AC_MSG_CHECKING([for frameworks for $1])
Expand All @@ -291,6 +294,7 @@ AC_DEFUN([MCA_CONFIGURE_PROJECT],[
MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS=
MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS=
MCA_$1_FRAMEWORK_LIBS=
MCA_$1_FRAMEWORK_CORE_LIBS=

m4_foreach(mca_framework, [mca_$1_framework_list],
[m4_ifval(mca_framework,
Expand All @@ -301,14 +305,17 @@ AC_DEFUN([MCA_CONFIGURE_PROJECT],[
MCA_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS="[\$(MCA_]$1[_]mca_framework[_ALL_SUBDIRS)] $MCA_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS"
MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS="[\$(MCA_]$1[_]mca_framework[_DSO_SUBDIRS)] $MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS"
MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS="[\$(MCA_]$1[_]mca_framework[_STATIC_SUBDIRS)] $MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS"
mca_$1_framework_base_lib=
], [
MCA_$1_FRAMEWORKS="$MCA_$1_FRAMEWORKS mca_framework"
MCA_$1_FRAMEWORKS_SUBDIRS="$MCA_$1_FRAMEWORKS_SUBDIRS [mca/]mca_framework"
MCA_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS="$MCA_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS [\$(MCA_]$1[_]mca_framework[_ALL_SUBDIRS)]"
MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS="$MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS [\$(MCA_]$1[_]mca_framework[_DSO_SUBDIRS)]"
MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS="$MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS [\$(MCA_]$1[_]mca_framework[_STATIC_SUBDIRS)]"
MCA_$1_FRAMEWORK_LIBS="$MCA_$1_FRAMEWORK_LIBS [mca/]mca_framework[/libmca_]mca_framework[.la]"])
MCA_$1_FRAMEWORK_LIBS="$MCA_$1_FRAMEWORK_LIBS [\$(MCA_]$1[_]mca_framework[_STATIC_LTLIBS)]"
mca_$1_framework_base_lib="[mca/]mca_framework[/libmca_]mca_framework[.la]"])
m4_ifdef([MCA_]$1[_]mca_framework[_CORE_LIB],
[MCA_$1_FRAMEWORK_CORE_LIBS="$MCA_$1_FRAMEWORK_CORE_LIBS ${mca_$1_framework_base_lib} [\$(MCA_]$1[_]mca_framework[_STATIC_LTLIBS)]"],
[MCA_$1_FRAMEWORK_LIBS="$MCA_$1_FRAMEWORK_LIBS ${mca_$1_framework_base_lib} [\$(MCA_]$1[_]mca_framework[_STATIC_LTLIBS)]"])
m4_ifdef([MCA_]$1[_]mca_framework[_CONFIG],
[MCA_]$1[_]mca_framework[_CONFIG]($1, mca_framework),
[MCA_CONFIGURE_FRAMEWORK($1, mca_framework, 1)])])])
Expand All @@ -324,6 +331,7 @@ AC_DEFUN([MCA_CONFIGURE_PROJECT],[
AC_SUBST(MCA_$1_FRAMEWORK_COMPONENT_DSO_SUBDIRS)
AC_SUBST(MCA_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS)
AC_SUBST(MCA_$1_FRAMEWORK_LIBS)
AC_SUBST(MCA_$1_FRAMEWORK_CORE_LIBS)
])

# MCA_ORDER_COMPONENT_LIST(project_name, framework_name)
Expand Down
10 changes: 10 additions & 0 deletions docs/developers/source-code.rst
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@ Each of the three main source directories (``oshmem``, ``ompi``, and
either static or shared libraries. Executables are also produced in
subdirectories of some of the trees.

The ``libopen-pal`` top-level library is built internally in two parts:

* ``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.

* Includes the following MCA frameworks: ``backtrace``, ``dl``, ``installdirs``, ``threads``, ``timer``
* Includes all of the source under ``opal/class`` and most of ``opal/util``
* Includes the files suffixed with ``_core`` in ``opal/runtime``

* ``libopen-pal`` Includes "core" plus all of the other OPAL project sources. This is installed.

Each of the sub-project source directories have similar (but not
identical) directory structures under them:

Expand Down
2 changes: 1 addition & 1 deletion ompi/tools/mpirun/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mpirun_SOURCES = \
main.c

mpirun_LDADD = \
$(top_builddir)/opal/libopen-pal.la
$(top_builddir)/opal/libopen-pal_core.la

install-exec-hook:
(cd $(DESTDIR)$(bindir); rm -f mpiexec$(EXEEXT); $(LN_S) mpirun$(EXEEXT) mpiexec$(EXEEXT))
Expand Down
20 changes: 15 additions & 5 deletions opal/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2009 The University of Tennessee and The University
# Copyright (c) 2004-2022 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2009 High Performance Computing Center Stuttgart,
Expand Down Expand Up @@ -55,26 +55,36 @@ DIST_SUBDIRS = \
$(MCA_opal_FRAMEWORKS_SUBDIRS) \
$(MCA_opal_FRAMEWORK_COMPONENT_ALL_SUBDIRS)

# Build the main OPAL library
noinst_LTLIBRARIES = libopen-pal_core.la
lib_LTLIBRARIES = lib@[email protected]

libopen_pal_core_la_SOURCES =
libopen_pal_core_la_LIBADD = \
mca/base/libmca_base.la \
util/libopalutil_core.la \
$(MCA_opal_FRAMEWORK_CORE_LIBS)
libopen_pal_core_la_DEPENDENCIES = \
mca/base/libmca_base.la \
util/libopalutil_core.la \
$(MCA_opal_FRAMEWORK_CORE_LIBS)

lib@OPAL_LIB_NAME@_la_SOURCES =
lib@OPAL_LIB_NAME@_la_LIBADD = \
libopen-pal_core.la \
datatype/libdatatype.la \
mca/base/libmca_base.la \
util/libopalutil.la \
$(LIBOPAL_GPU_LA) \
$(MCA_opal_FRAMEWORK_LIBS)
lib@OPAL_LIB_NAME@_la_DEPENDENCIES = \
libopen-pal_core.la \
datatype/libdatatype.la \
mca/base/libmca_base.la \
util/libopalutil.la \
$(LIBOPAL_GPU_LA) \
$(MCA_opal_FRAMEWORK_LIBS)
lib@OPAL_LIB_NAME@_la_LDFLAGS = -version-info @libopen_pal_so_version@

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

Expand Down
5 changes: 3 additions & 2 deletions opal/class/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2007 The University of Tennessee and The University
# Copyright (c) 2004-2022 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
Expand All @@ -14,6 +14,7 @@
# Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2021 Nanook Consulting. All rights reserved.
# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand Down Expand Up @@ -42,7 +43,7 @@ headers += \
class/opal_rb_tree.h \
class/opal_interval_tree.h

lib@OPAL_LIB_NAME@_la_SOURCES += \
libopen_pal_core_la_SOURCES += \
class/opal_bitmap.c \
class/opal_cstring.c \
class/opal_free_list.c \
Expand Down
4 changes: 4 additions & 0 deletions opal/mca/backtrace/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2006 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl

dnl need in the core library
AC_DEFUN([MCA_opal_backtrace_CORE_LIB], [1])

dnl we only want one :)
m4_define(MCA_opal_backtrace_CONFIGURE_MODE, STOP_AT_FIRST)
4 changes: 4 additions & 0 deletions opal/mca/dl/configure.m4
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl

dnl need in the core library
AC_DEFUN([MCA_opal_dl_CORE_LIB], [1])

dnl There will only be one component used in this framework, and it will
dnl be selected at configure time by priority. Components must set
dnl their priorities in their configure.m4 file.
Expand Down
4 changes: 4 additions & 0 deletions opal/mca/installdirs/configure.m4
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2006-2010 Sandia National Laboratories. All rights reserved.
dnl Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl

dnl need in the core library
AC_DEFUN([MCA_opal_installdirs_CORE_LIB], [1])

AC_DEFUN([MCA_opal_installdirs_CONFIGURE_MODE], [PRIORITY])
32 changes: 32 additions & 0 deletions opal/mca/pmix/base/pmix_base_frame.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/*
* Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2022 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand All @@ -16,6 +19,7 @@
#include "opal/mca/threads/thread_usage.h"
#include "opal/util/argv.h"
#include "opal/util/output.h"
#include "opal/util/proc.h"

#include "opal/mca/pmix/base/base.h"
#include "opal/mca/pmix/pmix-internal.h"
Expand Down Expand Up @@ -59,6 +63,32 @@ static int opal_pmix_base_frame_register(mca_base_register_flag_t flags)
return OPAL_SUCCESS;
}

static char*
opal_get_proc_hostname_using_pmix(const opal_proc_t *proc)
{
int ret;
char *hostname;

/* if the proc is NULL, then we can't know */
if (NULL == proc) {
return strdup("unknown");
}

/* if it is my own hostname we are after, then just hand back
* the value in opal_process_info */
if (proc == opal_proc_local_get()) {
return strdup(opal_process_info.nodename);
}
/* if we don't already have it, then try to get it */
OPAL_MODEX_RECV_VALUE_OPTIONAL(ret, PMIX_HOSTNAME, &proc->proc_name, (char **) &hostname,
PMIX_STRING);
if (OPAL_SUCCESS != ret) {
return strdup("unknown"); // return something so the caller doesn't segfault
}
/* user is not allowed to release the data */
return hostname;
}

static int opal_pmix_base_frame_close(void)
{
int rc;
Expand All @@ -77,6 +107,8 @@ static int opal_pmix_base_frame_open(mca_base_open_flag_t flags)
opal_pmix_base.evbase = opal_sync_event_base;
/* pass across the verbosity */
opal_pmix_verbose_output = opal_pmix_base_framework.framework_output;
/* Set the distributed name service via PMIx */
opal_get_proc_hostname = opal_get_proc_hostname_using_pmix;
return rc;
}

Expand Down
3 changes: 3 additions & 0 deletions opal/mca/threads/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ dnl
dnl $HEADER$
dnl

dnl need in the core library
AC_DEFUN([MCA_opal_threads_CORE_LIB], [1])

dnl we only want one :)
m4_define(MCA_opal_threads_CONFIGURE_MODE, STOP_AT_FIRST)

Expand Down
4 changes: 4 additions & 0 deletions opal/mca/timer/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl

dnl need in the core library
AC_DEFUN([MCA_opal_timer_CORE_LIB], [1])

dnl we only want one :)
m4_define(MCA_opal_timer_CONFIGURE_MODE, STOP_AT_FIRST)

Expand Down
13 changes: 10 additions & 3 deletions opal/runtime/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2020 The University of Tennessee and The University
# Copyright (c) 2004-2022 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
Expand All @@ -14,6 +14,7 @@
# All rights reserved.
# Copyright (c) 2014 Intel, Inc. All rights reserved
# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand All @@ -35,12 +36,18 @@ headers += \
runtime/opal.h \
runtime/opal_info_support.h \
runtime/opal_params.h \
runtime/opal_params_core.h \
runtime/opal_progress_threads.h

libopen_pal_core_la_SOURCES += \
runtime/opal_params_core.c \
runtime/opal_finalize_core.c \
runtime/opal_init_core.c \
runtime/opal_info_support.c

lib@OPAL_LIB_NAME@_la_SOURCES += \
runtime/opal_params.c \
runtime/opal_progress.c \
runtime/opal_finalize.c \
runtime/opal_init.c \
runtime/opal_params.c \
runtime/opal_info_support.c \
runtime/opal_progress_threads.c
Loading