Incorporate intel-tbb-oneapi package into intel-tbb package (#25613)

* Add intel-tbb-oneapi package that does the cmake configure and build.
Compare too the intel-oneapi-tbb package which only downloads a script that contains prebuilt binaries.

* Rename package intel-tbb-cmake

* Incorporate intel-tbb-cmake into intel-tbb package
This commit is contained in:
Patrick Gartung 2021-08-26 19:06:27 -05:00 committed by GitHub
parent 74389472ab
commit d0d6b29c9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,7 +11,7 @@
from spack import *
class IntelTbb(Package):
class IntelTbb(CMakePackage):
"""Widely used C++ template library for task parallelism.
Intel Threading Building Blocks (Intel TBB) lets you easily write parallel
C++ programs that take full advantage of multicore performance, that are
@ -24,6 +24,9 @@ class IntelTbb(Package):
# Note: when adding new versions, please check and update the
# patches, filters and url_for_version() below as needed.
version('2021.3.0', sha256='8f616561603695bbb83871875d2c6051ea28f8187dbe59299961369904d1d49e')
version('2021.2.0', sha256='cee20b0a71d977416f3e3b4ec643ee4f38cedeb2a9ff015303431dd9d8d79854')
version('2021.1.1', sha256='b182c73caaaabc44ddc5ad13113aca7e453af73c1690e4061f71dfe4935d74e8')
version('2020.3', sha256='ebc4f6aa47972daed1f7bf71d100ae5bf6931c2e3144cf299c8cc7d041dca2f3',
preferred=True)
version('2020.2', sha256='4804320e1e6cbe3a5421997b52199e3c1a3829b2ecb6489641da4b8e32faf500')
@ -97,7 +100,9 @@ class IntelTbb(Package):
# Build and install CMake config files if we're new enough.
# CMake support started in 2017.7.
depends_on('cmake@3.0.0:', type='build', when='@2017.7:')
depends_on('cmake@3.1.0:', type='build', when='@2017.7:')
depends_on('hwloc', when='@2021.1.1:')
# Patch for pedantic warnings (#10836). This was fixed in the TBB
# source tree in 2019.6.
@ -162,6 +167,7 @@ def url_for_version(self, version):
def setup_build_environment(self, env):
env.set('OS', platform.system())
@when('@:2020.3')
def coerce_to_spack(self, tbb_build_subdir):
for compiler in ["icc", "gcc", "clang"]:
fs = glob.glob(join_path(tbb_build_subdir,
@ -179,7 +185,16 @@ def coerce_to_spack(self, tbb_build_subdir):
else:
of.write(lin)
def install(self, spec, prefix):
@when('@:2020.3')
def cmake(self, spec, prefix):
return
@when('@:2020.3')
def cmake_args(self):
return
@when('@:2020.3')
def build(self, spec, prefix):
# Deactivate use of RTM with GCC when on an OS with a very old
# assembler.
if (spec.satisfies('%gcc@4.8.0: os=rhel6')
@ -207,9 +222,6 @@ def install(self, spec, prefix):
else:
tbb_compiler = "gcc"
mkdirp(prefix)
mkdirp(prefix.lib)
make_opts = []
# Static builds of TBB are enabled by including 'big_iron.inc' file
@ -229,6 +241,11 @@ def install(self, spec, prefix):
make_opts.append("compiler={0}".format(tbb_compiler))
make(*make_opts)
@when('@:2020.3')
def install(self, spec, prefix):
mkdirp(prefix)
mkdirp(prefix.lib)
# install headers to {prefix}/include
install_tree('include', prefix.include)
@ -254,6 +271,7 @@ def install(self, spec, prefix):
with working_dir(join_path(self.stage.source_path, 'cmake')):
inspect.getmodule(self).cmake(*cmake_args)
@when('@:2020.3')
@run_after('install')
def darwin_fix(self):
# Replace @rpath in ids with full path
@ -265,3 +283,18 @@ def libs(self):
shared = True if '+shared' in self.spec else False
return find_libraries(
'libtbb*', root=self.prefix, shared=shared, recursive=True)
@when('@2021.1.1:')
def cmake_args(self):
spec = self.spec
options = []
options.append('-DCMAKE_HWLOC_2_INCLUDE_PATH=%s' %
spec['hwloc'].prefix.include)
options.append('-DCMAKE_HWLOC_2_LIBRARY_PATH=%s' %
spec['hwloc'].libs)
options.append('-DTBB_CPF=ON')
options.append('-DTBB_STRICT=OFF')
if spec.variants['cxxstd'].value != 'default':
options.append('-DCMAKE_CXX_STANDARD=%s' %
spec.variants['cxxstd'].value)
return options