py-numpy: Add Fujitsu Fortran compiler to compiler type. (#19858)

* py-numpy: Add Fujitsu Fortran compiler to compiler type.

py-scipy: Specify Fujitsu to fcompiler types.

* Create patches applicable to each version.
This commit is contained in:
Tomoki, Karatsu 2020-11-17 01:05:45 +09:00 committed by GitHub
parent 5e904e37bb
commit 9c4733ab59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 224 additions and 0 deletions

View File

@ -0,0 +1,54 @@
diff -urN numpy-1.19.4.org/numpy/distutils/fcompiler/fj.py numpy-1.19.4/numpy/distutils/fcompiler/fj.py
--- numpy-1.19.4.org/numpy/distutils/fcompiler/fj.py 1970-01-01 09:00:00.000000000 +0900
+++ numpy-1.19.4/numpy/distutils/fcompiler/fj.py 2020-11-10 17:21:43.324928283 +0900
@@ -0,0 +1,38 @@
+from numpy.distutils.fcompiler import FCompiler
+
+compilers = ['FJFCompiler']
+
+class FJFCompiler(FCompiler):
+ compiler_type = 'fj'
+ description = 'Fujitsu Fortran Compiler'
+
+ possible_executables = ['frt']
+ version_pattern = r'frt \(FRT\) (?P<version>[a-z\d.]+)'
+ # $ frt --version
+ # frt (FRT) x.x.x yyyymmdd
+
+ executables = {
+ 'version_cmd' : ["<F77>", "--version"],
+ 'compiler_f77' : ["frt", "-Fixed"],
+ 'compiler_fix' : ["frt", "-Fixed"],
+ 'compiler_f90' : ["frt"],
+ 'linker_so' : ["frt", "-shared"],
+ 'archiver' : ["ar", "-cr"],
+ 'ranlib' : ["ranlib"]
+ }
+ pic_flags = ['-KPIC']
+ module_dir_switch = '-M'
+ module_include_switch = '-I'
+
+ def get_flags_opt(self):
+ return ['-O3']
+ def get_flags_debug(self):
+ return ['-g']
+ def runtime_library_dir_option(self, dir):
+ return f'-Wl,-rpath={dir}'
+
+if __name__ == '__main__':
+ from distutils import log
+ from numpy.distutils import customized_fcompiler
+ log.set_verbosity(2)
+ print(customized_fcompiler('fj').get_version())
diff -urN numpy-1.19.4.org/numpy/distutils/fcompiler/__init__.py numpy-1.19.4/numpy/distutils/fcompiler/__init__.py
--- numpy-1.19.4.org/numpy/distutils/fcompiler/__init__.py 2020-11-09 10:51:35.693490207 +0900
+++ numpy-1.19.4/numpy/distutils/fcompiler/__init__.py 2020-11-16 17:48:49.316744476 +0900
@@ -746,7 +746,7 @@
'intelvem', 'intelem', 'flang')),
('cygwin.*', ('gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95')),
('linux.*', ('gnu95', 'intel', 'lahey', 'pg', 'nv', 'absoft', 'nag', 'vast', 'compaq',
- 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor')),
+ 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor', 'fj')),
('darwin.*', ('gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg')),
('sunos.*', ('sun', 'gnu', 'gnu95', 'g95')),
('irix.*', ('mips', 'gnu', 'gnu95',)),

View File

@ -0,0 +1,54 @@
diff -urN spack-src.org/numpy/distutils/fcompiler/fj.py spack-src/numpy/distutils/fcompiler/fj.py
--- spack-src.org/numpy/distutils/fcompiler/fj.py 1970-01-01 09:00:00.000000000 +0900
+++ spack-src/numpy/distutils/fcompiler/fj.py 2020-11-16 17:55:57.608802456 +0900
@@ -0,0 +1,38 @@
+from numpy.distutils.fcompiler import FCompiler
+
+compilers = ['FJFCompiler']
+
+class FJFCompiler(FCompiler):
+ compiler_type = 'fj'
+ description = 'Fujitsu Fortran Compiler'
+
+ possible_executables = ['frt']
+ version_pattern = r'frt \(FRT\) (?P<version>[a-z\d.]+)'
+ # $ frt --version
+ # frt (FRT) x.x.x yyyymmdd
+
+ executables = {
+ 'version_cmd' : ["<F77>", "--version"],
+ 'compiler_f77' : ["frt", "-Fixed"],
+ 'compiler_fix' : ["frt", "-Fixed"],
+ 'compiler_f90' : ["frt"],
+ 'linker_so' : ["frt", "-shared"],
+ 'archiver' : ["ar", "-cr"],
+ 'ranlib' : ["ranlib"]
+ }
+ pic_flags = ['-KPIC']
+ module_dir_switch = '-M'
+ module_include_switch = '-I'
+
+ def get_flags_opt(self):
+ return ['-O3']
+ def get_flags_debug(self):
+ return ['-g']
+ def runtime_library_dir_option(self, dir):
+ return f'-Wl,-rpath={dir}'
+
+if __name__ == '__main__':
+ from distutils import log
+ from numpy.distutils import customized_fcompiler
+ log.set_verbosity(2)
+ print(customized_fcompiler('fj').get_version())
diff -urN spack-src.org/numpy/distutils/fcompiler/__init__.py spack-src/numpy/distutils/fcompiler/__init__.py
--- spack-src.org/numpy/distutils/fcompiler/__init__.py 2020-11-16 17:55:31.638677631 +0900
+++ spack-src/numpy/distutils/fcompiler/__init__.py 2020-11-16 17:56:29.978957954 +0900
@@ -746,7 +746,7 @@
'intelvem', 'intelem', 'flang')),
('cygwin.*', ('gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95')),
('linux.*', ('gnu95', 'intel', 'lahey', 'pg', 'absoft', 'nag', 'vast', 'compaq',
- 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor')),
+ 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor', 'fj')),
('darwin.*', ('gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg')),
('sunos.*', ('sun', 'gnu', 'gnu95', 'g95')),
('irix.*', ('mips', 'gnu', 'gnu95',)),

View File

@ -0,0 +1,54 @@
diff -urN spack-src.org/numpy/distutils/fcompiler/fj.py spack-src/numpy/distutils/fcompiler/fj.py
--- spack-src.org/numpy/distutils/fcompiler/fj.py 1970-01-01 09:00:00.000000000 +0900
+++ spack-src/numpy/distutils/fcompiler/fj.py 2020-11-16 18:30:06.698641953 +0900
@@ -0,0 +1,38 @@
+from numpy.distutils.fcompiler import FCompiler
+
+compilers = ['FJFCompiler']
+
+class FJFCompiler(FCompiler):
+ compiler_type = 'fj'
+ description = 'Fujitsu Fortran Compiler'
+
+ possible_executables = ['frt']
+ version_pattern = r'frt \(FRT\) (?P<version>[a-z\d.]+)'
+ # $ frt --version
+ # frt (FRT) x.x.x yyyymmdd
+
+ executables = {
+ 'version_cmd' : ["<F77>", "--version"],
+ 'compiler_f77' : ["frt", "-Fixed"],
+ 'compiler_fix' : ["frt", "-Fixed"],
+ 'compiler_f90' : ["frt"],
+ 'linker_so' : ["frt", "-shared"],
+ 'archiver' : ["ar", "-cr"],
+ 'ranlib' : ["ranlib"]
+ }
+ pic_flags = ['-KPIC']
+ module_dir_switch = '-M'
+ module_include_switch = '-I'
+
+ def get_flags_opt(self):
+ return ['-O3']
+ def get_flags_debug(self):
+ return ['-g']
+ def runtime_library_dir_option(self, dir):
+ return '-Wl,-rpath=%s' %dir
+
+if __name__ == '__main__':
+ from distutils import log
+ from numpy.distutils import customized_fcompiler
+ log.set_verbosity(2)
+ print(customized_fcompiler('fj').get_version())
diff -urN spack-src.org/numpy/distutils/fcompiler/__init__.py spack-src/numpy/distutils/fcompiler/__init__.py
--- spack-src.org/numpy/distutils/fcompiler/__init__.py 2020-11-16 18:25:26.087294181 +0900
+++ spack-src/numpy/distutils/fcompiler/__init__.py 2020-11-16 18:26:19.987553070 +0900
@@ -750,7 +750,7 @@
'intelvem', 'intelem', 'flang')),
('cygwin.*', ('gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95')),
('linux.*', ('gnu95', 'intel', 'lahey', 'pg', 'absoft', 'nag', 'vast', 'compaq',
- 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor')),
+ 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor', 'fj')),
('darwin.*', ('gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg')),
('sunos.*', ('sun', 'gnu', 'gnu95', 'g95')),
('irix.*', ('mips', 'gnu', 'gnu95',)),

View File

@ -0,0 +1,54 @@
diff -urN spack-src.org/numpy/distutils/fcompiler/fj.py spack-src/numpy/distutils/fcompiler/fj.py
--- spack-src.org/numpy/distutils/fcompiler/fj.py 1970-01-01 09:00:00.000000000 +0900
+++ spack-src/numpy/distutils/fcompiler/fj.py 2020-11-16 18:42:47.672297372 +0900
@@ -0,0 +1,38 @@
+from numpy.distutils.fcompiler import FCompiler
+
+compilers = ['FJFCompiler']
+
+class FJFCompiler(FCompiler):
+ compiler_type = 'fj'
+ description = 'Fujitsu Fortran Compiler'
+
+ possible_executables = ['frt']
+ version_pattern = r'frt \(FRT\) (?P<version>[a-z\d.]+)'
+ # $ frt --version
+ # frt (FRT) x.x.x yyyymmdd
+
+ executables = {
+ 'version_cmd' : ["<F77>", "--version"],
+ 'compiler_f77' : ["frt", "-Fixed"],
+ 'compiler_fix' : ["frt", "-Fixed"],
+ 'compiler_f90' : ["frt"],
+ 'linker_so' : ["frt", "-shared"],
+ 'archiver' : ["ar", "-cr"],
+ 'ranlib' : ["ranlib"]
+ }
+ pic_flags = ['-KPIC']
+ module_dir_switch = '-M'
+ module_include_switch = '-I'
+
+ def get_flags_opt(self):
+ return ['-O3']
+ def get_flags_debug(self):
+ return ['-g']
+ def runtime_library_dir_option(self, dir):
+ return '-Wl,-rpath=%s' %dir
+
+if __name__ == '__main__':
+ from distutils import log
+ from numpy.distutils import customized_fcompiler
+ log.set_verbosity(2)
+ print(customized_fcompiler('fj').get_version())
diff -urN spack-src.org/numpy/distutils/fcompiler/__init__.py spack-src/numpy/distutils/fcompiler/__init__.py
--- spack-src.org/numpy/distutils/fcompiler/__init__.py 2020-11-16 18:43:18.112443626 +0900
+++ spack-src/numpy/distutils/fcompiler/__init__.py 2020-11-16 18:44:54.062904636 +0900
@@ -709,7 +709,7 @@
'intelvem', 'intelem')),
('cygwin.*', ('gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95')),
('linux.*', ('gnu95', 'intel', 'lahey', 'pg', 'absoft', 'nag', 'vast', 'compaq',
- 'intele', 'intelem', 'gnu', 'g95', 'pathf95')),
+ 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'fj')),
('darwin.*', ('gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg')),
('sunos.*', ('sun', 'gnu', 'gnu95', 'g95')),
('irix.*', ('mips', 'gnu', 'gnu95',)),

View File

@ -104,6 +104,12 @@ class PyNumpy(PythonPackage):
# https://github.com/numpy/numpy/pull/13132 # https://github.com/numpy/numpy/pull/13132
patch('blas-lapack-order.patch', when='@1.15:1.16') patch('blas-lapack-order.patch', when='@1.15:1.16')
# Add Fujitsu Fortran compiler
patch('add_fj_compiler.patch', when='@1.19.3:%fj')
patch('add_fj_compiler2.patch', when='@1.19.0:1.19.2%fj')
patch('add_fj_compiler3.patch', when='@1.14.0:1.18.5%fj')
patch('add_fj_compiler4.patch', when='@:1.13.3%fj')
# GCC 4.8 is the minimum version that works # GCC 4.8 is the minimum version that works
conflicts('%gcc@:4.7', msg='GCC 4.8+ required') conflicts('%gcc@:4.7', msg='GCC 4.8+ required')

View File

@ -87,6 +87,8 @@ def setup_build_environment(self, env):
def build_args(self, spec, prefix): def build_args(self, spec, prefix):
args = [] args = []
if spec.satisfies('%fj'):
args.extend(['config_fc', '--fcompiler=fj'])
# Build in parallel # Build in parallel
# Known problems with Python 3.5+ # Known problems with Python 3.5+