summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authort-karatsu <49965247+t-karatsu@users.noreply.github.com>2019-05-22 10:31:14 +0900
committerAdam J. Stewart <ajstewart426@gmail.com>2019-05-21 20:31:14 -0500
commit1e9bb8c51252d9e58f8cf5db1e23c15282765d3b (patch)
tree066f1bedf56b70798ebb25b8b9423976e04f26e1 /lib
parenta973ab47517f50718ab92874bf0e934904b78a19 (diff)
downloadspack-1e9bb8c51252d9e58f8cf5db1e23c15282765d3b.tar.gz
spack-1e9bb8c51252d9e58f8cf5db1e23c15282765d3b.tar.bz2
spack-1e9bb8c51252d9e58f8cf5db1e23c15282765d3b.tar.xz
spack-1e9bb8c51252d9e58f8cf5db1e23c15282765d3b.zip
Add Fujitsu compiler to Spack. (#11287)
* Add Fujitsu compiler to Spack. * Fixes for flake8 * Chenges location of FCC to subdirectory called case-insensitive * Add compiler tests for Fujitsu compiler * Modify the logic of taking compiler version for new version of Fujitsu compiler
Diffstat (limited to 'lib')
-rwxr-xr-xlib/spack/env/cc8
l---------lib/spack/env/fj/case-insensitive/FCC1
l---------lib/spack/env/fj/fcc1
l---------lib/spack/env/fj/frt1
-rw-r--r--lib/spack/spack/compilers/fj.py49
-rw-r--r--lib/spack/spack/test/compilers.py30
6 files changed, 86 insertions, 4 deletions
diff --git a/lib/spack/env/cc b/lib/spack/env/cc
index 738a7e37af..f5a71d87d1 100755
--- a/lib/spack/env/cc
+++ b/lib/spack/env/cc
@@ -103,25 +103,25 @@ case "$command" in
cpp)
mode=cpp
;;
- cc|c89|c99|gcc|clang|armclang|icc|pgcc|xlc|xlc_r)
+ cc|c89|c99|gcc|clang|armclang|icc|pgcc|xlc|xlc_r|fcc)
command="$SPACK_CC"
language="C"
comp="CC"
lang_flags=C
;;
- c++|CC|g++|clang++|armclang++|icpc|pgc++|xlc++|xlc++_r)
+ c++|CC|g++|clang++|armclang++|icpc|pgc++|xlc++|xlc++_r|FCC)
command="$SPACK_CXX"
language="C++"
comp="CXX"
lang_flags=CXX
;;
- ftn|f90|fc|f95|gfortran|flang|armflang|ifort|pgfortran|xlf90|xlf90_r|nagfor)
+ ftn|f90|fc|f95|gfortran|flang|armflang|ifort|pgfortran|xlf90|xlf90_r|nagfor|frt)
command="$SPACK_FC"
language="Fortran 90"
comp="FC"
lang_flags=F
;;
- f77|xlf|xlf_r|pgf77)
+ f77|xlf|xlf_r|pgf77|frt)
command="$SPACK_F77"
language="Fortran 77"
comp="F77"
diff --git a/lib/spack/env/fj/case-insensitive/FCC b/lib/spack/env/fj/case-insensitive/FCC
new file mode 120000
index 0000000000..e2deb67f3b
--- /dev/null
+++ b/lib/spack/env/fj/case-insensitive/FCC
@@ -0,0 +1 @@
+../../cc \ No newline at end of file
diff --git a/lib/spack/env/fj/fcc b/lib/spack/env/fj/fcc
new file mode 120000
index 0000000000..82c2b8e90a
--- /dev/null
+++ b/lib/spack/env/fj/fcc
@@ -0,0 +1 @@
+../cc \ No newline at end of file
diff --git a/lib/spack/env/fj/frt b/lib/spack/env/fj/frt
new file mode 120000
index 0000000000..82c2b8e90a
--- /dev/null
+++ b/lib/spack/env/fj/frt
@@ -0,0 +1 @@
+../cc \ No newline at end of file
diff --git a/lib/spack/spack/compilers/fj.py b/lib/spack/spack/compilers/fj.py
new file mode 100644
index 0000000000..e37b3898bd
--- /dev/null
+++ b/lib/spack/spack/compilers/fj.py
@@ -0,0 +1,49 @@
+# Copyright 2013-2018 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)
+
+import spack.compiler
+
+
+class Fj(spack.compiler.Compiler):
+ # Subclasses use possible names of C compiler
+ cc_names = ['fcc']
+
+ # Subclasses use possible names of C++ compiler
+ cxx_names = ['FCC']
+
+ # Subclasses use possible names of Fortran 77 compiler
+ f77_names = ['frt']
+
+ # Subclasses use possible names of Fortran 90 compiler
+ fc_names = ['frt']
+
+ # Named wrapper links within build_env_path
+ link_paths = {'cc': 'fj/fcc',
+ 'cxx': 'fj/case-insensitive/FCC',
+ 'f77': 'fj/frt',
+ 'fc': 'fj/frt'}
+
+ version_argument = '--version'
+ version_regex = r'\((?:FCC|FRT)\) ([\d.]+)'
+
+ @property
+ def openmp_flag(self):
+ return "-Kopenmp"
+
+ @property
+ def cxx98_flag(self):
+ return "-std=c++98"
+
+ @property
+ def cxx11_flag(self):
+ return "-std=c++11"
+
+ @property
+ def cxx14_flag(self):
+ return "-std=c++14"
+
+ @property
+ def pic_flag(self):
+ return "-fPIC"
diff --git a/lib/spack/spack/test/compilers.py b/lib/spack/spack/test/compilers.py
index 27ddc8068b..4129503dbb 100644
--- a/lib/spack/spack/test/compilers.py
+++ b/lib/spack/spack/test/compilers.py
@@ -21,6 +21,7 @@ import spack.compilers.nag
import spack.compilers.pgi
import spack.compilers.xl
import spack.compilers.xl_r
+import spack.compilers.fj
from spack.compiler import _get_versioned_tuple, Compiler
@@ -243,6 +244,14 @@ def test_xl_r_flags():
supported_flag_test("pic_flag", "-qpic", "xl_r@1.0")
+def test_fj_flags():
+ supported_flag_test("openmp_flag", "-Kopenmp", "fj@1.2.0")
+ supported_flag_test("cxx98_flag", "-std=c++98", "fj@1.2.0")
+ supported_flag_test("cxx11_flag", "-std=c++11", "fj@1.2.0")
+ supported_flag_test("cxx14_flag", "-std=c++14", "fj@1.2.0")
+ supported_flag_test("pic_flag", "-fPIC", "fj@1.2.0")
+
+
@pytest.mark.regression('10191')
@pytest.mark.parametrize('version_str,expected_version', [
# macOS clang
@@ -356,3 +365,24 @@ def test_xl_version_detection(version_str, expected_version):
def test_cce_version_detection(version_str, expected_version):
version = spack.compilers.cce.Cce.extract_version_from_output(version_str)
assert version == expected_version
+
+
+@pytest.mark.parametrize('version_str,expected_version', [
+ # C compiler
+ ('fcc (FCC) 4.0.0 20190314\n'
+ 'simulating gcc version 6.1\n'
+ 'Copyright FUJITSU LIMITED 2019',
+ '4.0.0'),
+ # C++ compiler
+ ('FCC (FCC) 4.0.0 20190314\n'
+ 'simulating gcc version 6.1\n'
+ 'Copyright FUJITSU LIMITED 2019',
+ '4.0.0'),
+ # Fortran compiler
+ ('frt (FRT) 4.0.0 20190314\n'
+ 'Copyright FUJITSU LIMITED 2019',
+ '4.0.0')
+])
+def test_fj_version_detection(version_str, expected_version):
+ version = spack.compilers.fj.Fj.extract_version_from_output(version_str)
+ assert version == expected_version