summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2020-06-26 04:20:09 +0200
committerGitHub <noreply@github.com>2020-06-25 21:20:09 -0500
commitc401c63156b362fda12f5bf6d8b95a99c2540ad1 (patch)
treecfb0a89cca69841b8ef431baeb157ca2e18c29a9
parentcecd300693e654ee0bbd516a05c430475bbb76e0 (diff)
downloadspack-c401c63156b362fda12f5bf6d8b95a99c2540ad1.tar.gz
spack-c401c63156b362fda12f5bf6d8b95a99c2540ad1.tar.bz2
spack-c401c63156b362fda12f5bf6d8b95a99c2540ad1.tar.xz
spack-c401c63156b362fda12f5bf6d8b95a99c2540ad1.zip
Allow detection for "-classic" version of CCE (#17256)
* cce: detect modules based on the classic backend * cce: tweaked version checks for clang based options * Added unit test for cce flags
-rw-r--r--lib/spack/spack/compilers/cce.py15
-rw-r--r--lib/spack/spack/operating_systems/cray_backend.py4
-rw-r--r--lib/spack/spack/test/compilers/basics.py8
3 files changed, 21 insertions, 6 deletions
diff --git a/lib/spack/spack/compilers/cce.py b/lib/spack/spack/compilers/cce.py
index 47c0263cfd..9844eb299d 100644
--- a/lib/spack/spack/compilers/cce.py
+++ b/lib/spack/spack/compilers/cce.py
@@ -33,8 +33,13 @@ class Cce(Compiler):
'fc': 'cce/ftn'}
@property
+ def is_clang_based(self):
+ version = self.version
+ return version >= ver('9.0') and 'classic' not in str(version)
+
+ @property
def version_argument(self):
- if self.version >= ver('9.0'):
+ if self.is_clang_based:
return '--version'
return '-V'
@@ -50,19 +55,19 @@ class Cce(Compiler):
@property
def openmp_flag(self):
- if self.version >= ver('9.0'):
+ if self.is_clang_based:
return '-fopenmp'
return "-h omp"
@property
def cxx11_flag(self):
- if self.version >= ver('9.0'):
+ if self.is_clang_based:
return '-std=c++11'
return "-h std=c++11"
@property
def c99_flag(self):
- if self.version >= ver('9.0'):
+ if self.is_clang_based:
return '-std=c99'
elif self.version >= ver('8.4'):
return '-h std=c99,noconform,gnu'
@@ -75,7 +80,7 @@ class Cce(Compiler):
@property
def c11_flag(self):
- if self.version >= ver('9.0'):
+ if self.is_clang_based:
return '-std=c11'
elif self.version >= ver('8.5'):
return '-h std=c11,noconform,gnu'
diff --git a/lib/spack/spack/operating_systems/cray_backend.py b/lib/spack/spack/operating_systems/cray_backend.py
index 91c0e6ae98..262df6a7bd 100644
--- a/lib/spack/spack/operating_systems/cray_backend.py
+++ b/lib/spack/spack/operating_systems/cray_backend.py
@@ -142,7 +142,9 @@ class CrayBackend(LinuxDistro):
compiler_name = detect_version_args.id.compiler_name
compiler_cls = spack.compilers.class_for_compiler_name(compiler_name)
output = modulecmd('avail', compiler_cls.PrgEnv_compiler)
- version_regex = r'(%s)/([\d\.]+[\d])' % compiler_cls.PrgEnv_compiler
+ version_regex = r'({0})/([\d\.]+[\d]-?[\w]*)'.format(
+ compiler_cls.PrgEnv_compiler
+ )
matches = re.findall(version_regex, output)
version = tuple(version for _, version in matches)
compiler_id = detect_version_args.id
diff --git a/lib/spack/spack/test/compilers/basics.py b/lib/spack/spack/test/compilers/basics.py
index 825975b21a..9ccf44f14f 100644
--- a/lib/spack/spack/test/compilers/basics.py
+++ b/lib/spack/spack/test/compilers/basics.py
@@ -358,12 +358,20 @@ def test_arm_flags():
def test_cce_flags():
+ supported_flag_test("version_argument", "--version", "cce@9.0.1")
+ supported_flag_test("version_argument", "-V", "cce@9.0.1-classic")
+ supported_flag_test("openmp_flag", "-fopenmp", "cce@9.0.1")
+ supported_flag_test("openmp_flag", "-h omp", "cce@9.0.1-classic")
supported_flag_test("openmp_flag", "-h omp", "cce@1.0")
+ supported_flag_test("cxx11_flag", "-std=c++11", "cce@9.0.1")
+ supported_flag_test("cxx11_flag", "-h std=c++11", "cce@9.0.1-classic")
supported_flag_test("cxx11_flag", "-h std=c++11", "cce@1.0")
unsupported_flag_test("c99_flag", "cce@8.0")
+ supported_flag_test("c99_flag", "-std=c99", "cce@9.0.1")
supported_flag_test("c99_flag", "-h c99,noconform,gnu", "cce@8.1")
supported_flag_test("c99_flag", "-h std=c99,noconform,gnu", "cce@8.4")
unsupported_flag_test("c11_flag", "cce@8.4")
+ supported_flag_test("c11_flag", "-std=c11", "cce@9.0.1")
supported_flag_test("c11_flag", "-h std=c11,noconform,gnu", "cce@8.5")
supported_flag_test("cc_pic_flag", "-h PIC", "cce@1.0")
supported_flag_test("cxx_pic_flag", "-h PIC", "cce@1.0")