From c7e8bdf9cf0feadb5dabf861af98943552e7e20e Mon Sep 17 00:00:00 2001 From: Tom Payerle Date: Tue, 3 Aug 2021 07:35:31 -0400 Subject: 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. --- .../intel-tbb.nvhpc-remove-flags.2017.patch | 41 +++++++++++++++++++++ .../intel-tbb.nvhpc-remove-flags.2019.1.patch | 41 +++++++++++++++++++++ .../intel-tbb.nvhpc-remove-flags.2019.7.patch | 41 +++++++++++++++++++++ .../intel-tbb.nvhpc-remove-flags.2019.9.patch | 43 ++++++++++++++++++++++ .../intel-tbb.nvhpc-remove-flags.2019.patch | 41 +++++++++++++++++++++ .../intel-tbb.nvhpc-version-script-fix.2017.patch | 14 +++++++ .../repos/builtin/packages/intel-tbb/package.py | 21 +++++++++++ 7 files changed, 242 insertions(+) create mode 100644 var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2017.patch create mode 100644 var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.1.patch create mode 100644 var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.7.patch create mode 100644 var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.9.patch create mode 100644 var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.patch create mode 100644 var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-version-script-fix.2017.patch (limited to 'var') diff --git a/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2017.patch b/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2017.patch new file mode 100644 index 0000000000..beeaa15e7c --- /dev/null +++ b/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2017.patch @@ -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. diff --git a/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.1.patch b/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.1.patch new file mode 100644 index 0000000000..d561a82de0 --- /dev/null +++ b/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.1.patch @@ -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. diff --git a/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.7.patch b/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.7.patch new file mode 100644 index 0000000000..e7045f03a3 --- /dev/null +++ b/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.7.patch @@ -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. diff --git a/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.9.patch b/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.9.patch new file mode 100644 index 0000000000..4bc846276a --- /dev/null +++ b/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.9.patch @@ -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. diff --git a/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.patch b/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.patch new file mode 100644 index 0000000000..eb1ffff9a7 --- /dev/null +++ b/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-remove-flags.2019.patch @@ -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. diff --git a/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-version-script-fix.2017.patch b/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-version-script-fix.2017.patch new file mode 100644 index 0000000000..eb5dc47799 --- /dev/null +++ b/var/spack/repos/builtin/packages/intel-tbb/intel-tbb.nvhpc-version-script-fix.2017.patch @@ -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 # diff --git a/var/spack/repos/builtin/packages/intel-tbb/package.py b/var/spack/repos/builtin/packages/intel-tbb/package.py index 50c674543d..89276ec5ca 100644 --- a/var/spack/repos/builtin/packages/intel-tbb/package.py +++ b/var/spack/repos/builtin/packages/intel-tbb/package.py @@ -120,6 +120,27 @@ class IntelTbb(Package): # https://github.com/oneapi-src/oneTBB/commit/86f6dcdc17a8f5ef2382faaef860cfa5243984fe.patch?full_index=1 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: # 2020.0 --> v2020.0.tar.gz starting with 2020 # 2017.1 --> 2017_U1.tar.gz starting with 2017 -- cgit v1.2.3-60-g2f50