koichi12 commited on
Commit
d40a294
·
verified ·
1 Parent(s): ed30f97

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +7 -0
  2. .venv/lib/python3.11/site-packages/numpy/core/__pycache__/fromnumeric.cpython-311.pyc +3 -0
  3. .venv/lib/python3.11/site-packages/numpy/core/lib/libnpymath.a +0 -0
  4. .venv/lib/python3.11/site-packages/numpy/core/lib/npy-pkg-config/mlib.ini +12 -0
  5. .venv/lib/python3.11/site-packages/numpy/core/lib/npy-pkg-config/npymath.ini +20 -0
  6. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/__init__.cpython-311.pyc +0 -0
  7. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_abc.cpython-311.pyc +0 -0
  8. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_api.cpython-311.pyc +0 -0
  9. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_argparse.cpython-311.pyc +0 -0
  10. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_array_coercion.cpython-311.pyc +0 -0
  11. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_array_interface.cpython-311.pyc +0 -0
  12. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_arraymethod.cpython-311.pyc +0 -0
  13. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_casting_unittests.cpython-311.pyc +0 -0
  14. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_cpu_dispatcher.cpython-311.pyc +0 -0
  15. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_custom_dtypes.cpython-311.pyc +0 -0
  16. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_cython.cpython-311.pyc +0 -0
  17. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_datetime.cpython-311.pyc +3 -0
  18. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_deprecations.cpython-311.pyc +0 -0
  19. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_dlpack.cpython-311.pyc +0 -0
  20. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_dtype.cpython-311.pyc +3 -0
  21. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_einsum.cpython-311.pyc +0 -0
  22. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_hashtable.cpython-311.pyc +0 -0
  23. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_indexing.cpython-311.pyc +0 -0
  24. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_item_selection.cpython-311.pyc +0 -0
  25. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_limited_api.cpython-311.pyc +0 -0
  26. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_mem_overlap.cpython-311.pyc +0 -0
  27. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_mem_policy.cpython-311.pyc +0 -0
  28. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_multiarray.cpython-311.pyc +3 -0
  29. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_numerictypes.cpython-311.pyc +0 -0
  30. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_overrides.cpython-311.pyc +0 -0
  31. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_regression.cpython-311.pyc +3 -0
  32. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_scalar_ctors.cpython-311.pyc +0 -0
  33. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_scalarinherit.cpython-311.pyc +0 -0
  34. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_scalarprint.cpython-311.pyc +0 -0
  35. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_ufunc.cpython-311.pyc +3 -0
  36. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_umath.cpython-311.pyc +3 -0
  37. .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_umath_complex.cpython-311.pyc +0 -0
  38. .venv/lib/python3.11/site-packages/numpy/core/tests/data/astype_copy.pkl +3 -0
  39. .venv/lib/python3.11/site-packages/numpy/core/tests/data/numpy_2_0_array.pkl +3 -0
  40. .venv/lib/python3.11/site-packages/numpy/distutils/__init__.py +64 -0
  41. .venv/lib/python3.11/site-packages/numpy/distutils/__init__.pyi +4 -0
  42. .venv/lib/python3.11/site-packages/numpy/distutils/_shell_utils.py +91 -0
  43. .venv/lib/python3.11/site-packages/numpy/distutils/armccompiler.py +26 -0
  44. .venv/lib/python3.11/site-packages/numpy/distutils/ccompiler.py +826 -0
  45. .venv/lib/python3.11/site-packages/numpy/distutils/ccompiler_opt.py +0 -0
  46. .venv/lib/python3.11/site-packages/numpy/distutils/checks/cpu_asimd.c +27 -0
  47. .venv/lib/python3.11/site-packages/numpy/distutils/checks/cpu_asimdfhm.c +19 -0
  48. .venv/lib/python3.11/site-packages/numpy/distutils/checks/cpu_asimdhp.c +15 -0
  49. .venv/lib/python3.11/site-packages/numpy/distutils/checks/cpu_avx2.c +20 -0
  50. .venv/lib/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_cnl.c +24 -0
.gitattributes CHANGED
@@ -373,3 +373,10 @@ tuning-competition-baseline/.venv/lib/python3.11/site-packages/nvidia/cudnn/lib/
373
  .venv/lib/python3.11/site-packages/numpy/core/_multiarray_tests.cpython-311-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
374
  .venv/lib/python3.11/site-packages/numpy/core/_simd.cpython-311-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
375
  .venv/lib/python3.11/site-packages/numpy/core/__pycache__/_add_newdocs.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
373
  .venv/lib/python3.11/site-packages/numpy/core/_multiarray_tests.cpython-311-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
374
  .venv/lib/python3.11/site-packages/numpy/core/_simd.cpython-311-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
375
  .venv/lib/python3.11/site-packages/numpy/core/__pycache__/_add_newdocs.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
