Armcompiler (#9840)
* Initial compiler support * added arm.py * Changed licence to Arm suggested header * Changed licence to the same as clang.py Main author of file is Nick Forrington <Nick.Forrington@arm.com> Minor changes by Srinath Vadlamani <srinath.vadlamani@arm.com> * compilers: add arm compiler detection to Spack - added arm.py with support for detecting `armclang` and `armflang` Co-authored-by: Srinath Vadlamani <srinath.vadlamani@arm.com> * Changed to using get get_compiler_version * linking to general cc for arm compiler * For arm compiler add CFLAGS to use compiler-rt rtlib. * Escape for special characters in rexep * Cleaned up for Flake8 to pass. * libcompiler-rt should be part of the LDFLAGS not CFLAGS * fixed m4 when using clang to used LDFLAGS. Fixed comments for arm.py to display compiler --version output with # NOAQ for flakes pass. * added arm compilers * proper linked names
This commit is contained in:
parent
ee64db4764
commit
4fdd3b6794
1
lib/spack/env/arm/armclang
vendored
Symbolic link
1
lib/spack/env/arm/armclang
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../cc
|
1
lib/spack/env/arm/armclang++
vendored
Symbolic link
1
lib/spack/env/arm/armclang++
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../cc
|
1
lib/spack/env/arm/armflang
vendored
Symbolic link
1
lib/spack/env/arm/armflang
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../cc
|
6
lib/spack/env/cc
vendored
6
lib/spack/env/cc
vendored
@ -106,19 +106,19 @@ case "$command" in
|
|||||||
cpp)
|
cpp)
|
||||||
mode=cpp
|
mode=cpp
|
||||||
;;
|
;;
|
||||||
cc|c89|c99|gcc|clang|icc|pgcc|xlc|xlc_r)
|
cc|c89|c99|gcc|clang|armclang|icc|pgcc|xlc|xlc_r)
|
||||||
command="$SPACK_CC"
|
command="$SPACK_CC"
|
||||||
language="C"
|
language="C"
|
||||||
comp="CC"
|
comp="CC"
|
||||||
lang_flags=C
|
lang_flags=C
|
||||||
;;
|
;;
|
||||||
c++|CC|g++|clang++|icpc|pgc++|xlc++|xlc++_r)
|
c++|CC|g++|clang++|armclang++|icpc|pgc++|xlc++|xlc++_r)
|
||||||
command="$SPACK_CXX"
|
command="$SPACK_CXX"
|
||||||
language="C++"
|
language="C++"
|
||||||
comp="CXX"
|
comp="CXX"
|
||||||
lang_flags=CXX
|
lang_flags=CXX
|
||||||
;;
|
;;
|
||||||
ftn|f90|fc|f95|gfortran|flang|ifort|pgfortran|xlf90|xlf90_r|nagfor)
|
ftn|f90|fc|f95|gfortran|flang|armflang|ifort|pgfortran|xlf90|xlf90_r|nagfor)
|
||||||
command="$SPACK_FC"
|
command="$SPACK_FC"
|
||||||
language="Fortran 90"
|
language="Fortran 90"
|
||||||
comp="FC"
|
comp="FC"
|
||||||
|
@ -3,10 +3,7 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
import re
|
from spack.compiler import Compiler, get_compiler_version
|
||||||
|
|
||||||
from spack.compiler import Compiler, _version_cache
|
|
||||||
from spack.util.executable import Executable
|
|
||||||
|
|
||||||
|
|
||||||
class Arm(Compiler):
|
class Arm(Compiler):
|
||||||
@ -23,10 +20,10 @@ class Arm(Compiler):
|
|||||||
fc_names = ['armflang']
|
fc_names = ['armflang']
|
||||||
|
|
||||||
# Named wrapper links within lib/spack/env
|
# Named wrapper links within lib/spack/env
|
||||||
link_paths = {'cc': 'clang/clang',
|
link_paths = {'cc': 'arm/armclang',
|
||||||
'cxx': 'clang/clang++',
|
'cxx': 'arm/armclang++',
|
||||||
'f77': 'clang/flang',
|
'f77': 'arm/armflang',
|
||||||
'fc': 'clang/flang'}
|
'fc': 'arm/armflang'}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def openmp_flag(self):
|
def openmp_flag(self):
|
||||||
@ -50,19 +47,19 @@ def pic_flag(self):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_version(cls, comp):
|
def default_version(cls, comp):
|
||||||
if comp not in _version_cache:
|
"""The ``--version`` option seems to be the most consistent one
|
||||||
compiler = Executable(comp)
|
for arm compilers. Output looks like this::
|
||||||
output = compiler('--version', output=str, error=str)
|
|
||||||
|
|
||||||
ver = 'unknown'
|
$ arm<c/f>lang --version
|
||||||
match = re.search(r'Arm C/C++/Fortran Compiler version ([^ )]+)',
|
Arm C/C++/Fortran Compiler version 19.0 (build number 73) (based on LLVM 7.0.2) # NOQA
|
||||||
output)
|
Target: aarch64--linux-gnu
|
||||||
if match:
|
Thread model: posix
|
||||||
ver = match.group(1)
|
InstalledDir:
|
||||||
|
/opt/arm/arm-hpc-compiler-19.0_Generic-AArch64_RHEL-7_aarch64-linux/bin # NOQA
|
||||||
_version_cache[comp] = ver
|
"""
|
||||||
|
return get_compiler_version(
|
||||||
return _version_cache[comp]
|
comp, '--version',
|
||||||
|
r'Arm C\/C\+\+\/Fortran Compiler version ([^ )]+)')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def fc_version(cls, fc):
|
def fc_version(cls, fc):
|
||||||
|
@ -34,9 +34,11 @@ def configure_args(self):
|
|||||||
spec = self.spec
|
spec = self.spec
|
||||||
args = ['--enable-c++']
|
args = ['--enable-c++']
|
||||||
|
|
||||||
if (spec.satisfies('%clang') or spec.satisfies('%arm')) and not \
|
if spec.satisfies('%clang') and not spec.satisfies('platform=darwin'):
|
||||||
spec.satisfies('platform=darwin'):
|
args.append('LDFLAGS=-rtlib=compiler-rt')
|
||||||
args.append('CFLAGS=-rtlib=compiler-rt')
|
|
||||||
|
if spec.satisfies('%arm') and not spec.satisfies('platform=darwin'):
|
||||||
|
args.append('LDFLAGS=-rtlib=compiler-rt')
|
||||||
|
|
||||||
if spec.satisfies('%intel'):
|
if spec.satisfies('%intel'):
|
||||||
args.append('CFLAGS=-no-gcc')
|
args.append('CFLAGS=-no-gcc')
|
||||||
|
Loading…
Reference in New Issue
Block a user