From f57626a7c4a05cc11972a43eba498a943b17a08d Mon Sep 17 00:00:00 2001 From: Robert Cohn Date: Mon, 22 Mar 2021 20:35:45 -0400 Subject: Oneapi packages: update URLs, environment management, and dependencies (#22202) * Replace URL computation in base IntelOneApiPackage class with defining URLs in component packages (this is expected to be simpler for now) * Add component_dir property that all oneAPI component packages must define. This property names a directory that should exist after installation completes (useful for making sure the install was successful) and also defines the search location for the component's environment update script. * Add needed dependencies for components (e.g. intel-oneapi-dnn requires intel-oneapi-tbb). The compilers provided by intel-oneapi-compilers need some components under certain circumstances (e.g. when enabling SYCL support) but these were omitted since the libraries should only be linked when a dependent package requests that feature * Remove individual setup_run_environment implementations and use IntelOneApiPackage superclass method which sources vars.sh (located in a subdirectory of component_dir) * Add documentation for IntelOneApiPackge build system Co-authored-by: Vasily Danilin --- lib/spack/docs/build_systems.rst | 1 + .../docs/build_systems/inteloneapipackage.rst | 137 +++++++++++++++++++++ lib/spack/docs/build_systems/intelpackage.rst | 5 + lib/spack/spack/build_systems/oneapi.py | 78 ++++++------ .../builtin/packages/intel-oneapi-ccl/package.py | 21 ++-- .../packages/intel-oneapi-compilers/package.py | 104 ++++++++-------- .../builtin/packages/intel-oneapi-dal/package.py | 24 ++-- .../builtin/packages/intel-oneapi-dnn/package.py | 22 ++-- .../builtin/packages/intel-oneapi-ipp/package.py | 21 ++-- .../builtin/packages/intel-oneapi-ippcp/package.py | 20 +-- .../builtin/packages/intel-oneapi-mkl/package.py | 44 ++----- .../builtin/packages/intel-oneapi-mpi/package.py | 58 +++------ .../builtin/packages/intel-oneapi-tbb/package.py | 40 ++---- .../builtin/packages/intel-oneapi-vpl/package.py | 19 ++- 14 files changed, 341 insertions(+), 253 deletions(-) create mode 100644 lib/spack/docs/build_systems/inteloneapipackage.rst diff --git a/lib/spack/docs/build_systems.rst b/lib/spack/docs/build_systems.rst index 784730ce40..59b9bb643a 100644 --- a/lib/spack/docs/build_systems.rst +++ b/lib/spack/docs/build_systems.rst @@ -59,6 +59,7 @@ on these ideas for each distinct build system that Spack supports: build_systems/bundlepackage build_systems/cudapackage + build_systems/inteloneapipackage build_systems/intelpackage build_systems/rocmpackage build_systems/custompackage diff --git a/lib/spack/docs/build_systems/inteloneapipackage.rst b/lib/spack/docs/build_systems/inteloneapipackage.rst new file mode 100644 index 0000000000..036fc738ad --- /dev/null +++ b/lib/spack/docs/build_systems/inteloneapipackage.rst @@ -0,0 +1,137 @@ +.. Copyright 2013-2021 Lawrence Livermore National Security, LLC and other + Spack Project Developers. See the top-level COPYRIGHT file for details. + + SPDX-License-Identifier: (Apache-2.0 OR MIT) + +.. _inteloneapipackage: + + +==================== + IntelOneapiPackage +==================== + + +.. contents:: + + +oneAPI packages in Spack +======================== + +Spack can install and use the Intel oneAPI products. You may either +use spack to install the oneAPI tools or use the `Intel +installers`_. After installation, you may use the tools directly, or +use Spack to build packages with the tools. + +The Spack Python class ``IntelOneapiPackage`` is a base class that is +used by ``IntelOneapiCompilers``, ``IntelOneapiMkl``, +``IntelOneapiTbb`` and other classes to implement the oneAPI +packages. See the :ref: for the full list of available +oneAPI packages or use:: + + spack list -d oneAPI + +For more information on a specific package, do:: + + spack info + +Intel no longer releases new versions of Parallel Studio, which can be +used in Spack via the :ref:. All of its components can +now be found in oneAPI. + +Example +======= + +We start with a simple example that will be sufficient for most +users. Install the oneAPI compilers:: + + spack install intel-oneapi-compilers + +Add the oneAPI compilers to the set of compilers that Spack can use:: + + spack compiler add `spack location -i intel-oneapi-compilers`/compiler/latest/linux/bin/intel64 + spack compiler add `spack location -i intel-oneapi-compilers`/compiler/latest/linux/bin + +This adds the compilers to your ``compilers.yaml``. Verify that the +compilers are available:: + + spack compiler list + +The ``intel-oneapi-compilers`` package includes 2 families of +compilers: + +* ``intel``: ``icc``, ``icpc``, ``ifort``. Intel's *classic* + compilers. +* ``oneapi``: ``icx``, ``icpx``, ``ifx``. Intel's new generation of + compilers based on LLVM. + +To build the ``patchelf`` Spack package with ``icc``, do:: + + spack install patchelf%intel + +To build with with ``icx``, do :: + + spack install patchelf%oneapi + +In addition to compilers, oneAPI contains many libraries. The ``hdf5`` +package works with any compatible MPI implementation. To build +``hdf5`` with Intel oneAPI MPI do:: + + spack install hdf5 +mpi ^intel-oneapi-mpi + +Using an Externally Installed oneAPI +==================================== + +Spack can also use oneAPI tools that are manually installed with +`Intel Installers`_. The procedures for configuring Spack to use +external compilers and libraries are different. + +Compilers +--------- + +To use the compilers, add some information about the installation to +``compilers.yaml``. For most users, it is sufficient to do:: + + spack compiler add /opt/intel/oneapi/compiler/latest/linux/bin/intel64 + spack compiler add /opt/intel/oneapi/compiler/latest/linux/bin + +Adapt the paths above if you did not install the tools in the default +location. After adding the compilers, using them in Spack will be +exactly the same as if you had installed the +``intel-oneapi-compilers`` package. Another option is to manually add +the configuration to ``compilers.yaml`` as described in :ref:`Compiler +configuration `. + + +Using oneAPI Tools Installed by Spack +===================================== + +Spack can be a convenient way to install and configure compilers and +libaries, even if you do not intend to build a Spack package. If you +want to build a Makefile project using Spack-installed oneAPI compilers, +then use spack to configure your environment:: + + spack load intel-oneapi-compilers + +And then you can build with:: + + CXX=icpx make + +You can also use Spack-installed libraries. For example:: + + spack load intel-oneapi-mkl + +Will update your environment CPATH, LIBRARY_PATH, and other +environment variables for building an application with MKL. + +More information +================ + +This section describes basic use of oneAPI, especially if it has +changed compared to Parallel Studio. See :ref: for more +information on :ref:, +:ref:, +:ref:, and +:ref:. + + +.. _`Intel installers`: https://software.intel.com/content/www/us/en/develop/documentation/installation-guide-for-intel-oneapi-toolkits-linux/top.html diff --git a/lib/spack/docs/build_systems/intelpackage.rst b/lib/spack/docs/build_systems/intelpackage.rst index 2c1723bbbc..2d7187bf81 100644 --- a/lib/spack/docs/build_systems/intelpackage.rst +++ b/lib/spack/docs/build_systems/intelpackage.rst @@ -137,6 +137,7 @@ If you need to save disk space or installation time, you could install the ``intel`` compilers-only subset (0.6 GB) and just the library packages you need, for example ``intel-mpi`` (0.5 GB) and ``intel-mkl`` (2.5 GB). +.. _intel-unrelated-packages: """""""""""""""""""" Unrelated packages @@ -358,6 +359,8 @@ affected by an advanced third method: Next, visit section `Selecting Intel Compilers`_ to learn how to tell Spack to use the newly configured compilers. +.. _intel-integrating-external-libraries: + """""""""""""""""""""""""""""""""" Integrating external libraries """""""""""""""""""""""""""""""""" @@ -834,6 +837,7 @@ for example: compiler: [ intel@18, intel@17, gcc@4.4.7, gcc@4.9.3, gcc@7.3.0, ] +.. _intel-virtual-packages: """""""""""""""""""""""""""""""""""""""""""""""" Selecting libraries to satisfy virtual packages @@ -907,6 +911,7 @@ With the proper installation as detailed above, no special steps should be required when a client package specifically (and thus deliberately) requests an Intel package as dependency, this being one of the target use cases for Spack. +.. _using-mkl-tips: """"""""""""""""""""""""""""""""""""""""""""""" Tips for configuring client packages to use MKL diff --git a/lib/spack/spack/build_systems/oneapi.py b/lib/spack/spack/build_systems/oneapi.py index 5babdc5a75..e1a0c66a7e 100644 --- a/lib/spack/spack/build_systems/oneapi.py +++ b/lib/spack/spack/build_systems/oneapi.py @@ -7,9 +7,11 @@ """ -from os.path import dirname, isdir +from sys import platform +from os.path import basename, dirname, isdir, join from spack.package import Package +from spack.util.environment import EnvironmentModifications from spack.util.executable import Executable from llnl.util.filesystem import find_headers, find_libraries @@ -22,46 +24,50 @@ class IntelOneApiPackage(Package): phases = ['install'] - def component_info(self, - dir_name, - components, - releases, - url_name): - self._dir_name = dir_name - self._components = components - self._releases = releases - self._url_name = url_name + # oneAPI license does not allow mirroring outside of the + # organization (e.g. University/Company). + redistribute_source = False - def url_for_version(self, version): - release = self._release(version) - return 'https://registrationcenter-download.intel.com/akdlm/irc_nas/%s/%s' % ( - release['irc_id'], self._oneapi_file(version, release)) + @property + def component_dir(self): + """Subdirectory for this component in the install prefix.""" + raise NotImplementedError + + def install(self, spec, prefix, installer_path=None): + """Shared install method for all oneapi packages.""" + + # intel-oneapi-compilers overrides the installer_path when + # installing fortran, which comes from a spack resource + if installer_path is None: + installer_path = basename(self.url_for_version(spec.version)) + + if platform == 'linux': + bash = Executable('bash') + + # Installer writes files in ~/intel set HOME so it goes to prefix + bash.add_default_env('HOME', prefix) + + bash(installer_path, + '-s', '-a', '-s', '--action', 'install', + '--eula', 'accept', + '--install-dir', prefix) - def install(self, spec, prefix): - bash = Executable('bash') + # Some installers have a bug and do not return an error code when failing + if not isdir(join(prefix, self.component_dir)): + raise RuntimeError('install failed') - # Installer writes files in ~/intel set HOME so it goes to prefix - bash.add_default_env('HOME', prefix) + def setup_run_environment(self, env): - version = spec.versions.lowest() - release = self._release(version) - bash('./%s' % self._oneapi_file(version, release), - '-s', '-a', '-s', '--action', 'install', - '--eula', 'accept', - '--components', - self._components, - '--install-dir', prefix) + """Adds environment variables to the generated module file. - # - # Helper functions - # + These environment variables come from running: - def _release(self, version): - return self._releases[str(version)] + .. code-block:: console - def _oneapi_file(self, version, release): - return 'l_%s_p_%s.%s_offline.sh' % ( - self._url_name, version, release['build']) + $ source {prefix}/setvars.sh --force + """ + env.extend(EnvironmentModifications.from_sourcing_file( + join(self.prefix, self.component_dir, 'latest/env/vars.sh'))) class IntelOneApiLibraryPackage(IntelOneApiPackage): @@ -70,11 +76,11 @@ class IntelOneApiLibraryPackage(IntelOneApiPackage): @property def headers(self): include_path = '%s/%s/latest/include' % ( - self.prefix, self._dir_name) + self.prefix, self.component_dir) return find_headers('*', include_path, recursive=True) @property def libs(self): - lib_path = '%s/%s/latest/lib/intel64' % (self.prefix, self._dir_name) + lib_path = '%s/%s/latest/lib/intel64' % (self.prefix, self.component_dir) lib_path = lib_path if isdir(lib_path) else dirname(lib_path) return find_libraries('*', root=lib_path, shared=True, recursive=True) diff --git a/var/spack/repos/builtin/packages/intel-oneapi-ccl/package.py b/var/spack/repos/builtin/packages/intel-oneapi-ccl/package.py index 44ee3fabe5..fea039dfbd 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-ccl/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-ccl/package.py @@ -3,12 +3,10 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +from sys import platform from spack import * -releases = { - '2021.1.1': {'irc_id': '17391', 'build': '54'}} - class IntelOneapiCcl(IntelOneApiLibraryPackage): """Intel oneAPI CCL.""" @@ -17,11 +15,14 @@ class IntelOneapiCcl(IntelOneApiLibraryPackage): homepage = 'https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/oneccl.html' - version('2021.1.1', sha256='de732df57a03763a286106c8b885fd60e83d17906936a8897a384b874e773f49', expand=False) + depends_on('intel-oneapi-mpi') + + if platform == 'linux': + version('2021.1.1', + sha256='de732df57a03763a286106c8b885fd60e83d17906936a8897a384b874e773f49', + url='https://registrationcenter-download.intel.com/akdlm/irc_nas/17391/l_oneapi_ccl_p_2021.1.1.54_offline.sh', + expand=False) - def __init__(self, spec): - self.component_info(dir_name='ccl', - components='intel.oneapi.lin.ccl.devel', - releases=releases, - url_name='oneapi_ccl') - super(IntelOneapiCcl, self).__init__(spec) + @property + def component_dir(self): + return 'ccl' diff --git a/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py b/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py index 5f11826f3a..b8d3dedc78 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py @@ -5,82 +5,78 @@ import glob import subprocess +from os import path +from sys import platform from spack import * -releases = {'2021.1.0': - {'irc_id': '17427', 'build': '2684'}} - - class IntelOneapiCompilers(IntelOneApiPackage): - """Intel oneAPI compilers. - - Contains icc, icpc, icx, icpx, dpcpp, ifort, ifx. - - """ - - maintainers = ['rscohn2'] + """Intel OneAPI compilers - homepage = 'https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/dpc-compiler.html' + Provides Classic and Beta compilers for: Fortran, C, C++""" - version('2021.1.0', sha256='666b1002de3eab4b6f3770c42bcf708743ac74efeba4c05b0834095ef27a11b9', expand=False) + homepage = "https://software.intel.com/content/www/us/en/develop/tools/oneapi.html" depends_on('patchelf', type='build') - def __init__(self, spec): - self.component_info( - dir_name='compiler', - components=('intel.oneapi.lin.dpcpp-cpp-compiler-pro' - ':intel.oneapi.lin.ifort-compiler'), - releases=releases, - url_name='HPCKit') - super(IntelOneapiCompilers, self).__init__(spec) - - def _join_prefix(self, path): - return join_path(self.prefix, 'compiler', 'latest', 'linux', path) + if platform == 'linux': + version('2021.1.2', + sha256='68d6cb638091990e578e358131c859f3bbbbfbf975c581fd0b4b4d36476d6f0a', + url='https://registrationcenter-download.intel.com/akdlm/irc_nas/17513/l_dpcpp-cpp-compiler_p_2021.1.2.63_offline.sh', + expand=False) + resource(name='fortran-installer', + url='https://registrationcenter-download.intel.com/akdlm/irc_nas/17508/l_fortran-compiler_p_2021.1.2.62_offline.sh', + sha256='29345145268d08a59fa7eb6e58c7522768466dd98f6d9754540d1a0803596829', + expand=False, + placement='fortran-installer', + when='@2021.1.2') + + @property + def component_dir(self): + return 'compiler' + + def _join_prefix(self, p): + return path.join(self.prefix, 'compiler', 'latest', 'linux', p) def _ld_library_path(self): dirs = ['lib', - 'lib/x64', - 'lib/emu', - 'lib/oclfpga/host/linux64/lib', - 'lib/oclfpga/linux64/lib', - 'compiler/lib/intel64_lin', - 'compiler/lib'] + path.join('lib', 'x64'), + path.join('lib', 'emu'), + path.join('lib', 'oclfpga', 'host', 'linux64', 'lib'), + path.join('lib', 'oclfpga', 'linux64', 'lib'), + path.join('compiler', 'lib', 'intel64_lin'), + path.join('compiler', 'lib')] for dir in dirs: yield self._join_prefix(dir) def install(self, spec, prefix): - # For quick turnaround debugging, comment out line below and - # use the copy instead + # install cpp + # Copy instead of install to speed up debugging + # subprocess.run(f'cp -r /opt/intel/oneapi/compiler {prefix}', shell=True) super(IntelOneapiCompilers, self).install(spec, prefix) - # Copy installed compiler instead of running the installer - # from shutil import copytree - # copytree('/opt/intel/oneapi/compiler', join_path(prefix, 'compiler'), - # symlinks=True) + # install fortran + super(IntelOneapiCompilers, self).install( + spec, + prefix, + installer_path=glob.glob(path.join('fortran-installer', '*'))[0]) + + # Some installers have a bug and do not return an error code when failing + if not path.isfile(path.join(prefix, 'compiler', 'latest', 'linux', + 'bin', 'intel64', 'ifort')): + raise RuntimeError('install failed') + + # set rpath so 'spack compiler add' can check version strings + # without setting LD_LIBRARY_PATH rpath = ':'.join(self._ld_library_path()) - patch_dirs = ['compiler/lib/intel64_lin', - 'compiler/lib/intel64', + patch_dirs = [path.join('compiler', 'lib', 'intel64_lin'), + path.join('compiler', 'lib', 'intel64'), 'bin'] for pd in patch_dirs: - for file in glob.glob(self._join_prefix(join_path(pd, '*'))): + patchables = glob.glob(self._join_prefix(path.join(pd, '*'))) + patchables.append(self._join_prefix(path.join('lib', 'icx-lto.so'))) + for file in patchables: # Try to patch all files, patchelf will do nothing if # file should not be patched subprocess.call(['patchelf', '--set-rpath', rpath, file]) - - def setup_run_environment(self, env): - env.prepend_path('PATH', self._join_prefix('bin')) - env.prepend_path('CPATH', self._join_prefix('include')) - env.prepend_path('LIBRARY_PATH', self._join_prefix('lib')) - for dir in self._ld_library_path(): - env.prepend_path('LD_LIBRARY_PATH', dir) - env.set('CC', self._join_prefix('bin/icx')) - env.set('CXX', self._join_prefix('bin/icpx')) - env.set('FC', self._join_prefix('bin/ifx')) - # Set these so that MPI wrappers will pick up these compilers - # when this module is loaded. - env.set('I_MPI_CC', 'icx') - env.set('I_MPI_CXX', 'icpx') - env.set('I_MPI_FC', 'ifx') diff --git a/var/spack/repos/builtin/packages/intel-oneapi-dal/package.py b/var/spack/repos/builtin/packages/intel-oneapi-dal/package.py index e95af333c0..a41a98c986 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-dal/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-dal/package.py @@ -4,10 +4,9 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack import * +from sys import platform -releases = { - '2021.1.1': {'irc_id': '17443', 'build': '79'}} +from spack import * class IntelOneapiDal(IntelOneApiLibraryPackage): @@ -17,11 +16,16 @@ class IntelOneapiDal(IntelOneApiLibraryPackage): homepage = 'https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onedal.html' - version('2021.1.1', sha256='6e0e24bba462e80f0fba5a46e95cf0cca6cf17948a7753f8e396ddedd637544e', expand=False) + if platform == 'linux': + version('2021.1.1', + sha256='6e0e24bba462e80f0fba5a46e95cf0cca6cf17948a7753f8e396ddedd637544e', + url='https://registrationcenter-download.intel.com/akdlm/irc_nas/17443/l_daal_oneapi_p_2021.1.1.79_offline.sh', + expand=False) + + depends_on('intel-oneapi-tbb') + + provides('daal') - def __init__(self, spec): - self.component_info(dir_name='dal', - components='intel.oneapi.lin.dal.devel', - releases=releases, - url_name='daal_oneapi') - super(IntelOneapiDal, self).__init__(spec) + @property + def component_dir(self): + return 'dal' diff --git a/var/spack/repos/builtin/packages/intel-oneapi-dnn/package.py b/var/spack/repos/builtin/packages/intel-oneapi-dnn/package.py index 59ef5be4b4..def6d0fade 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-dnn/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-dnn/package.py @@ -4,10 +4,9 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack import * +from sys import platform -releases = { - '2021.1.1': {'irc_id': '17385', 'build': '55'}} +from spack import * class IntelOneapiDnn(IntelOneApiLibraryPackage): @@ -17,11 +16,14 @@ class IntelOneapiDnn(IntelOneApiLibraryPackage): homepage = 'https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onednn.html' - version('2021.1.1', sha256='24002c57bb8931a74057a471a5859d275516c331fd8420bee4cae90989e77dc3', expand=False) + if platform == 'linux': + version('2021.1.1', + sha256='24002c57bb8931a74057a471a5859d275516c331fd8420bee4cae90989e77dc3', + url='https://registrationcenter-download.intel.com/akdlm/irc_nas/17385/l_onednn_p_2021.1.1.55_offline.sh', + expand=False) + + depends_on('intel-oneapi-tbb') - def __init__(self, spec): - self.component_info(dir_name='dnn', - components='intel.oneapi.lin.dnnl.devel', - releases=releases, - url_name='onednn') - super(IntelOneapiDnn, self).__init__(spec) + @property + def component_dir(self): + return 'dnnl' diff --git a/var/spack/repos/builtin/packages/intel-oneapi-ipp/package.py b/var/spack/repos/builtin/packages/intel-oneapi-ipp/package.py index 642274d44d..c067ebc577 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-ipp/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-ipp/package.py @@ -3,12 +3,10 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +from sys import platform from spack import * -releases = { - '2021.1.1': {'irc_id': '17436', 'build': '47'}} - class IntelOneapiIpp(IntelOneApiLibraryPackage): """Intel oneAPI IPP.""" @@ -17,13 +15,16 @@ class IntelOneapiIpp(IntelOneApiLibraryPackage): homepage = 'https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/ipp.html' - version('2021.1.1', sha256='2656a3a7f1f9f1438cbdf98fd472a213c452754ef9476dd65190a7d46618ba86', expand=False) + if platform == 'linux': + version('2021.1.1', + sha256='2656a3a7f1f9f1438cbdf98fd472a213c452754ef9476dd65190a7d46618ba86', + url='https://registrationcenter-download.intel.com/akdlm/irc_nas/17436/l_ipp_oneapi_p_2021.1.1.47_offline.sh', + expand=False) + + depends_on('intel-oneapi-tbb') provides('ipp') - def __init__(self, spec): - self.component_info(dir_name='ipp', - components='intel.oneapi.lin.ipp.devel', - releases=releases, - url_name='ipp_oneapi') - super(IntelOneapiIpp, self).__init__(spec) + @property + def component_dir(self): + return 'ipp' diff --git a/var/spack/repos/builtin/packages/intel-oneapi-ippcp/package.py b/var/spack/repos/builtin/packages/intel-oneapi-ippcp/package.py index b355302550..78f1b0d226 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-ippcp/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-ippcp/package.py @@ -4,10 +4,9 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack import * +from sys import platform -releases = { - '2021.1.1': {'irc_id': '17415', 'build': '54'}} +from spack import * class IntelOneapiIppcp(IntelOneApiLibraryPackage): @@ -17,11 +16,12 @@ class IntelOneapiIppcp(IntelOneApiLibraryPackage): homepage = 'https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/ipp.html' - version('2021.1.1', sha256='c0967afae22c7a223ec42542bcc702121064cd3d8f680eff36169c94f964a936', expand=False) + if platform == 'linux': + version('2021.1.1', + sha256='c0967afae22c7a223ec42542bcc702121064cd3d8f680eff36169c94f964a936', + url='https://registrationcenter-download.intel.com/akdlm/irc_nas/17415/l_ippcp_oneapi_p_2021.1.1.54_offline.sh', + expand=False) - def __init__(self, spec): - self.component_info(dir_name='ippcp', - components='intel.oneapi.lin.ippcp.devel', - releases=releases, - url_name='ippcp_oneapi') - super(IntelOneapiIppcp, self).__init__(spec) + @property + def component_dir(self): + return 'ippcp' diff --git a/var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py b/var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py index a92981bafc..7f2bec21bd 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-mkl/package.py @@ -4,10 +4,9 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack import * +from sys import platform -releases = { - '2021.1.1': {'irc_id': '17402', 'build': '52'}} +from spack import * class IntelOneapiMkl(IntelOneApiLibraryPackage): @@ -17,7 +16,13 @@ class IntelOneapiMkl(IntelOneApiLibraryPackage): homepage = 'https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html' - version('2021.1.1', sha256='818b6bd9a6c116f4578cda3151da0612ec9c3ce8b2c8a64730d625ce5b13cc0c', expand=False) + if platform == 'linux': + version('2021.1.1', + sha256='818b6bd9a6c116f4578cda3151da0612ec9c3ce8b2c8a64730d625ce5b13cc0c', + url='https://registrationcenter-download.intel.com/akdlm/irc_nas/17402/l_onemkl_p_2021.1.1.52_offline.sh', + expand=False) + + depends_on('intel-oneapi-tbb') provides('fftw-api@3') provides('scalapack') @@ -25,31 +30,6 @@ class IntelOneapiMkl(IntelOneApiLibraryPackage): provides('lapack') provides('blas') - def __init__(self, spec): - self.component_info(dir_name='mkl', - components='intel.oneapi.lin.mkl.devel', - releases=releases, - url_name='onemkl') - super(IntelOneapiMkl, self).__init__(spec) - - def _join_prefix(self, path): - return join_path(self.prefix, 'mkl', 'latest', path) - - def _ld_library_path(self): - dirs = ['lib/intel64'] - for dir in dirs: - yield self._join_prefix(dir) - - def _library_path(self): - dirs = ['lib/intel64'] - for dir in dirs: - yield self._join_prefix(dir) - - def setup_run_environment(self, env): - env.prepend_path('PATH', self._join_prefix('bin/intel64')) - env.prepend_path('CPATH', self._join_prefix('include')) - for dir in self._library_path(): - env.prepend_path('LIBRARY_PATH', dir) - for dir in self._ld_library_path(): - env.prepend_path('LD_LIBRARY_PATH', dir) - env.set('MKLROOT', join_path(self.prefix, 'mkl', 'latest')) + @property + def component_dir(self): + return 'mkl' diff --git a/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py b/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py index 7a08871c8a..bc83583178 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-mpi/package.py @@ -4,12 +4,12 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) +from os import path import subprocess +from sys import platform -from spack import * -releases = { - '2021.1.1': {'irc_id': '17397', 'build': '76'}} +from spack import * class IntelOneapiMpi(IntelOneApiLibraryPackage): @@ -19,18 +19,19 @@ class IntelOneapiMpi(IntelOneApiLibraryPackage): homepage = 'https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/mpi-library.html' - version('2021.1.1', sha256='8b7693a156c6fc6269637bef586a8fd3ea6610cac2aae4e7f48c1fbb601625fe', expand=False) + if platform == 'linux': + version('2021.1.1', + sha256='8b7693a156c6fc6269637bef586a8fd3ea6610cac2aae4e7f48c1fbb601625fe', + url='https://registrationcenter-download.intel.com/akdlm/irc_nas/17397/l_mpi_oneapi_p_2021.1.1.76_offline.sh', + expand=False) provides('mpi@:3') depends_on('patchelf', type='build') - def __init__(self, spec): - self.component_info(dir_name='mpi', - components='intel.oneapi.lin.mpi.devel', - releases=releases, - url_name='mpi_oneapi') - super(IntelOneapiMpi, self).__init__(spec) + @property + def component_dir(self): + return 'mpi' def setup_dependent_package(self, module, dep_spec): dir = join_path(self.prefix, 'mpi', 'latest', 'bin') @@ -49,8 +50,10 @@ class IntelOneapiMpi(IntelOneApiLibraryPackage): @property def libs(self): libs = [] - for dir in ['lib/release_mt', 'lib', 'libfabric/lib']: - lib_path = '{0}/{1}/latest/{2}'.format(self.prefix, self._dir_name, dir) + for dir in [path.join('lib', 'release_mt'), + 'lib', + path.join('libfabric', 'lib')]: + lib_path = path.join(self.prefix, 'mpi', 'latest', dir) ldir = find_libraries('*', root=lib_path, shared=True, recursive=False) libs += ldir return libs @@ -58,38 +61,11 @@ class IntelOneapiMpi(IntelOneApiLibraryPackage): def _join_prefix(self, path): return join_path(self.prefix, 'mpi', 'latest', path) - def _ld_library_path(self): - dirs = ['lib', - 'lib/release', - 'libfabric/lib'] - for dir in dirs: - yield self._join_prefix(dir) - - def _library_path(self): - dirs = ['lib', - 'lib/release', - 'libfabric/lib'] - for dir in dirs: - yield self._join_prefix(dir) - def install(self, spec, prefix): super(IntelOneapiMpi, self).install(spec, prefix) # need to patch libmpi.so so it can always find libfabric - libfabric_rpath = self._join_prefix('libfabric/lib') + libfabric_rpath = self._join_prefix(path.join('libfabric', 'lib')) for lib_version in ['debug', 'release', 'release_mt', 'debug_mt']: - file = self._join_prefix('lib/' + lib_version + '/libmpi.so') + file = self._join_prefix(path.join('lib', lib_version, 'libmpi.so')) subprocess.call(['patchelf', '--set-rpath', libfabric_rpath, file]) - - def setup_run_environment(self, env): - env.prepend_path('PATH', self._join_prefix('bin')) - env.prepend_path('CPATH', self._join_prefix('include')) - for dir in self._library_path(): - env.prepend_path('LIBRARY_PATH', dir) - for dir in self._ld_library_path(): - env.prepend_path('LD_LIBRARY_PATH', dir) - # so wrappers know where MPI lives - mpi_root = join_path(prefix, 'mpi', 'latest') - env.set('I_MPI_ROOT', mpi_root) - # set this so that wrappers can find libfabric providers - env.set('FI_PROVIDER_PATH', self._join_prefix('libfabric/lib/prov')) diff --git a/var/spack/repos/builtin/packages/intel-oneapi-tbb/package.py b/var/spack/repos/builtin/packages/intel-oneapi-tbb/package.py index d80afbb020..4c04ba7a18 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-tbb/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-tbb/package.py @@ -4,10 +4,9 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack import * +from sys import platform -releases = { - '2021.1.1': {'irc_id': '17378', 'build': '119'}} +from spack import * class IntelOneapiTbb(IntelOneApiLibraryPackage): @@ -17,33 +16,14 @@ class IntelOneapiTbb(IntelOneApiLibraryPackage): homepage = 'https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onetbb.html' - version('2021.1.1', sha256='535290e3910a9d906a730b24af212afa231523cf13a668d480bade5f2a01b53b', expand=False) + if platform == 'linux': + version('2021.1.1', + sha256='535290e3910a9d906a730b24af212afa231523cf13a668d480bade5f2a01b53b', + url='https://registrationcenter-download.intel.com/akdlm/irc_nas/17378/l_tbb_oneapi_p_2021.1.1.119_offline.sh', + expand=False) provides('tbb') - def __init__(self, spec): - self.component_info(dir_name='tbb', - components='intel.oneapi.lin.tbb.devel', - releases=releases, - url_name='tbb_oneapi') - super(IntelOneapiTbb, self).__init__(spec) - - def _join_prefix(self, path): - return join_path(self.prefix, 'tbb', 'latest', path) - - def _ld_library_path(self): - dirs = ['lib/intel64/gcc4.8'] - for dir in dirs: - yield self._join_prefix(dir) - - def _library_path(self): - dirs = ['lib/intel64/gcc4.8'] - for dir in dirs: - yield self._join_prefix(dir) - - def setup_run_environment(self, env): - for dir in self._library_path(): - env.prepend_path('LIBRARY_PATH', dir) - for dir in self._ld_library_path(): - env.prepend_path('LD_LIBRARY_PATH', dir) - env.set('TBBROOT', join_path(self.prefix, 'tbb', 'latest')) + @property + def component_dir(self): + return 'tbb' diff --git a/var/spack/repos/builtin/packages/intel-oneapi-vpl/package.py b/var/spack/repos/builtin/packages/intel-oneapi-vpl/package.py index 2476c22041..674e32bf27 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-vpl/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-vpl/package.py @@ -3,12 +3,10 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +from sys import platform from spack import * -releases = { - '2021.1.1': {'irc_id': '17418', 'build': '66'}} - class IntelOneapiVpl(IntelOneApiLibraryPackage): """Intel oneAPI VPL.""" @@ -17,11 +15,12 @@ class IntelOneapiVpl(IntelOneApiLibraryPackage): homepage = 'https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onevpl.html' - version('2021.1.1', sha256='0fec42545b30b7bb2e4e33deb12ab27a02900f5703153d9601673a8ce43082ed', expand=False) + if platform == 'linux': + version('2021.1.1', + sha256='0fec42545b30b7bb2e4e33deb12ab27a02900f5703153d9601673a8ce43082ed', + url='https://registrationcenter-download.intel.com/akdlm/irc_nas/17418/l_oneVPL_p_2021.1.1.66_offline.sh', + expand=False) - def __init__(self, spec): - self.component_info(dir_name='vpl', - components='intel.oneapi.lin.vpl.devel', - releases=releases, - url_name='oneVPL') - super(IntelOneapiVpl, self).__init__(spec) + @property + def component_dir(self): + return 'vpl' -- cgit v1.2.3-60-g2f50