Skip to content

Commit 6fe3237

Browse files
committed
update threads MCA framework configury
It now works more like the ompi/mca/rte configury, modulo some edge items that are special for threading package linking, etc. Signed-off-by: Howard Pritchard <[email protected]>
1 parent a5e87d6 commit 6fe3237

File tree

5 files changed

+155
-55
lines changed

5 files changed

+155
-55
lines changed

configure.ac

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
# Copyright (c) 2018 Amazon.com, Inc. or its affiliates.
2727
# All Rights reserved.
2828
# Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
29+
# Copyright (c) 2019 Triad National Security, LLC. All rights
30+
# reserved.
2931
# $COPYRIGHT$
3032
#
3133
# Additional copyrights may follow
@@ -969,24 +971,6 @@ OPAL_CHECK_BROKEN_QSORT
969971
# all: type of getsockopt optlen
970972
# all: type of recvfrom optlen
971973

972-
#
973-
# Check out what thread support we have
974-
#
975-
OPAL_CONFIG_THREADS
976-
977-
CFLAGS="$CFLAGS $THREAD_CFLAGS"
978-
CPPFLAGS="$CPPFLAGS $THREAD_CPPFLAGS"
979-
CXXFLAGS="$CXXFLAGS $THREAD_CXXFLAGS"
980-
CXXCPPFLAGS="$CXXCPPFLAGS $THREAD_CXXCPPFLAGS"
981-
LDFLAGS="$LDFLAGS $THREAD_LDFLAGS"
982-
LIBS="$LIBS $THREAD_LIBS"
983-
984-
OPAL_WRAPPER_FLAGS_ADD([CFLAGS], [$THREAD_CFLAGS])
985-
OPAL_WRAPPER_FLAGS_ADD([CXXFLAGS], [$THREAD_CXXFLAGS])
986-
OPAL_WRAPPER_FLAGS_ADD([FCFLAGS], [$THREAD_FCFLAGS])
987-
OPAL_WRAPPER_FLAGS_ADD([LDFLAGS], [$THREAD_LDFLAGS])
988-
# no need to update WRAPPER_EXTRA_LIBS - we'll get it from LT later
989-
990974
#
991975
# What is the local equivalent of "ln -s"
992976
#
@@ -1144,6 +1128,14 @@ AC_MSG_RESULT([$opal_subdir_args])
11441128

11451129
OPAL_MCA
11461130

1131+
#
1132+
# Now that we know how to support threads with wrappers, update
1133+
#
1134+
OPAL_WRAPPER_FLAGS_ADD([CFLAGS], [$THREAD_CFLAGS])
1135+
OPAL_WRAPPER_FLAGS_ADD([CXXFLAGS], [$THREAD_CXXFLAGS])
1136+
OPAL_WRAPPER_FLAGS_ADD([FCFLAGS], [$THREAD_FCFLAGS])
1137+
OPAL_WRAPPER_FLAGS_ADD([LDFLAGS], [$THREAD_LDFLAGS])
1138+
11471139
m4_ifdef([project_ompi], [OMPI_REQUIRE_ENDPOINT_TAG_FINI])
11481140

11491141
# Last minute disable of OpenSHMEM if we didn't find any oshmem SPMLs

opal/mca/threads/argobots/configure.m4

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# and Technology (RIST). All rights reserved.
1616
# Copyright (c) 2019 Sandia National Laboratories. All rights reserved.
1717
# Copyright (c) 2019 Triad National Security, LLC. All rights
18+
# Reserved.
1819
# $COPYRIGHT$
1920
#
2021
# Additional copyrights may follow
@@ -34,6 +35,7 @@ AC_DEFUN([OPAL_CONFIG_ARGOBOTS_THREADS],[
3435
[$2])
3536
])dnl
3637

38+
3739
AC_DEFUN([MCA_opal_threads_argobots_PRIORITY], [30])
3840

