intel-tbb: allow compilation with nvhpc (#25044)

These are the versions tested (and successfully patched) against
intel-tbb.nvhpc-remove-flags.2017.patch: @2017, @2017.8, @2018, @2018.6
intel-tbb.nvhpc-remove-flags.2019.patch: @2019
intel-tbb.nvhpc-remove-flags.2019.1.patch: @2019.[1-6]
intel-tbb.nvhpc-remove-flags.2019.7.patch: @2019.[7-8]
intel-tbb.nvhpc-remove-flags.2019.9.patch: @2019.9, 2020.[0-3]

The intel-tbb.nvhpc-version-script-fix.2017.patch was tested and
applied successfully against all of the versions above.
This commit is contained in:
Tom Payerle 2021-08-03 07:35:31 -04:00 committed by GitHub
parent d33d9d1f03
commit c7e8bdf9cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 242 additions and 0 deletions

View file

@ -0,0 +1,41 @@
diff -Naur spack-src/build/linux.gcc.inc spack-src.patched/build/linux.gcc.inc
--- spack-src/build/linux.gcc.inc 2018-03-30 11:55:05.000000000 -0400
+++ spack-src.patched/build/linux.gcc.inc 2021-07-22 10:41:47.712124058 -0400
@@ -27,7 +27,9 @@
WARNING_KEY = -Wall
TEST_WARNING_KEY = -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor
-WARNING_SUPPRESS = -Wno-parentheses -Wno-non-virtual-dtor
+# Skip for nvhpc compilers
+# WARNING_SUPPRESS = -Wno-parentheses -Wno-non-virtual-dtor
+WARNING_SUPPRESS =
DYLIB_KEY = -shared
EXPORT_KEY = -Wl,--version-script,
LIBDL = -ldl
@@ -62,10 +64,11 @@
# gcc 6.0 and later have -flifetime-dse option that controls
# elimination of stores done outside the object lifetime
-ifneq (,$(shell gcc -dumpversion | egrep "^([6-9])"))
- # keep pre-contruction stores for zero initialization
- DSE_KEY = -flifetime-dse=1
-endif
+# Skip for nvhpc compilers
+#ifneq (,$(shell gcc -dumpversion | egrep "^([6-9])"))
+# # keep pre-contruction stores for zero initialization
+# DSE_KEY = -flifetime-dse=1
+#endif
ifeq ($(cfg), release)
CPLUS_FLAGS = $(ITT_NOTIFY) -g -O2 -DUSE_PTHREAD
@@ -148,7 +151,9 @@
# Setting tbbmalloc data.
#------------------------------------------------------------------------------
-M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions
+# Drop -fno-rtti for nvhpc compilers
+#M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions
+M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-exceptions
#------------------------------------------------------------------------------
# End of setting tbbmalloc data.

View file

@ -0,0 +1,41 @@
diff -Naur spack-src/build/linux.gcc.inc spack-src.patched/build/linux.gcc.inc
--- spack-src/build/linux.gcc.inc 2019-03-21 11:28:21.000000000 -0400
+++ spack-src.patched/build/linux.gcc.inc 2021-07-28 16:02:11.714975264 -0400
@@ -29,7 +29,9 @@
WARNING_KEY = -Wall
TEST_WARNING_KEY = -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor
-WARNING_SUPPRESS = -Wno-parentheses
+# Skip for nvhpc compilers
+#WARNING_SUPPRESS = -Wno-parentheses
+WARNING_SUPPRESS =
DYLIB_KEY = -shared
EXPORT_KEY = -Wl,--version-script,
LIBDL = -ldl
@@ -63,10 +65,11 @@
# gcc 6.0 and later have -flifetime-dse option that controls
# elimination of stores done outside the object lifetime
-ifneq (,$(shell $(CONLY) -dumpversion | egrep "^([6-9])"))
- # keep pre-contruction stores for zero initialization
- DSE_KEY = -flifetime-dse=1
-endif
+# Skip for nvhpc compilers
+#ifneq (,$(shell $(CONLY) -dumpversion | egrep "^([6-9])"))
+# # keep pre-contruction stores for zero initialization
+# DSE_KEY = -flifetime-dse=1
+#endif
ifeq ($(cfg), release)
CPLUS_FLAGS = $(ITT_NOTIFY) -g -O2 -DUSE_PTHREAD
@@ -149,7 +152,9 @@
# Setting tbbmalloc data.
#------------------------------------------------------------------------------
-M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions
+# Drop -fno-rtti flag for nvhpc compilers
+#M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions
+M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-exceptions
#------------------------------------------------------------------------------
# End of setting tbbmalloc data.

View file

@ -0,0 +1,41 @@
diff -Naur spack-src/build/linux.gcc.inc spack-src.patched/build/linux.gcc.inc
--- spack-src/build/linux.gcc.inc 2019-05-23 06:35:29.000000000 -0400
+++ spack-src.patched/build/linux.gcc.inc 2021-07-28 16:09:17.574383383 -0400
@@ -25,7 +25,9 @@
WARNING_KEY = -Wall
TEST_WARNING_KEY = -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor
-WARNING_SUPPRESS = -Wno-parentheses
+# Skip for nvhpc compilers
+#WARNING_SUPPRESS = -Wno-parentheses
+WARNING_SUPPRESS =
DYLIB_KEY = -shared
EXPORT_KEY = -Wl,--version-script,
LIBDL = -ldl
@@ -59,10 +61,11 @@
# gcc 6.0 and later have -flifetime-dse option that controls
# elimination of stores done outside the object lifetime
-ifneq (,$(shell $(CONLY) -dumpfullversion -dumpversion | egrep "^([6-9])"))
- # keep pre-contruction stores for zero initialization
- DSE_KEY = -flifetime-dse=1
-endif
+# Skip for nvhpc compilers
+#ifneq (,$(shell $(CONLY) -dumpfullversion -dumpversion | egrep "^([6-9])"))
+# # keep pre-contruction stores for zero initialization
+# DSE_KEY = -flifetime-dse=1
+#endif
ifeq ($(cfg), release)
CPLUS_FLAGS = $(ITT_NOTIFY) -g -O2 -DUSE_PTHREAD
@@ -145,7 +148,9 @@
# Setting tbbmalloc data.
#------------------------------------------------------------------------------
-M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions
+# Drop -fno-rtti flag for nvhpc compilers
+#M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions
+M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-exceptions
#------------------------------------------------------------------------------
# End of setting tbbmalloc data.

View file

@ -0,0 +1,43 @@
diff -Naur spack-src/build/linux.gcc.inc spack-src.patched/build/linux.gcc.inc
--- spack-src/build/linux.gcc.inc 2020-07-10 09:18:01.000000000 -0400
+++ spack-src.patched/build/linux.gcc.inc 2021-07-28 15:32:43.640185318 -0400
@@ -25,7 +25,9 @@
WARNING_KEY = -Wall
TEST_WARNING_KEY = -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor
-WARNING_SUPPRESS = -Wno-parentheses
+# Skip for nvhpc compilers
+# WARNING_SUPPRESS = -Wno-parentheses
+WARNING_SUPPRESS =
DYLIB_KEY = -shared
EXPORT_KEY = -Wl,--version-script,
LIBDL = -ldl
@@ -57,12 +59,11 @@
WARNING_SUPPRESS += -Wno-sized-deallocation
endif
-# gcc 6.0 and later have -flifetime-dse option that controls
-# elimination of stores done outside the object lifetime
-ifneq (,$(shell $(CONLY) -dumpfullversion -dumpversion | egrep "^([6-9]|1[0-9])"))
- # keep pre-contruction stores for zero initialization
- DSE_KEY = -flifetime-dse=1
-endif
+#Skip for nvhpc compilers
+#ifneq (,$(shell $(CONLY) -dumpfullversion -dumpversion | egrep "^([6-9]|1[0-9])"))
+# # keep pre-contruction stores for zero initialization
+# DSE_KEY = -flifetime-dse=1
+#endif
ifeq ($(cfg), release)
# -g is set intentionally in the release mode. It should not affect performance.
@@ -149,7 +150,9 @@
# Setting tbbmalloc data.
#------------------------------------------------------------------------------
-M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions
+# Drop -fno-rtti for nvhpc compilers
+# M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions
+M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-exceptions
#------------------------------------------------------------------------------
# End of setting tbbmalloc data.

View file

@ -0,0 +1,41 @@
diff -Naur spack-src/build/linux.gcc.inc spack-src.patched/build/linux.gcc.inc
--- spack-src/build/linux.gcc.inc 2018-08-29 10:37:51.000000000 -0400
+++ spack-src.patched/build/linux.gcc.inc 2021-07-28 15:52:03.235813820 -0400
@@ -27,7 +27,9 @@
WARNING_KEY = -Wall
TEST_WARNING_KEY = -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor
-WARNING_SUPPRESS = -Wno-parentheses
+# Skip for nvhpc compilers
+#WARNING_SUPPRESS = -Wno-parentheses
+WARNING_SUPPRESS =
DYLIB_KEY = -shared
EXPORT_KEY = -Wl,--version-script,
LIBDL = -ldl
@@ -63,10 +65,11 @@
# gcc 6.0 and later have -flifetime-dse option that controls
# elimination of stores done outside the object lifetime
-ifneq (,$(shell gcc -dumpversion | egrep "^([6-9])"))
- # keep pre-contruction stores for zero initialization
- DSE_KEY = -flifetime-dse=1
-endif
+# Skip for nvhpc compilers
+#ifneq (,$(shell gcc -dumpversion | egrep "^([6-9])"))
+# # keep pre-contruction stores for zero initialization
+# DSE_KEY = -flifetime-dse=1
+#endif
ifeq ($(cfg), release)
CPLUS_FLAGS = $(ITT_NOTIFY) -g -O2 -DUSE_PTHREAD
@@ -149,7 +152,9 @@
# Setting tbbmalloc data.
#------------------------------------------------------------------------------
-M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions
+# Drop -fno-rtti flag for nvhpc compilers
+#M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions
+M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-exceptions
#------------------------------------------------------------------------------
# End of setting tbbmalloc data.

View file

@ -0,0 +1,14 @@
diff -Naur spack-src/build/linux.gcc.inc spack-src.patched/build/linux.gcc.inc
--- spack-src/build/linux.gcc.inc 2018-03-30 11:55:05.000000000 -0400
+++ spack-src.patched/build/linux.gcc.inc 2021-07-22 15:58:22.876292608 -0400
@@ -17,7 +17,9 @@
#
COMPILE_ONLY = -c -MMD
-PREPROC_ONLY = -E -x c++
+# For nvc++, need --no_preincludes as well to avoid issues with
+# pre-included content interfering with version scripts, etc.
+PREPROC_ONLY = -E -x c++ --no_preincludes
INCLUDE_KEY = -I
DEFINE_KEY = -D
OUTPUT_KEY = -o #

View file

@ -120,6 +120,27 @@ class IntelTbb(Package):
# https://github.com/oneapi-src/oneTBB/commit/86f6dcdc17a8f5ef2382faaef860cfa5243984fe.patch?full_index=1 # https://github.com/oneapi-src/oneTBB/commit/86f6dcdc17a8f5ef2382faaef860cfa5243984fe.patch?full_index=1
patch("macos-arm64.patch", when="@:2021.0") patch("macos-arm64.patch", when="@:2021.0")
# Support for building with %nvhpc
# 1) remove flags nvhpc compilers do not recognize
patch("intel-tbb.nvhpc-remove-flags.2017.patch",
when="@2017:2018.9 %nvhpc")
patch("intel-tbb.nvhpc-remove-flags.2019.patch",
when="@2019:2019.0 %nvhpc")
patch("intel-tbb.nvhpc-remove-flags.2019.1.patch",
when="@2019.1:2019.6 %nvhpc")
patch("intel-tbb.nvhpc-remove-flags.2019.7.patch",
when="@2019.7:2019.8 %nvhpc")
# The 2019.9 patch below was tested successfully
# on @2019.9, @2020.0, and @2020.3
patch("intel-tbb.nvhpc-remove-flags.2019.9.patch",
when="@2019.9: %nvhpc")
# 2) Fix generation of version script tbb.def for ld (nvc++ -E
# appears to produce more output than g++ -E which was causing problems)
# The 2017 patch below was tested on @2017, @2017.8, @2018,
# @2018.3, @2018.6, 2019, @2019.[1-9], and @2020.[0-3]
patch("intel-tbb.nvhpc-version-script-fix.2017.patch",
when="@2017 %nvhpc")
# Version and tar file names: # Version and tar file names:
# 2020.0 --> v2020.0.tar.gz starting with 2020 # 2020.0 --> v2020.0.tar.gz starting with 2020
# 2017.1 --> 2017_U1.tar.gz starting with 2017 # 2017.1 --> 2017_U1.tar.gz starting with 2017