From 5c1aca22c712be21592ab916ce99b73d3b3969dd Mon Sep 17 00:00:00 2001 From: Prabhanjan Kambadur Date: Thu, 15 Jan 2004 01:11:59 +0000 Subject: [PATCH] CVSc: Changed to have 2 new AM_CONDITIONALS, WANT_MPI_BINDINGS_LAYER and WANT_PMPI_BINDINGS_LAYER. These determine whether src/mpi/interface/c and src/mpi/interface/c/profile are built. Makefile.am's were changed to reflect the same change. Now the top layer always builds MPI bindings and the lower layer always builds PMPI bindings : ---------------------------------------------------------------------- This commit was SVN r393. --- configure.ac | 21 +++- src/mpi/interface/c/Makefile.am | 142 +++++++++++++++--------- src/mpi/interface/c/bindings.h | 4 - src/mpi/interface/c/profile/Makefile.am | 84 ++++++++++---- src/mpi/interface/c/profile/defines.h | 15 +-- 5 files changed, 175 insertions(+), 91 deletions(-) diff --git a/configure.ac b/configure.ac index 7a54160fcb..7db31089eb 100644 --- a/configure.ac +++ b/configure.ac @@ -163,7 +163,7 @@ LAM_C_WEAK_SYMBOLS # separate directory. if test "$WANT_WEAK_SYMBOLS" = "0"; then - LAM_C_HAVE_WEAK_SYMBOLS=1 + LAM_C_HAVE_WEAK_SYMBOLS=0 fi if test "$WANT_MPI_PROFILING" = "1"; then if test "$LAM_C_HAVE_WEAK_SYMBOLS" = "1"; then @@ -174,6 +174,25 @@ if test "$WANT_MPI_PROFILING" = "1"; then else LAM_PROFILING_COMPILE_SEPARATELY=0 fi +# +# There are 2 layers to the MPI Language binidings +# One layer generates MPI_* bindings. The other layer +# generates PMPI_* bindings. The following conditions +# determine whether each (or both) these layers are +# built. +# 1. MPI_* bindings are needed if: +# - Profiling is not required +# - Profiling is required but weak symbols are not +# supported +# 2. PMPI_* bindings are needed if profiling is required. +# Hence we define 2 AM_CONDITIONALs which tell us whether +# each of these layers need to be built or NOT +# +AM_CONDITIONAL(WANT_MPI_BINDINGS_LAYER, + test "$WANT_MPI_PROFILING" = 0 -o "$LAM_PROFILING_COMPILE_SEPARATELY" = 1) + +AM_CONDITIONAL(WANT_PMPI_BINDINGS_LAYER, + test "$WANT_MPI_PROFILING" = 1) AM_CONDITIONAL(COMPILE_PROFILING_SEPARATELY, test "$LAM_PROFILING_COMPILE_SEPARATELY" = 1) AC_DEFINE_UNQUOTED(LAM_WANT_MPI_PROFILING, $WANT_MPI_PROFILING, diff --git a/src/mpi/interface/c/Makefile.am b/src/mpi/interface/c/Makefile.am index 70dae1eb29..41598463f3 100644 --- a/src/mpi/interface/c/Makefile.am +++ b/src/mpi/interface/c/Makefile.am @@ -4,68 +4,102 @@ # include $(top_srcdir)/config/Makefile.options - -# We must traverse into the profile directory to install the proper -# header files. So only only expect to find the C profiling library -# if we're compiling profiling separately. - -if COMPILE_PROFILING_SEPARATELY -profile_lib = profile/libmpi_c_profile.la +# +# LAM_IS_PMPI_BINDING flag s enabled when we want our MPI_* symbols +# to be replaced by PMPI_*. In other words, this flag decides +# whether "profile/defines.h" is included or not. "profile/defines.h" +# replaces all MPI_* symbols with PMPI_* symbols. In this directory, +# we need it to be 0 +# +AM_CPPFLAGS = -DLAM_PROFILING_DEFINES=0 + +# +# The top directory always builds MPI_* bindings. The bottom directory +# always builds PMPI_* bindings. The cases where the top directory +# needs to be built are +# 1. When profiling is disabled. +# 2. When profiling is enabled but weak symbol support is absent. +# +if WANT_MPI_BINDINGS_LAYER +mpi_lib = libmpi_c_mpi.la else -profile_lib = +mpi_lib = endif + +noinst_LTLIBRARIES = libmpi_c.la $(mpi_lib) +# +# The profile subdirectory always builds PMPI_* bindings. Hence, this +# directory needs to be built whenever profiling is enabled +# +if WANT_PMPI_BINDINGS_LAYER + pmpi_lib = profile/libmpi_c_pmpi.la +else + pmpi_lib = +endif +# +# SUBDIRS = profile - -noinst_LTLIBRARIES = libmpi_c.la - +# +# headers = bindings.h +# +# libmpi_c.la is the final library that will be built. This will try +# to snarf in mpi_lib and pmpi_lib. So, the right things will be done +# by default +# -libmpi_c_la_SOURCES = \ - alloc_mem.c \ - comm_get_name.c \ - comm_set_name.c \ - init.c \ - finalize.c \ - free_mem.c \ - type_commit.c \ - type_contiguous.c \ - type_create_darray.c \ - type_create_f90_complex.c \ - type_create_f90_integer.c \ - type_create_f90_real.c \ - type_create_hindexed.c \ - type_create_hvector.c \ - type_create_indexed_block.c \ - type_create_keyval.c \ - type_create_resized.c \ - type_create_struct.c \ - type_create_subarray.c \ - type_delete_attr.c \ - type_dup.c \ - type_extent.c \ - type_free.c \ - type_free_keyval.c \ - type_get_attr.c \ - type_get_contents.c \ - type_get_envelope.c \ - type_get_extent.c \ - type_get_name.c \ - type_get_true_extent.c \ - type_hindexed.c \ - type_hvector.c \ - type_indexed.c \ - type_lb.c \ - type_match_size.c \ - type_set_attr.c \ - type_set_name.c \ - type_size.c \ - type_struct.c \ - type_ub.c \ - type_vector.c +libmpi_c_la_SOURCES = -libmpi_c_la_LIBADD = $(profile_lib) +libmpi_c_la_LIBADD = \ + $(mpi_lib) \ + $(pmpi_lib) +libmpi_c_mpi_la_SOURCES = \ + alloc_mem.c \ + comm_get_name.c \ + comm_set_name.c \ + finalize.c \ + free_mem.c \ + init.c \ + type_commit.c \ + type_contiguous.c \ + type_create_darray.c \ + type_create_f90_complex.c \ + type_create_f90_integer.c \ + type_create_f90_real.c \ + type_create_hindexed.c \ + type_create_hvector.c \ + type_create_indexed_block.c \ + type_create_keyval.c \ + type_create_resized.c \ + type_create_struct.c \ + type_create_subarray.c \ + type_delete_attr.c \ + type_dup.c \ + type_extent.c \ + type_free.c \ + type_free_keyval.c \ + type_get_attr.c \ + type_get_contents.c \ + type_get_envelope.c \ + type_get_extent.c \ + type_get_name.c \ + type_get_true_extent.c \ + type_hindexed.c \ + type_hvector.c \ + type_indexed.c \ + type_lb.c \ + type_match_size.c \ + type_set_attr.c \ + type_set_name.c \ + type_size.c \ + type_struct.c \ + type_ub.c \ + type_vector.c + + +EXTRA_DIST = $(libmpi_c_mpi_la_SOURCES) # Conditionally install the header files if WANT_INSTALL_HEADERS diff --git a/src/mpi/interface/c/bindings.h b/src/mpi/interface/c/bindings.h index 874b4ab14f..13e2fa6865 100644 --- a/src/mpi/interface/c/bindings.h +++ b/src/mpi/interface/c/bindings.h @@ -8,10 +8,6 @@ #include "lam_config.h" #include "mpi.h" -#ifndef LAM_PROFILING_DEFINES -#define LAM_PROFILING_DEFINES 0 -#endif - /* If compiling in the profile directory, then we don't have weak symbols and therefore we need the defines to map from MPI->PMPI. NOTE: pragma weak stuff is handled on a file-by-file basis; it diff --git a/src/mpi/interface/c/profile/Makefile.am b/src/mpi/interface/c/profile/Makefile.am index 6eca03adc0..e63af7a102 100644 --- a/src/mpi/interface/c/profile/Makefile.am +++ b/src/mpi/interface/c/profile/Makefile.am @@ -4,34 +4,76 @@ # include $(top_srcdir)/config/Makefile.options +# +# LAM_IS_PMPI_BINDING flag s enabled when we want our MPI_* symbols +# to be replaced by PMPI_*. In other words, this flag decides +# whether "profile/defines.h" is included or not. "profile/defines.h" +# replaces all MPI_* symbols with PMPI_* symbols. In this directory +# we definately need it to be 1. +# +AM_CPPFLAGS = -DLAM_PROFILING_DEFINES=1 + +# +# This build needs to go through only if profiling is required. +# Further, this build HAS to go through if profiling is required. +# -AM_CPPFLAGS = -DLAM_PROFILING_DEFINES=1 - -# We must traverse into the profile directory to install the proper -# header files. So only only expect to find the C profiling library -# if we're compiling profiling separately. - -if COMPILE_PROFILING_SEPARATELY -lib = libmpi_c_profile.la +if WANT_PMPI_BINDINGS_LAYER +pmpi_lib = libmpi_c_pmpi.la else -lib = +pmpi_lib = endif -noinst_LTLIBRARIES = $(lib) +noinst_LTLIBRARIES = $(pmpi_lib) headers = defines.h -nodist_libmpi_c_profile_la_SOURCES = \ - palloc_mem.c \ - pcomm_get_name.c \ - pcomm_set_name.c \ - pinit.c \ - pfinalize.c \ - pfree_mem.c - +nodist_libmpi_c_pmpi_la_SOURCES = \ + palloc_mem.c \ + pcomm_get_name.c \ + pcomm_set_name.c \ + pfinalize.c \ + pfree_mem.c \ + pinit.c \ + ptype_commit.c \ + ptype_contiguous.c \ + ptype_create_darray.c \ + ptype_create_f90_complex.c \ + ptype_create_f90_integer.c \ + ptype_create_f90_real.c \ + ptype_create_hindexed.c \ + ptype_create_hvector.c \ + ptype_create_indexed_block.c \ + ptype_create_keyval.c \ + ptype_create_resized.c \ + ptype_create_struct.c \ + ptype_create_subarray.c \ + ptype_delete_attr.c \ + ptype_dup.c \ + ptype_extent.c \ + ptype_free.c \ + ptype_free_keyval.c \ + ptype_get_attr.c \ + ptype_get_contents.c \ + ptype_get_envelope.c \ + ptype_get_extent.c \ + ptype_get_name.c \ + ptype_get_true_extent.c \ + ptype_hindexed.c \ + ptype_hvector.c \ + ptype_indexed.c \ + ptype_lb.c \ + ptype_match_size.c \ + ptype_set_attr.c \ + ptype_set_name.c \ + ptype_size.c \ + ptype_struct.c \ + ptype_ub.c \ + ptype_vector.c +# # Sym link in the sources from the real MPI directory - -$(nodist_libmpi_c_profile_la_SOURCES): +# +$(nodist_libmpi_c_pmpi_la_SOURCES): if test ! -r $@ ; then \ pname=`echo $@ | cut -b '2-'` ; \ ln -s $(top_srcdir)/src/mpi/interface/c/$$pname $@ ; \ @@ -48,7 +90,7 @@ endif # These files were created by targets above -MAINTAINERCLEANFILES = $(nodist_libmpi_c_profile_la_SOURCES) +MAINTAINERCLEANFILES = $(nodist_libmpi_c_pmpi_la_SOURCES) # Don't want these targets in here diff --git a/src/mpi/interface/c/profile/defines.h b/src/mpi/interface/c/profile/defines.h index 160cdcd73b..b71a46b445 100644 --- a/src/mpi/interface/c/profile/defines.h +++ b/src/mpi/interface/c/profile/defines.h @@ -4,20 +4,13 @@ #ifndef LAM_C_PROFILE_DEFINES_H #define LAM_C_PROFILE_DEFINES_H - /* - * This file contains the #defines for the profiled versions of all - * the MPI C bindings. It is only included if we do not have weak - * symbols, or weak symbol support was explicitly disabled. + * This file is included in the top directory only if + * profiling is required. Once profiling is required, + * this file will replace all MPI_* symbols with + * PMPI_* symbols */ -#if LAM_PROFILING_DEFINES -#define MPI_Comm_set_name PMPI_Comm_set_name -#define MPI_Comm_get_name PMPI_Comm_get_name -#define MPI_Init PMPI_Init -#define MPI_Finalize PMPI_Finalize #define MPI_Alloc_mem PMPI_Alloc_mem -#define MPI_Free_mem PMPI_Free_mem -#endif #endif /* LAM_C_PROFILE_DEFINES_H */