3941
AC_DEFUN([MCA_opal_threads_argobots_COMPILE_MODE], [
@@ -42,23 +44,24 @@ AC_DEFUN([MCA_opal_threads_argobots_COMPILE_MODE], [
4244
AC_MSG_RESULT([$$4])
4345
])
4446

47+
# If component was selected, $1 will be 1 and we should set the base header
4548
AC_DEFUN([MCA_opal_threads_argobots_POST_CONFIG],[
46-
AS_IF([test "$1" = "1"], [threads_base_include="argobots/threads_argobots_threads.h"])
47-
])dnl
48-
49-
AC_DEFUN([MCA_opal_mutex_argobots_POST_CONFIG],[
50-
AS_IF([test "$1" = "1"], [mutex_base_include="argobots/threads_argobots_mutex.h"])
51-
AC_MSG_CHECKING([mutex_base_include = $mutex_base_include])
52-
])dnl
49+
AS_IF([test "$1" = "1"],
50+
[opal_thread_type_found="argobots"
51+
AC_DEFINE_UNQUOTED([MCA_threads_base_include_HEADER],
52+
["opal/mca/threads/argobots/threads_argobots_threads.h"],
53+
[Header to include for threads implementation])
54+
AC_DEFINE_UNQUOTED([MCA_threads_mutex_base_include_HEADER],
55+
["opal/mca/threads/argobots/threads_argobots_mutex.h"],
56+
[Header to include for mutex implementation])
57+
AC_DEFINE_UNQUOTED([MCA_threads_tsd_base_include_HEADER],
58+
["opal/mca/threads/argobots/threads_argobots_tsd.h"],
59+
[Header to include for tsd implementation])
60+
AC_DEFINE_UNQUOTED([MCA_threads_wait_sync_base_include_HEADER],
61+
["opal/mca/threads/argobots/threads_argobots_wait_sync.h"],
62+
[Header to include for wait_sync implementation])
63+
])
5364

54-
AC_DEFUN([MCA_opal_tsd_argobots_POST_CONFIG],[
55-
AS_IF([test "$1" = "1"], [threads_base_include="argobots/threads_argobots_tsd.h"])
56-
AC_MSG_CHECKING([threads_base_include = $threads_base_include])
57-
])dnl
58-
59-
AC_DEFUN([MCA_opal_wait_sync_argobots_POST_CONFIG],[
60-
AS_IF([test "$1" = "1"], [wait_sync_base_include="argobots/threads_argobots_wait_sync.h"])
61-
AC_MSG_CHECKING([wait_sync_base_include = $wait_sync_base_include])
6265
])dnl
6366

6467
# MCA_threads_argobots_CONFIG(action-if-can-compile,
@@ -67,7 +70,12 @@ AC_DEFUN([MCA_opal_wait_sync_argobots_POST_CONFIG],[
6770
AC_DEFUN([MCA_opal_threads_argobots_CONFIG],[
6871
AC_CONFIG_FILES([opal/mca/threads/argobots/Makefile])
6972

70-
AS_IF([test "$HAVE_THREAD_PKG_TYPE" = "argobots"],
71-
[$1],
73+
AS_IF([test "$with_threads" = "argobots"],
74+
[OPAL_CONFIG_ARGOBOTS_THREADS([argobots_threads_works=1], [argobots_threads_works=0])],
75+
[argobots_threads_works=0])
76+
77+
AS_IF([test "$argobots_threads_works" = "1"],
78+
[$1
79+
opal_thread_type_found="argobots"],
7280
[$2])
7381
])

opal/mca/threads/configure.m4

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
dnl -*- shell-script -*-
2+
dnl
3+
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4+
dnl University Research and Technology
5+
dnl Corporation. All rights reserved.
6+
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
7+
dnl of Tennessee Research Foundation. All rights
8+
dnl reserved.
9+
dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10+
dnl University of Stuttgart. All rights reserved.
11+
dnl Copyright (c) 2004-2005 The Regents of the University of California.
12+
dnl All rights reserved.
13+
dnl Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
14+
dnl Copyright (c) 2019 Sandia National Laboratories. All rights reserved.
15+
dnl Copyright (c) 2019 Triad National Security, LLC. All rights
16+
dnl reserved.
17+
dnl
18+
dnl $COPYRIGHT$
19+
dnl
20+
dnl Additional copyrights may follow
21+
dnl
22+
dnl $HEADER$
23+
dnl
24+
25+
dnl we only want one :)
26+
m4_define(MCA_opal_threads_CONFIGURE_MODE, STOP_AT_FIRST)
27+
28+
AC_DEFUN([MCA_opal_threads_CONFIG],[
29+
#
30+
# Arguments: none
31+
#
32+
# Dependencies: None
33+
#
34+
# Modifies:
35+
# none - see called tests
36+
#
37+
# configure threads
38+
#
39+
40+
#
41+
# First see what kind of threads we are going to use
42+
#
43+
44+
AC_ARG_WITH([threads],
45+
[AC_HELP_STRING([--with-threads=TYPE],
46+
[Specify thread TYPE to use. default:pthreads. Other options are qthreads and argobots.])])
47+
48+
#
49+
# Configure components
50+
#
51+
52+
MCA_CONFIGURE_FRAMEWORK($1, $2, 1)
53+
54+
AS_IF([test x"$opal_thread_type_found" = x""],
55+
[AC_MSG_ERROR([Did not find a suitable threads component])])
56+
57+
AC_MSG_RESULT([Found thread type $opal_thread_type_found])
58+
59+
OPAL_SUMMARY_ADD([[Miscellaneous]],[[Threading Package]],[], [$opal_thread_type_found])
60+
])dnl

opal/mca/threads/pthreads/configure.m4

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -664,9 +664,11 @@ if test "$opal_pthread_c_success" = "1" && \
664664
test "$opal_pthread_cxx_success" = "1" && \
665665
test "$opal_pthread_fortran_success" = "1"; then
666666
internal_useless=1
667+
AC_MSG_RESULT("looks like posix threads work")
667668
$1
668669
else
669670
internal_useless=1
671+
AC_MSG_RESULT("looks like posix threads don't work")
670672
$2
671673
fi
672674

@@ -682,23 +684,31 @@ AC_DEFUN([MCA_opal_threads_pthreads_COMPILE_MODE], [
682684
AC_MSG_RESULT([$$4])
683685
])
684686

685-
AC_DEFUN([MCA_opal_threads_pthreads_POST_CONFIG],[
686-
AS_IF([test "$1" = "1"], [threads_base_include="pthreads/threads_pthreads_threads.h"])
687-
])dnl
688-
689-
AC_DEFUN([MCA_opal_mutex_pthreads_POST_CONFIG],[
690-
AS_IF([test "$1" = "1"], [mutex_base_include="pthreads/threads_pthreads_mutex.h"])
691-
AC_MSG_CHECKING([mutex_base_include = $mutex_base_include])
692-
])dnl
693687

694-
AC_DEFUN([MCA_opal_tsd_pthreads_POST_CONFIG],[
695-
AS_IF([test "$1" = "1"], [threads_base_include="pthreads/threads_pthreads_tsd.h"])
696-
AC_MSG_CHECKING([threads_base_include = $threads_base_include])
697-
])dnl
698-
699-
AC_DEFUN([MCA_opal_wait_sync_pthreads_POST_CONFIG],[
700-
AS_IF([test "$1" = "1"], [wait_sync_base_include="pthreads/threads_pthreads_wait_sync.h"])
701-
AC_MSG_CHECKING([wait_sync_includenclude = $wait_sync_base_include])
688+
# If component was selected, $1 will be 1 and we should set the base header
689+
AC_DEFUN([MCA_opal_threads_pthreads_POST_CONFIG],[
690+
AS_IF([test "$1" = "1"],
691+
[opal_thread_type_found="pthreads"
692+
AC_DEFINE_UNQUOTED([MCA_threads_base_include_HEADER],
693+
["opal/mca/threads/pthreads/threads_pthreads_threads.h"],
694+
[Header to include for threads implementation])
695+
AC_DEFINE_UNQUOTED([MCA_threads_mutex_base_include_HEADER],
696+
["opal/mca/threads/pthreads/threads_pthreads_mutex.h"],
697+
[Header to include for mutex implementation])
698+
AC_DEFINE_UNQUOTED([MCA_threads_tsd_base_include_HEADER],
699+
["opal/mca/threads/pthreads/threads_pthreads_tsd.h"],
700+
[Header to include for tsd implementation])
701+
AC_DEFINE_UNQUOTED([MCA_threads_wait_sync_base_include_HEADER],
702+
["opal/mca/threads/pthreads/threads_pthreads_wait_sync.h"],
703+
[Header to include for wait_sync implementation])
704+
THREAD_CFLAGS="$TPKG_CFLAGS"
705+
THREAD_FCFLAGS="$TPKG_FCFLAGS"
706+
THREAD_CXXFLAGS="$TPKG_CXXFLAGS"
707+
THREAD_CPPFLAGS="$TPKG_CPPFLAGS"
708+
THREAD_CXXCPPFLAGS="$TPKG_CXXCPPFLAGS"
709+
THREAD_LDFLAGS="$TPKG_LDFLAGS"
710+
THREAD_LIBS="$TPKG_LIBS"
711+
])
702712
])dnl
703713

704714
# MCA_threads_pthreads_CONFIG(action-if-can-compile,
@@ -707,8 +717,13 @@ AC_DEFUN([MCA_opal_wait_sync_pthreads_POST_CONFIG],[
707717
AC_DEFUN([MCA_opal_threads_pthreads_CONFIG],[
708718
AC_CONFIG_FILES([opal/mca/threads/pthreads/Makefile])
709719

710-
AS_IF([test "$HAVE_THREAD_PKG_TYPE" = "pthreads"],
720+
AS_IF([test -z "$with_threads" || test "$with_threads" = "pthreads" || test "$with_threads" = "yes"],
721+
[OPAL_CONFIG_POSIX_THREADS([posix_threads_works=1],[posix_threads_works=0])],
722+
[posix_threads_works=0])
723+
724+
AS_IF([test "$posix_threads_works" = "1"],
711725
[$1],
712726
[$2])
727+
AC_MSG_RESULT("posix_threads_works = $posix_threads_works")
713728
])
714729

opal/mca/threads/qthreads/configure.m4

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
1414
# Copyright (c) 2015 Research Organization for Information Science
1515
# and Technology (RIST). All rights reserved.
16+
# Copyright (c) 2019 Triad National Security, LLC. All rights
17+
# reserved.
18+
#
1619
# $COPYRIGHT$
1720
#
1821
# Additional copyrights may follow
@@ -41,17 +44,39 @@ AC_DEFUN([MCA_opal_threads_qthreads_COMPILE_MODE], [
4144
AC_MSG_RESULT([$$4])
4245
])
4346

47+
# If component was selected, $1 will be 1 and we should set the base header
4448
AC_DEFUN([MCA_opal_threads_qthreads_POST_CONFIG],[
45-
AS_IF([test "$1" = "1"], [threads_base_include="qthreads/threads_qthreads.h"])
49+
AS_IF([test "$1" = "1"],
50+
[opal_thread_type_found="qthreads"
51+
AC_DEFINE_UNQUOTED([MCA_threads_base_include_HEADER],
52+
["opal/mca/threads/qthreads/threads_qthreads.h"],
53+
[Header to include for threads implementation])
54+
AC_DEFINE_UNQUOTED([MCA_threads_mutex_base_include_HEADER],
55+
["opal/mca/threads/qthreads/threads_qthreads_mutex.h"],
56+
[Header to include for mutex implementation])
57+
AC_DEFINE_UNQUOTED([MCA_threads_tsd_base_include_HEADER],
58+
["opal/mca/threads/qthreads/threads_qthreads_tsd.h"],
59+
[Header to include for tsd implementation])
60+
AC_DEFINE_UNQUOTED([MCA_threads_wait_sync_base_include_HEADER],
61+
["opal/mca/threads/qthreads/threads_qthreads_wait_sync.h"],
62+
[Header to include for wait_sync implementation])
63+
])
64+
4665
])dnl
4766

67+
4868
# MCA_threads_qthreads_CONFIG(action-if-can-compile,
4969
# [action-if-cant-compile])
5070
# ------------------------------------------------
5171
AC_DEFUN([MCA_opal_threads_qthreads_CONFIG],[
5272
AC_CONFIG_FILES([opal/mca/threads/qthreads/Makefile])
5373

54-
AS_IF([test "$HAVE_THREAD_PKG_TYPE" = "qthreads"],
55-
[$1],
74+
AS_IF([test "$with_threads" = "qthreads"],
75+
[OPAL_CONFIG_QTHREADS([qthreads_works=1],[qthreads_works=0])],
76+
[qthreads_works=0])
77+
78+
AS_IF([test "$qthreads_works" = "1"],
79+
[$1
80+
opal_thread_type_found="qthreads"],
5681
[$2])
5782
])

0 commit comments

Comments
 (0)