Fix module support for oneapi compilers (#28901)
Updates to improve Spack-generated modules for Intel oneAPI compilers: * intel-oneapi-compilers set CC etc. * Add a new package intel-oneapi-compilers-classic which can be used to generate a module which sets CC etc. to older compilers (e.g. icc) * lmod module logic now updated to treat the intel-oneapi-compilers* packages as compilers
This commit is contained in:
parent
adc9f887ea
commit
f3af38ba9b
@ -196,6 +196,14 @@ def provides(self):
|
||||
if self.spec.name == 'llvm-amdgpu':
|
||||
provides['compiler'] = spack.spec.CompilerSpec(str(self.spec))
|
||||
provides['compiler'].name = 'rocmcc'
|
||||
# Special case for oneapi
|
||||
if self.spec.name == 'intel-oneapi-compilers':
|
||||
provides['compiler'] = spack.spec.CompilerSpec(str(self.spec))
|
||||
provides['compiler'].name = 'oneapi'
|
||||
# Special case for oneapi classic
|
||||
if self.spec.name == 'intel-oneapi-compilers-classic':
|
||||
provides['compiler'] = spack.spec.CompilerSpec(str(self.spec))
|
||||
provides['compiler'].name = 'intel'
|
||||
|
||||
# All the other tokens in the hierarchy must be virtual dependencies
|
||||
for x in self.hierarchy_tokens:
|
||||
|
@ -0,0 +1,50 @@
|
||||
# Copyright 2013-2022 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)
|
||||
|
||||
from spack import *
|
||||
|
||||
|
||||
@IntelOneApiPackage.update_description
|
||||
class IntelOneapiCompilersClassic(Package):
|
||||
"""Relies on intel-oneapi-compilers to install the compilers, and
|
||||
configures modules for icc/icpc/ifort.
|
||||
|
||||
"""
|
||||
|
||||
maintainers = ['rscohn2']
|
||||
|
||||
homepage = "https://software.intel.com/content/www/us/en/develop/tools/oneapi.html"
|
||||
|
||||
has_code = False
|
||||
|
||||
phases = []
|
||||
|
||||
for ver in ['2022.1.0',
|
||||
'2022.0.2',
|
||||
'2022.0.1',
|
||||
'2021.4.0',
|
||||
'2021.3.0',
|
||||
'2021.2.0',
|
||||
'2021.1.2']:
|
||||
version(ver)
|
||||
depends_on('intel-oneapi-compilers@' + ver, when='@' + ver, type='run')
|
||||
|
||||
def setup_run_environment(self, env):
|
||||
"""Adds environment variables to the generated module file.
|
||||
|
||||
These environment variables come from running:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ source {prefix}/{component}/{version}/env/vars.sh
|
||||
|
||||
and from setting CC/CXX/F77/FC
|
||||
"""
|
||||
bin = join_path(self.spec['intel-oneapi-compilers'].prefix,
|
||||
'compile', 'linux', 'bin', 'intel64')
|
||||
env.set('CC', join_path(bin, 'icc'))
|
||||
env.set('CXX', join_path(bin, 'icpc'))
|
||||
env.set('F77', join_path(bin, 'ifort'))
|
||||
env.set('FC', join_path(bin, 'ifort'))
|
@ -143,3 +143,22 @@ def install(self, spec, prefix):
|
||||
# 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):
|
||||
"""Adds environment variables to the generated module file.
|
||||
|
||||
These environment variables come from running:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ source {prefix}/{component}/{version}/env/vars.sh
|
||||
|
||||
and from setting CC/CXX/F77/FC
|
||||
"""
|
||||
super(IntelOneapiCompilers, self).setup_run_environment(env)
|
||||
|
||||
bin = join_path(self.component_path, 'linux', 'bin')
|
||||
env.set('CC', join_path(bin, 'icx'))
|
||||
env.set('CXX', join_path(bin, 'icpx'))
|
||||
env.set('F77', join_path(bin, 'ifx'))
|
||||
env.set('FC', join_path(bin, 'ifx'))
|
||||
|
Loading…
Reference in New Issue
Block a user