Skip to content
Snippets Groups Projects
Unverified Commit bef56063 authored by Massimiliano Culpo's avatar Massimiliano Culpo Committed by GitHub
Browse files

intel: added external detection capabilities (#17991)

parent 71748a3b
No related branches found
No related tags found
No related merge requests found
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re
from spack import * import llnl.util.tty as tty
class Intel(IntelPackage): class Intel(IntelPackage):
...@@ -65,5 +66,60 @@ class Intel(IntelPackage): ...@@ -65,5 +66,60 @@ class Intel(IntelPackage):
conflicts('auto_dispatch=SSE3', 'platform=darwin target=x86_64:', conflicts('auto_dispatch=SSE3', 'platform=darwin target=x86_64:',
msg='SSE3 is not supported on MacOS 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', # Since the current package is a subset of 'intel-parallel-studio',
# all remaining Spack actions are handled in the package class. # all remaining Spack actions are handled in the package class.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment