1717# reserved.
1818# Copyright (c) 2015-2020 Research Organization for Information Science
1919# and Technology (RIST). All rights reserved.
20+ # Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
21+ # reserved.
2022# $COPYRIGHT$
2123#
2224# Additional copyrights may follow
2325#
2426# $HEADER$
2527#
2628
27- SUBDIRS = profile
28-
29- # OMPI_BUILD_MPI_PROFILING is enabled when we want our generated MPI_* symbols
30- # to be replaced by PMPI_*.
31- # In this directory, we need it to be 0
32-
33- AM_CPPFLAGS = -DOMPI_BUILD_MPI_PROFILING=0
34-
35- #
36- # The top directory always builds MPI_* bindings. The bottom directory
37- # always builds PMPI_* bindings. The cases where the top directory
38- # needs to be built are:
39- #
40- # 1. When profiling is disabled.
41- # 2. When profiling is enabled but weak symbol support is absent.
42- #
29+ # The purpose of the profiling layer is to allow intercept libraries
30+ # which override the MPI_ namespace symbols. We potentially compile
31+ # every MPI function twice. We always build the profiling layer,
32+ # because the symbols that are always implemented as functions are the
33+ # PMPI_ namespace symbols. We sometimes also build the non-profiling
34+ # layer, if weak symbols can't be used to alias the MPI_ namespace
35+ # into the PMPI_ namespace.
4336
44- noinst_LTLIBRARIES = libmpi_c.la
37+ noinst_LTLIBRARIES = libmpi_c.la libmpi_c_profile.la
4538if BUILD_MPI_BINDINGS_LAYER
46- noinst_LTLIBRARIES += libmpi_c_mpi .la
39+ noinst_LTLIBRARIES += libmpi_c_noprofile .la
4740endif
4841
4942headers = bindings.h
5043
51- #
52- # libmpi_c.la is always build because it contains some non-profilied
53- # functions.
54- #
55-
44+ # attr_fn.c contains attribute manipulation functions which do not
45+ # profiling implications, and so are always built.
5646libmpi_c_la_SOURCES = \
5747 attr_fn.c
48+ libmpi_c_la_LIBADD = libmpi_c_profile.la
49+ if BUILD_MPI_BINDINGS_LAYER
50+ libmpi_c_la_LIBADD += libmpi_c_noprofile.la
51+ endif
52+
53+ # Conditionally install the header files
54+ if WANT_INSTALL_HEADERS
55+ ompidir = $(ompiincludedir ) /$(subdir )
56+ ompi_HEADERS = $(headers )
57+ endif
5858
5959#
60- # libmpi_c_mpi.la is only built in some cases (see above)
60+ # List of all C files that have profile versions
6161#
62-
63- libmpi_c_mpi_la_SOURCES = \
62+ interface_profile_sources = \
6463 abort.c \
6564 add_error_class.c \
6665 add_error_code.c \
@@ -469,9 +468,8 @@ libmpi_c_mpi_la_SOURCES = \
469468 win_unlock_all.c \
470469 win_wait.c
471470
472-
473471if OMPI_ENABLE_MPI1_COMPAT
474- libmpi_c_mpi_la_SOURCES += \
472+ interface_profile_sources += \
475473 address.c \
476474 errhandler_create.c \
477475 errhandler_get.c \
@@ -484,9 +482,8 @@ libmpi_c_mpi_la_SOURCES += \
484482 type_ub.c
485483endif
486484
487- # Conditionally install the header files
485+ libmpi_c_profile_la_SOURCES = $(interface_profile_sources )
486+ libmpi_c_profile_la_CPPFLAGS = -DOMPI_BUILD_MPI_PROFILING=1
488487
489- if WANT_INSTALL_HEADERS
490- ompidir = $(ompiincludedir ) /$(subdir )
491- ompi_HEADERS = $(headers )
492- endif
488+ libmpi_c_noprofile_la_SOURCES = $(interface_profile_sources )
489+ libmpi_c_noprofile_la_CPPFLAGS = -DOMPI_BUILD_MPI_PROFILING=0
0 commit comments