Skip to content

Commit c074a23

Browse files
authored
Merge pull request #7675 from hppritcha/topic/fix_issue_7578
rework argobots configury to be smarter
2 parents 1036eca + b9498ec commit c074a23

10 files changed

+106
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,3 +674,4 @@ test/util/bipartite_graph
674674

675675
opal/test/reachable/reachable_netlink
676676
opal/test/reachable/reachable_weighted
677+
opal/mca/threads/argobots/threads_argobots.h

opal/mca/threads/argobots/Makefile.am

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
# $HEADER$
1919
#
2020

21-
noinst_LTLIBRARIES = libmca_threads_argobots.la
21+
AM_CPPFLAGS = $(opal_argo_CPPFLAGS)
2222

23-
libmca_threads_argobots_la_SOURCES = \
23+
sources = \
2424
threads_argobots.h \
2525
threads_argobots_component.c \
2626
threads_argobots_condition.c \
@@ -32,4 +32,27 @@ libmca_threads_argobots_la_SOURCES = \
3232
threads_argobots_wait_sync.c \
3333
threads_argobots_wait_sync.h
3434

35-
AM_LDFLAGS = -labt
35+
#lib = libmca_threads_argobots.la
36+
lib_sources = $(sources)
37+
38+
if MCA_BUILD_opal_threads_argobots_DSO
39+
component_noinst =
40+
component_install = mca_threads_argobots.la
41+
else
42+
component_noinst = libmca_threads_argobots.la
43+
component_install =
44+
endif
45+
46+
mcacomponentdir = $(opallibdir)
47+
mcacomponent_LTLIBRARIES = $(component_install)
48+
mca_threads_argobots_la_SOURCES = $(sources)
49+
mca_threads_argobots_la_LDFLAGS = -module -avoid-version
50+
mca_threads_argobots_la_LIBADD = $(top_builddir)/opal/lib@[email protected] \
51+
$(opal_argo_LIBS)
52+
53+
noinst_LTLIBRARIES = $(component_noinst)
54+
libmca_threads_argobots_la_SOURCES = $(sources)
55+
libmca_threads_argobots_la_LDFLAGS = -module -avoid-version $(opal_argo_LDFLAGS)
56+
libmca_threads_argobots_la_LIBADD = $(opal_argo_LIBS)
57+
58+

opal/mca/threads/argobots/configure.m4

Lines changed: 77 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,68 @@
2424
#
2525