376
+ .venv/lib/python3.11/site-packages/numpy/core/__pycache__/fromnumeric.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
377
+ .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_regression.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
378
+ .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_multiarray.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
379
+ .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_dtype.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
380
+ .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_datetime.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
381
+ .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_umath.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
382
+ .venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_ufunc.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
.venv/lib/python3.11/site-packages/numpy/core/__pycache__/fromnumeric.cpython-311.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f708e7d1c6986af064a1f974c5fbc9ed8c2265f832b3816f9246f6928e59555
3
+ size 138391
.venv/lib/python3.11/site-packages/numpy/core/lib/libnpymath.a ADDED
Binary file (94 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/lib/npy-pkg-config/mlib.ini ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [meta]
2
+ Name = mlib
3
+ Description = Math library used with this version of numpy
4
+ Version = 1.0
5
+
6
+ [default]
7
+ Libs=-lm
8
+ Cflags=
9
+
10
+ [msvc]
11
+ Libs=m.lib
12
+ Cflags=
.venv/lib/python3.11/site-packages/numpy/core/lib/npy-pkg-config/npymath.ini ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [meta]
2
+ Name=npymath
3
+ Description=Portable, core math library implementing C99 standard
4
+ Version=0.1
5
+
6
+ [variables]
7
+ pkgname=numpy.core
8
+ prefix=${pkgdir}
9
+ libdir=${prefix}/lib
10
+ includedir=${prefix}/include
11
+
12
+ [default]
13
+ Libs=-L${libdir} -lnpymath
14
+ Cflags=-I${includedir}
15
+ Requires=mlib
16
+
17
+ [msvc]
18
+ Libs=/LIBPATH:${libdir} npymath.lib
19
+ Cflags=/INCLUDE:${includedir}
20
+ Requires=mlib
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (189 Bytes). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_abc.cpython-311.pyc ADDED
Binary file (4.91 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_api.cpython-311.pyc ADDED
Binary file (43.4 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_argparse.cpython-311.pyc ADDED
Binary file (4.49 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_array_coercion.cpython-311.pyc ADDED
Binary file (58.2 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_array_interface.cpython-311.pyc ADDED
Binary file (8.41 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_arraymethod.cpython-311.pyc ADDED
Binary file (5.64 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_casting_unittests.cpython-311.pyc ADDED
Binary file (42.4 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_cpu_dispatcher.cpython-311.pyc ADDED
Binary file (1.81 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_custom_dtypes.cpython-311.pyc ADDED
Binary file (19.2 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_cython.cpython-311.pyc ADDED
Binary file (7.14 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_datetime.cpython-311.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2e0c3d7232260c033eb81fd115df9726bc46c26f398f0de1994ae0b8f7282bee
3
+ size 182268
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_deprecations.cpython-311.pyc ADDED
Binary file (67.1 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_dlpack.cpython-311.pyc ADDED
Binary file (10 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_dtype.cpython-311.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:249b91291f022427627ce54ba7acda9347681c6235a77f7eda209890a65e9236
3
+ size 126538
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_einsum.cpython-311.pyc ADDED
Binary file (87.4 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_hashtable.cpython-311.pyc ADDED
Binary file (2.16 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_indexing.cpython-311.pyc ADDED
Binary file (93.7 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_item_selection.cpython-311.pyc ADDED
Binary file (11.8 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_limited_api.cpython-311.pyc ADDED
Binary file (1.85 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_mem_overlap.cpython-311.pyc ADDED
Binary file (55.2 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_mem_policy.cpython-311.pyc ADDED
Binary file (21.3 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_multiarray.cpython-311.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd62abae0db116ba948fa1d70d5ef91e0486534e0108444ba177033c09619ba5
3
+ size 722413
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_numerictypes.cpython-311.pyc ADDED
Binary file (42.7 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_overrides.cpython-311.pyc ADDED
Binary file (58.3 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_regression.cpython-311.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7e7c3b082979ca8226acc59fe301ea52f4ee36a605eb1d216d55077b0b8cc74f
3
+ size 186475
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_scalar_ctors.cpython-311.pyc ADDED
Binary file (14.3 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_scalarinherit.cpython-311.pyc ADDED
Binary file (7.08 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_scalarprint.cpython-311.pyc ADDED
Binary file (23.3 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_ufunc.cpython-311.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e30e90398a4cff151bd27deb21173050409f92bf3c2e96f3075065e074aee6a9
3
+ size 226774
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_umath.cpython-311.pyc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:799aa0eeebadd79f25fa7555a7f72cf566483c415817b2b61812c9b44e0515d9
3
+ size 373101
.venv/lib/python3.11/site-packages/numpy/core/tests/__pycache__/test_umath_complex.cpython-311.pyc ADDED
Binary file (45.4 kB). View file
 
.venv/lib/python3.11/site-packages/numpy/core/tests/data/astype_copy.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9564b309cbf3441ff0a6e4468fddaca46230fab34f15c77d87025a455bdf59d9
3
+ size 716
.venv/lib/python3.11/site-packages/numpy/core/tests/data/numpy_2_0_array.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:561d36b5dc82ca96bc35be10cdd5619c30225c43b6590adcc1cbce7430c5179c
3
+ size 718
.venv/lib/python3.11/site-packages/numpy/distutils/__init__.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ An enhanced distutils, providing support for Fortran compilers, for BLAS,
3
+ LAPACK and other common libraries for numerical computing, and more.
4
+
5
+ Public submodules are::
6
+
7
+ misc_util
8
+ system_info
9
+ cpu_info
10
+ log
11
+ exec_command
12
+
13
+ For details, please see the *Packaging* and *NumPy Distutils User Guide*
14
+ sections of the NumPy Reference Guide.
15
+
16
+ For configuring the preference for and location of libraries like BLAS and
17
+ LAPACK, and for setting include paths and similar build options, please see
18
+ ``site.cfg.example`` in the root of the NumPy repository or sdist.
19
+
20
+ """
21
+
22
+ import warnings
23
+
24
+ # Must import local ccompiler ASAP in order to get
25
+ # customized CCompiler.spawn effective.
26
+ from . import ccompiler
27
+ from . import unixccompiler
28
+
29
+ from .npy_pkg_config import *
30
+
31
+ warnings.warn("\n\n"
32
+ " `numpy.distutils` is deprecated since NumPy 1.23.0, as a result\n"
33
+ " of the deprecation of `distutils` itself. It will be removed for\n"
34
+ " Python >= 3.12. For older Python versions it will remain present.\n"
35
+ " It is recommended to use `setuptools < 60.0` for those Python versions.\n"
36
+ " For more details, see:\n"
37
+ " https://numpy.org/devdocs/reference/distutils_status_migration.html \n\n",
38
+ DeprecationWarning, stacklevel=2
39
+ )
40
+ del warnings
41
+
42
+ # If numpy is installed, add distutils.test()
43
+ try:
44
+ from . import __config__
45
+ # Normally numpy is installed if the above import works, but an interrupted
46
+ # in-place build could also have left a __config__.py. In that case the
47
+ # next import may still fail, so keep it inside the try block.
48
+ from numpy._pytesttester import PytestTester
49
+ test = PytestTester(__name__)
50
+ del PytestTester
51
+ except ImportError:
52
+ pass
53
+
54
+
55
+ def customized_fcompiler(plat=None, compiler=None):
56
+ from numpy.distutils.fcompiler import new_fcompiler
57
+ c = new_fcompiler(plat=plat, compiler=compiler)
58
+ c.customize()
59
+ return c
60
+
61
+ def customized_ccompiler(plat=None, compiler=None, verbose=1):
62
+ c = ccompiler.new_compiler(plat=plat, compiler=compiler, verbose=verbose)
63
+ c.customize('')
64
+ return c
.venv/lib/python3.11/site-packages/numpy/distutils/__init__.pyi ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ from typing import Any
2
+
3
+ # TODO: remove when the full numpy namespace is defined
4
+ def __getattr__(name: str) -> Any: ...
.venv/lib/python3.11/site-packages/numpy/distutils/_shell_utils.py ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Helper functions for interacting with the shell, and consuming shell-style
3
+ parameters provided in config files.
4
+ """
5
+ import os
6
+ import shlex
7
+ import subprocess
8
+ try:
9
+ from shlex import quote
10
+ except ImportError:
11
+ from pipes import quote
12
+
13
+ __all__ = ['WindowsParser', 'PosixParser', 'NativeParser']
14
+
15
+
16
+ class CommandLineParser:
17
+ """
18
+ An object that knows how to split and join command-line arguments.
19
+
20
+ It must be true that ``argv == split(join(argv))`` for all ``argv``.
21
+ The reverse neednt be true - `join(split(cmd))` may result in the addition
22
+ or removal of unnecessary escaping.
23
+ """
24
+ @staticmethod
25
+ def join(argv):
26
+ """ Join a list of arguments into a command line string """
27
+ raise NotImplementedError
28
+
29
+ @staticmethod
30
+ def split(cmd):
31
+ """ Split a command line string into a list of arguments """
32
+ raise NotImplementedError
33
+
34
+
35
+ class WindowsParser:
36
+ """
37
+ The parsing behavior used by `subprocess.call("string")` on Windows, which
38
+ matches the Microsoft C/C++ runtime.
39
+
40
+ Note that this is _not_ the behavior of cmd.
41
+ """
42
+ @staticmethod
43
+ def join(argv):
44
+ # note that list2cmdline is specific to the windows syntax
45
+ return subprocess.list2cmdline(argv)
46
+
47
+ @staticmethod
48
+ def split(cmd):
49
+ import ctypes # guarded import for systems without ctypes
50
+ try:
51
+ ctypes.windll
52
+ except AttributeError:
53
+ raise NotImplementedError
54
+
55
+ # Windows has special parsing rules for the executable (no quotes),
56
+ # that we do not care about - insert a dummy element
57
+ if not cmd:
58
+ return []
59
+ cmd = 'dummy ' + cmd
60
+
61
+ CommandLineToArgvW = ctypes.windll.shell32.CommandLineToArgvW
62
+ CommandLineToArgvW.restype = ctypes.POINTER(ctypes.c_wchar_p)
63
+ CommandLineToArgvW.argtypes = (ctypes.c_wchar_p, ctypes.POINTER(ctypes.c_int))
64
+
65
+ nargs = ctypes.c_int()
66
+ lpargs = CommandLineToArgvW(cmd, ctypes.byref(nargs))
67
+ args = [lpargs[i] for i in range(nargs.value)]
68
+ assert not ctypes.windll.kernel32.LocalFree(lpargs)
69
+
70
+ # strip the element we inserted
71
+ assert args[0] == "dummy"
72
+ return args[1:]
73
+
74
+
75
+ class PosixParser:
76
+ """
77
+ The parsing behavior used by `subprocess.call("string", shell=True)` on Posix.
78
+ """
79
+ @staticmethod
80
+ def join(argv):
81
+ return ' '.join(quote(arg) for arg in argv)
82
+
83
+ @staticmethod
84
+ def split(cmd):
85
+ return shlex.split(cmd, posix=True)
86
+
87
+
88
+ if os.name == 'nt':
89
+ NativeParser = WindowsParser
90
+ elif os.name == 'posix':
91
+ NativeParser = PosixParser
.venv/lib/python3.11/site-packages/numpy/distutils/armccompiler.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from distutils.unixccompiler import UnixCCompiler
2
+
3
+ class ArmCCompiler(UnixCCompiler):
4
+
5
+ """
6
+ Arm compiler.
7
+ """
8
+
9
+ compiler_type = 'arm'
10
+ cc_exe = 'armclang'
11
+ cxx_exe = 'armclang++'
12
+
13
+ def __init__(self, verbose=0, dry_run=0, force=0):
14
+ UnixCCompiler.__init__(self, verbose, dry_run, force)
15
+ cc_compiler = self.cc_exe
16
+ cxx_compiler = self.cxx_exe
17
+ self.set_executables(compiler=cc_compiler +
18
+ ' -O3 -fPIC',
19
+ compiler_so=cc_compiler +
20
+ ' -O3 -fPIC',
21
+ compiler_cxx=cxx_compiler +
22
+ ' -O3 -fPIC',
23
+ linker_exe=cc_compiler +
24
+ ' -lamath',
25
+ linker_so=cc_compiler +
26
+ ' -lamath -shared')
.venv/lib/python3.11/site-packages/numpy/distutils/ccompiler.py ADDED
@@ -0,0 +1,826 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import re
3
+ import sys
4
+ import platform
5
+ import shlex
6
+ import time
7
+ import subprocess
8
+ from copy import copy
9
+ from pathlib import Path
10
+ from distutils import ccompiler
11
+ from distutils.ccompiler import (
12
+ compiler_class, gen_lib_options, get_default_compiler, new_compiler,
13
+ CCompiler
14
+ )
15
+ from distutils.errors import (
16
+ DistutilsExecError, DistutilsModuleError, DistutilsPlatformError,
17
+ CompileError, UnknownFileError
18
+ )
19
+ from distutils.sysconfig import customize_compiler
20
+ from distutils.version import LooseVersion
21
+
22
+ from numpy.distutils import log
23
+ from numpy.distutils.exec_command import (
24
+ filepath_from_subprocess_output, forward_bytes_to_stdout
25
+ )
26
+ from numpy.distutils.misc_util import cyg2win32, is_sequence, mingw32, \
27
+ get_num_build_jobs, \
28
+ _commandline_dep_string, \
29
+ sanitize_cxx_flags
30
+
31
+ # globals for parallel build management
32
+ import threading
33
+
34
+ _job_semaphore = None
35
+ _global_lock = threading.Lock()
36
+ _processing_files = set()
37
+
38
+
39
+ def _needs_build(obj, cc_args, extra_postargs, pp_opts):
40
+ """
41
+ Check if an objects needs to be rebuild based on its dependencies
42
+
43
+ Parameters
44
+ ----------
45
+ obj : str
46
+ object file
47
+
48
+ Returns
49
+ -------
50
+ bool
51
+ """
52
+ # defined in unixcompiler.py
53
+ dep_file = obj + '.d'
54
+ if not os.path.exists(dep_file):
55
+ return True
56
+
57
+ # dep_file is a makefile containing 'object: dependencies'
58
+ # formatted like posix shell (spaces escaped, \ line continuations)
59
+ # the last line contains the compiler commandline arguments as some
60
+ # projects may compile an extension multiple times with different
61
+ # arguments
62
+ with open(dep_file) as f:
63
+ lines = f.readlines()
64
+
65
+ cmdline =_commandline_dep_string(cc_args, extra_postargs, pp_opts)
66
+ last_cmdline = lines[-1]
67
+ if last_cmdline != cmdline:
68
+ return True
69
+
70
+ contents = ''.join(lines[:-1])
71
+ deps = [x for x in shlex.split(contents, posix=True)
72
+ if x != "\n" and not x.endswith(":")]
73
+
74
+ try:
75
+ t_obj = os.stat(obj).st_mtime
76
+
77
+ # check if any of the dependencies is newer than the object
78
+ # the dependencies includes the source used to create the object
79
+ for f in deps:
80
+ if os.stat(f).st_mtime > t_obj:
81
+ return True
82
+ except OSError:
83
+ # no object counts as newer (shouldn't happen if dep_file exists)
84
+ return True
85
+
86
+ return False
87
+
88
+
89
+ def replace_method(klass, method_name, func):
90
+ # Py3k does not have unbound method anymore, MethodType does not work
91
+ m = lambda self, *args, **kw: func(self, *args, **kw)
92
+ setattr(klass, method_name, m)
93
+
94
+
95
+ ######################################################################
96
+ ## Method that subclasses may redefine. But don't call this method,
97
+ ## it i private to CCompiler class and may return unexpected
98
+ ## results if used elsewhere. So, you have been warned..
99
+
100
+ def CCompiler_find_executables(self):
101
+ """
102
+ Does nothing here, but is called by the get_version method and can be
103
+ overridden by subclasses. In particular it is redefined in the `FCompiler`
104
+ class where more documentation can be found.
105
+
106
+ """
107
+ pass
108
+
109
+
110
+ replace_method(CCompiler, 'find_executables', CCompiler_find_executables)
111
+
112
+
113
+ # Using customized CCompiler.spawn.
114
+ def CCompiler_spawn(self, cmd, display=None, env=None):
115
+ """
116
+ Execute a command in a sub-process.
117
+
118
+ Parameters
119
+ ----------
120
+ cmd : str
121
+ The command to execute.
122
+ display : str or sequence of str, optional
123
+ The text to add to the log file kept by `numpy.distutils`.
124
+ If not given, `display` is equal to `cmd`.
125
+ env : a dictionary for environment variables, optional
126
+
127
+ Returns
128
+ -------
129
+ None
130
+
131
+ Raises
132
+ ------
133
+ DistutilsExecError
134
+ If the command failed, i.e. the exit status was not 0.
135
+
136
+ """
137
+ env = env if env is not None else dict(os.environ)
138
+ if display is None:
139
+ display = cmd
140
+ if is_sequence(display):
141
+ display = ' '.join(list(display))
142
+ log.info(display)
143
+ try:
144
+ if self.verbose:
145
+ subprocess.check_output(cmd, env=env)
146
+ else:
147
+ subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env)
148
+ except subprocess.CalledProcessError as exc:
149
+ o = exc.output
150
+ s = exc.returncode
151
+ except OSError as e:
152
+ # OSError doesn't have the same hooks for the exception
153
+ # output, but exec_command() historically would use an
154
+ # empty string for EnvironmentError (base class for
155
+ # OSError)
156
+ # o = b''
157
+ # still that would make the end-user lost in translation!
158
+ o = f"\n\n{e}\n\n\n"
159
+ try:
160
+ o = o.encode(sys.stdout.encoding)
161
+ except AttributeError:
162
+ o = o.encode('utf8')
163
+ # status previously used by exec_command() for parent
164
+ # of OSError
165
+ s = 127
166
+ else:
167
+ # use a convenience return here so that any kind of
168
+ # caught exception will execute the default code after the
169
+ # try / except block, which handles various exceptions
170
+ return None
171
+
172
+ if is_sequence(cmd):
173
+ cmd = ' '.join(list(cmd))
174
+
175
+ if self.verbose:
176
+ forward_bytes_to_stdout(o)
177
+
178
+ if re.search(b'Too many open files', o):
179
+ msg = '\nTry rerunning setup command until build succeeds.'
180
+ else:
181
+ msg = ''
182
+ raise DistutilsExecError('Command "%s" failed with exit status %d%s' %
183
+ (cmd, s, msg))
184
+
185
+ replace_method(CCompiler, 'spawn', CCompiler_spawn)
186
+
187
+ def CCompiler_object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
188
+ """
189
+ Return the name of the object files for the given source files.
190
+
191
+ Parameters
192
+ ----------
193
+ source_filenames : list of str
194
+ The list of paths to source files. Paths can be either relative or
195
+ absolute, this is handled transparently.
196
+ strip_dir : bool, optional
197
+ Whether to strip the directory from the returned paths. If True,
198
+ the file name prepended by `output_dir` is returned. Default is False.
199
+ output_dir : str, optional
200
+ If given, this path is prepended to the returned paths to the
201
+ object files.
202
+
203
+ Returns
204
+ -------
205
+ obj_names : list of str
206
+ The list of paths to the object files corresponding to the source
207
+ files in `source_filenames`.
208
+
209
+ """
210
+ if output_dir is None:
211
+ output_dir = ''
212
+ obj_names = []
213
+ for src_name in source_filenames:
214
+ base, ext = os.path.splitext(os.path.normpath(src_name))
215
+ base = os.path.splitdrive(base)[1] # Chop off the drive
216
+ base = base[os.path.isabs(base):] # If abs, chop off leading /
217
+ if base.startswith('..'):
218
+ # Resolve starting relative path components, middle ones
219
+ # (if any) have been handled by os.path.normpath above.
220
+ i = base.rfind('..')+2
221
+ d = base[:i]
222
+ d = os.path.basename(os.path.abspath(d))
223
+ base = d + base[i:]
224
+ if ext not in self.src_extensions:
225
+ raise UnknownFileError("unknown file type '%s' (from '%s')" % (ext, src_name))
226
+ if strip_dir:
227
+ base = os.path.basename(base)
228
+ obj_name = os.path.join(output_dir, base + self.obj_extension)
229
+ obj_names.append(obj_name)
230
+ return obj_names
231
+
232
+ replace_method(CCompiler, 'object_filenames', CCompiler_object_filenames)
233
+
234
+ def CCompiler_compile(self, sources, output_dir=None, macros=None,
235
+ include_dirs=None, debug=0, extra_preargs=None,
236
+ extra_postargs=None, depends=None):
237
+ """
238
+ Compile one or more source files.
239
+
240
+ Please refer to the Python distutils API reference for more details.
241
+
242
+ Parameters
243
+ ----------
244
+ sources : list of str
245
+ A list of filenames
246
+ output_dir : str, optional
247
+ Path to the output directory.
248
+ macros : list of tuples
249
+ A list of macro definitions.
250
+ include_dirs : list of str, optional
251
+ The directories to add to the default include file search path for
252
+ this compilation only.
253
+ debug : bool, optional
254
+ Whether or not to output debug symbols in or alongside the object
255
+ file(s).
256
+ extra_preargs, extra_postargs : ?
257
+ Extra pre- and post-arguments.
258
+ depends : list of str, optional
259
+ A list of file names that all targets depend on.
260
+
261
+ Returns
262
+ -------
263
+ objects : list of str
264
+ A list of object file names, one per source file `sources`.
265
+
266
+ Raises
267
+ ------
268
+ CompileError
269
+ If compilation fails.
270
+
271
+ """
272
+ global _job_semaphore
273
+
274
+ jobs = get_num_build_jobs()
275
+
276
+ # setup semaphore to not exceed number of compile jobs when parallelized at
277
+ # extension level (python >= 3.5)
278
+ with _global_lock:
279
+ if _job_semaphore is None:
280
+ _job_semaphore = threading.Semaphore(jobs)
281
+
282
+ if not sources:
283
+ return []
284
+ from numpy.distutils.fcompiler import (FCompiler,
285
+ FORTRAN_COMMON_FIXED_EXTENSIONS,
286
+ has_f90_header)
287
+ if isinstance(self, FCompiler):
288
+ display = []
289
+ for fc in ['f77', 'f90', 'fix']:
290
+ fcomp = getattr(self, 'compiler_'+fc)
291
+ if fcomp is None:
292
+ continue
293
+ display.append("Fortran %s compiler: %s" % (fc, ' '.join(fcomp)))
294
+ display = '\n'.join(display)
295
+ else:
296
+ ccomp = self.compiler_so
297
+ display = "C compiler: %s\n" % (' '.join(ccomp),)
298
+ log.info(display)
299
+ macros, objects, extra_postargs, pp_opts, build = \
300
+ self._setup_compile(output_dir, macros, include_dirs, sources,
301
+ depends, extra_postargs)
302
+ cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
303
+ display = "compile options: '%s'" % (' '.join(cc_args))
304
+ if extra_postargs:
305
+ display += "\nextra options: '%s'" % (' '.join(extra_postargs))
306
+ log.info(display)
307
+
308
+ def single_compile(args):
309
+ obj, (src, ext) = args
310
+ if not _needs_build(obj, cc_args, extra_postargs, pp_opts):
311
+ return
312
+
313
+ # check if we are currently already processing the same object
314
+ # happens when using the same source in multiple extensions
315
+ while True:
316
+ # need explicit lock as there is no atomic check and add with GIL
317
+ with _global_lock:
318
+ # file not being worked on, start working
319
+ if obj not in _processing_files:
320
+ _processing_files.add(obj)
321
+ break
322
+ # wait for the processing to end
323
+ time.sleep(0.1)
324
+
325
+ try:
326
+ # retrieve slot from our #job semaphore and build
327
+ with _job_semaphore:
328
+ self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
329
+ finally:
330
+ # register being done processing
331
+ with _global_lock:
332
+ _processing_files.remove(obj)
333
+
334
+
335
+ if isinstance(self, FCompiler):
336
+ objects_to_build = list(build.keys())
337
+ f77_objects, other_objects = [], []
338
+ for obj in objects:
339
+ if obj in objects_to_build:
340
+ src, ext = build[obj]
341
+ if self.compiler_type=='absoft':
342
+ obj = cyg2win32(obj)
343
+ src = cyg2win32(src)
344
+ if Path(src).suffix.lower() in FORTRAN_COMMON_FIXED_EXTENSIONS \
345
+ and not has_f90_header(src):
346
+ f77_objects.append((obj, (src, ext)))
347
+ else:
348
+ other_objects.append((obj, (src, ext)))
349
+
350
+ # f77 objects can be built in parallel
351
+ build_items = f77_objects
352
+ # build f90 modules serial, module files are generated during
353
+ # compilation and may be used by files later in the list so the
354
+ # ordering is important
355
+ for o in other_objects:
356
+ single_compile(o)
357
+ else:
358
+ build_items = build.items()
359
+
360
+ if len(build) > 1 and jobs > 1:
361
+ # build parallel
362
+ from concurrent.futures import ThreadPoolExecutor
363
+ with ThreadPoolExecutor(jobs) as pool:
364
+ res = pool.map(single_compile, build_items)
365
+ list(res) # access result to raise errors
366
+ else:
367
+ # build serial
368
+ for o in build_items:
369
+ single_compile(o)
370
+
371
+ # Return *all* object filenames, not just the ones we just built.
372
+ return objects
373
+
374
+ replace_method(CCompiler, 'compile', CCompiler_compile)
375
+
376
+ def CCompiler_customize_cmd(self, cmd, ignore=()):
377
+ """
378
+ Customize compiler using distutils command.
379
+
380
+ Parameters
381
+ ----------
382
+ cmd : class instance
383
+ An instance inheriting from `distutils.cmd.Command`.
384
+ ignore : sequence of str, optional
385
+ List of `CCompiler` commands (without ``'set_'``) that should not be
386
+ altered. Strings that are checked for are:
387
+ ``('include_dirs', 'define', 'undef', 'libraries', 'library_dirs',
388
+ 'rpath', 'link_objects')``.
389
+
390
+ Returns
391
+ -------
392
+ None
393
+
394
+ """
395
+ log.info('customize %s using %s' % (self.__class__.__name__,
396
+ cmd.__class__.__name__))
397
+
398
+ if (
399
+ hasattr(self, 'compiler') and
400
+ 'clang' in self.compiler[0] and
401
+ not (platform.machine() == 'arm64' and sys.platform == 'darwin')
402
+ ):
403
+ # clang defaults to a non-strict floating error point model.
404
+ # However, '-ftrapping-math' is not currently supported (2023-04-08)
405
+ # for macosx_arm64.
406
+ # Since NumPy and most Python libs give warnings for these, override:
407
+ self.compiler.append('-ftrapping-math')
408
+ self.compiler_so.append('-ftrapping-math')
409
+
410
+ def allow(attr):
411
+ return getattr(cmd, attr, None) is not None and attr not in ignore
412
+
413
+ if allow('include_dirs'):
414
+ self.set_include_dirs(cmd.include_dirs)
415
+ if allow('define'):
416
+ for (name, value) in cmd.define:
417
+ self.define_macro(name, value)
418
+ if allow('undef'):
419
+ for macro in cmd.undef:
420
+ self.undefine_macro(macro)
421
+ if allow('libraries'):
422
+ self.set_libraries(self.libraries + cmd.libraries)
423
+ if allow('library_dirs'):
424
+ self.set_library_dirs(self.library_dirs + cmd.library_dirs)
425
+ if allow('rpath'):
426
+ self.set_runtime_library_dirs(cmd.rpath)
427
+ if allow('link_objects'):
428
+ self.set_link_objects(cmd.link_objects)
429
+
430
+ replace_method(CCompiler, 'customize_cmd', CCompiler_customize_cmd)
431
+
432
+ def _compiler_to_string(compiler):
433
+ props = []
434
+ mx = 0
435
+ keys = list(compiler.executables.keys())
436
+ for key in ['version', 'libraries', 'library_dirs',
437
+ 'object_switch', 'compile_switch',
438
+ 'include_dirs', 'define', 'undef', 'rpath', 'link_objects']:
439
+ if key not in keys:
440
+ keys.append(key)
441
+ for key in keys:
442
+ if hasattr(compiler, key):
443
+ v = getattr(compiler, key)
444
+ mx = max(mx, len(key))
445
+ props.append((key, repr(v)))
446
+ fmt = '%-' + repr(mx+1) + 's = %s'
447
+ lines = [fmt % prop for prop in props]
448
+ return '\n'.join(lines)
449
+
450
+ def CCompiler_show_customization(self):
451
+ """
452
+ Print the compiler customizations to stdout.
453
+
454
+ Parameters
455
+ ----------
456
+ None
457
+
458
+ Returns
459
+ -------
460
+ None
461
+
462
+ Notes
463
+ -----
464
+ Printing is only done if the distutils log threshold is < 2.
465
+
466
+ """
467
+ try:
468
+ self.get_version()
469
+ except Exception:
470
+ pass
471
+ if log._global_log.threshold<2:
472
+ print('*'*80)
473
+ print(self.__class__)
474
+ print(_compiler_to_string(self))
475
+ print('*'*80)
476
+
477
+ replace_method(CCompiler, 'show_customization', CCompiler_show_customization)
478
+
479
+ def CCompiler_customize(self, dist, need_cxx=0):
480
+ """
481
+ Do any platform-specific customization of a compiler instance.
482
+
483
+ This method calls `distutils.sysconfig.customize_compiler` for
484
+ platform-specific customization, as well as optionally remove a flag
485
+ to suppress spurious warnings in case C++ code is being compiled.
486
+
487
+ Parameters
488
+ ----------
489
+ dist : object
490
+ This parameter is not used for anything.
491
+ need_cxx : bool, optional
492
+ Whether or not C++ has to be compiled. If so (True), the
493
+ ``"-Wstrict-prototypes"`` option is removed to prevent spurious
494
+ warnings. Default is False.
495
+
496
+ Returns
497
+ -------
498
+ None
499
+
500
+ Notes
501
+ -----
502
+ All the default options used by distutils can be extracted with::
503
+
504
+ from distutils import sysconfig
505
+ sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'BASECFLAGS',
506
+ 'CCSHARED', 'LDSHARED', 'SO')
507
+
508
+ """
509
+ # See FCompiler.customize for suggested usage.
510
+ log.info('customize %s' % (self.__class__.__name__))
511
+ customize_compiler(self)
512
+ if need_cxx:
513
+ # In general, distutils uses -Wstrict-prototypes, but this option is
514
+ # not valid for C++ code, only for C. Remove it if it's there to
515
+ # avoid a spurious warning on every compilation.
516
+ try:
517
+ self.compiler_so.remove('-Wstrict-prototypes')
518
+ except (AttributeError, ValueError):
519
+ pass
520
+
521
+ if hasattr(self, 'compiler') and 'cc' in self.compiler[0]:
522
+ if not self.compiler_cxx:
523
+ if self.compiler[0].startswith('gcc'):
524
+ a, b = 'gcc', 'g++'
525
+ else:
526
+ a, b = 'cc', 'c++'
527
+ self.compiler_cxx = [self.compiler[0].replace(a, b)]\
528
+ + self.compiler[1:]
529
+ else:
530
+ if hasattr(self, 'compiler'):
531
+ log.warn("#### %s #######" % (self.compiler,))
532
+ if not hasattr(self, 'compiler_cxx'):
533
+ log.warn('Missing compiler_cxx fix for ' + self.__class__.__name__)
534
+
535
+
536
+ # check if compiler supports gcc style automatic dependencies
537
+ # run on every extension so skip for known good compilers
538
+ if hasattr(self, 'compiler') and ('gcc' in self.compiler[0] or
539
+ 'g++' in self.compiler[0] or
540
+ 'clang' in self.compiler[0]):
541
+ self._auto_depends = True
542
+ elif os.name == 'posix':
543
+ import tempfile
544
+ import shutil
545
+ tmpdir = tempfile.mkdtemp()
546
+ try:
547
+ fn = os.path.join(tmpdir, "file.c")
548
+ with open(fn, "w") as f:
549
+ f.write("int a;\n")
550
+ self.compile([fn], output_dir=tmpdir,
551
+ extra_preargs=['-MMD', '-MF', fn + '.d'])
552
+ self._auto_depends = True
553
+ except CompileError:
554
+ self._auto_depends = False
555
+ finally:
556
+ shutil.rmtree(tmpdir)
557
+
558
+ return
559
+
560
+ replace_method(CCompiler, 'customize', CCompiler_customize)
561
+
562
+ def simple_version_match(pat=r'[-.\d]+', ignore='', start=''):
563
+ """
564
+ Simple matching of version numbers, for use in CCompiler and FCompiler.
565
+
566
+ Parameters
567
+ ----------
568
+ pat : str, optional
569
+ A regular expression matching version numbers.
570
+ Default is ``r'[-.\\d]+'``.
571
+ ignore : str, optional
572
+ A regular expression matching patterns to skip.
573
+ Default is ``''``, in which case nothing is skipped.
574
+ start : str, optional
575
+ A regular expression matching the start of where to start looking
576
+ for version numbers.
577
+ Default is ``''``, in which case searching is started at the
578
+ beginning of the version string given to `matcher`.
579
+
580
+ Returns
581
+ -------
582
+ matcher : callable
583
+ A function that is appropriate to use as the ``.version_match``
584
+ attribute of a `CCompiler` class. `matcher` takes a single parameter,
585
+ a version string.
586
+
587
+ """
588
+ def matcher(self, version_string):
589
+ # version string may appear in the second line, so getting rid
590
+ # of new lines:
591
+ version_string = version_string.replace('\n', ' ')
592
+ pos = 0
593
+ if start:
594
+ m = re.match(start, version_string)
595
+ if not m:
596
+ return None
597
+ pos = m.end()
598
+ while True:
599
+ m = re.search(pat, version_string[pos:])
600
+ if not m:
601
+ return None
602
+ if ignore and re.match(ignore, m.group(0)):
603
+ pos = m.end()
604
+ continue
605
+ break
606
+ return m.group(0)
607
+ return matcher
608
+
609
+ def CCompiler_get_version(self, force=False, ok_status=[0]):
610
+ """
611
+ Return compiler version, or None if compiler is not available.
612
+
613
+ Parameters
614
+ ----------
615
+ force : bool, optional
616
+ If True, force a new determination of the version, even if the
617
+ compiler already has a version attribute. Default is False.
618
+ ok_status : list of int, optional
619
+ The list of status values returned by the version look-up process
620
+ for which a version string is returned. If the status value is not
621
+ in `ok_status`, None is returned. Default is ``[0]``.
622
+
623
+ Returns
624
+ -------
625
+ version : str or None
626
+ Version string, in the format of `distutils.version.LooseVersion`.
627
+
628
+ """
629
+ if not force and hasattr(self, 'version'):
630
+ return self.version
631
+ self.find_executables()
632
+ try:
633
+ version_cmd = self.version_cmd
634
+ except AttributeError:
635
+ return None
636
+ if not version_cmd or not version_cmd[0]:
637
+ return None
638
+ try:
639
+ matcher = self.version_match
640
+ except AttributeError:
641
+ try:
642
+ pat = self.version_pattern
643
+ except AttributeError:
644
+ return None
645
+ def matcher(version_string):
646
+ m = re.match(pat, version_string)
647
+ if not m:
648
+ return None
649
+ version = m.group('version')
650
+ return version
651
+
652
+ try:
653
+ output = subprocess.check_output(version_cmd, stderr=subprocess.STDOUT)
654
+ except subprocess.CalledProcessError as exc:
655
+ output = exc.output
656
+ status = exc.returncode
657
+ except OSError:
658
+ # match the historical returns for a parent
659
+ # exception class caught by exec_command()
660
+ status = 127
661
+ output = b''
662
+ else:
663
+ # output isn't actually a filepath but we do this
664
+ # for now to match previous distutils behavior
665
+ output = filepath_from_subprocess_output(output)
666
+ status = 0
667
+
668
+ version = None
669
+ if status in ok_status:
670
+ version = matcher(output)
671
+ if version:
672
+ version = LooseVersion(version)
673
+ self.version = version
674
+ return version
675
+
676
+ replace_method(CCompiler, 'get_version', CCompiler_get_version)
677
+
678
+ def CCompiler_cxx_compiler(self):
679
+ """
680
+ Return the C++ compiler.
681
+
682
+ Parameters
683
+ ----------
684
+ None
685
+
686
+ Returns
687
+ -------
688
+ cxx : class instance
689
+ The C++ compiler, as a `CCompiler` instance.
690
+
691
+ """
692
+ if self.compiler_type in ('msvc', 'intelw', 'intelemw'):
693
+ return self
694
+
695
+ cxx = copy(self)
696
+ cxx.compiler_cxx = cxx.compiler_cxx
697
+ cxx.compiler_so = [cxx.compiler_cxx[0]] + \
698
+ sanitize_cxx_flags(cxx.compiler_so[1:])
699
+ if (sys.platform.startswith(('aix', 'os400')) and
700
+ 'ld_so_aix' in cxx.linker_so[0]):
701
+ # AIX needs the ld_so_aix script included with Python
702
+ cxx.linker_so = [cxx.linker_so[0], cxx.compiler_cxx[0]] \
703
+ + cxx.linker_so[2:]
704
+ if sys.platform.startswith('os400'):
705
+ #This is required by i 7.4 and prievous for PRId64 in printf() call.
706
+ cxx.compiler_so.append('-D__STDC_FORMAT_MACROS')
707
+ #This a bug of gcc10.3, which failed to handle the TLS init.
708
+ cxx.compiler_so.append('-fno-extern-tls-init')
709
+ cxx.linker_so.append('-fno-extern-tls-init')
710
+ else:
711
+ cxx.linker_so = [cxx.compiler_cxx[0]] + cxx.linker_so[1:]
712
+ return cxx
713
+
714
+ replace_method(CCompiler, 'cxx_compiler', CCompiler_cxx_compiler)
715
+
716
+ compiler_class['intel'] = ('intelccompiler', 'IntelCCompiler',
717
+ "Intel C Compiler for 32-bit applications")
718
+ compiler_class['intele'] = ('intelccompiler', 'IntelItaniumCCompiler',
719
+ "Intel C Itanium Compiler for Itanium-based applications")
720
+ compiler_class['intelem'] = ('intelccompiler', 'IntelEM64TCCompiler',
721
+ "Intel C Compiler for 64-bit applications")
722
+ compiler_class['intelw'] = ('intelccompiler', 'IntelCCompilerW',
723
+ "Intel C Compiler for 32-bit applications on Windows")
724
+ compiler_class['intelemw'] = ('intelccompiler', 'IntelEM64TCCompilerW',
725
+ "Intel C Compiler for 64-bit applications on Windows")
726
+ compiler_class['pathcc'] = ('pathccompiler', 'PathScaleCCompiler',
727
+ "PathScale Compiler for SiCortex-based applications")
728
+ compiler_class['arm'] = ('armccompiler', 'ArmCCompiler',
729
+ "Arm C Compiler")
730
+ compiler_class['fujitsu'] = ('fujitsuccompiler', 'FujitsuCCompiler',
731
+ "Fujitsu C Compiler")
732
+
733
+ ccompiler._default_compilers += (('linux.*', 'intel'),
734
+ ('linux.*', 'intele'),
735
+ ('linux.*', 'intelem'),
736
+ ('linux.*', 'pathcc'),
737
+ ('nt', 'intelw'),
738
+ ('nt', 'intelemw'))
739
+
740
+ if sys.platform == 'win32':
741
+ compiler_class['mingw32'] = ('mingw32ccompiler', 'Mingw32CCompiler',
742
+ "Mingw32 port of GNU C Compiler for Win32"\
743
+ "(for MSC built Python)")
744
+ if mingw32():
745
+ # On windows platforms, we want to default to mingw32 (gcc)
746
+ # because msvc can't build blitz stuff.
747
+ log.info('Setting mingw32 as default compiler for nt.')
748
+ ccompiler._default_compilers = (('nt', 'mingw32'),) \
749
+ + ccompiler._default_compilers
750
+
751
+
752
+ _distutils_new_compiler = new_compiler
753
+ def new_compiler (plat=None,
754
+ compiler=None,
755
+ verbose=None,
756
+ dry_run=0,
757
+ force=0):
758
+ # Try first C compilers from numpy.distutils.
759
+ if verbose is None:
760
+ verbose = log.get_threshold() <= log.INFO
761
+ if plat is None:
762
+ plat = os.name
763
+ try:
764
+ if compiler is None:
765
+ compiler = get_default_compiler(plat)
766
+ (module_name, class_name, long_description) = compiler_class[compiler]
767
+ except KeyError:
768
+ msg = "don't know how to compile C/C++ code on platform '%s'" % plat
769
+ if compiler is not None:
770
+ msg = msg + " with '%s' compiler" % compiler
771
+ raise DistutilsPlatformError(msg)
772
+ module_name = "numpy.distutils." + module_name
773
+ try:
774
+ __import__ (module_name)
775
+ except ImportError as e:
776
+ msg = str(e)
777
+ log.info('%s in numpy.distutils; trying from distutils',
778
+ str(msg))
779
+ module_name = module_name[6:]
780
+ try:
781
+ __import__(module_name)
782
+ except ImportError as e:
783
+ msg = str(e)
784
+ raise DistutilsModuleError("can't compile C/C++ code: unable to load module '%s'" % \
785
+ module_name)
786
+ try:
787
+ module = sys.modules[module_name]
788
+ klass = vars(module)[class_name]
789
+ except KeyError:
790
+ raise DistutilsModuleError(("can't compile C/C++ code: unable to find class '%s' " +
791
+ "in module '%s'") % (class_name, module_name))
792
+ compiler = klass(None, dry_run, force)
793
+ compiler.verbose = verbose
794
+ log.debug('new_compiler returns %s' % (klass))
795
+ return compiler
796
+
797
+ ccompiler.new_compiler = new_compiler
798
+
799
+ _distutils_gen_lib_options = gen_lib_options
800
+ def gen_lib_options(compiler, library_dirs, runtime_library_dirs, libraries):
801
+ # the version of this function provided by CPython allows the following
802
+ # to return lists, which are unpacked automatically:
803
+ # - compiler.runtime_library_dir_option
804
+ # our version extends the behavior to:
805
+ # - compiler.library_dir_option
806
+ # - compiler.library_option
807
+ # - compiler.find_library_file
808
+ r = _distutils_gen_lib_options(compiler, library_dirs,
809
+ runtime_library_dirs, libraries)
810
+ lib_opts = []
811
+ for i in r:
812
+ if is_sequence(i):
813
+ lib_opts.extend(list(i))
814
+ else:
815
+ lib_opts.append(i)
816
+ return lib_opts
817
+ ccompiler.gen_lib_options = gen_lib_options
818
+
819
+ # Also fix up the various compiler modules, which do
820
+ # from distutils.ccompiler import gen_lib_options
821
+ # Don't bother with mwerks, as we don't support Classic Mac.
822
+ for _cc in ['msvc9', 'msvc', '_msvc', 'bcpp', 'cygwinc', 'emxc', 'unixc']:
823
+ _m = sys.modules.get('distutils.' + _cc + 'compiler')
824
+ if _m is not None:
825
+ setattr(_m, 'gen_lib_options', gen_lib_options)
826
+
.venv/lib/python3.11/site-packages/numpy/distutils/ccompiler_opt.py ADDED
The diff for this file is too large to render. See raw diff
 
.venv/lib/python3.11/site-packages/numpy/distutils/checks/cpu_asimd.c ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifdef _MSC_VER
2
+ #include <Intrin.h>
3
+ #endif
4
+ #include <arm_neon.h>
5
+
6
+ int main(int argc, char **argv)
7
+ {
8
+ float *src = (float*)argv[argc-1];
9
+ float32x4_t v1 = vdupq_n_f32(src[0]), v2 = vdupq_n_f32(src[1]);
10
+ /* MAXMIN */
11
+ int ret = (int)vgetq_lane_f32(vmaxnmq_f32(v1, v2), 0);
12
+ ret += (int)vgetq_lane_f32(vminnmq_f32(v1, v2), 0);
13
+ /* ROUNDING */
14
+ ret += (int)vgetq_lane_f32(vrndq_f32(v1), 0);
15
+ #ifdef __aarch64__
16
+ {
17
+ double *src2 = (double*)argv[argc-1];
18
+ float64x2_t vd1 = vdupq_n_f64(src2[0]), vd2 = vdupq_n_f64(src2[1]);
19
+ /* MAXMIN */
20
+ ret += (int)vgetq_lane_f64(vmaxnmq_f64(vd1, vd2), 0);
21
+ ret += (int)vgetq_lane_f64(vminnmq_f64(vd1, vd2), 0);
22
+ /* ROUNDING */
23
+ ret += (int)vgetq_lane_f64(vrndq_f64(vd1), 0);
24
+ }
25
+ #endif
26
+ return ret;
27
+ }
.venv/lib/python3.11/site-packages/numpy/distutils/checks/cpu_asimdfhm.c ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifdef _MSC_VER
2
+ #include <Intrin.h>
3
+ #endif
4
+ #include <arm_neon.h>
5
+
6
+ int main(int argc, char **argv)
7
+ {
8
+ float16_t *src = (float16_t*)argv[argc-1];
9
+ float *src2 = (float*)argv[argc-2];
10
+ float16x8_t vhp = vdupq_n_f16(src[0]);
11
+ float16x4_t vlhp = vdup_n_f16(src[1]);
12
+ float32x4_t vf = vdupq_n_f32(src2[0]);
13
+ float32x2_t vlf = vdup_n_f32(src2[1]);
14
+
15
+ int ret = (int)vget_lane_f32(vfmlal_low_f16(vlf, vlhp, vlhp), 0);
16
+ ret += (int)vgetq_lane_f32(vfmlslq_high_f16(vf, vhp, vhp), 0);
17
+
18
+ return ret;
19
+ }
.venv/lib/python3.11/site-packages/numpy/distutils/checks/cpu_asimdhp.c ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #ifdef _MSC_VER
2
+ #include <Intrin.h>
3
+ #endif
4
+ #include <arm_neon.h>
5
+
6
+ int main(int argc, char **argv)
7
+ {
8
+ float16_t *src = (float16_t*)argv[argc-1];
9
+ float16x8_t vhp = vdupq_n_f16(src[0]);
10
+ float16x4_t vlhp = vdup_n_f16(src[1]);
11
+
12
+ int ret = (int)vgetq_lane_f16(vabdq_f16(vhp, vhp), 0);
13
+ ret += (int)vget_lane_f16(vabd_f16(vlhp, vlhp), 0);
14
+ return ret;
15
+ }
.venv/lib/python3.11/site-packages/numpy/distutils/checks/cpu_avx2.c ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
2
+ /*
3
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
4
+ * whether or not the build options for those features are specified.
5
+ * Therefore, we must test #definitions of CPU features when option native/host
6
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
7
+ * the test will be broken and leads to enable all possible features.
8
+ */
9
+ #ifndef __AVX2__
10
+ #error "HOST/ARCH doesn't support AVX2"
11
+ #endif
12
+ #endif
13
+
14
+ #include <immintrin.h>
15
+
16
+ int main(int argc, char **argv)
17
+ {
18
+ __m256i a = _mm256_abs_epi16(_mm256_loadu_si256((const __m256i*)argv[argc-1]));
19
+ return _mm_cvtsi128_si32(_mm256_castsi256_si128(a));
20
+ }
.venv/lib/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_cnl.c ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
2
+ /*
3
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
4
+ * whether or not the build options for those features are specified.
5
+ * Therefore, we must test #definitions of CPU features when option native/host
6
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
7
+ * the test will be broken and leads to enable all possible features.
8
+ */
9
+ #if !defined(__AVX512VBMI__) || !defined(__AVX512IFMA__)
10
+ #error "HOST/ARCH doesn't support CannonLake AVX512 features"
11
+ #endif
12
+ #endif
13
+
14
+ #include <immintrin.h>
15
+
16
+ int main(int argc, char **argv)
17
+ {
18
+ __m512i a = _mm512_loadu_si512((const __m512i*)argv[argc-1]);
19
+ /* IFMA */
20
+ a = _mm512_madd52hi_epu64(a, a, _mm512_setzero_si512());
21
+ /* VMBI */
22
+ a = _mm512_permutex2var_epi8(a, _mm512_setzero_si512(), a);
23
+ return _mm_cvtsi128_si32(_mm512_castsi512_si128(a));
24
+ }