summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Cohn <rscohn2@gmail.com>2020-12-23 18:39:40 -0500
committerTamara Dahlgren <dahlgren1@llnl.gov>2021-02-17 17:07:33 -0800
commit290043b72a6a88da66bef38b0e1e0b15ebfebddf (patch)
tree9c71504e5046ddf8a43129f8e2a7475f03c909ca /lib
parent1a1babe185fd9a01a518a5c25a55896e70909a89 (diff)
downloadspack-290043b72a6a88da66bef38b0e1e0b15ebfebddf.tar.gz
spack-290043b72a6a88da66bef38b0e1e0b15ebfebddf.tar.bz2
spack-290043b72a6a88da66bef38b0e1e0b15ebfebddf.tar.xz
spack-290043b72a6a88da66bef38b0e1e0b15ebfebddf.zip
Add Intel oneAPI packages (#20411)
This creates a set of packages which all use the same script to install components of Intel oneAPI. This includes: * An inheritable IntelOneApiPackage which knows how to invoke the installation script based on which components are requested * For components which include headers/libraries, an inheritable IntelOneApiLibraryPackage is provided to locate them * Individual packages for DAL, DNN, TBB, etc. * A package for the Intel oneAPI compilers (icx/ifx). This also includes icc/ifortran but these are not currently detected in this PR
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/oneapi.py80
-rw-r--r--lib/spack/spack/compilers/oneapi.py5
-rw-r--r--lib/spack/spack/pkgkit.py2
-rw-r--r--lib/spack/spack/test/compilers/detection.py26
4 files changed, 93 insertions, 20 deletions
diff --git a/lib/spack/spack/build_systems/oneapi.py b/lib/spack/spack/build_systems/oneapi.py
new file mode 100644
index 0000000000..ec8732bbd6
--- /dev/null
+++ b/lib/spack/spack/build_systems/oneapi.py
@@ -0,0 +1,80 @@
+# Copyright 2013-2020 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)
+
+"""Common utilities for managing intel oneapi packages.
+
+"""
+
+from os.path import dirname, isdir
+
+from spack.package import Package
+from spack.util.executable import Executable
+
+from llnl.util.filesystem import find_headers, find_libraries
+
+
+class IntelOneApiPackage(Package):
+ """Base class for Intel oneAPI packages."""
+
+ homepage = 'https://software.intel.com/oneapi'
+
+ 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
+
+ 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))
+
+ def install(self, spec, prefix):
+ bash = Executable('bash')
+
+ # Installer writes files in ~/intel set HOME so it goes to prefix
+ bash.add_default_env('HOME', prefix)
+
+ 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)
+
+ #
+ # Helper functions
+ #
+
+ def _release(self, version):
+ return self._releases[str(version)]
+
+ def _oneapi_file(self, version, release):
+ return 'l_%s_p_%s.%s_offline.sh' % (
+ self._url_name, version, release['build'])
+
+
+class IntelOneApiLibraryPackage(IntelOneApiPackage):
+ """Base class for Intel oneAPI library packages."""
+
+ @property
+ def headers(self):
+ include_path = '%s/%s/latest/include' % (
+ self.prefix, self._dir_name)
+ 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 = lib_path if isdir(lib_path) else dirname(lib_path)
+ return find_libraries('*', root=lib_path, shared=True, recursive=True)
diff --git a/lib/spack/spack/compilers/oneapi.py b/lib/spack/spack/compilers/oneapi.py
index bd511a4988..1b029699b5 100644
--- a/lib/spack/spack/compilers/oneapi.py
+++ b/lib/spack/spack/compilers/oneapi.py
@@ -29,13 +29,14 @@ class Oneapi(Compiler):
PrgEnv_compiler = 'oneapi'
version_argument = '--version'
- version_regex = r'\((?:IFORT|ICC)\)|DPC\+\+ [^ ]+ [^ ]+ [^ ]+ \(([^ ]+)\)'
+ version_regex = r'(?:(?:oneAPI DPC\+\+ Compiler)|(?:ifx \(IFORT\))) (\S+)'
@property
def verbose_flag(self):
return "-v"
- required_libs = ['libirc', 'libifcore', 'libifcoremt', 'libirng']
+ required_libs = ['libirc', 'libifcore', 'libifcoremt', 'libirng',
+ 'libsvml', 'libintlc', 'libimf']
@property
def debug_flags(self):
diff --git a/lib/spack/spack/pkgkit.py b/lib/spack/spack/pkgkit.py
index 2673d2dbd5..423c0fb05f 100644
--- a/lib/spack/spack/pkgkit.py
+++ b/lib/spack/spack/pkgkit.py
@@ -20,6 +20,8 @@ from spack.build_systems.aspell_dict import AspellDictPackage
from spack.build_systems.autotools import AutotoolsPackage
from spack.build_systems.cmake import CMakePackage
from spack.build_systems.cuda import CudaPackage
+from spack.build_systems.oneapi import IntelOneApiPackage
+from spack.build_systems.oneapi import IntelOneApiLibraryPackage
from spack.build_systems.rocm import ROCmPackage
from spack.build_systems.qmake import QMakePackage
from spack.build_systems.maven import MavenPackage
diff --git a/lib/spack/spack/test/compilers/detection.py b/lib/spack/spack/test/compilers/detection.py
index a74c4c201a..47e078f242 100644
--- a/lib/spack/spack/test/compilers/detection.py
+++ b/lib/spack/spack/test/compilers/detection.py
@@ -152,28 +152,18 @@ def test_intel_version_detection(version_str, expected_version):
@pytest.mark.parametrize('version_str,expected_version', [
- ( # ICX
- 'Intel(R) oneAPI DPC++ Compiler Pro 2021.1 (2020.8.0.0827)\n'
+ ( # ICX/ICPX
+ 'Intel(R) oneAPI DPC++ Compiler 2021.1 (2020.10.0.1113)\n'
'Target: x86_64-unknown-linux-gnu\n'
'Thread model: posix\n'
- 'InstalledDir: /soft/restricted/CNDA/sdk/\n'
- '2020.9.15.1/oneapi/compiler/2021.1-beta09/linux/bin',
- '2020.8.0.0827'
+ 'InstalledDir: /made/up/path',
+ '2021.1'
),
- ( # ICPX
- 'Intel(R) oneAPI DPC++ Compiler Pro 2021.1 (2020.8.0.0827)\n'
- 'Target: x86_64-unknown-linux-gnu\n'
- 'Thread model: posix\n'
- 'InstalledDir: /soft/restricted/CNDA/sdk/\n'
- '2020.9.15.1/oneapi/compiler/2021.1-beta09/linux/bin',
- '2020.8.0.0827'
+ ( # IFX
+ 'ifx (IFORT) 2021.1 Beta 20201113\n'
+ 'Copyright (C) 1985-2020 Intel Corporation. All rights reserved.',
+ '2021.1'
)
- # Detection will fail for ifx because it can't parse it from this.
- # ( # IFX
- # 'ifx (IFORT) 2021.1 Beta 20200827\n'
- # 'Copyright (C) 1985-2020 Intel Corporation. All rights reserved.',
- # '2020.8.0.0827'
- # )
])
def test_oneapi_version_detection(version_str, expected_version):
version = spack.compilers.oneapi.Oneapi.extract_version_from_output(