2626
AC_DEFUN([OPAL_CONFIG_ARGOBOTS_THREADS],[
27-
AC_CHECK_HEADERS([abt.h],
28-
[AC_CHECK_LIB([abt],[ABT_init],
29-
[threads_argobots_happy="yes"],
30-
[threads_argobots_happy="no"])],
31-
[threads_argobots_happy="no"])
3227

33-
AS_IF([test "$threads_argobots_happy" = "yes"],
28+
AC_ARG_WITH([argobots],
29+
[AC_HELP_STRING([--with-argobots=DIR],
30+
[Specify location of argobots installation. Error if argobots support cannot be found.])])
31+
32+
AC_ARG_WITH([argobots-libdir],
33+
[AC_HELP_STRING([--with-argobots-libdir=DIR],
34+
[Search for argobots libraries in DIR])])
35+
36+
opal_check_argo_save_CPPFLAGS=$CPPFLAGS
37+
opal_check_argo_save_LDFLAGS=$LDFLAGS
38+
opal_check_argo_save_LIBS=$LIBS
39+
40+
opal_argo_happy=yes
41+
AS_IF([test "$with_argo" = "no"],
42+
[opal_argo_happy=no])
43+
44+
AS_IF([test $opal_argo_happy = yes],
45+
[AC_MSG_CHECKING([looking for argobots in])
46+
AS_IF([test "$with_argobots" != "yes"],
47+
[opal_argo_dir=$with_argobots
48+
AC_MSG_RESULT([($opal_argo_dir)])],
49+
[AC_MSG_RESULT([(default search paths)])])
50+
AS_IF([test ! -z "$with_argobots_libdir" && \
51+
test "$with_argobots_libdir" != "yes"],
52+
[opal_argo_libdir=$with_argobots_libdir])
53+
])
54+
55+
AS_IF([test $opal_argo_happy = yes],
56+
[OPAL_CHECK_PACKAGE([opal_argo],
57+
[abt.h],
58+
[abt],
59+
[ABT_init],
60+
[],
61+
[$opal_argo_dir],
62+
[$opal_argo_libdir],
63+
[],
64+
[opal_argo_happy=no])])
65+
66+
AS_IF([test $opal_argo_happy = yes && test -n "$opal_argo_dir"],
67+
[OPAL_ARGO_INCLUDE_PATH="$opal_argo_dir/include/"],
68+
[OPAL_ARGO_INCLUDE_PATH=""])
69+
70+
AS_IF([test $opal_argo_happy = yes],
71+
[AC_CONFIG_FILES([opal/mca/threads/argobots/threads_argobots.h])
72+
AC_SUBST([OPAL_ARGO_INCLUDE_PATH])
73+
AC_SUBST([opal_argo_CPPFLAGS])
74+
AC_SUBST([opal_argo_LDFLAGS])
75+
AC_SUBST([opal_argo_LIBS])
76+
TPKG_CFLAGS="$opal_argo_CPPFLAGS"
77+
TPKG_FCFLAGS="$opal_argo_CPPFLAGS"
78+
TPKG_CXXFLAGS="$opal_argo_CPPFLAGS"
79+
TPKG_CPPFLAGS="$opal_argo_CPPFLAGS"
80+
TPKG_CXXCPPFLAGS="$opal_argo_CPPFLAGS"
81+
TPKG_LDFLAGS="$opal_argo_LDFLAGS"
82+
TPKG_LIBS="$opal_argo_LIBS"])
83+
84+
CPPFLAGS=$opal_check_argo_save_CPPFLAGS
85+
LDFLAGS=$opal_check_argo_save_LDFLAGS
86+
LIBS=$opal_check_argo_save_LIBS
87+
88+
AS_IF([test "$opal_argo_happy" = "yes"],
3489
[$1],
3590
[$2])
3691
])dnl
@@ -44,6 +99,7 @@ AC_DEFUN([MCA_opal_threads_argobots_COMPILE_MODE], [
4499
AC_MSG_RESULT([$$4])
45100
])
46101

102+
47103
# If component was selected, $1 will be 1 and we should set the base header
48104
AC_DEFUN([MCA_opal_threads_argobots_POST_CONFIG],[
49105
AS_IF([test "$1" = "1"],
@@ -60,6 +116,21 @@ AC_DEFUN([MCA_opal_threads_argobots_POST_CONFIG],[
60116
AC_DEFINE_UNQUOTED([MCA_threads_wait_sync_base_include_HEADER],
61117
["opal/mca/threads/argobots/threads_argobots_wait_sync.h"],
62118
[Header to include for wait_sync implementation])
119+
THREAD_CFLAGS="$TPKG_CFLAGS"
120+
THREAD_FCFLAGS="$TPKG_FCFLAGS"
121+
THREAD_CXXFLAGS="$TPKG_CXXFLAGS"
122+
THREAD_CPPFLAGS="$TPKG_CPPFLAGS"
123+
THREAD_CXXCPPFLAGS="$TPKG_CXXCPPFLAGS"
124+
THREAD_LDFLAGS="$TPKG_LDFLAGS"
125+
THREAD_LIBS="$TPKG_LIBS"
126+
AC_SUBST(THREAD_CFLAGS)
127+
AC_SUBST(THREAD_FCFLAGS)
128+
AC_SUBST(THREAD_CXXFLAGS)
129+
AC_SUBST(THREAD_CPPFLAGS)
130+
AC_SUBST(THREAD_LDFLAGS)
131+
AC_SUBST(THREAD_LIBS)
132+
LIBS="$LIBS $THREAD_LIBS"
133+
LDFLAGS="$LDFLAGS $THREAD_LDFLAGS"
63134
])
64135

65136
])dnl

opal/mca/threads/argobots/threads_argobots.h renamed to opal/mca/threads/argobots/threads_argobots.h.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#ifndef OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_H
2727
#define OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_H
2828

29-
#include <abt.h>
29+
#include "@OPAL_ARGO_INCLUDE_PATH@abt.h"
3030

3131
static inline void opal_threads_argobots_ensure_init(void)
3232
{

opal/mca/threads/argobots/threads_argobots_component.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "opal/mca/threads/thread.h"
2828
#include "opal/mca/threads/threads.h"
2929
#include "opal/constants.h"
30-
#include <abt.h>
3130

3231
static int opal_threads_argobots_open(void);
3332

opal/mca/threads/argobots/threads_argobots_module.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
#include "opal/mca/threads/threads.h"
3333
#include "opal/mca/threads/tsd.h"
3434

35-
#include <abt.h>
36-
3735
struct opal_tsd_key_value {
3836
opal_tsd_key_t key;
3937
opal_tsd_destructor_t destructor;

opal/mca/threads/argobots/threads_argobots_mutex.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#include "opal/sys/atomic.h"
4141
#include "opal/util/output.h"
4242

43-
#include <abt.h>
4443

4544
BEGIN_C_DECLS
4645

opal/mca/threads/argobots/threads_argobots_threads.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#ifndef OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_THREADS_H
2727
#define OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_THREADS_H
2828

29-
#include <abt.h>
3029
#include <signal.h>
30+
#include "opal/mca/threads/argobots/threads_argobots.h"
3131

3232
struct opal_thread_t {
3333
opal_object_t super;

opal/mca/threads/argobots/threads_argobots_tsd.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#define OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_TSD_H
2929

3030
#include "opal/mca/threads/argobots/threads_argobots.h"
31-
#include <abt.h>
3231

3332
typedef ABT_key opal_tsd_key_t;
3433

opal/mca/threads/argobots/threads_argobots_wait_sync.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#define OPAL_MCA_THREADS_ARGOBOTS_THREADS_ARGOBOTS_WAIT_SYNC_H
2828

2929
#include "opal/mca/threads/argobots/threads_argobots.h"
30-
#include <abt.h>
3130

3231
typedef struct ompi_wait_sync_t {
3332
opal_atomic_int32_t count;

0 commit comments

Comments
 (0)