summaryrefslogtreecommitdiff
path: root/numpy/distutils
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/distutils')
-rw-r--r--numpy/distutils/ccompiler.py20
-rw-r--r--numpy/distutils/ccompiler_opt.py50
-rw-r--r--numpy/distutils/checks/cpu_avx512_spr.c26
-rw-r--r--numpy/distutils/command/build_clib.py1
-rw-r--r--numpy/distutils/command/build_ext.py7
-rw-r--r--numpy/distutils/command/build_src.py4
-rw-r--r--numpy/distutils/command/install.py2
-rw-r--r--numpy/distutils/fcompiler/__init__.py9
-rw-r--r--numpy/distutils/fcompiler/absoft.py4
-rw-r--r--numpy/distutils/fcompiler/ibm.py2
-rw-r--r--numpy/distutils/fujitsuccompiler.py28
-rw-r--r--numpy/distutils/mingw32ccompiler.py9
-rw-r--r--numpy/distutils/misc_util.py4
-rw-r--r--numpy/distutils/system_info.py89
-rw-r--r--numpy/distutils/tests/test_ccompiler_opt.py6
-rw-r--r--numpy/distutils/tests/test_system_info.py4
16 files changed, 213 insertions, 52 deletions
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py
index f0487cb64..40f495fc7 100644
--- a/numpy/distutils/ccompiler.py
+++ b/numpy/distutils/ccompiler.py
@@ -1,10 +1,12 @@
import os
import re
import sys
+import platform
import shlex
import time
import subprocess
from copy import copy
+from pathlib import Path
from distutils import ccompiler
from distutils.ccompiler import (
compiler_class, gen_lib_options, get_default_compiler, new_compiler,
@@ -57,7 +59,7 @@ def _needs_build(obj, cc_args, extra_postargs, pp_opts):
# the last line contains the compiler commandline arguments as some
# projects may compile an extension multiple times with different
# arguments
- with open(dep_file, "r") as f:
+ with open(dep_file) as f:
lines = f.readlines()
cmdline =_commandline_dep_string(cc_args, extra_postargs, pp_opts)
@@ -279,7 +281,8 @@ def CCompiler_compile(self, sources, output_dir=None, macros=None,
if not sources:
return []
- from numpy.distutils.fcompiler import (FCompiler, is_f_file,
+ from numpy.distutils.fcompiler import (FCompiler,
+ FORTRAN_COMMON_FIXED_EXTENSIONS,
has_f90_header)
if isinstance(self, FCompiler):
display = []
@@ -338,7 +341,8 @@ def CCompiler_compile(self, sources, output_dir=None, macros=None,
if self.compiler_type=='absoft':
obj = cyg2win32(obj)
src = cyg2win32(src)
- if is_f_file(src) and not has_f90_header(src):
+ if Path(src).suffix.lower() in FORTRAN_COMMON_FIXED_EXTENSIONS \
+ and not has_f90_header(src):
f77_objects.append((obj, (src, ext)))
else:
other_objects.append((obj, (src, ext)))
@@ -391,8 +395,14 @@ def CCompiler_customize_cmd(self, cmd, ignore=()):
log.info('customize %s using %s' % (self.__class__.__name__,
cmd.__class__.__name__))
- if hasattr(self, 'compiler') and 'clang' in self.compiler[0]:
+ if (
+ hasattr(self, 'compiler') and
+ 'clang' in self.compiler[0] and
+ not (platform.machine() == 'arm64' and sys.platform == 'darwin')
+ ):
# clang defaults to a non-strict floating error point model.
+ # However, '-ftrapping-math' is not currently supported (2023-04-08)
+ # for macosx_arm64.
# Since NumPy and most Python libs give warnings for these, override:
self.compiler.append('-ftrapping-math')
self.compiler_so.append('-ftrapping-math')
@@ -717,6 +727,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 5f18efc7d..6ba4cd816 100644
--- a/numpy/distutils/ccompiler_opt.py
+++ b/numpy/distutils/ccompiler_opt.py
@@ -16,15 +16,6 @@ import re
import subprocess
import textwrap
-# These flags are used to compile any C++ source within Numpy.
-# They are chosen to have very few runtime dependencies.
-NPY_CXX_FLAGS = [
- '-std=c++11', # Minimal standard version
- '-D__STDC_VERSION__=0', # for compatibility with C headers
- '-fno-exceptions', # no exception support
- '-fno-rtti'] # no runtime type information
-
-
class _Config:
"""An abstract class holds all configurable attributes of `CCompilerOpt`,
these class attributes can be used to change the default behavior
@@ -229,6 +220,11 @@ class _Config:
native = None,
opt = '/O2',
werror = '/WX',
+ ),
+ fcc = dict(
+ native = '-mcpu=a64fx',
+ opt = None,
+ werror = None,
)
)
conf_min_features = dict(
@@ -295,6 +291,10 @@ class _Config:
group="AVX512VBMI2 AVX512BITALG AVX512VPOPCNTDQ",
detect="AVX512_ICL", implies_detect=False
),
+ AVX512_SPR = dict(
+ interest=46, implies="AVX512_ICL", group="AVX512FP16",
+ detect="AVX512_SPR", implies_detect=False
+ ),
# IBM/Power
## Power7/ISA 2.06
VSX = dict(interest=1, headers="altivec.h", extra_checks="VSX_ASM"),
@@ -338,7 +338,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"),
@@ -365,7 +365,8 @@ class _Config:
AVX512_CNL = dict(flags="-mavx512ifma -mavx512vbmi"),
AVX512_ICL = dict(
flags="-mavx512vbmi2 -mavx512bitalg -mavx512vpopcntdq"
- )
+ ),
+ AVX512_SPR = dict(flags="-mavx512fp16"),
)
if on_x86 and self.cc_is_icc: return dict(
SSE = dict(flags="-msse"),
@@ -397,6 +398,7 @@ class _Config:
AVX512_CLX = dict(flags="-xCASCADELAKE"),
AVX512_CNL = dict(flags="-xCANNONLAKE"),
AVX512_ICL = dict(flags="-xICELAKE-CLIENT"),
+ AVX512_SPR = dict(disable="Not supported yet")
)
if on_x86 and self.cc_is_iccw: return dict(
SSE = dict(flags="/arch:SSE"),
@@ -429,7 +431,8 @@ class _Config:
AVX512_SKX = dict(flags="/Qx:SKYLAKE-AVX512"),
AVX512_CLX = dict(flags="/Qx:CASCADELAKE"),
AVX512_CNL = dict(flags="/Qx:CANNONLAKE"),
- AVX512_ICL = dict(flags="/Qx:ICELAKE-CLIENT")
+ AVX512_ICL = dict(flags="/Qx:ICELAKE-CLIENT"),
+ AVX512_SPR = dict(disable="Not supported yet")
)
if on_x86 and self.cc_is_msvc: return dict(
SSE = dict(flags="/arch:SSE") if self.cc_on_x86 else {},
@@ -467,7 +470,10 @@ class _Config:
AVX512_SKX = dict(flags="/arch:AVX512"),
AVX512_CLX = {},
AVX512_CNL = {},
- AVX512_ICL = {}
+ AVX512_ICL = {},
+ AVX512_SPR= dict(
+ disable="MSVC compiler doesn't support it"
+ )
)
on_power = self.cc_on_ppc64le or self.cc_on_ppc64
@@ -959,8 +965,12 @@ class _CCompiler:
detect_arch = (
("cc_on_x64", ".*(x|x86_|amd)64.*", ""),
("cc_on_x86", ".*(win32|x86|i386|i686).*", ""),
- ("cc_on_ppc64le", ".*(powerpc|ppc)64(el|le).*", ""),
- ("cc_on_ppc64", ".*(powerpc|ppc)64.*", ""),
+ ("cc_on_ppc64le", ".*(powerpc|ppc)64(el|le).*|.*powerpc.*",
+ "defined(__powerpc64__) && "
+ "defined(__LITTLE_ENDIAN__)"),
+ ("cc_on_ppc64", ".*(powerpc|ppc).*|.*powerpc.*",
+ "defined(__powerpc64__) && "
+ "defined(__BIG_ENDIAN__)"),
("cc_on_aarch64", ".*(aarch64|arm64).*", ""),
("cc_on_armhf", ".*arm.*", "defined(__ARM_ARCH_7__) || "
"defined(__ARM_ARCH_7A__)"),
@@ -975,12 +985,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.*", ""),
)
@@ -1041,7 +1053,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
@@ -1163,7 +1175,7 @@ class _CCompiler:
continue
lower_flags = flags[:-(i+1)]
upper_flags = flags[-i:]
- filterd = list(filter(
+ filtered = list(filter(
self._cc_normalize_unix_frgx.search, lower_flags
))
# gather subflags
@@ -1175,7 +1187,7 @@ class _CCompiler:
subflags = xsubflags + subflags
cur_flag = arch + '+' + '+'.join(subflags)
- flags = filterd + [cur_flag]
+ flags = filtered + [cur_flag]
if i > 0:
flags += upper_flags
break
diff --git a/numpy/distutils/checks/cpu_avx512_spr.c b/numpy/distutils/checks/cpu_avx512_spr.c
new file mode 100644
index 000000000..9710d0b2f
--- /dev/null
+++ b/numpy/distutils/checks/cpu_avx512_spr.c
@@ -0,0 +1,26 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #if !defined(__AVX512FP16__)
+ #error "HOST/ARCH doesn't support Sapphire Rapids AVX512FP16 features"
+ #endif
+#endif
+
+#include <immintrin.h>
+
+int main(int argc, char **argv)
+{
+/* clang has a bug regarding our spr coode, see gh-23730. */
+#if __clang__
+#error
+#endif
+ __m512h a = _mm512_loadu_ph((void*)argv[argc-1]);
+ __m512h temp = _mm512_fmadd_ph(a, a, a);
+ _mm512_storeu_ph((void*)(argv[argc-1]), temp);
+ return 0;
+}
diff --git a/numpy/distutils/command/build_clib.py b/numpy/distutils/command/build_clib.py
index 45201f98f..11999dae2 100644
--- a/numpy/distutils/command/build_clib.py
+++ b/numpy/distutils/command/build_clib.py
@@ -307,6 +307,7 @@ class build_clib(old_build_clib):
# problem, msvc uses its own convention :(
c_sources += cxx_sources
cxx_sources = []
+ extra_cflags += extra_cxxflags
# filtering C dispatch-table sources when optimization is not disabled,
# otherwise treated as normal sources.
diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py
index 6dc6b4265..68b13c0dd 100644
--- a/numpy/distutils/command/build_ext.py
+++ b/numpy/distutils/command/build_ext.py
@@ -259,7 +259,7 @@ class build_ext (old_build_ext):
log.warn('resetting extension %r language from %r to %r.' %
(ext.name, l, ext_language))
- ext.language = ext_language
+ ext.language = ext_language
# global language
all_languages.update(ext_languages)
@@ -407,6 +407,7 @@ class build_ext (old_build_ext):
if cxx_sources:
# Needed to compile kiva.agg._agg extension.
extra_args.append('/Zm1000')
+ extra_cflags += extra_cxxflags
# this hack works around the msvc compiler attributes
# problem, msvc uses its own convention :(
c_sources += cxx_sources
@@ -641,12 +642,12 @@ class build_ext (old_build_ext):
if os.path.isfile(fake_lib):
# Replace fake static library
libraries.remove(lib)
- with open(fake_lib, 'r') as f:
+ with open(fake_lib) as f:
unlinkable_fobjects.extend(f.read().splitlines())
# Expand C objects
c_lib = os.path.join(libdir, lib + '.cobjects')
- with open(c_lib, 'r') as f:
+ with open(c_lib) as f:
objects.extend(f.read().splitlines())
# Wrap unlinkable objects to a linkable one
diff --git a/numpy/distutils/command/build_src.py b/numpy/distutils/command/build_src.py
index 5581011f6..bf3d03c70 100644
--- a/numpy/distutils/command/build_src.py
+++ b/numpy/distutils/command/build_src.py
@@ -725,7 +725,7 @@ _has_c_header = re.compile(r'-\*-\s*c\s*-\*-', re.I).search
_has_cpp_header = re.compile(r'-\*-\s*c\+\+\s*-\*-', re.I).search
def get_swig_target(source):
- with open(source, 'r') as f:
+ with open(source) as f:
result = None
line = f.readline()
if _has_cpp_header(line):
@@ -735,7 +735,7 @@ def get_swig_target(source):
return result
def get_swig_modulename(source):
- with open(source, 'r') as f:
+ with open(source) as f:
name = None
for line in f:
m = _swig_module_name_match(line)
diff --git a/numpy/distutils/command/install.py b/numpy/distutils/command/install.py
index 2eff2d145..efa9b4740 100644
--- a/numpy/distutils/command/install.py
+++ b/numpy/distutils/command/install.py
@@ -62,7 +62,7 @@ class install(old_install):
# bdist_rpm fails when INSTALLED_FILES contains
# paths with spaces. Such paths must be enclosed
# with double-quotes.
- with open(self.record, 'r') as f:
+ with open(self.record) as f:
lines = []
need_rewrite = False
for l in f:
diff --git a/numpy/distutils/fcompiler/__init__.py b/numpy/distutils/fcompiler/__init__.py
index ecba3e5d5..5160e2abf 100644
--- a/numpy/distutils/fcompiler/__init__.py
+++ b/numpy/distutils/fcompiler/__init__.py
@@ -19,6 +19,7 @@ __all__ = ['FCompiler', 'new_fcompiler', 'show_fcompilers',
import os
import sys
import re
+from pathlib import Path
from distutils.sysconfig import get_python_lib
from distutils.fancy_getopt import FancyGetopt
@@ -37,6 +38,10 @@ from .environment import EnvironmentConfig
__metaclass__ = type
+
+FORTRAN_COMMON_FIXED_EXTENSIONS = ['.for', '.ftn', '.f77', '.f']
+
+
class CompilerNotFound(Exception):
pass
@@ -571,7 +576,8 @@ class FCompiler(CCompiler):
def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
"""Compile 'src' to product 'obj'."""
src_flags = {}
- if is_f_file(src) and not has_f90_header(src):
+ if Path(src).suffix.lower() in FORTRAN_COMMON_FIXED_EXTENSIONS \
+ and not has_f90_header(src):
flavor = ':f77'
compiler = self.compiler_f77
src_flags = get_f77flags(src)
@@ -970,7 +976,6 @@ def dummy_fortran_file():
return name[:-2]
-is_f_file = re.compile(r'.*\.(for|ftn|f77|f)\Z', re.I).match
_has_f_header = re.compile(r'-\*-\s*fortran\s*-\*-', re.I).search
_has_f90_header = re.compile(r'-\*-\s*f90\s*-\*-', re.I).search
_has_fix_header = re.compile(r'-\*-\s*fix\s*-\*-', re.I).search
diff --git a/numpy/distutils/fcompiler/absoft.py b/numpy/distutils/fcompiler/absoft.py
index efe3a4cb5..68f516b92 100644
--- a/numpy/distutils/fcompiler/absoft.py
+++ b/numpy/distutils/fcompiler/absoft.py
@@ -1,6 +1,6 @@
-# http://www.absoft.com/literature/osxuserguide.pdf
-# http://www.absoft.com/documentation.html
+# Absoft Corporation ceased operations on 12/31/2022.
+# Thus, all links to <http://www.absoft.com> are invalid.
# Notes:
# - when using -g77 then use -DUNDERSCORE_G77 to compile f2py
diff --git a/numpy/distutils/fcompiler/ibm.py b/numpy/distutils/fcompiler/ibm.py
index eff24401a..29927518c 100644
--- a/numpy/distutils/fcompiler/ibm.py
+++ b/numpy/distutils/fcompiler/ibm.py
@@ -76,7 +76,7 @@ class IBMFCompiler(FCompiler):
xlf_cfg = '/etc/opt/ibmcmp/xlf/%s/xlf.cfg' % version
fo, new_cfg = make_temp_file(suffix='_xlf.cfg')
log.info('Creating '+new_cfg)
- with open(xlf_cfg, 'r') as fi:
+ with open(xlf_cfg) as fi:
crt1_match = re.compile(r'\s*crt\s*=\s*(?P<path>.*)/crt1.o').match
for line in fi:
m = crt1_match(line)
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/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py
index 5d1c27a65..4763f41ad 100644
--- a/numpy/distutils/mingw32ccompiler.py
+++ b/numpy/distutils/mingw32ccompiler.py
@@ -8,7 +8,6 @@ Support code for building Python extensions on Windows.
"""
import os
-import platform
import sys
import subprocess
import re
@@ -203,11 +202,11 @@ def find_python_dll():
# search in the file system for possible candidates
major_version, minor_version = tuple(sys.version_info[:2])
- implementation = platform.python_implementation()
- if implementation == 'CPython':
+ implementation = sys.implementation.name
+ if implementation == 'cpython':
dllname = f'python{major_version}{minor_version}.dll'
- elif implementation == 'PyPy':
- dllname = f'libpypy{major_version}-c.dll'
+ elif implementation == 'pypy':
+ dllname = f'libpypy{major_version}.{minor_version}-c.dll'
else:
dllname = f'Unknown platform {implementation}'
print("Looking for %s" % dllname)
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
index 79ba08515..e226b4744 100644
--- a/numpy/distutils/misc_util.py
+++ b/numpy/distutils/misc_util.py
@@ -475,7 +475,7 @@ def _get_f90_modules(source):
if not f90_ext_match(source):
return []
modules = []
- with open(source, 'r') as f:
+ with open(source) as f:
for line in f:
m = f90_module_name_match(line)
if m:
@@ -1932,7 +1932,7 @@ class Configuration:
revision0 = f.read().strip()
branch_map = {}
- with open(branch_cache_fn, 'r') as f:
+ with open(branch_cache_fn) as f:
for line in f:
branch1, revision1 = line.split()[:2]
if revision1==revision0:
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
index d5a1687da..3dca7fb5a 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,
@@ -1260,7 +1266,7 @@ class mkl_info(system_info):
paths = os.environ.get('LD_LIBRARY_PATH', '').split(os.pathsep)
ld_so_conf = '/etc/ld.so.conf'
if os.path.isfile(ld_so_conf):
- with open(ld_so_conf, 'r') as f:
+ with open(ld_so_conf) as f:
for d in f:
d = d.strip()
if d:
@@ -1325,6 +1331,63 @@ class blas_mkl_info(mkl_info):
pass
+class ssl2_info(system_info):
+ section = 'ssl2'
+ dir_env_var = 'SSL2_DIR'
+ # Multi-threaded version. Python itself must be built by Fujitsu compiler.
+ _lib_ssl2 = ['fjlapackexsve']
+ # Single-threaded version
+ #_lib_ssl2 = ['fjlapacksve']
+
+ def get_tcsds_rootdir(self):
+ tcsdsroot = os.environ.get('TCSDS_PATH', None)
+ if tcsdsroot is not None:
+ return tcsdsroot
+ return None
+
+ def __init__(self):
+ tcsdsroot = self.get_tcsds_rootdir()
+ if tcsdsroot is None:
+ system_info.__init__(self)
+ else:
+ system_info.__init__(
+ self,
+ default_lib_dirs=[os.path.join(tcsdsroot, 'lib64')],
+ default_include_dirs=[os.path.join(tcsdsroot,
+ 'clang-comp/include')])
+
+ def calc_info(self):
+ tcsdsroot = self.get_tcsds_rootdir()
+
+ lib_dirs = self.get_lib_dirs()
+ if lib_dirs is None:
+ lib_dirs = os.path.join(tcsdsroot, 'lib64')
+
+ incl_dirs = self.get_include_dirs()
+ if incl_dirs is None:
+ incl_dirs = os.path.join(tcsdsroot, 'clang-comp/include')
+
+ 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 +1850,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 +1868,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 +2041,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 +2059,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:
@@ -2190,7 +2267,7 @@ class blas_info(system_info):
}""")
src = os.path.join(tmpdir, 'source.c')
try:
- with open(src, 'wt') as f:
+ with open(src, 'w') as f:
f.write(s)
try:
@@ -2345,7 +2422,7 @@ class openblas_info(blas_info):
except Exception:
extra_args = []
try:
- with open(src, 'wt') as f:
+ with open(src, 'w') as f:
f.write(s)
obj = c.compile([src], output_dir=tmpdir)
try:
@@ -2456,7 +2533,7 @@ class flame_info(system_info):
# Add the additional "extra" arguments
extra_args = info.get('extra_link_args', [])
try:
- with open(src, 'wt') as f:
+ with open(src, 'w') as f:
f.write(s)
obj = c.compile([src], output_dir=tmpdir)
try:
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(
diff --git a/numpy/distutils/tests/test_system_info.py b/numpy/distutils/tests/test_system_info.py
index eb7235e04..66304a5e5 100644
--- a/numpy/distutils/tests/test_system_info.py
+++ b/numpy/distutils/tests/test_system_info.py
@@ -271,7 +271,7 @@ class TestSystemInfoReading:
# But if we copy the values to a '[mkl]' section the value
# is correct
- with open(cfg, 'r') as fid:
+ with open(cfg) as fid:
mkl = fid.read().replace('[ALL]', '[mkl]', 1)
with open(cfg, 'w') as fid:
fid.write(mkl)
@@ -279,7 +279,7 @@ class TestSystemInfoReading:
assert info.get_lib_dirs() == lib_dirs
# Also, the values will be taken from a section named '[DEFAULT]'
- with open(cfg, 'r') as fid:
+ with open(cfg) as fid:
dflt = fid.read().replace('[mkl]', '[DEFAULT]', 1)
with open(cfg, 'w') as fid:
fid.write(dflt)