From af60f962cdf5047bef2cd53ec72f38e033146aa4 Mon Sep 17 00:00:00 2001 From: "Mark W. Krentel" Date: Thu, 26 Jul 2018 01:14:17 -0500 Subject: intel-tbb: Add `tm` variant to disable transactional memory. (#8799) * intel-tbb: Add variant `tm` to disable transactional memory. Some AMD or very old Intel systems don't support transactional memory. This commit adds a variant `tm` that defaults to `True`, but can be switched off to allow running on those systems. --- .../repos/builtin/packages/intel-tbb/disable-tm.patch | 15 +++++++++++++++ var/spack/repos/builtin/packages/intel-tbb/package.py | 6 ++++++ 2 files changed, 21 insertions(+) create mode 100644 var/spack/repos/builtin/packages/intel-tbb/disable-tm.patch diff --git a/var/spack/repos/builtin/packages/intel-tbb/disable-tm.patch b/var/spack/repos/builtin/packages/intel-tbb/disable-tm.patch new file mode 100644 index 0000000000..7ef0e93b78 --- /dev/null +++ b/var/spack/repos/builtin/packages/intel-tbb/disable-tm.patch @@ -0,0 +1,15 @@ +Disable transactional memory. This is needed for some AMD or very old +Intel systems. See issue #6090. + +diff -Naurb tbb-2018_U4.orig/include/tbb/tbb_config.h tbb-2018_U4/include/tbb/tbb_config.h +--- tbb-2018_U4.orig/include/tbb/tbb_config.h 2018-05-30 07:35:25.000000000 -0500 ++++ tbb-2018_U4/include/tbb/tbb_config.h 2018-07-24 16:26:11.662673434 -0500 +@@ -98,7 +98,7 @@ + #define __TBB_DEFINE_MIC 1 + #endif + +-#define __TBB_TSX_AVAILABLE ((__TBB_x86_32 || __TBB_x86_64) && !__TBB_DEFINE_MIC) ++#define __TBB_TSX_AVAILABLE 0 + + /** Presence of compiler features **/ + diff --git a/var/spack/repos/builtin/packages/intel-tbb/package.py b/var/spack/repos/builtin/packages/intel-tbb/package.py index ab486bf896..4e884dd0ab 100644 --- a/var/spack/repos/builtin/packages/intel-tbb/package.py +++ b/var/spack/repos/builtin/packages/intel-tbb/package.py @@ -73,6 +73,9 @@ class IntelTbb(Package): multi=False, description='Use the specified C++ standard when building.') + variant('tm', default=True, + description='Enable use of transactional memory on x86') + # Build and install CMake config files if we're new enough. depends_on('cmake@3.0.0:', type='build', when='@2017.0:') @@ -84,6 +87,9 @@ class IntelTbb(Package): # Patch cmakeConfig.cmake.in to find the libraries where we install them. patch("tbb_cmakeConfig.patch", level=0, when='@2017.0:') + # Some very old systems don't support transactional memory. + patch("disable-tm.patch", when='~tm') + def url_for_version(self, version): url = 'https://github.com/01org/tbb/archive/{0}.tar.gz' if (version[0] >= 2017) and len(version) > 1: -- cgit v1.2.3-60-g2f50