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
This commit is contained in:
t-karatsu 2019-05-22 10:31:14 +09:00 committed by Adam J. Stewart
parent a973ab4751
commit 1e9bb8c512
7 changed files with 87 additions and 5 deletions

View File

@ -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]

8
lib/spack/env/cc vendored
View File

@ -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"

1
lib/spack/env/fj/case-insensitive/FCC vendored Symbolic link
View File

@ -0,0 +1 @@
../../cc

1
lib/spack/env/fj/fcc vendored Symbolic link
View File

@ -0,0 +1 @@
../cc

1
lib/spack/env/fj/frt vendored Symbolic link
View File

@ -0,0 +1 @@
../cc

View File

@ -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"

View File

@ -21,6 +21,7 @@
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