From b9498ec31b8b8f52e635402a3432dc85ecf686a0 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Thu, 30 Apr 2020 08:26:01 -0600 Subject: [PATCH] rework argobots configury to be smarter Signed-off-by: Howard Pritchard --- .gitignore | 1 + opal/mca/threads/argobots/Makefile.am | 29 ++++++- opal/mca/threads/argobots/configure.m4 | 83 +++++++++++++++++-- ...reads_argobots.h => threads_argobots.h.in} | 2 +- .../argobots/threads_argobots_component.c | 1 - .../argobots/threads_argobots_module.c | 2 - .../threads/argobots/threads_argobots_mutex.h | 1 - .../argobots/threads_argobots_threads.h | 2 +- .../threads/argobots/threads_argobots_tsd.h | 1 - .../argobots/threads_argobots_wait_sync.h | 1 - 10 files changed, 106 insertions(+), 17 deletions(-) rename opal/mca/threads/argobots/{threads_argobots.h => threads_argobots.h.in} (97%) diff --git a/.gitignore b/.gitignore index 8f8dde2764..42770e3554 100644 --- a/.gitignore +++ b/.gitignore @@ -674,3 +674,4 @@ test/util/bipartite_graph opal/test/reachable/reachable_netlink opal/test/reachable/reachable_weighted +opal/mca/threads/argobots/threads_argobots.h diff --git a/opal/mca/threads/argobots/Makefile.am b/opal/mca/threads/argobots/Makefile.am index ba74c728d4..b0c90fd78d 100644 --- a/opal/mca/threads/argobots/Makefile.am +++ b/opal/mca/threads/argobots/Makefile.am @@ -18,9 +18,9 @@ # $HEADER$ # -noinst_LTLIBRARIES = libmca_threads_argobots.la +AM_CPPFLAGS = $(opal_argo_CPPFLAGS) -libmca_threads_argobots_la_SOURCES = \ +sources = \ threads_argobots.h \ threads_argobots_component.c \ threads_argobots_condition.c \ @@ -32,4 +32,27 @@ libmca_threads_argobots_la_SOURCES = \ threads_argobots_wait_sync.c \ threads_argobots_wait_sync.h -AM_LDFLAGS = -labt +#lib = libmca_threads_argobots.la +lib_sources = $(sources) + +if MCA_BUILD_opal_threads_argobots_DSO +component_noinst = +component_install = mca_threads_argobots.la +else +component_noinst = libmca_threads_argobots.la +component_install = +endif + +mcacomponentdir = $(opallibdir) +mcacomponent_LTLIBRARIES = $(component_install) +mca_threads_argobots_la_SOURCES = $(sources) +mca_threads_argobots_la_LDFLAGS = -module -avoid-version +mca_threads_argobots_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la \ + $(opal_argo_LIBS) + +noinst_LTLIBRARIES = $(component_noinst) +libmca_threads_argobots_la_SOURCES = $(sources) +libmca_threads_argobots_la_LDFLAGS = -module -avoid-version $(opal_argo_LDFLAGS) +libmca_threads_argobots_la_LIBADD = $(opal_argo_LIBS) + + diff --git a/opal/mca/threads/argobots/configure.m4 b/opal/mca/threads/argobots/configure.m4 index 1702bc307e..db961e8da6 100644 --- a/opal/mca/threads/argobots/configure.m4 +++ b/opal/mca/threads/argobots/configure.m4 @@ -24,13 +24,68 @@ # AC_DEFUN([OPAL_CONFIG_ARGOBOTS_THREADS],[ - AC_CHECK_HEADERS([abt.h], - [AC_CHECK_LIB([abt],[ABT_init], - [threads_argobots_happy="yes"], - [threads_argobots_happy="no"])], - [threads_argobots_happy="no"]) - AS_IF([test "$threads_argobots_happy" = "yes"], + AC_ARG_WITH([argobots], + [AC_HELP_STRING([--with-argobots=DIR], + [Specify location of argobots installation. Error if argobots support cannot be found.])]) + + AC_ARG_WITH([argobots-libdir], + [AC_HELP_STRING([--with-argobots-libdir=DIR], + [Search for argobots libraries in DIR])]) + + opal_check_argo_save_CPPFLAGS=$CPPFLAGS + opal_check_argo_save_LDFLAGS=$LDFLAGS + opal_check_argo_save_LIBS=$LIBS + + opal_argo_happy=yes + AS_IF([test "$with_argo" = "no"], + [opal_argo_happy=no]) + + AS_IF([test $opal_argo_happy = yes], + [AC_MSG_CHECKING([looking for argobots in]) + AS_IF([test "$with_argobots" != "yes"], + [opal_argo_dir=$with_argobots + AC_MSG_RESULT([($opal_argo_dir)])], + [AC_MSG_RESULT([(default search paths)])]) + AS_IF([test ! -z "$with_argobots_libdir" && \ + test "$with_argobots_libdir" != "yes"], + [opal_argo_libdir=$with_argobots_libdir]) + ]) + + AS_IF([test $opal_argo_happy = yes], + [OPAL_CHECK_PACKAGE([opal_argo], + [abt.h], + [abt], + [ABT_init], + [], + [$opal_argo_dir], + [$opal_argo_libdir], + [], + [opal_argo_happy=no])]) + + AS_IF([test $opal_argo_happy = yes && test -n "$opal_argo_dir"], + [OPAL_ARGO_INCLUDE_PATH="$opal_argo_dir/include/"], + [OPAL_ARGO_INCLUDE_PATH=""]) + + AS_IF([test $opal_argo_happy = yes], + [AC_CONFIG_FILES([opal/mca/threads/argobots/threads_argobots.h]) + AC_SUBST([OPAL_ARGO_INCLUDE_PATH]) + AC_SUBST([opal_argo_CPPFLAGS]) + AC_SUBST([opal_argo_LDFLAGS]) + AC_SUBST([opal_argo_LIBS]) + TPKG_CFLAGS="$opal_argo_CPPFLAGS" + TPKG_FCFLAGS="$opal_argo_CPPFLAGS" + TPKG_CXXFLAGS="$opal_argo_CPPFLAGS" + TPKG_CPPFLAGS="$opal_argo_CPPFLAGS" + TPKG_CXXCPPFLAGS="$opal_argo_CPPFLAGS" + TPKG_LDFLAGS="$opal_argo_LDFLAGS" + TPKG_LIBS="$opal_argo_LIBS"]) + + CPPFLAGS=$opal_check_argo_save_CPPFLAGS + LDFLAGS=$opal_check_argo_save_LDFLAGS + LIBS=$opal_check_argo_save_LIBS + + AS_IF([test "$opal_argo_happy" = "yes"], [$1], [$2]) ])dnl @@ -44,6 +99,7 @@ AC_DEFUN([MCA_opal_threads_argobots_COMPILE_MODE], [ AC_MSG_RESULT([$$4]) ]) + # If component was selected, $1 will be 1 and we should set the base header AC_DEFUN([MCA_opal_threads_argobots_POST_CONFIG],[ AS_IF([test "$1" = "1"], @@ -60,6 +116,21 @@ AC_DEFUN([MCA_opal_threads_argobots_POST_CONFIG],[ AC_DEFINE_UNQUOTED([MCA_threads_wait_sync_base_include_HEADER], ["opal/mca/threads/argobots/threads_argobots_wait_sync.h"], [Header to include for wait_sync implementation]) + THREAD_CFLAGS="$TPKG_CFLAGS" + THREAD_FCFLAGS="$TPKG_FCFLAGS" + THREAD_CXXFLAGS="$TPKG_CXXFLAGS" + THREAD_CPPFLAGS="$TPKG_CPPFLAGS" + THREAD_CXXCPPFLAGS="$TPKG_CXXCPPFLAGS" + THREAD_LDFLAGS="$TPKG_LDFLAGS" + THREAD_LIBS="$TPKG_LIBS" + AC_SUBST(THREAD_CFLAGS) + AC_SUBST(THREAD_FCFLAGS) + AC_SUBST(THREAD_CXXFLAGS) + AC_SUBST(THREAD_CPPFLAGS) + AC_SUBST(THREAD_LDFLAGS) + AC_SUBST(THREAD_LIBS) + LIBS="$LIBS $THREAD_LIBS" + LDFLAGS="$LDFLAGS $THREAD_LDFLAGS" ]) ])dnl diff --git a/opal/mca/threads/argobots/threads_argobots.h b/opal/mca/threads/argobots/threads_argobots.h.in similarity index 97% rename from opal/mca/threads/argobots/threads_argobots.h rename to opal/mca/threads/argobots/threads_argobots.h.in index 83673860c8..324933c3e2 100644 --- a/opal/mca/threads/argobots/threads_argobots.h +++ b/opal/mca/threads/argobots/threads_argobots.h.in @@ -26,7 +26,7 @@ #ifndef OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_H #define OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_H -#include +#include "@OPAL_ARGO_INCLUDE_PATH@abt.h" static inline void opal_threads_argobots_ensure_init(void) { diff --git a/opal/mca/threads/argobots/threads_argobots_component.c b/opal/mca/threads/argobots/threads_argobots_component.c index 6d3fd0a519..6c4e6f815f 100644 --- a/opal/mca/threads/argobots/threads_argobots_component.c +++ b/opal/mca/threads/argobots/threads_argobots_component.c @@ -27,7 +27,6 @@ #include "opal/mca/threads/thread.h" #include "opal/mca/threads/threads.h" #include "opal/constants.h" -#include static int opal_threads_argobots_open(void); diff --git a/opal/mca/threads/argobots/threads_argobots_module.c b/opal/mca/threads/argobots/threads_argobots_module.c index 0776b87741..9aaa4ef128 100644 --- a/opal/mca/threads/argobots/threads_argobots_module.c +++ b/opal/mca/threads/argobots/threads_argobots_module.c @@ -32,8 +32,6 @@ #include "opal/mca/threads/threads.h" #include "opal/mca/threads/tsd.h" -#include - struct opal_tsd_key_value { opal_tsd_key_t key; opal_tsd_destructor_t destructor; diff --git a/opal/mca/threads/argobots/threads_argobots_mutex.h b/opal/mca/threads/argobots/threads_argobots_mutex.h index 8fb4d1f413..7dff30f010 100644 --- a/opal/mca/threads/argobots/threads_argobots_mutex.h +++ b/opal/mca/threads/argobots/threads_argobots_mutex.h @@ -40,7 +40,6 @@ #include "opal/sys/atomic.h" #include "opal/util/output.h" -#include BEGIN_C_DECLS diff --git a/opal/mca/threads/argobots/threads_argobots_threads.h b/opal/mca/threads/argobots/threads_argobots_threads.h index 5d85369fa9..fe51353253 100644 --- a/opal/mca/threads/argobots/threads_argobots_threads.h +++ b/opal/mca/threads/argobots/threads_argobots_threads.h @@ -26,8 +26,8 @@ #ifndef OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_THREADS_H #define OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_THREADS_H -#include #include +#include "opal/mca/threads/argobots/threads_argobots.h" struct opal_thread_t { opal_object_t super; diff --git a/opal/mca/threads/argobots/threads_argobots_tsd.h b/opal/mca/threads/argobots/threads_argobots_tsd.h index cbeaa914fb..f638939c81 100644 --- a/opal/mca/threads/argobots/threads_argobots_tsd.h +++ b/opal/mca/threads/argobots/threads_argobots_tsd.h @@ -28,7 +28,6 @@ #define OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_TSD_H #include "opal/mca/threads/argobots/threads_argobots.h" -#include typedef ABT_key opal_tsd_key_t; diff --git a/opal/mca/threads/argobots/threads_argobots_wait_sync.h b/opal/mca/threads/argobots/threads_argobots_wait_sync.h index b5aec54d02..0c46c7b872 100644 --- a/opal/mca/threads/argobots/threads_argobots_wait_sync.h +++ b/opal/mca/threads/argobots/threads_argobots_wait_sync.h @@ -27,7 +27,6 @@ #define OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_WAIT_SYNC_H #include "opal/mca/threads/argobots/threads_argobots.h" -#include typedef struct ompi_wait_sync_t { opal_atomic_int32_t count;