diff options
-rw-r--r-- | etc/spack/defaults/packages.yaml | 2 | ||||
-rwxr-xr-x | lib/spack/env/cc | 8 | ||||
l--------- | lib/spack/env/fj/case-insensitive/FCC | 1 | ||||
l--------- | lib/spack/env/fj/fcc | 1 | ||||
l--------- | lib/spack/env/fj/frt | 1 | ||||
-rw-r--r-- | lib/spack/spack/compilers/fj.py | 49 | ||||
-rw-r--r-- | lib/spack/spack/test/compilers.py | 30 |
7 files changed, 87 insertions, 5 deletions
diff --git a/etc/spack/defaults/packages.yaml b/etc/spack/defaults/packages.yaml index 7994d49f19..c278f7bec7 100644 --- a/etc/spack/defaults/packages.yaml +++ b/etc/spack/defaults/packages.yaml @@ -15,7 +15,7 @@ # ------------------------------------------------------------------------- packages: all: - compiler: [gcc, intel, pgi, clang, xl, nag] + compiler: [gcc, intel, pgi, clang, xl, nag, fj] providers: D: [ldc] awk: [gawk] 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 |