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
This commit is contained in:
@@ -22,18 +22,14 @@
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from spack import *
|
||||
import os
|
||||
|
||||
from spack.pkg.builtin.intel import IntelInstaller
|
||||
from spack import *
|
||||
from spack.environment import EnvironmentModifications
|
||||
|
||||
|
||||
class IntelDaal(IntelInstaller):
|
||||
"""Intel Data Analytics Acceleration Library.
|
||||
|
||||
Note: You will have to add the download file to a
|
||||
mirror so that Spack can find it. For instructions on how to set up a
|
||||
mirror, see http://spack.readthedocs.io/en/latest/mirrors.html"""
|
||||
class IntelDaal(IntelPackage):
|
||||
"""Intel Data Analytics Acceleration Library."""
|
||||
|
||||
homepage = "https://software.intel.com/en-us/daal"
|
||||
|
||||
@@ -52,11 +48,35 @@ class IntelDaal(IntelInstaller):
|
||||
|
||||
provides('daal')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
@property
|
||||
def license_required(self):
|
||||
# The Intel libraries are provided without requiring a license as of
|
||||
# version 2017.2. Trying to specify the license will fail. See:
|
||||
# https://software.intel.com/en-us/articles/free-ipsxe-tools-and-libraries
|
||||
if self.version >= Version('2017.2'):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
self.intel_prefix = os.path.join(prefix, "pkg")
|
||||
IntelInstaller.install(self, spec, prefix)
|
||||
def setup_environment(self, spack_env, run_env):
|
||||
"""Adds environment variables to the generated module file.
|
||||
|
||||
daal_dir = os.path.join(self.intel_prefix, "daal")
|
||||
for f in os.listdir(daal_dir):
|
||||
os.symlink(os.path.join(daal_dir, f), os.path.join(self.prefix, f))
|
||||
These environment variables come from running:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ source daal/bin/daalvars.sh intel64
|
||||
"""
|
||||
# NOTE: Spack runs setup_environment twice, once pre-build to set up
|
||||
# the build environment, and once post-installation to determine
|
||||
# the environment variables needed at run-time to add to the module
|
||||
# file. The script we need to source is only present post-installation,
|
||||
# so check for its existence before sourcing.
|
||||
# TODO: At some point we should split setup_environment into
|
||||
# setup_build_environment and setup_run_environment to get around
|
||||
# this problem.
|
||||
daalvars = os.path.join(self.prefix.daal.bin, 'daalvars.sh')
|
||||
|
||||
if os.path.isfile(daalvars):
|
||||
run_env.extend(EnvironmentModifications.from_sourcing_file(
|
||||
daalvars, 'intel64'))
|
||||
|
@@ -22,18 +22,14 @@
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from spack import *
|
||||
import os
|
||||
|
||||
from spack.pkg.builtin.intel import IntelInstaller
|
||||
from spack import *
|
||||
from spack.environment import EnvironmentModifications
|
||||
|
||||
|
||||
class IntelIpp(IntelInstaller):
|
||||
"""Intel Integrated Performance Primitives.
|
||||
|
||||
Note: You will have to add the download file to a
|
||||
mirror so that Spack can find it. For instructions on how to set up a
|
||||
mirror, see http://spack.readthedocs.io/en/latest/mirrors.html"""
|
||||
class IntelIpp(IntelPackage):
|
||||
"""Intel Integrated Performance Primitives."""
|
||||
|
||||
homepage = "https://software.intel.com/en-us/intel-ipp"
|
||||
|
||||
@@ -50,11 +46,35 @@ class IntelIpp(IntelInstaller):
|
||||
|
||||
provides('ipp')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
@property
|
||||
def license_required(self):
|
||||
# The Intel libraries are provided without requiring a license as of
|
||||
# version 2017.2. Trying to specify the license will fail. See:
|
||||
# https://software.intel.com/en-us/articles/free-ipsxe-tools-and-libraries
|
||||
if self.version >= Version('2017.2'):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
self.intel_prefix = os.path.join(prefix, "pkg")
|
||||
IntelInstaller.install(self, spec, prefix)
|
||||
def setup_environment(self, spack_env, run_env):
|
||||
"""Adds environment variables to the generated module file.
|
||||
|
||||
ipp_dir = os.path.join(self.intel_prefix, "ipp")
|
||||
for f in os.listdir(ipp_dir):
|
||||
os.symlink(os.path.join(ipp_dir, f), os.path.join(self.prefix, f))
|
||||
These environment variables come from running:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ source ipp/bin/ippvars.sh intel64
|
||||
"""
|
||||
# NOTE: Spack runs setup_environment twice, once pre-build to set up
|
||||
# the build environment, and once post-installation to determine
|
||||
# the environment variables needed at run-time to add to the module
|
||||
# file. The script we need to source is only present post-installation,
|
||||
# so check for its existence before sourcing.
|
||||
# TODO: At some point we should split setup_environment into
|
||||
# setup_build_environment and setup_run_environment to get around
|
||||
# this problem.
|
||||
ippvars = os.path.join(self.prefix.ipp.bin, 'ippvars.sh')
|
||||
|
||||
if os.path.isfile(ippvars):
|
||||
run_env.extend(EnvironmentModifications.from_sourcing_file(
|
||||
ippvars, 'intel64'))
|
||||
|
@@ -22,13 +22,13 @@
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from spack import *
|
||||
import os
|
||||
|
||||
from spack.pkg.builtin.intel import IntelInstaller
|
||||
from spack import *
|
||||
from spack.environment import EnvironmentModifications
|
||||
|
||||
|
||||
class IntelMkl(IntelInstaller):
|
||||
class IntelMkl(IntelPackage):
|
||||
"""Intel Math Kernel Library."""
|
||||
|
||||
homepage = "https://software.intel.com/en-us/intel-mkl"
|
||||
@@ -50,12 +50,21 @@ class IntelMkl(IntelInstaller):
|
||||
variant('ilp64', default=False, description='64 bit integers')
|
||||
variant('openmp', default=False, description='OpenMP multithreading layer')
|
||||
|
||||
# virtual dependency
|
||||
provides('blas')
|
||||
provides('lapack')
|
||||
provides('scalapack')
|
||||
provides('mkl')
|
||||
|
||||
@property
|
||||
def license_required(self):
|
||||
# The Intel libraries are provided without requiring a license as of
|
||||
# version 2017.2. Trying to specify the license will fail. See:
|
||||
# https://software.intel.com/en-us/articles/free-ipsxe-tools-and-libraries
|
||||
if self.version >= Version('2017.2'):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
@property
|
||||
def blas_libs(self):
|
||||
spec = self.spec
|
||||
@@ -69,15 +78,27 @@ def blas_libs(self):
|
||||
|
||||
mkl_threading = ['libmkl_sequential']
|
||||
|
||||
omp_libs = LibraryList([])
|
||||
|
||||
if '+openmp' in spec:
|
||||
if '%intel' in spec:
|
||||
mkl_threading = ['libmkl_intel_thread', 'libiomp5']
|
||||
else:
|
||||
mkl_threading = ['libmkl_intel_thread']
|
||||
omp_threading = ['libiomp5']
|
||||
|
||||
omp_root = prefix.compilers_and_libraries.linux.lib.intel64
|
||||
omp_libs = find_libraries(
|
||||
omp_threading, root=omp_root, shared=shared)
|
||||
elif '%gcc' in spec:
|
||||
mkl_threading = ['libmkl_gnu_thread']
|
||||
|
||||
gcc = Executable(self.compiler.cc)
|
||||
libgomp = gcc('--print-file-name', 'libgomp.{0}'.format(
|
||||
dso_suffix), output=str)
|
||||
omp_libs = LibraryList(libgomp)
|
||||
|
||||
# TODO: TBB threading: ['libmkl_tbb_thread', 'libtbb', 'libstdc++']
|
||||
|
||||
mkl_root = join_path(prefix.lib, 'intel64')
|
||||
mkl_root = prefix.compilers_and_libraries.linux.mkl.lib.intel64
|
||||
|
||||
mkl_libs = find_libraries(
|
||||
mkl_integer + ['libmkl_core'] + mkl_threading,
|
||||
@@ -91,7 +112,7 @@ def blas_libs(self):
|
||||
shared=shared
|
||||
)
|
||||
|
||||
return mkl_libs + system_libs
|
||||
return mkl_libs + omp_libs + system_libs
|
||||
|
||||
@property
|
||||
def lapack_libs(self):
|
||||
@@ -120,30 +141,46 @@ def scalapack_libs(self):
|
||||
elif '^intel-mpi' in root:
|
||||
libnames.append('libmkl_blacs_intelmpi')
|
||||
else:
|
||||
raise InstallError("No MPI found for scalapack")
|
||||
raise InstallError('No MPI found for scalapack')
|
||||
|
||||
shared = True if '+shared' in self.spec else False
|
||||
integer = 'ilp64' if '+ilp64' in self.spec else 'lp64'
|
||||
mkl_root = self.prefix.compilers_and_libraries.linux.mkl.lib.intel64
|
||||
shared = True if '+shared' in self.spec else False
|
||||
|
||||
libs = find_libraries(
|
||||
['{0}_{1}'.format(l, integer) for l in libnames],
|
||||
root=join_path(self.prefix.lib, 'intel64'),
|
||||
root=mkl_root,
|
||||
shared=shared
|
||||
)
|
||||
|
||||
return libs
|
||||
|
||||
def install(self, spec, prefix):
|
||||
self.intel_prefix = os.path.join(prefix, "pkg")
|
||||
IntelInstaller.install(self, spec, prefix)
|
||||
|
||||
mkl_dir = os.path.join(self.intel_prefix, "mkl")
|
||||
for f in os.listdir(mkl_dir):
|
||||
os.symlink(os.path.join(mkl_dir, f), os.path.join(self.prefix, f))
|
||||
|
||||
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
|
||||
# set up MKLROOT for everyone using MKL package
|
||||
mkl_root = self.prefix.compilers_and_libraries.linux.mkl.lib.intel64
|
||||
|
||||
spack_env.set('MKLROOT', self.prefix)
|
||||
spack_env.append_path('SPACK_COMPILER_EXTRA_RPATHS',
|
||||
join_path(self.prefix.lib, 'intel64'))
|
||||
spack_env.append_path('SPACK_COMPILER_EXTRA_RPATHS', mkl_root)
|
||||
|
||||
def setup_environment(self, spack_env, run_env):
|
||||
run_env.set('MKLROOT', self.prefix)
|
||||
"""Adds environment variables to the generated module file.
|
||||
|
||||
These environment variables come from running:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ source mkl/bin/mklvars.sh intel64
|
||||
"""
|
||||
# NOTE: Spack runs setup_environment twice, once pre-build to set up
|
||||
# the build environment, and once post-installation to determine
|
||||
# the environment variables needed at run-time to add to the module
|
||||
# file. The script we need to source is only present post-installation,
|
||||
# so check for its existence before sourcing.
|
||||
# TODO: At some point we should split setup_environment into
|
||||
# setup_build_environment and setup_run_environment to get around
|
||||
# this problem.
|
||||
mklvars = os.path.join(self.prefix.mkl.bin, 'mklvars.sh')
|
||||
|
||||
if os.path.isfile(mklvars):
|
||||
run_env.extend(EnvironmentModifications.from_sourcing_file(
|
||||
mklvars, 'intel64'))
|
||||
|
@@ -22,30 +22,41 @@
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from spack import *
|
||||
import os
|
||||
|
||||
from spack.pkg.builtin.intel import IntelInstaller
|
||||
from spack import *
|
||||
from spack.environment import EnvironmentModifications
|
||||
|
||||
|
||||
class IntelMpi(IntelInstaller):
|
||||
class IntelMpi(IntelPackage):
|
||||
"""Intel MPI"""
|
||||
|
||||
homepage = "https://software.intel.com/en-us/intel-mpi-library"
|
||||
|
||||
version('2017.3', '721ecd5f6afa385e038777e5b5361dfb',
|
||||
version('2017.3.196', '721ecd5f6afa385e038777e5b5361dfb',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/11595/l_mpi_2017.3.196.tgz')
|
||||
version('2017.2', 'b6c2e62c3fb9b1558ede72ccf72cf1d6',
|
||||
version('2017.2.174', 'b6c2e62c3fb9b1558ede72ccf72cf1d6',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/11334/l_mpi_2017.2.174.tgz')
|
||||
version('2017.1', 'd5e941ac2bcf7c5576f85f6bcfee4c18',
|
||||
version('2017.1.132', 'd5e941ac2bcf7c5576f85f6bcfee4c18',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/11014/l_mpi_2017.1.132.tgz')
|
||||
version('5.1.3', '4316e78533a932081b1a86368e890800',
|
||||
version('5.1.3.223', '4316e78533a932081b1a86368e890800',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/9278/l_mpi_p_5.1.3.223.tgz')
|
||||
|
||||
provides('mpi')
|
||||
|
||||
@property
|
||||
def license_required(self):
|
||||
# The Intel libraries are provided without requiring a license as of
|
||||
# version 2017.2. Trying to specify the license will fail. See:
|
||||
# https://software.intel.com/en-us/articles/free-ipsxe-tools-and-libraries
|
||||
if self.version >= Version('2017.2'):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
@property
|
||||
def mpi_libs(self):
|
||||
mpi_root = self.prefix.compilers_and_libraries.linux.mpi.lib64
|
||||
query_parameters = self.spec.last_query.extra_parameters
|
||||
libraries = ['libmpifort', 'libmpi']
|
||||
|
||||
@@ -53,19 +64,15 @@ def mpi_libs(self):
|
||||
libraries = ['libmpicxx'] + libraries
|
||||
|
||||
return find_libraries(
|
||||
libraries, root=self.prefix.lib64, shared=True, recurse=True
|
||||
libraries, root=mpi_root, shared=True, recurse=True
|
||||
)
|
||||
|
||||
@property
|
||||
def mpi_headers(self):
|
||||
# recurse from self.prefix will find too many things for all the
|
||||
# supported sub-architectures like 'mic'
|
||||
return find_headers(
|
||||
'mpi', root=self.prefix.include64, recurse=False)
|
||||
|
||||
def install(self, spec, prefix):
|
||||
self.intel_prefix = prefix
|
||||
IntelInstaller.install(self, spec, prefix)
|
||||
mpi_root = self.prefix.compilers_and_libraries.linux.mpi.include64
|
||||
return find_headers('mpi', root=mpi_root, recurse=False)
|
||||
|
||||
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
|
||||
spack_env.set('I_MPI_CC', spack_cc)
|
||||
@@ -75,15 +82,52 @@ def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
|
||||
spack_env.set('I_MPI_FC', spack_fc)
|
||||
|
||||
def setup_dependent_package(self, module, dep_spec):
|
||||
# Check for presence of bin64 or bin directory
|
||||
if os.path.isdir(self.prefix.bin):
|
||||
bindir = self.prefix.bin
|
||||
elif os.path.isdir(self.prefix.bin64):
|
||||
bindir = self.prefix.bin64
|
||||
else:
|
||||
raise RuntimeError('No suitable bindir found')
|
||||
# Intel comes with 2 different flavors of MPI wrappers:
|
||||
#
|
||||
# * mpiicc, mpiicpc, and mpifort are hardcoded to wrap around
|
||||
# the Intel compilers.
|
||||
# * mpicc, mpicxx, mpif90, and mpif77 allow you to set which
|
||||
# compilers to wrap using I_MPI_CC and friends. By default,
|
||||
# wraps around the GCC compilers.
|
||||
#
|
||||
# In theory, these should be equivalent as long as I_MPI_CC
|
||||
# and friends are set to point to the Intel compilers, but in
|
||||
# practice, mpicc fails to compile some applications while
|
||||
# mpiicc works.
|
||||
bindir = self.prefix.compilers_and_libraries.linux.mpi.intel64.bin
|
||||
|
||||
self.spec.mpicc = join_path(bindir, 'mpicc')
|
||||
self.spec.mpicxx = join_path(bindir, 'mpicxx')
|
||||
self.spec.mpifc = join_path(bindir, 'mpif90')
|
||||
self.spec.mpif77 = join_path(bindir, 'mpif77')
|
||||
if self.compiler.name == 'intel':
|
||||
self.spec.mpicc = bindir.mpiicc
|
||||
self.spec.mpicxx = bindir.mpiicpc
|
||||
self.spec.mpifc = bindir.mpiifort
|
||||
self.spec.mpif77 = bindir.mpiifort
|
||||
else:
|
||||
self.spec.mpicc = bindir.mpicc
|
||||
self.spec.mpicxx = bindir.mpicxx
|
||||
self.spec.mpifc = bindir.mpif90
|
||||
self.spec.mpif77 = bindir.mpif77
|
||||
|
||||
def setup_environment(self, spack_env, run_env):
|
||||
"""Adds environment variables to the generated module file.
|
||||
|
||||
These environment variables come from running:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ source compilers_and_libraries/linux/mpi/intel64/bin/mpivars.sh
|
||||
"""
|
||||
# NOTE: Spack runs setup_environment twice, once pre-build to set up
|
||||
# the build environment, and once post-installation to determine
|
||||
# the environment variables needed at run-time to add to the module
|
||||
# file. The script we need to source is only present post-installation,
|
||||
# so check for its existence before sourcing.
|
||||
# TODO: At some point we should split setup_environment into
|
||||
# setup_build_environment and setup_run_environment to get around
|
||||
# this problem.
|
||||
mpivars = os.path.join(
|
||||
self.prefix.compilers_and_libraries.linux.mpi.intel64.bin,
|
||||
'mpivars.sh')
|
||||
|
||||
if os.path.isfile(mpivars):
|
||||
run_env.extend(EnvironmentModifications.from_sourcing_file(
|
||||
mpivars))
|
||||
|
@@ -22,30 +22,29 @@
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from spack import *
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
|
||||
from spack.pkg.builtin.intel import IntelInstaller, filter_pick, \
|
||||
get_all_components
|
||||
from spack import *
|
||||
from spack.environment import EnvironmentModifications
|
||||
|
||||
|
||||
class IntelParallelStudio(IntelInstaller):
|
||||
class IntelParallelStudio(IntelPackage):
|
||||
"""Intel Parallel Studio."""
|
||||
|
||||
homepage = "https://software.intel.com/en-us/intel-parallel-studio-xe"
|
||||
|
||||
version('professional.2017.4', '27398416078e1e4005afced3e9a6df7e',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/11537/parallel_studio_xe_2017_update4.tgz')
|
||||
version('cluster.2017.4', '27398416078e1e4005afced3e9a6df7e',
|
||||
version('cluster.2017.4', '27398416078e1e4005afced3e9a6df7e',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/11537/parallel_studio_xe_2017_update4.tgz')
|
||||
version('composer.2017.4', 'd03d351809e182c481dc65e07376d9a2',
|
||||
version('composer.2017.4', 'd03d351809e182c481dc65e07376d9a2',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/11541/parallel_studio_xe_2017_update4_composer_edition.tgz')
|
||||
version('professional.2017.3', '691874735458d3e88fe0bcca4438b2a9',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/11460/parallel_studio_xe_2017_update3.tgz')
|
||||
version('cluster.2017.3', '691874735458d3e88fe0bcca4438b2a9',
|
||||
version('cluster.2017.3', '691874735458d3e88fe0bcca4438b2a9',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/11460/parallel_studio_xe_2017_update3.tgz')
|
||||
version('composer.2017.3', '52344df122c17ddff3687f84ceb21623',
|
||||
version('composer.2017.3', '52344df122c17ddff3687f84ceb21623',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/11464/parallel_studio_xe_2017_update3_composer_edition.tgz')
|
||||
version('professional.2017.2', '70e54b33d940a1609ff1d35d3c56e3b3',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/11298/parallel_studio_xe_2017_update2.tgz')
|
||||
@@ -90,34 +89,64 @@ class IntelParallelStudio(IntelInstaller):
|
||||
version('composer.2015.6', 'da9f8600c18d43d58fba0488844f79c9',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/8432/l_compxe_2015.6.233.tgz')
|
||||
|
||||
variant('rpath', default=True, description="Add rpath to .cfg files")
|
||||
# Generic Variants
|
||||
variant('rpath', default=True,
|
||||
description='Add rpath to .cfg files')
|
||||
variant('newdtags', default=False,
|
||||
description="Allow use of --enable-new-dtags in MPI wrappers")
|
||||
variant('all', default=False,
|
||||
description="Install all files with the requested edition")
|
||||
variant('mpi', default=True,
|
||||
description="Install the Intel MPI library and ITAC tool")
|
||||
variant('mkl', default=True, description="Install the Intel MKL library")
|
||||
variant('daal',
|
||||
default=True, description="Install the Intel DAAL libraries")
|
||||
variant('ipp', default=True, description="Install the Intel IPP libraries")
|
||||
variant('tools', default=True, description="Install the Intel Advisor, "
|
||||
"VTune Amplifier, and Inspector tools")
|
||||
description='Allow use of --enable-new-dtags in MPI wrappers')
|
||||
variant('shared', default=True,
|
||||
description='Builds shared library')
|
||||
variant('ilp64', default=False,
|
||||
description='64 bit integers')
|
||||
variant('openmp', default=False,
|
||||
description='OpenMP multithreading layer')
|
||||
|
||||
variant('shared', default=True, description='Builds shared library')
|
||||
variant('ilp64', default=False, description='64 bit integers')
|
||||
variant('openmp', default=False, description='OpenMP multithreading layer')
|
||||
# Components available in all editions
|
||||
variant('daal', default=True,
|
||||
description='Install the Intel DAAL libraries')
|
||||
variant('gdb', default=False,
|
||||
description='Install the Intel Debugger for Heterogeneous Compute')
|
||||
variant('ipp', default=True,
|
||||
description='Install the Intel IPP libraries')
|
||||
variant('mkl', default=True,
|
||||
description='Install the Intel MKL library')
|
||||
variant('mpi', default=True,
|
||||
description='Install the Intel MPI library')
|
||||
variant('tbb', default=True,
|
||||
description='Install the Intel TBB libraries')
|
||||
|
||||
# Components only available in the Professional and Cluster Editions
|
||||
variant('advisor', default=False,
|
||||
description='Install the Intel Advisor')
|
||||
variant('clck', default=False,
|
||||
description='Install the Intel Cluster Checker')
|
||||
variant('inspector', default=False,
|
||||
description='Install the Intel Inspector')
|
||||
variant('itac', default=False,
|
||||
description='Install the Intel Trace Analyzer and Collector')
|
||||
variant('vtune', default=False,
|
||||
description='Install the Intel VTune Amplifier XE')
|
||||
|
||||
provides('mpi', when='@cluster.0:cluster.9999+mpi')
|
||||
provides('mkl', when='+mkl')
|
||||
provides('daal', when='+daal')
|
||||
|
||||
provides('ipp', when='+ipp')
|
||||
|
||||
# virtual dependency
|
||||
provides('blas', when='+mkl')
|
||||
provides('lapack', when='+mkl')
|
||||
provides('mkl', when='+mkl')
|
||||
provides('blas', when='+mkl')
|
||||
provides('lapack', when='+mkl')
|
||||
provides('scalapack', when='+mkl')
|
||||
|
||||
provides('mpi', when='+mpi')
|
||||
|
||||
provides('tbb', when='+tbb')
|
||||
|
||||
# The following components are not available in the Composer Edition
|
||||
conflicts('+advisor', when='@composer.0:composer.9999')
|
||||
conflicts('+clck', when='@composer.0:composer.9999')
|
||||
conflicts('+inspector', when='@composer.0:composer.9999')
|
||||
conflicts('+itac', when='@composer.0:composer.9999')
|
||||
conflicts('+vtune', when='@composer.0:composer.9999')
|
||||
|
||||
@property
|
||||
def blas_libs(self):
|
||||
spec = self.spec
|
||||
@@ -131,15 +160,27 @@ def blas_libs(self):
|
||||
|
||||
mkl_threading = ['libmkl_sequential']
|
||||
|
||||
omp_libs = LibraryList([])
|
||||
|
||||
if '+openmp' in spec:
|
||||
if '%intel' in spec:
|
||||
mkl_threading = ['libmkl_intel_thread', 'libiomp5']
|
||||
else:
|
||||
mkl_threading = ['libmkl_intel_thread']
|
||||
omp_threading = ['libiomp5']
|
||||
|
||||
omp_root = prefix.compilers_and_libraries.linux.lib.intel64
|
||||
omp_libs = find_libraries(
|
||||
omp_threading, root=omp_root, shared=shared)
|
||||
elif '%gcc' in spec:
|
||||
mkl_threading = ['libmkl_gnu_thread']
|
||||
|
||||
gcc = Executable(self.compiler.cc)
|
||||
omp_libs = gcc('--print-file-name', 'libgomp.{0}'.format(
|
||||
dso_suffix), output=str)
|
||||
omp_libs = LibraryList(omp_libs)
|
||||
|
||||
# TODO: TBB threading: ['libmkl_tbb_thread', 'libtbb', 'libstdc++']
|
||||
|
||||
mkl_root = join_path(prefix, 'mkl', 'lib', 'intel64')
|
||||
mkl_root = prefix.compilers_and_libraries.linux.mkl.lib.intel64
|
||||
|
||||
mkl_libs = find_libraries(
|
||||
mkl_integer + ['libmkl_core'] + mkl_threading,
|
||||
@@ -153,7 +194,7 @@ def blas_libs(self):
|
||||
shared=shared
|
||||
)
|
||||
|
||||
return mkl_libs + system_libs
|
||||
return mkl_libs + omp_libs + system_libs
|
||||
|
||||
@property
|
||||
def lapack_libs(self):
|
||||
@@ -176,109 +217,182 @@ def scalapack_libs(self):
|
||||
# elif self.spec.satisfies('^intel-parallel-studio'):
|
||||
# libnames.append('libmkl_blacs_intelmpi')
|
||||
else:
|
||||
raise InstallError("No MPI found for scalapack")
|
||||
raise InstallError('No MPI found for scalapack')
|
||||
|
||||
shared = True if '+shared' in self.spec else False
|
||||
integer = 'ilp64' if '+ilp64' in self.spec else 'lp64'
|
||||
mkl_root = self.prefix.compilers_and_libraries.linux.mkl.lib.intel64
|
||||
shared = True if '+shared' in self.spec else False
|
||||
|
||||
libs = find_libraries(
|
||||
['{0}_{1}'.format(l, integer) for l in libnames],
|
||||
root=join_path(self.prefix, 'mkl', 'lib', 'intel64'),
|
||||
root=mkl_root,
|
||||
shared=shared
|
||||
)
|
||||
return libs
|
||||
|
||||
def install(self, spec, prefix):
|
||||
base_components = "ALL" # when in doubt, install everything
|
||||
mpi_components = ""
|
||||
mkl_components = ""
|
||||
daal_components = ""
|
||||
ipp_components = ""
|
||||
@property
|
||||
def mpi_libs(self):
|
||||
mpi_root = self.prefix.compilers_and_libraries.linux.mpi.lib64
|
||||
query_parameters = self.spec.last_query.extra_parameters
|
||||
libraries = ['libmpifort', 'libmpi']
|
||||
|
||||
if not spec.satisfies('+all'):
|
||||
all_components = get_all_components()
|
||||
regex = '(comp|openmp|intel-tbb|icc|ifort|psxe)'
|
||||
base_components = \
|
||||
filter_pick(all_components, re.compile(regex).search)
|
||||
regex = '(icsxe|imb|mpi|itac|intel-ta|intel-tc|clck)'
|
||||
mpi_components = \
|
||||
filter_pick(all_components, re.compile(regex).search)
|
||||
mkl_components = \
|
||||
filter_pick(all_components, re.compile('(mkl)').search)
|
||||
daal_components = \
|
||||
filter_pick(all_components, re.compile('(daal)').search)
|
||||
ipp_components = \
|
||||
filter_pick(all_components, re.compile('(ipp)').search)
|
||||
regex = '(gdb|vtune|inspector|advisor)'
|
||||
tool_components = \
|
||||
filter_pick(all_components, re.compile(regex).search)
|
||||
components = base_components
|
||||
if 'cxx' in query_parameters:
|
||||
libraries = ['libmpicxx'] + libraries
|
||||
|
||||
if not spec.satisfies('+all'):
|
||||
if spec.satisfies('+mpi'):
|
||||
components += mpi_components
|
||||
if spec.satisfies('+mkl'):
|
||||
components += mkl_components
|
||||
if spec.satisfies('+daal'):
|
||||
components += daal_components
|
||||
if spec.satisfies('+ipp'):
|
||||
components += ipp_components
|
||||
if spec.satisfies('+tools') and (spec.satisfies('@cluster') or
|
||||
spec.satisfies('@professional')):
|
||||
components += tool_components
|
||||
return find_libraries(
|
||||
libraries, root=mpi_root, shared=True, recurse=True
|
||||
)
|
||||
|
||||
if spec.satisfies('+all'):
|
||||
self.intel_components = 'ALL'
|
||||
else:
|
||||
self.intel_components = ';'.join(components)
|
||||
IntelInstaller.install(self, spec, prefix)
|
||||
@property
|
||||
def mpi_headers(self):
|
||||
# recurse from self.prefix will find too many things for all the
|
||||
# supported sub-architectures like 'mic'
|
||||
mpi_root = self.prefix.compilers_and_libraries.linux.mpi.include64
|
||||
return find_headers('mpi', root=mpi_root, recurse=False)
|
||||
|
||||
absbindir = os.path.dirname(
|
||||
os.path.realpath(os.path.join(self.prefix.bin, "icc")))
|
||||
abslibdir = os.path.dirname(
|
||||
os.path.realpath(os.path.join(
|
||||
self.prefix.lib, "intel64", "libimf.a")))
|
||||
@property
|
||||
def components(self):
|
||||
spec = self.spec
|
||||
edition = self.version[0]
|
||||
|
||||
os.symlink(self.global_license_file, os.path.join(absbindir,
|
||||
"license.lic"))
|
||||
if spec.satisfies('+tools') and (spec.satisfies('@cluster') or
|
||||
spec.satisfies('@professional')):
|
||||
inspector_dir = "inspector_xe/licenses"
|
||||
advisor_dir = "advisor_xe/licenses"
|
||||
vtune_amplifier_dir = "vtune_amplifier_xe/licenses"
|
||||
# Intel(R) Compilers
|
||||
components = [
|
||||
# Common files
|
||||
'intel-comp-',
|
||||
'intel-openmp',
|
||||
|
||||
# C/C++
|
||||
'intel-icc',
|
||||
|
||||
# Fortran
|
||||
'intel-ifort',
|
||||
|
||||
# Parallel Studio Documentation and Licensing Files
|
||||
'intel-psxe',
|
||||
]
|
||||
|
||||
# Intel(R) Parallel Studio XE Suite Files and Documentation
|
||||
if edition == 'cluster':
|
||||
components.append('intel-icsxe')
|
||||
elif edition == 'professional':
|
||||
components.extend(['intel-ips', 'intel-ipsc', 'intel-ipsf'])
|
||||
elif edition == 'composer':
|
||||
components.extend([
|
||||
'intel-compxe', 'intel-ccompxe', 'intel-fcompxe'
|
||||
])
|
||||
|
||||
# Intel(R) Data Analytics Acceleration Library
|
||||
if '+daal' in spec:
|
||||
components.append('intel-daal')
|
||||
|
||||
# Intel(R) Debugger for Heterogeneous Compute
|
||||
if '+gdb' in spec:
|
||||
components.append('intel-gdb')
|
||||
|
||||
# Intel(R) Integrated Performance Primitives
|
||||
if '+ipp' in spec:
|
||||
components.extend(['intel-ipp', 'intel-crypto-ipp'])
|
||||
|
||||
# Intel(R) Math Kernel Library
|
||||
if '+mkl' in spec:
|
||||
components.append('intel-mkl')
|
||||
|
||||
# Intel(R) MPI Library
|
||||
if '+mpi' in spec:
|
||||
components.extend(['intel-mpi', 'intel-mpirt', 'intel-imb'])
|
||||
|
||||
# Intel(R) Threading Building Blocks
|
||||
if '+tbb' in spec:
|
||||
components.append('intel-tbb')
|
||||
|
||||
# Intel(R) Advisor
|
||||
if '+advisor' in spec:
|
||||
components.append('intel-advisor')
|
||||
|
||||
# Intel(R) Cluster Checker
|
||||
if '+clck' in spec:
|
||||
components.append('intel_clck')
|
||||
|
||||
# Intel(R) Inspector
|
||||
if '+inspector' in spec:
|
||||
components.append('intel-inspector')
|
||||
|
||||
# Intel(R) Trace Analyzer and Collector
|
||||
if '+itac' in spec:
|
||||
components.extend(['intel-itac', 'intel-ta', 'intel-tc'])
|
||||
|
||||
# Intel(R) VTune(TM) Amplifier XE
|
||||
if '+vtune' in spec:
|
||||
components.append('intel-vtune-amplifier-xe')
|
||||
|
||||
return components
|
||||
|
||||
@property
|
||||
def bin_dir(self):
|
||||
"""The relative path to the bin directory with symlinks resolved."""
|
||||
|
||||
bin_path = os.path.join(self.prefix.bin, 'icc')
|
||||
absolute_path = os.path.realpath(bin_path) # resolve symlinks
|
||||
relative_path = os.path.relpath(absolute_path, self.prefix)
|
||||
return os.path.dirname(relative_path)
|
||||
|
||||
@property
|
||||
def lib_dir(self):
|
||||
"""The relative path to the lib directory with symlinks resolved."""
|
||||
|
||||
lib_path = os.path.join(self.prefix.lib, 'intel64', 'libimf.a')
|
||||
absolute_path = os.path.realpath(lib_path) # resolve symlinks
|
||||
relative_path = os.path.relpath(absolute_path, self.prefix)
|
||||
return os.path.dirname(relative_path)
|
||||
|
||||
@property
|
||||
def license_files(self):
|
||||
spec = self.spec
|
||||
year = self.version[1]
|
||||
|
||||
directories = [
|
||||
'Licenses',
|
||||
self.bin_dir
|
||||
]
|
||||
|
||||
if '+advisor' in spec:
|
||||
advisor_dir = 'advisor_xe/licenses'
|
||||
|
||||
year = int(str(self.version).split('.')[1])
|
||||
if year >= 2017:
|
||||
inspector_dir = "inspector/licenses"
|
||||
advisor_dir = "advisor/licenses"
|
||||
advisor_dir = 'advisor/licenses'
|
||||
|
||||
os.mkdir(os.path.join(self.prefix, inspector_dir))
|
||||
os.symlink(self.global_license_file, os.path.join(
|
||||
self.prefix, inspector_dir, "license.lic"))
|
||||
os.mkdir(os.path.join(self.prefix, advisor_dir))
|
||||
os.symlink(self.global_license_file, os.path.join(
|
||||
self.prefix, advisor_dir, "license.lic"))
|
||||
os.mkdir(os.path.join(self.prefix, vtune_amplifier_dir))
|
||||
os.symlink(self.global_license_file, os.path.join(
|
||||
self.prefix, vtune_amplifier_dir, "license.lic"))
|
||||
directories.append(advisor_dir)
|
||||
|
||||
if (spec.satisfies('+all') or spec.satisfies('+mpi')) and \
|
||||
spec.satisfies('@cluster'):
|
||||
for ifile in os.listdir(os.path.join(self.prefix, "itac")):
|
||||
if os.path.isdir(os.path.join(self.prefix, "itac", ifile)):
|
||||
os.symlink(self.global_license_file,
|
||||
os.path.join(self.prefix, "itac", ifile,
|
||||
"license.lic"))
|
||||
if os.path.isdir(os.path.join(self.prefix, "itac",
|
||||
ifile, "intel64")):
|
||||
os.symlink(self.global_license_file,
|
||||
os.path.join(self.prefix, "itac",
|
||||
ifile, "intel64",
|
||||
"license.lic"))
|
||||
if spec.satisfies('~newdtags'):
|
||||
wrappers = ["mpif77", "mpif77", "mpif90", "mpif90",
|
||||
"mpigcc", "mpigcc", "mpigxx", "mpigxx",
|
||||
"mpiicc", "mpiicc", "mpiicpc", "mpiicpc",
|
||||
"mpiifort", "mpiifort"]
|
||||
if '+inspector' in spec:
|
||||
inspector_dir = 'inspector_xe/licenses'
|
||||
|
||||
if year >= 2017:
|
||||
inspector_dir = 'inspector/licenses'
|
||||
|
||||
directories.append(inspector_dir)
|
||||
|
||||
if '+itac' in spec:
|
||||
itac_dir = 'itac_{0}'.format(year)
|
||||
|
||||
directories.append(itac_dir)
|
||||
|
||||
if '+vtune' in spec:
|
||||
vtune_dir = 'vtune_amplifier_xe/licenses'
|
||||
|
||||
directories.append(vtune_dir)
|
||||
|
||||
return [os.path.join(dir, 'license.lic') for dir in directories]
|
||||
|
||||
@run_after('install')
|
||||
def filter_compiler_wrappers(self):
|
||||
spec = self.spec
|
||||
|
||||
if '+mpi' in spec:
|
||||
if '~newdtags' in spec:
|
||||
wrappers = [
|
||||
'mpif77', 'mpif90', 'mpigcc', 'mpigxx',
|
||||
'mpiicc', 'mpiicpc', 'mpiifort'
|
||||
]
|
||||
wrapper_paths = []
|
||||
for root, dirs, files in os.walk(spec.prefix):
|
||||
for name in files:
|
||||
@@ -286,153 +400,95 @@ def install(self, spec, prefix):
|
||||
wrapper_paths.append(os.path.join(spec.prefix,
|
||||
root, name))
|
||||
for wrapper in wrapper_paths:
|
||||
filter_file(r'-Xlinker --enable-new-dtags', r' ',
|
||||
wrapper)
|
||||
filter_file('-Xlinker --enable-new-dtags', ' ',
|
||||
wrapper, string=True)
|
||||
|
||||
if spec.satisfies('+rpath'):
|
||||
for compiler_command in ["icc", "icpc", "ifort"]:
|
||||
cfgfilename = os.path.join(absbindir, "%s.cfg" %
|
||||
compiler_command)
|
||||
with open(cfgfilename, "w") as f:
|
||||
f.write('-Xlinker -rpath -Xlinker %s\n' % abslibdir)
|
||||
@run_after('install')
|
||||
def rpath_configuration(self):
|
||||
spec = self.spec
|
||||
|
||||
os.symlink(os.path.join(self.prefix.man, "common", "man1"),
|
||||
os.path.join(self.prefix.man, "man1"))
|
||||
if '+rpath' in spec:
|
||||
lib_dir = os.path.join(self.prefix, self.lib_dir)
|
||||
for compiler in ['icc', 'icpc', 'ifort']:
|
||||
cfgfilename = os.path.join(
|
||||
self.prefix, self.bin_dir, '{0}.cfg'.format(compiler))
|
||||
with open(cfgfilename, 'w') as f:
|
||||
f.write('-Xlinker -rpath -Xlinker {0}\n'.format(lib_dir))
|
||||
|
||||
def setup_environment(self, spack_env, run_env):
|
||||
# TODO: Determine variables needed for the professional edition.
|
||||
@run_after('install')
|
||||
def fix_psxevars(self):
|
||||
"""Newer versions of Intel Parallel Studio have a bug in the
|
||||
``psxevars.sh`` script."""
|
||||
|
||||
major_ver = self.version[1]
|
||||
bindir = glob.glob(join_path(
|
||||
self.prefix, 'parallel_studio*', 'bin'))[0]
|
||||
|
||||
# Remove paths that were guessed but are incorrect for this package.
|
||||
run_env.remove_path('LIBRARY_PATH',
|
||||
join_path(self.prefix, 'lib'))
|
||||
run_env.remove_path('LD_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'lib'))
|
||||
run_env.remove_path('CPATH',
|
||||
join_path(self.prefix, 'include'))
|
||||
|
||||
# Add the default set of variables
|
||||
run_env.prepend_path('LIBRARY_PATH',
|
||||
join_path(self.prefix, 'lib', 'intel64'))
|
||||
run_env.prepend_path('LD_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'lib', 'intel64'))
|
||||
run_env.prepend_path('LIBRARY_PATH',
|
||||
join_path(self.prefix, 'tbb', 'lib',
|
||||
'intel64', 'gcc4.4'))
|
||||
run_env.prepend_path('LD_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'tbb', 'lib',
|
||||
'intel64', 'gcc4.4'))
|
||||
run_env.prepend_path('CPATH',
|
||||
join_path(self.prefix, 'tbb', 'include'))
|
||||
run_env.prepend_path('MIC_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'lib', 'mic'))
|
||||
run_env.prepend_path('MIC_LD_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'lib', 'mic'))
|
||||
run_env.prepend_path('MIC_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'tbb', 'lib', 'mic'))
|
||||
run_env.prepend_path('MIC_LD_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'tbb', 'lib', 'mic'))
|
||||
|
||||
if self.spec.satisfies('+all'):
|
||||
run_env.prepend_path('LD_LIBRARY_PATH',
|
||||
join_path(self.prefix,
|
||||
'debugger_{0}'.format(major_ver),
|
||||
'libipt', 'intel64', 'lib'))
|
||||
run_env.set('GDBSERVER_MIC',
|
||||
join_path(self.prefix,
|
||||
'debugger_{0}'.format(major_ver), 'gdb',
|
||||
'targets', 'mic', 'bin', 'gdbserver'))
|
||||
run_env.set('GDB_CROSS',
|
||||
join_path(self.prefix,
|
||||
'debugger_{0}'.format(major_ver),
|
||||
'gdb', 'intel64_mic', 'bin', 'gdb-mic'))
|
||||
run_env.set('MPM_LAUNCHER',
|
||||
join_path(self.prefix,
|
||||
'debugger_{0}'.format(major_ver), 'mpm',
|
||||
'mic',
|
||||
'bin', 'start_mpm.sh'))
|
||||
run_env.set('INTEL_PYTHONHOME',
|
||||
join_path(self.prefix,
|
||||
'debugger_{0}'.format(major_ver), 'python',
|
||||
'intel64'))
|
||||
|
||||
if (self.spec.satisfies('+all') or self.spec.satisfies('+mpi')):
|
||||
# Only I_MPI_ROOT is set here because setting the various PATH
|
||||
# variables will potentially be in conflict with other MPI
|
||||
# environment modules. The I_MPI_ROOT environment variable can be
|
||||
# used as a base to set necessary PATH variables for using Intel
|
||||
# MPI. It is also possible to set the variables in the modules.yaml
|
||||
# file if Intel MPI is the dominant, or only, MPI on a system.
|
||||
run_env.set('I_MPI_ROOT', join_path(self.prefix, 'impi'))
|
||||
|
||||
if self.spec.satisfies('+all') or self.spec.satisfies('+mkl'):
|
||||
spack_env.set('MKLROOT', join_path(self.prefix, 'mkl'))
|
||||
|
||||
run_env.prepend_path('LD_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'mkl', 'lib',
|
||||
'intel64'))
|
||||
run_env.prepend_path('LIBRARY_PATH',
|
||||
join_path(self.prefix, 'mkl', 'lib',
|
||||
'intel64'))
|
||||
run_env.prepend_path('CPATH',
|
||||
join_path(self.prefix, 'mkl', 'include'))
|
||||
run_env.prepend_path('MIC_LD_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'mkl', 'lib', 'mic'))
|
||||
run_env.set('MKLROOT', join_path(self.prefix, 'mkl'))
|
||||
|
||||
if self.spec.satisfies('+all') or self.spec.satisfies('+daal'):
|
||||
run_env.prepend_path('LD_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'daal', 'lib',
|
||||
'intel64_lin'))
|
||||
run_env.prepend_path('LIBRARY_PATH',
|
||||
join_path(self.prefix, 'daal', 'lib',
|
||||
'intel64_lin'))
|
||||
run_env.prepend_path('CPATH',
|
||||
join_path(self.prefix, 'daal', 'include'))
|
||||
run_env.prepend_path('CLASSPATH',
|
||||
join_path(self.prefix, 'daal', 'lib',
|
||||
'daal.jar'))
|
||||
run_env.set('DAALROOT', join_path(self.prefix, 'daal'))
|
||||
|
||||
if self.spec.satisfies('+all') or self.spec.satisfies('+ipp'):
|
||||
run_env.prepend_path('LD_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'ipp', 'lib',
|
||||
'intel64'))
|
||||
run_env.prepend_path('LIBRARY_PATH',
|
||||
join_path(self.prefix, 'ipp', 'lib',
|
||||
'intel64'))
|
||||
run_env.prepend_path('CPATH',
|
||||
join_path(self.prefix, 'ipp', 'include'))
|
||||
run_env.prepend_path('MIC_LD_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'ipp', 'lib', 'mic'))
|
||||
run_env.set('IPPROOT', join_path(self.prefix, 'ipp'))
|
||||
|
||||
if self.spec.satisfies('+all') or self.spec.satisfies('+tools'):
|
||||
run_env.prepend_path('PATH',
|
||||
join_path(self.prefix, 'vtune_amplifier_xe',
|
||||
'bin64'))
|
||||
run_env.prepend_path('VTUNE_AMPLIFIER_XE_{0}_DIR'.format(
|
||||
major_ver),
|
||||
join_path(self.prefix, 'vtune_amplifier_xe'))
|
||||
filter_file('^SCRIPTPATH=.*', 'SCRIPTPATH={0}'.format(self.prefix),
|
||||
os.path.join(bindir, 'psxevars.sh'),
|
||||
os.path.join(bindir, 'psxevars.csh'))
|
||||
|
||||
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
|
||||
spack_env.set('I_MPI_CC', spack_cc)
|
||||
spack_env.set('I_MPI_CXX', spack_cxx)
|
||||
spack_env.set('I_MPI_F77', spack_fc)
|
||||
spack_env.set('I_MPI_F90', spack_f77)
|
||||
spack_env.set('I_MPI_FC', spack_fc)
|
||||
if '+mpi' in self.spec:
|
||||
spack_env.set('I_MPI_CC', spack_cc)
|
||||
spack_env.set('I_MPI_CXX', spack_cxx)
|
||||
spack_env.set('I_MPI_F77', spack_fc)
|
||||
spack_env.set('I_MPI_F90', spack_f77)
|
||||
spack_env.set('I_MPI_FC', spack_fc)
|
||||
|
||||
# set up MKLROOT for everyone using MKL package
|
||||
if '+mkl' in self.spec:
|
||||
mkl_root = self.prefix.compilers_and_libraries.linux.mkl.lib.intel64 # noqa
|
||||
|
||||
spack_env.set('MKLROOT', self.prefix)
|
||||
spack_env.append_path('SPACK_COMPILER_EXTRA_RPATHS', mkl_root)
|
||||
|
||||
def setup_dependent_package(self, module, dep_spec):
|
||||
# Check for presence of bin64 or bin directory
|
||||
if os.path.isdir(self.prefix.bin):
|
||||
bindir = self.prefix.bin
|
||||
elif os.path.isdir(self.prefix.bin64):
|
||||
bindir = self.prefix.bin64
|
||||
else:
|
||||
raise RuntimeError('No suitable bindir found')
|
||||
if '+mpi' in self.spec:
|
||||
# Intel comes with 2 different flavors of MPI wrappers:
|
||||
#
|
||||
# * mpiicc, mpiicpc, and mpifort are hardcoded to wrap around
|
||||
# the Intel compilers.
|
||||
# * mpicc, mpicxx, mpif90, and mpif77 allow you to set which
|
||||
# compilers to wrap using I_MPI_CC and friends. By default,
|
||||
# wraps around the GCC compilers.
|
||||
#
|
||||
# In theory, these should be equivalent as long as I_MPI_CC
|
||||
# and friends are set to point to the Intel compilers, but in
|
||||
# practice, mpicc fails to compile some applications while
|
||||
# mpiicc works.
|
||||
bindir = self.prefix.compilers_and_libraries.linux.mpi.intel64.bin
|
||||
|
||||
self.spec.mpicc = join_path(bindir, 'mpicc')
|
||||
self.spec.mpicxx = join_path(bindir, 'mpic++')
|
||||
self.spec.mpifc = join_path(bindir, 'mpif90')
|
||||
self.spec.mpif77 = join_path(bindir, 'mpif77')
|
||||
if self.compiler.name == 'intel':
|
||||
self.spec.mpicc = bindir.mpiicc
|
||||
self.spec.mpicxx = bindir.mpiicpc
|
||||
self.spec.mpifc = bindir.mpiifort
|
||||
self.spec.mpif77 = bindir.mpiifort
|
||||
else:
|
||||
self.spec.mpicc = bindir.mpicc
|
||||
self.spec.mpicxx = bindir.mpicxx
|
||||
self.spec.mpifc = bindir.mpif90
|
||||
self.spec.mpif77 = bindir.mpif77
|
||||
|
||||
def setup_environment(self, spack_env, run_env):
|
||||
"""Adds environment variables to the generated module file.
|
||||
|
||||
These environment variables come from running:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ source parallel_studio_xe_2017/bin/psxevars.sh intel64
|
||||
"""
|
||||
# NOTE: Spack runs setup_environment twice, once pre-build to set up
|
||||
# the build environment, and once post-installation to determine
|
||||
# the environment variables needed at run-time to add to the module
|
||||
# file. The script we need to source is only present post-installation,
|
||||
# so check for its existence before sourcing.
|
||||
# TODO: At some point we should split setup_environment into
|
||||
# setup_build_environment and setup_run_environment to get around
|
||||
# this problem.
|
||||
psxevars = glob.glob(join_path(
|
||||
self.prefix, 'parallel_studio*', 'bin', 'psxevars.sh'))
|
||||
|
||||
if psxevars:
|
||||
run_env.extend(EnvironmentModifications.from_sourcing_file(
|
||||
psxevars[0], 'intel64'))
|
||||
|
@@ -26,7 +26,7 @@
|
||||
import glob
|
||||
|
||||
|
||||
class Tbb(Package):
|
||||
class IntelTbb(Package):
|
||||
"""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
|
||||
@@ -47,6 +47,8 @@ class Tbb(Package):
|
||||
version('4.4.3', '80707e277f69d9b20eeebdd7a5f5331137868ce1',
|
||||
url='https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb44_20160128oss_src_0.tgz')
|
||||
|
||||
provides('tbb')
|
||||
|
||||
def coerce_to_spack(self, tbb_build_subdir):
|
||||
for compiler in ["icc", "gcc", "clang"]:
|
||||
fs = glob.glob(join_path(tbb_build_subdir,
|
@@ -22,102 +22,13 @@
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from spack import *
|
||||
import os
|
||||
import re
|
||||
|
||||
from spack import *
|
||||
from spack.environment import EnvironmentModifications
|
||||
|
||||
|
||||
def filter_pick(input_list, regex_filter):
|
||||
"""Returns the items in input_list that are found in the regex_filter"""
|
||||
return [l for l in input_list for m in (regex_filter(l),) if m]
|
||||
|
||||
|
||||
def unfilter_pick(input_list, regex_filter):
|
||||
"""Returns the items in input_list that are not found in the
|
||||
regex_filter"""
|
||||
return [l for l in input_list for m in (regex_filter(l),) if not m]
|
||||
|
||||
|
||||
def get_all_components():
|
||||
"""Returns a list of all the components associated with the downloaded
|
||||
Intel package"""
|
||||
all_components = []
|
||||
with open("pset/mediaconfig.xml", "r") as f:
|
||||
lines = f.readlines()
|
||||
for line in lines:
|
||||
if line.find('<Abbr>') != -1:
|
||||
component = line[line.find('<Abbr>') + 6:line.find('</Abbr>')]
|
||||
all_components.append(component)
|
||||
return all_components
|
||||
|
||||
|
||||
class IntelInstaller(Package):
|
||||
"""Base package containing common methods for installing Intel software"""
|
||||
|
||||
homepage = "https://software.intel.com/en-us"
|
||||
intel_components = "ALL"
|
||||
license_comment = '#'
|
||||
license_files = ['Licenses/license.lic']
|
||||
license_vars = ['INTEL_LICENSE_FILE']
|
||||
license_url = \
|
||||
'https://software.intel.com/en-us/articles/intel-license-manager-faq'
|
||||
|
||||
@property
|
||||
def license_required(self):
|
||||
# The Intel libraries are provided without requiring a license as of
|
||||
# version 2017.2. Trying to specify the license will fail. See
|
||||
# https://software.intel.com/en-us/articles/free-mkl
|
||||
if (self.spec.satisfies("intel-mkl@2017.2:") or
|
||||
self.spec.satisfies("intel-daal@2017.2:") or
|
||||
self.spec.satisfies("intel-mpi@2017.2:") or
|
||||
self.spec.satisfies("intel-ipp@2017.2:")):
|
||||
return False
|
||||
return True
|
||||
|
||||
@property
|
||||
def global_license_file(self):
|
||||
"""Returns the path where a global license file should be stored."""
|
||||
if not self.license_files:
|
||||
return
|
||||
return join_path(self.global_license_dir, "intel",
|
||||
os.path.basename(self.license_files[0]))
|
||||
|
||||
def install(self, spec, prefix):
|
||||
|
||||
if not hasattr(self, "intel_prefix"):
|
||||
self.intel_prefix = self.prefix
|
||||
|
||||
silent_config_filename = 'silent.cfg'
|
||||
with open(silent_config_filename, 'w') as f:
|
||||
f.write("""
|
||||
ACCEPT_EULA=accept
|
||||
PSET_MODE=install
|
||||
CONTINUE_WITH_INSTALLDIR_OVERWRITE=yes
|
||||
PSET_INSTALL_DIR=%s
|
||||
NONRPM_DB_DIR=%s
|
||||
CONTINUE_WITH_OPTIONAL_ERROR=yes
|
||||
COMPONENTS=%s
|
||||
""" % (self.intel_prefix, self.intel_prefix, self.intel_components))
|
||||
|
||||
# The Intel libraries are provided without requiring a license as of
|
||||
# version 2017.2. Trying to specify the license will fail. See
|
||||
# https://software.intel.com/en-us/articles/free-mkl
|
||||
if not (spec.satisfies("intel-mkl@2017.2:") or
|
||||
spec.satisfies("intel-daal@2017.2:") or
|
||||
spec.satisfies("intel-mpi@2017.2:") or
|
||||
spec.satisfies("intel-ipp@2017.2:")):
|
||||
with open(silent_config_filename, 'a') as f:
|
||||
f.write("""
|
||||
ACTIVATION_LICENSE_FILE=%s
|
||||
ACTIVATION_TYPE=license_file
|
||||
PHONEHOME_SEND_USAGE_DATA=no
|
||||
""" % (self.global_license_file))
|
||||
|
||||
install_script = Executable("./install.sh")
|
||||
install_script('--silent', silent_config_filename)
|
||||
|
||||
|
||||
class Intel(IntelInstaller):
|
||||
class Intel(IntelPackage):
|
||||
"""Intel Compilers."""
|
||||
|
||||
homepage = "https://software.intel.com/en-us/intel-parallel-studio-xe"
|
||||
@@ -126,77 +37,72 @@ class Intel(IntelInstaller):
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/11541/parallel_studio_xe_2017_update4_composer_edition.tgz')
|
||||
version('17.0.3', '52344df122c17ddff3687f84ceb21623',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/11464/parallel_studio_xe_2017_update3_composer_edition.tgz')
|
||||
version('17.0.2', '2891ab1ece43eb61b6ab892f07c47f01',
|
||||
version('17.0.2', '2891ab1ece43eb61b6ab892f07c47f01',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/11302/parallel_studio_xe_2017_update2_composer_edition.tgz')
|
||||
version('17.0.1', '1f31976931ed8ec424ac7c3ef56f5e85',
|
||||
version('17.0.1', '1f31976931ed8ec424ac7c3ef56f5e85',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/10978/parallel_studio_xe_2017_update1_composer_edition.tgz')
|
||||
version('17.0.0', 'b67da0065a17a05f110ed1d15c3c6312',
|
||||
version('17.0.0', 'b67da0065a17a05f110ed1d15c3c6312',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/9656/parallel_studio_xe_2017_composer_edition.tgz')
|
||||
version('16.0.4', '2bc9bfc9be9c1968a6e42efb4378f40e',
|
||||
version('16.0.4', '2bc9bfc9be9c1968a6e42efb4378f40e',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/9785/parallel_studio_xe_2016_composer_edition_update4.tgz')
|
||||
version('16.0.3', '3208eeabee951fc27579177b593cefe9',
|
||||
version('16.0.3', '3208eeabee951fc27579177b593cefe9',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/9063/parallel_studio_xe_2016_composer_edition_update3.tgz')
|
||||
version('16.0.2', '1133fb831312eb519f7da897fec223fa',
|
||||
version('16.0.2', '1133fb831312eb519f7da897fec223fa',
|
||||
url='http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/8680/parallel_studio_xe_2016_composer_edition_update2.tgz')
|
||||
|
||||
variant('rpath', default=True, description="Add rpath to .cfg files")
|
||||
variant('rpath', default=True, description='Add rpath to .cfg files')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
components = []
|
||||
all_components = get_all_components()
|
||||
regex = '(comp|openmp|intel-tbb|icc|ifort|psxe|icsxe-pset)'
|
||||
components = filter_pick(all_components, re.compile(regex).search)
|
||||
components = [
|
||||
# Common files
|
||||
'intel-comp-',
|
||||
'intel-openmp',
|
||||
|
||||
self.intel_components = ';'.join(components)
|
||||
IntelInstaller.install(self, spec, prefix)
|
||||
# C/C++
|
||||
'intel-icc',
|
||||
|
||||
absbindir = os.path.split(os.path.realpath(os.path.join(
|
||||
self.prefix.bin, "icc")))[0]
|
||||
abslibdir = os.path.split(os.path.realpath(os.path.join(
|
||||
self.prefix.lib, "intel64", "libimf.a")))[0]
|
||||
# Fortran
|
||||
'intel-ifort',
|
||||
]
|
||||
|
||||
# symlink or copy?
|
||||
os.symlink(self.global_license_file,
|
||||
os.path.join(absbindir, "license.lic"))
|
||||
@property
|
||||
def license_files(self):
|
||||
return [
|
||||
'Licenses/license.lic',
|
||||
join_path('compilers_and_libraries', 'linux', 'bin',
|
||||
'intel64', 'license.lic')
|
||||
]
|
||||
|
||||
if spec.satisfies('+rpath'):
|
||||
for compiler_command in ["icc", "icpc", "ifort"]:
|
||||
cfgfilename = os.path.join(absbindir, "%s.cfg" %
|
||||
compiler_command)
|
||||
with open(cfgfilename, "w") as f:
|
||||
f.write('-Xlinker -rpath -Xlinker %s\n' % abslibdir)
|
||||
|
||||
os.symlink(os.path.join(self.prefix.man, "common", "man1"),
|
||||
os.path.join(self.prefix.man, "man1"))
|
||||
@run_after('install')
|
||||
def rpath_configuration(self):
|
||||
if '+rpath' in self.spec:
|
||||
bin_dir = join_path(self.prefix, 'compilers_and_libraries',
|
||||
'linux', 'bin', 'intel64')
|
||||
lib_dir = join_path(self.prefix, 'compilers_and_libraries',
|
||||
'linux', 'compiler', 'lib', 'intel64_lin')
|
||||
for compiler in ['icc', 'icpc', 'ifort']:
|
||||
cfgfilename = join_path(bin_dir, '{0}.cfg'.format(compiler))
|
||||
with open(cfgfilename, 'w') as f:
|
||||
f.write('-Xlinker -rpath -Xlinker {0}\n'.format(lib_dir))
|
||||
|
||||
def setup_environment(self, spack_env, run_env):
|
||||
"""Adds environment variables to the generated module file.
|
||||
|
||||
# Remove paths that were guessed but are incorrect for this package.
|
||||
run_env.remove_path('LIBRARY_PATH',
|
||||
join_path(self.prefix, 'lib'))
|
||||
run_env.remove_path('LD_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'lib'))
|
||||
run_env.remove_path('CPATH',
|
||||
join_path(self.prefix, 'include'))
|
||||
These environment variables come from running:
|
||||
|
||||
# Add the default set of variables
|
||||
run_env.prepend_path('LIBRARY_PATH',
|
||||
join_path(self.prefix, 'lib', 'intel64'))
|
||||
run_env.prepend_path('LD_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'lib', 'intel64'))
|
||||
run_env.prepend_path('LIBRARY_PATH',
|
||||
join_path(self.prefix, 'tbb', 'lib',
|
||||
'intel64', 'gcc4.4'))
|
||||
run_env.prepend_path('LD_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'tbb', 'lib',
|
||||
'intel64', 'gcc4.4'))
|
||||
run_env.prepend_path('CPATH',
|
||||
join_path(self.prefix, 'tbb', 'include'))
|
||||
run_env.prepend_path('MIC_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'lib', 'mic'))
|
||||
run_env.prepend_path('MIC_LD_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'lib', 'mic'))
|
||||
run_env.prepend_path('MIC_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'tbb', 'lib', 'mic'))
|
||||
run_env.prepend_path('MIC_LD_LIBRARY_PATH',
|
||||
join_path(self.prefix, 'tbb', 'lib', 'mic'))
|
||||
.. code-block:: console
|
||||
|
||||
$ source bin/compilervars.sh intel64
|
||||
"""
|
||||
# NOTE: Spack runs setup_environment twice, once pre-build to set up
|
||||
# the build environment, and once post-installation to determine
|
||||
# the environment variables needed at run-time to add to the module
|
||||
# file. The script we need to source is only present post-installation,
|
||||
# so check for its existence before sourcing.
|
||||
# TODO: At some point we should split setup_environment into
|
||||
# setup_build_environment and setup_run_environment to get around
|
||||
# this problem.
|
||||
compilervars = os.path.join(self.prefix.bin, 'compilervars.sh')
|
||||
|
||||
if os.path.isfile(compilervars):
|
||||
run_env.extend(EnvironmentModifications.from_sourcing_file(
|
||||
compilervars, 'intel64'))
|
||||
|
Reference in New Issue
Block a user