intel: added external detection capabilities (#17991)
This commit is contained in:
parent
71748a3b7a
commit
bef560636d
@ -2,8 +2,9 @@
|
||||
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
import re
|
||||
|
||||
from spack import *
|
||||
import llnl.util.tty as tty
|
||||
|
||||
|
||||
class Intel(IntelPackage):
|
||||
@ -65,5 +66,60 @@ class Intel(IntelPackage):
|
||||
conflicts('auto_dispatch=SSE3', 'platform=darwin target=x86_64:',
|
||||
msg='SSE3 is not supported on MacOS x86_64')
|
||||
|
||||
executables = ['^icc$', '^icpc$', '^ifort$']
|
||||
|
||||
@classmethod
|
||||
def determine_version(cls, exe):
|
||||
version_regex = re.compile(r'\((?:IFORT|ICC)\) ([^ ]+)')
|
||||
try:
|
||||
output = spack.compiler.get_compiler_version_output(
|
||||
exe, '--version'
|
||||
)
|
||||
match = version_regex.search(output)
|
||||
if match:
|
||||
return match.group(1)
|
||||
except spack.util.executable.ProcessError:
|
||||
pass
|
||||
except Exception as e:
|
||||
tty.debug(str(e))
|
||||
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
def determine_variants(cls, exes, version_str):
|
||||
compilers = {}
|
||||
for exe in exes:
|
||||
if 'icc' in exe:
|
||||
compilers['c'] = exe
|
||||
if 'icpc' in exe:
|
||||
compilers['cxx'] = exe
|
||||
if 'ifort' in exe:
|
||||
compilers['fortran'] = exe
|
||||
return '', {'compilers': compilers}
|
||||
|
||||
@property
|
||||
def cc(self):
|
||||
msg = "cannot retrieve C compiler [spec is not concrete]"
|
||||
assert self.spec.concrete, msg
|
||||
if self.spec.external:
|
||||
return self.spec.extra_attributes['compilers'].get('c', None)
|
||||
return str(self.spec.prefix.bin.intel64.icc)
|
||||
|
||||
@property
|
||||
def cxx(self):
|
||||
msg = "cannot retrieve C++ compiler [spec is not concrete]"
|
||||
assert self.spec.concrete, msg
|
||||
if self.spec.external:
|
||||
return self.spec.extra_attributes['compilers'].get('cxx', None)
|
||||
return str(self.spec.prefix.bin.intel64.icpc)
|
||||
|
||||
@property
|
||||
def fortran(self):
|
||||
msg = "cannot retrieve Fortran compiler [spec is not concrete]"
|
||||
assert self.spec.concrete, msg
|
||||
if self.spec.external:
|
||||
return self.spec.extra_attributes['compilers'].get('fortran', None)
|
||||
return str(self.spec.prefix.bin.intel64.ifort)
|
||||
|
||||
# Since the current package is a subset of 'intel-parallel-studio',
|
||||
# all remaining Spack actions are handled in the package class.
|
||||
|
Loading…
Reference in New Issue
Block a user