diff options
| author | yamadafuyuka <yamada.fuyuka@jp.fuijitsu.com> | 2022-12-28 12:59:07 +0900 |
|---|---|---|
| committer | yamadafuyuka <yamada.fuyuka@jp.fuijitsu.com> | 2023-03-02 17:32:23 +0900 |
| commit | fccb005a6c995923d47aeda4e71a1d2a4a07f703 (patch) | |
| tree | 3de975cbca65a50a9bb04fc98a63ea971c96251d /numpy/distutils | |
| parent | 80d5aeb986a885b8cc43b27839477a15677bcac8 (diff) | |
| download | numpy-fccb005a6c995923d47aeda4e71a1d2a4a07f703.tar.gz | |
ENH: add support for fujitsu C/C++ compiler and SSL2 to numpy.
Diffstat (limited to 'numpy/distutils')
| -rw-r--r-- | numpy/distutils/ccompiler.py | 2 | ||||
| -rw-r--r-- | numpy/distutils/ccompiler_opt.py | 13 | ||||
| -rw-r--r-- | numpy/distutils/fujitsuccompiler.py | 28 | ||||
| -rw-r--r-- | numpy/distutils/system_info.py | 52 | ||||
| -rw-r--r-- | numpy/distutils/tests/test_ccompiler_opt.py | 6 |
5 files changed, 93 insertions, 8 deletions
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py index ee00511a8..0e018a268 100644 --- a/numpy/distutils/ccompiler.py +++ b/numpy/distutils/ccompiler.py @@ -720,6 +720,8 @@ compiler_class['pathcc'] = ('pathccompiler', 'PathScaleCCompiler', "PathScale Compiler for SiCortex-based applications") compiler_class['arm'] = ('armccompiler', 'ArmCCompiler', "Arm C Compiler") +compiler_class['fujitsu'] = ('fujitsuccompiler', 'FujitsuCCompiler', + "Fujitsu C Compiler") ccompiler._default_compilers += (('linux.*', 'intel'), ('linux.*', 'intele'), diff --git a/numpy/distutils/ccompiler_opt.py b/numpy/distutils/ccompiler_opt.py index 4bb0dd008..da60205ec 100644 --- a/numpy/distutils/ccompiler_opt.py +++ b/numpy/distutils/ccompiler_opt.py @@ -229,6 +229,11 @@ class _Config: native = None, opt = '/O2', werror = '/WX', + ), + fcc = dict( + native = '-mcpu=a64fx', + opt = None, + werror = None, ) ) conf_min_features = dict( @@ -338,7 +343,7 @@ class _Config: return {} on_x86 = self.cc_on_x86 or self.cc_on_x64 - is_unix = self.cc_is_gcc or self.cc_is_clang + is_unix = self.cc_is_gcc or self.cc_is_clang or self.cc_is_fcc if on_x86 and is_unix: return dict( SSE = dict(flags="-msse"), @@ -979,12 +984,14 @@ class _CCompiler: ("cc_is_iccw", ".*(intelw|intelemw|iccw).*", ""), ("cc_is_icc", ".*(intel|icc).*", ""), # intel unix like ("cc_is_msvc", ".*msvc.*", ""), + ("cc_is_fcc", ".*fcc.*", ""), # undefined compiler will be treat it as gcc ("cc_is_nocc", "", ""), ) detect_args = ( ("cc_has_debug", ".*(O0|Od|ggdb|coverage|debug:full).*", ""), - ("cc_has_native", ".*(-march=native|-xHost|/QxHost).*", ""), + ("cc_has_native", + ".*(-march=native|-xHost|/QxHost|-mcpu=a64fx).*", ""), # in case if the class run with -DNPY_DISABLE_OPTIMIZATION ("cc_noopt", ".*DISABLE_OPT.*", ""), ) @@ -1045,7 +1052,7 @@ class _CCompiler: break self.cc_name = "unknown" - for name in ("gcc", "clang", "iccw", "icc", "msvc"): + for name in ("gcc", "clang", "iccw", "icc", "msvc", "fcc"): if getattr(self, "cc_is_" + name): self.cc_name = name break diff --git a/numpy/distutils/fujitsuccompiler.py b/numpy/distutils/fujitsuccompiler.py new file mode 100644 index 000000000..c25900b34 --- /dev/null +++ b/numpy/distutils/fujitsuccompiler.py @@ -0,0 +1,28 @@ +from distutils.unixccompiler import UnixCCompiler + +class FujitsuCCompiler(UnixCCompiler): + + """ + Fujitsu compiler. + """ + + compiler_type = 'fujitsu' + cc_exe = 'fcc' + cxx_exe = 'FCC' + + def __init__(self, verbose=0, dry_run=0, force=0): + UnixCCompiler.__init__(self, verbose, dry_run, force) + cc_compiler = self.cc_exe + cxx_compiler = self.cxx_exe + self.set_executables( + compiler=cc_compiler + + ' -O3 -Nclang -fPIC', + compiler_so=cc_compiler + + ' -O3 -Nclang -fPIC', + compiler_cxx=cxx_compiler + + ' -O3 -Nclang -fPIC', + linker_exe=cc_compiler + + ' -lfj90i -lfj90f -lfjsrcinfo -lelf -shared', + linker_so=cc_compiler + + ' -lfj90i -lfj90f -lfjsrcinfo -lelf -shared' + ) diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py index d5a1687da..524171d24 100644 --- a/numpy/distutils/system_info.py +++ b/numpy/distutils/system_info.py @@ -62,6 +62,7 @@ Currently, the following classes are available, along with their section names: blas_ilp64_plain_opt_info:ALL # usage recommended (general ILP64 BLAS, no symbol suffix) blas_info:blas blas_mkl_info:mkl + blas_ssl2_info:ssl2 blas_opt_info:ALL # usage recommended blas_src_info:blas_src blis_info:blis @@ -93,9 +94,11 @@ Currently, the following classes are available, along with their section names: lapack_ilp64_plain_opt_info:ALL # usage recommended (general ILP64 LAPACK, no symbol suffix) lapack_info:lapack lapack_mkl_info:mkl + lapack_ssl2_info:ssl2 lapack_opt_info:ALL # usage recommended lapack_src_info:lapack_src mkl_info:mkl + ssl2_info:ssl2 numarray_info:numarray numerix_info:numerix numpy_info:numpy @@ -519,6 +522,7 @@ def get_info(name, notfound_action=0): 'lapack_atlas_3_10_threads': lapack_atlas_3_10_threads_info, # ditto 'flame': flame_info, # use lapack_opt instead 'mkl': mkl_info, + 'ssl2': ssl2_info, # openblas which may or may not have embedded lapack 'openblas': openblas_info, # use blas_opt instead # openblas with embedded lapack @@ -527,6 +531,8 @@ def get_info(name, notfound_action=0): 'blis': blis_info, # use blas_opt instead 'lapack_mkl': lapack_mkl_info, # use lapack_opt instead 'blas_mkl': blas_mkl_info, # use blas_opt instead + 'lapack_ssl2': lapack_ssl2_info, + 'blas_ssl2': blas_ssl2_info, 'accelerate': accelerate_info, # use blas_opt instead 'openblas64_': openblas64__info, 'openblas64__lapack': openblas64__lapack_info, @@ -1325,6 +1331,34 @@ class blas_mkl_info(mkl_info): pass +class ssl2_info(system_info): + section = 'ssl2' + dir_env_var = 'SSL2_DIR' + _lib_ssl2 = ['fjlapacksve'] + + def calc_info(self): + lib_dirs = self.get_lib_dirs() + incl_dirs = self.get_include_dirs() + ssl2_libs = self.get_libs('ssl2_libs', self._lib_ssl2) + info = self.check_libs2(lib_dirs, ssl2_libs) + if info is None: + return + dict_append(info, + define_macros=[('HAVE_CBLAS', None), + ('HAVE_SSL2', 1)], + include_dirs=incl_dirs,) + self.set_info(**info) + + +class lapack_ssl2_info(ssl2_info): + pass + + +class blas_ssl2_info(ssl2_info): + pass + + + class armpl_info(system_info): section = 'armpl' dir_env_var = 'ARMPL_DIR' @@ -1787,7 +1821,7 @@ class lapack_opt_info(system_info): notfounderror = LapackNotFoundError # List of all known LAPACK libraries, in the default order - lapack_order = ['armpl', 'mkl', 'openblas', 'flame', + lapack_order = ['armpl', 'mkl', 'ssl2', 'openblas', 'flame', 'accelerate', 'atlas', 'lapack'] order_env_var_name = 'NPY_LAPACK_ORDER' @@ -1805,6 +1839,13 @@ class lapack_opt_info(system_info): return True return False + def _calc_info_ssl2(self): + info = get_info('lapack_ssl2') + if info: + self.set_info(**info) + return True + return False + def _calc_info_openblas(self): info = get_info('openblas_lapack') if info: @@ -1971,7 +2012,7 @@ class blas_opt_info(system_info): notfounderror = BlasNotFoundError # List of all known BLAS libraries, in the default order - blas_order = ['armpl', 'mkl', 'blis', 'openblas', + blas_order = ['armpl', 'mkl', 'ssl2', 'blis', 'openblas', 'accelerate', 'atlas', 'blas'] order_env_var_name = 'NPY_BLAS_ORDER' @@ -1989,6 +2030,13 @@ class blas_opt_info(system_info): return True return False + def _calc_info_ssl2(self): + info = get_info('blas_ssl2') + if info: + self.set_info(**info) + return True + return False + def _calc_info_blis(self): info = get_info('blis') if info: diff --git a/numpy/distutils/tests/test_ccompiler_opt.py b/numpy/distutils/tests/test_ccompiler_opt.py index 657ebdb68..a1b780336 100644 --- a/numpy/distutils/tests/test_ccompiler_opt.py +++ b/numpy/distutils/tests/test_ccompiler_opt.py @@ -31,7 +31,7 @@ arch_compilers = dict( ppc64 = ("gcc", "clang"), ppc64le = ("gcc", "clang"), armhf = ("gcc", "clang"), - aarch64 = ("gcc", "clang"), + aarch64 = ("gcc", "clang", "fcc"), s390x = ("gcc", "clang"), noarch = ("gcc",) ) @@ -422,8 +422,8 @@ class _Test_CCompilerOpt: # when option "native" is activated through the args try: self.expect("native", - trap_flags=".*(-march=native|-xHost|/QxHost).*", - x86=".*", ppc64=".*", armhf=".*", s390x=".*" + trap_flags=".*(-march=native|-xHost|/QxHost|-mcpu=a64fx).*", + x86=".*", ppc64=".*", armhf=".*", s390x=".*", aarch64=".*", ) if self.march() != "unknown": raise AssertionError( |
