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
This commit is contained in:
80
lib/spack/spack/build_systems/oneapi.py
Normal file
80
lib/spack/spack/build_systems/oneapi.py
Normal file
@@ -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)
|
@@ -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):
|
||||
|
@@ -20,6 +20,8 @@
|
||||
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
|
||||
|
@@ -156,28 +156,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(
|
||||
|
Reference in New Issue
Block a user