Skip to content
Snippets Groups Projects
Commit d9497250 authored by Todd Gamblin's avatar Todd Gamblin
Browse files

Merge pull request #964 from davydden/update/tbb

tbb: add 4.4.4; raise InstallError when building 4.4.3 with GCC6.1
parents 0514dd5e 267666cd
No related branches found
No related tags found
No related merge requests found
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
from spack import * from spack import *
import os
import glob import glob
class Tbb(Package): class Tbb(Package):
"""Widely used C++ template library for task parallelism. """Widely used C++ template library for task parallelism.
Intel Threading Building Blocks (Intel TBB) lets you easily write parallel Intel Threading Building Blocks (Intel TBB) lets you easily write parallel
...@@ -35,35 +35,39 @@ class Tbb(Package): ...@@ -35,35 +35,39 @@ class Tbb(Package):
homepage = "http://www.threadingbuildingblocks.org/" homepage = "http://www.threadingbuildingblocks.org/"
# Only version-specific URL's work for TBB # Only version-specific URL's work for TBB
version('4.4.3', '80707e277f69d9b20eeebdd7a5f5331137868ce1', url='https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb44_20160128oss_src_0.tgz') version('4.4.4', 'd4cee5e4ca75cab5181834877738619c56afeb71', url='https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb44_20160413oss_src.tgz') # NOQA: ignore=E501
version('4.4.3', '80707e277f69d9b20eeebdd7a5f5331137868ce1', url='https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb44_20160128oss_src_0.tgz') # NOQA: ignore=E501
def coerce_to_spack(self,tbb_build_subdir): def coerce_to_spack(self, tbb_build_subdir):
for compiler in ["icc","gcc","clang"]: for compiler in ["icc", "gcc", "clang"]:
fs = glob.glob(join_path(tbb_build_subdir,"*.%s.inc" % compiler )) fs = glob.glob(join_path(tbb_build_subdir,
for f in fs: "*.%s.inc" % compiler))
lines = open(f).readlines() for f in fs:
of = open(f,"w") lines = open(f).readlines()
for l in lines: of = open(f, "w")
if l.strip().startswith("CPLUS ="): for l in lines:
if l.strip().startswith("CPLUS ="):
of.write("# coerced to spack\n") of.write("# coerced to spack\n")
of.write("CPLUS = $(CXX)\n") of.write("CPLUS = $(CXX)\n")
elif l.strip().startswith("CPLUS ="): elif l.strip().startswith("CPLUS ="):
of.write("# coerced to spack\n") of.write("# coerced to spack\n")
of.write("CONLY = $(CC)\n") of.write("CONLY = $(CC)\n")
else: else:
of.write(l); of.write(l)
def install(self, spec, prefix): def install(self, spec, prefix):
# if spec.satisfies('%gcc@6.1:') and spec.satisfies('@:4.4.3'):
# we need to follow TBB's compiler selection logic to get the proper build + link flags raise InstallError('Only TBB 4.4.4 and above build with GCC 6.1!')
# but we still need to use spack's compiler wrappers
# We need to follow TBB's compiler selection logic to get the proper
# build + link flags but we still need to use spack's compiler wrappers
# to accomplish this, we do two things: # to accomplish this, we do two things:
# #
# * Look at the spack spec to determine which compiler we should pass to tbb's Makefile # * Look at the spack spec to determine which compiler we should pass
# to tbb's Makefile;
# #
# * patch tbb's build system to use the compiler wrappers (CC, CXX) for # * patch tbb's build system to use the compiler wrappers (CC, CXX) for
# icc, gcc, clang # icc, gcc, clang (see coerce_to_spack());
# (see coerce_to_spack())
# #
self.coerce_to_spack("build") self.coerce_to_spack("build")
...@@ -74,7 +78,6 @@ def install(self, spec, prefix): ...@@ -74,7 +78,6 @@ def install(self, spec, prefix):
else: else:
tbb_compiler = "gcc" tbb_compiler = "gcc"
mkdirp(prefix) mkdirp(prefix)
mkdirp(prefix.lib) mkdirp(prefix.lib)
...@@ -82,10 +85,10 @@ def install(self, spec, prefix): ...@@ -82,10 +85,10 @@ def install(self, spec, prefix):
# tbb does not have a configure script or make install target # tbb does not have a configure script or make install target
# we simply call make, and try to put the pieces together # we simply call make, and try to put the pieces together
# #
make("compiler=%s" %(tbb_compiler)) make("compiler=%s" % (tbb_compiler))
# install headers to {prefix}/include # install headers to {prefix}/include
install_tree('include',prefix.include) install_tree('include', prefix.include)
# install libs to {prefix}/lib # install libs to {prefix}/lib
tbb_lib_names = ["libtbb", tbb_lib_names = ["libtbb",
...@@ -94,10 +97,10 @@ def install(self, spec, prefix): ...@@ -94,10 +97,10 @@ def install(self, spec, prefix):
for lib_name in tbb_lib_names: for lib_name in tbb_lib_names:
# install release libs # install release libs
fs = glob.glob(join_path("build","*release",lib_name + ".*")) fs = glob.glob(join_path("build", "*release", lib_name + ".*"))
for f in fs: for f in fs:
install(f, prefix.lib) install(f, prefix.lib)
# install debug libs if they exist # install debug libs if they exist
fs = glob.glob(join_path("build","*debug",lib_name + "_debug.*")) fs = glob.glob(join_path("build", "*debug", lib_name + "_debug.*"))
for f in fs: for f in fs:
install(f, prefix.lib) install(f, prefix.lib)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment