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.
This commit is contained in:
Mark W. Krentel 2018-07-26 01:14:17 -05:00 committed by Todd Gamblin
parent 7902f3eb49
commit af60f962cd
2 changed files with 21 additions and 0 deletions

View file

@ -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 **/

View file

@ -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: