Files
spack/var/spack/repos/builtin/packages/intel-tbb/package.py

118 lines
5.1 KiB
Python
Raw Normal View History

##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
2016-03-22 16:59:40 +01:00
from spack import *
import glob
2016-05-17 23:35:05 +02:00
Refactor IntelInstaller into IntelPackage base class (#4300) * Refactor IntelInstaller into IntelPackage base class * Move license attributes from __init__ to class-level * Flake8 fixes: remove unused imports * Fix logic that writes the silent.cfg file * More specific version numbers for Intel MPI * Rework logic that selects components to install * Final changes necessary to get intel package working * Various updates to intel-parallel-studio * Add latest version of every Intel package * Add environment variables for Intel packages * Update env vars for intel package * Finalize components for intel-parallel-studio package Adds a +tbb variant to intel-parallel-studio. The tbb package was renamed to intel-tbb. Now both intel-tbb and intel-parallel-studio+tbb provide tbb. * Overhaul environment variables set by intel-parallel-studio * Point dependent packages to the correct MPI wrappers * Never default to intel-parallel-studio * Gather env vars by sourcing setup scripts * Use mpiicc instead of mpicc when using Intel compiler * Undo change to ARCH * Add changes from intel-mpi to intel-parallel-studio * Add comment explaining mpicc vs mpiicc * Prepend env vars containing 'PATH' or separators * Flake8 fix * Fix bugs in from_sourcing_file * Indentation fix * Prepend, not set if contains separator * Fix license symlinking broken by changes to intel-parallel-studio * Use comments instead of docstrings to document attributes * Flake8 fixes * Use a set instead of a list to prevent duplicate components * Fix MKL and MPI library linking directories * Remove +all variant from intel-parallel-studio * It is not possible to build with MKL, GCC, and OpenMP at this time * Found a workaround for locating GCC libraries * Typos and variable names * Fix initialization of empty LibraryList
2017-08-16 12:21:07 -05:00
class IntelTbb(Package):
2016-03-22 16:59:40 +01:00
"""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
portable and composable, and that have future-proof scalability.
"""
homepage = "http://www.threadingbuildingblocks.org/"
# Only version-specific URL's work for TBB
2016-12-19 01:20:26 +01:00
# can also use https://github.com/01org/tbb/releases/
2017-05-27 23:35:17 +02:00
version('2017.6', '5b0909fbb1741724f7a0ce83232f50b166788af0',
url='https://github.com/01org/tbb/archive/2017_U6.tar.gz')
2017-03-26 09:38:18 +02:00
version('2017.5', '26f720729d322913912e99d1e4a36bd10625d3ca',
url='https://github.com/01org/tbb/archive/2017_U5.tar.gz')
2016-12-19 01:20:26 +01:00
version('2017.3', '2c451a5bcf6fc31487b98b4b29651c369874277c',
url='https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb2017_20161128oss_src.tgz')
2016-08-10 14:05:59 -07:00
version('4.4.4', 'd4cee5e4ca75cab5181834877738619c56afeb71',
url='https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb44_20160413oss_src.tgz')
version('4.4.3', '80707e277f69d9b20eeebdd7a5f5331137868ce1',
url='https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb44_20160128oss_src_0.tgz')
2016-03-22 16:59:40 +01:00
Refactor IntelInstaller into IntelPackage base class (#4300) * Refactor IntelInstaller into IntelPackage base class * Move license attributes from __init__ to class-level * Flake8 fixes: remove unused imports * Fix logic that writes the silent.cfg file * More specific version numbers for Intel MPI * Rework logic that selects components to install * Final changes necessary to get intel package working * Various updates to intel-parallel-studio * Add latest version of every Intel package * Add environment variables for Intel packages * Update env vars for intel package * Finalize components for intel-parallel-studio package Adds a +tbb variant to intel-parallel-studio. The tbb package was renamed to intel-tbb. Now both intel-tbb and intel-parallel-studio+tbb provide tbb. * Overhaul environment variables set by intel-parallel-studio * Point dependent packages to the correct MPI wrappers * Never default to intel-parallel-studio * Gather env vars by sourcing setup scripts * Use mpiicc instead of mpicc when using Intel compiler * Undo change to ARCH * Add changes from intel-mpi to intel-parallel-studio * Add comment explaining mpicc vs mpiicc * Prepend env vars containing 'PATH' or separators * Flake8 fix * Fix bugs in from_sourcing_file * Indentation fix * Prepend, not set if contains separator * Fix license symlinking broken by changes to intel-parallel-studio * Use comments instead of docstrings to document attributes * Flake8 fixes * Use a set instead of a list to prevent duplicate components * Fix MKL and MPI library linking directories * Remove +all variant from intel-parallel-studio * It is not possible to build with MKL, GCC, and OpenMP at this time * Found a workaround for locating GCC libraries * Typos and variable names * Fix initialization of empty LibraryList
2017-08-16 12:21:07 -05:00
provides('tbb')
2016-05-17 23:35:05 +02:00
def coerce_to_spack(self, tbb_build_subdir):
for compiler in ["icc", "gcc", "clang"]:
fs = glob.glob(join_path(tbb_build_subdir,
"*.%s.inc" % compiler))
for f in fs:
lines = open(f).readlines()
of = open(f, "w")
for l in lines:
if l.strip().startswith("CPLUS ="):
2016-03-22 16:59:40 +01:00
of.write("# coerced to spack\n")
of.write("CPLUS = $(CXX)\n")
2016-05-17 23:35:05 +02:00
elif l.strip().startswith("CPLUS ="):
2016-03-22 16:59:40 +01:00
of.write("# coerced to spack\n")
of.write("CONLY = $(CC)\n")
2016-05-17 23:35:05 +02:00
else:
of.write(l)
2016-03-22 16:59:40 +01:00
def install(self, spec, prefix):
if spec.satisfies('%gcc@6.1:') and spec.satisfies('@:4.4.3'):
2016-05-17 23:35:05 +02:00
raise InstallError('Only TBB 4.4.4 and above build with GCC 6.1!')
2016-05-17 23:35:05 +02:00
# 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
2016-03-22 16:59:40 +01:00
# to accomplish this, we do two things:
#
2016-05-17 23:35:05 +02:00
# * Look at the spack spec to determine which compiler we should pass
# to tbb's Makefile;
2016-03-22 16:59:40 +01:00
#
# * patch tbb's build system to use the compiler wrappers (CC, CXX) for
2016-05-17 23:35:05 +02:00
# icc, gcc, clang (see coerce_to_spack());
2016-03-22 16:59:40 +01:00
#
self.coerce_to_spack("build")
if spec.satisfies('%clang'):
tbb_compiler = "clang"
elif spec.satisfies('%intel'):
tbb_compiler = "icc"
else:
tbb_compiler = "gcc"
mkdirp(prefix)
mkdirp(prefix.lib)
#
# tbb does not have a configure script or make install target
# we simply call make, and try to put the pieces together
#
2016-05-17 23:35:05 +02:00
make("compiler=%s" % (tbb_compiler))
2016-03-22 16:59:40 +01:00
# install headers to {prefix}/include
2016-05-17 23:35:05 +02:00
install_tree('include', prefix.include)
2016-03-22 16:59:40 +01:00
# install libs to {prefix}/lib
tbb_lib_names = ["libtbb",
"libtbbmalloc",
"libtbbmalloc_proxy"]
for lib_name in tbb_lib_names:
# install release libs
2016-05-17 23:35:05 +02:00
fs = glob.glob(join_path("build", "*release", lib_name + ".*"))
2016-03-22 16:59:40 +01:00
for f in fs:
install(f, prefix.lib)
# install debug libs if they exist
2016-05-17 23:35:05 +02:00
fs = glob.glob(join_path("build", "*debug", lib_name + "_debug.*"))
2016-03-22 16:59:40 +01:00
for f in fs:
install(f, prefix.lib)