| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
| |
Co-authored-by: Matti Picus <matti.picus@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The default compiles compatibly with 1.17.x, we allow going back to
1.15 (mainly because it is easy).
There were few additions in this time, a few structs grew and very
few API functions were added. Added a way to mark API functions
as requiring a specific target version.
If a user wishes to use the *new* API, they have to add the definition:
#define NPY_TARGET_VERSION NPY_1_22_API_VERSION
Before importing NumPy. (Our version numbering is a bit funny
I first thought to use a hex version of the main NumPy version,
but since we already have the `NPY_1_22_API_VERSION` defines...)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a way for downstream users to specify which NumPy version
they wish to be compaible with.
Note that we provide a conservative default here (because almost nobody
actually uses new API as they would lose backwards compatibility).
Initially I had thought we should just redefine it so that the target
version uses the same scheme as the Python hex version (and limited API),
but since we have `NPY_1_15_API_VERSION` defines, use those...
This commit does not include any actual use of this!
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
It seems on raspian arm with clang 13 `__builtin_mul_overflow` is
defined for `int` but doesn't work for `ptrdiff_t` (and maybe others).
This checks for `ptrdiff_t` instead of int, which was reported to
work-around the issue.
Closes gh-22811
|
| |
|
|\
| |
| |
| |
| | |
Developer-Ecosystem-Engineering/remove_Avx_when_not_used
ENH: Remove AVX related functions from non x86 based builds
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Apple silicon builds of NumPy have extra functions in them for AVX2/AVX512. The changes here remove those implementations if we're not building for x86.
Apple silicon:
- original size: 3946035 bytes
- new size: 3657731 bytes
- savings: 288304 bytes (7.31%)
Changes pass all tests on M1 native, M1 Rosetta, and iMacPro (AVX512). We've verified performance is the same before/after for Rosetta and iMacPro. We've also verified that binaries are exactly the same size and have the same number of symbols in them.
|
| | |
|
| | |
|
|\ \
| |/
|/| |
BUG: Support using libunwind for backtrack
|
| |
| |
| |
| |
| |
| |
| | |
Some system (e.g. musl) do not have "execinfo.h", and the backtracking
is provided by libunwind.
Fix: #22084
|
| | |
|
| | |
|
| |
| |
| |
| | |
generated
|
| | |
|
| |
| |
| |
| | |
Signed-off-by: mattip <matti.picus@gmail.com>
|
| |
| |
| |
| | |
Signed-off-by: mattip <matti.picus@gmail.com>
|
| | |
|
|/ |
|
| |
|
| |
|
|
|
|
| |
These were missed in the 1.24.0 preparations.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I am not sure why the previous places led to (oddly) unreliable code
on some Mac clang versions. Moving it here fixes it, so it is all fine.
There was previously some inlining, which we should be able to trust the
compiler to do (as an attempt to get back to the same result as the
macro version.
But it turned out the issue was moving down the FPE clearing till after
we know we actually do the operation.
This also removes an unused function for true division IIRC.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The web assembly linker is strict about function types, it is unwilling
to link a function defined with signature say `double f(double, double)`
to an invocation with signature `void f(void)`. This causes trouble in
`numpy/core/setup.py` in the functions `check_math_capabilities` and
`check_mathlib`.
This patch fixes the problem by giving config.try_link the correct
function signatures for these functions. In particular I added a separate
header file with all the math declarations. It would be be possible to
just include 'math.h' but we also need to parse the declarations to figure
out how to call the functions. If f has arguments type1, type2, type3, we
want to call it like f((type1)0, (type2)0, (type3)0). Anyways it is easier
to parse the arguments out of our feature_detection_math.h than to worry
about the possibility that someone will have a differently formatted system
math.h. We do a test where we include both math.h and feature_detection_math.h
to ensure consistency between the signatures.
I also separated out the fcntl functions, backtrace and madvise, and strtold_l.
This is because they require separate headers. strtold_l requires testing both
with the locale.h header and with the xlocale.h header (this seems to vary even
among different linuxes). All of the functions I moved out of OPTIONAL_STDFUNCS
are absent on windows and some are absent on OSX so separating them out of the
OPTIONAL_STDFUNCS should mildly improve the speed of feature detection on mac
and windows (since they have all the functions remaining in OPTIONAL_STDFUNCS).
|
|
|
|
|
|
|
|
| |
LooseVersion is provided by Python distutils, which is going away in
3.12. This PR vendors _pep440 from scipy and uses it as a replacement.
Numpy distutils is not touched, replacing LooseVersion in that package
was considered too risky, and numpy distutils will need to go away when
Python distutils does.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes gh-17467. Adds a public struct to hold memory manipulation routines PyDataMem_Handler and two new API functions PyDataMem_SetHandler to replace the current routines with the new ones, and PyDataMem_GetHandlerName to get the string name of the current routines (either globally or for a specific ndarray object). This also changes the size of the ndarray object to hold the PyDataMem_Handler active when it was created so subsequent actions on its data memory will remain consistent.
Tests and documentation are included. Along the way, I found some places in the code where the current policy is inconsistent (all data memory handling should have gone through npy_*_cache not PyDataMem_*) so even if this is rejected it might improve the cache handling.
The PyDataMem_Handler has fields to override memcpy, these are currently not implemented: memcpy in the code base is untouched. I think this PR is invasive enough as-is, if desired memcpy can be handled in a follow-up PR.
* ENH: add and use global configurable memory routines
* ENH: add tests and a way to compile c-extensions from tests
* fix allocation/free exposed by tests
* DOC: document the new APIs (and some old ones too)
* BUG: return void from FREE, also some cleanup
* MAINT: changes from review
* fixes from linter
* setting ndarray->descr on 0d or scalars mess with FREE
* make scalar allocation more consistent wrt np_alloc_cache
* change formatting for sphinx
* remove memcpy variants
* update to match NEP 49
* ENH: add a python-level get_handler_name
* ENH: add core.multiarray.get_handler_name
* Allow closure-like definition of the data mem routines
* Fix incompatible pointer warnings
* Note PyDataMemAllocator and PyMemAllocatorEx differentiation
Co-authored-by: Matti Picus <matti.picus@gmail.com>
* Redefine default allocator handling
* Always allocate new arrays using the current_handler
* Search for the mem_handler name of the data owner
* Sub-comparisons don't need a local mem_handler
* Make the default_handler a valid PyDataMem_Handler
* Fix PyDataMem_SetHandler description (NEP discussion)
* Pass the allocators by reference
* Implement allocator context-locality
* Fix documentation, make PyDataMem_GetHandler return const
* remove import of setuptools==49.1.3, doesn't work on python3.10
* Fix refcount leaks
* fix function signatures in test
* Return early on PyDataMem_GetHandler error (VOID_compare)
* Add context/thread-locality tests, allow testing custom policies
* ENH: add and use global configurable memory routines
* ENH: add tests and a way to compile c-extensions from tests
* fix allocation/free exposed by tests
* DOC: document the new APIs (and some old ones too)
* BUG: return void from FREE, also some cleanup
* MAINT: changes from review
* fixes from linter
* setting ndarray->descr on 0d or scalars mess with FREE
* make scalar allocation more consistent wrt np_alloc_cache
* change formatting for sphinx
* remove memcpy variants
* update to match NEP 49
* ENH: add a python-level get_handler_name
* ENH: add core.multiarray.get_handler_name
* Allow closure-like definition of the data mem routines
* Fix incompatible pointer warnings
* Note PyDataMemAllocator and PyMemAllocatorEx differentiation
Co-authored-by: Matti Picus <matti.picus@gmail.com>
* Redefine default allocator handling
* Always allocate new arrays using the current_handler
* Search for the mem_handler name of the data owner
* Sub-comparisons don't need a local mem_handler
* Make the default_handler a valid PyDataMem_Handler
* Fix PyDataMem_SetHandler description (NEP discussion)
* Pass the allocators by reference
* remove import of setuptools==49.1.3, doesn't work on python3.10
* fix function signatures in test
* try to fix cygwin extension building
* YAPF mem_policy test
* Less empty lines, more comments (tests)
* Apply suggestions from code review (set an exception and)
Co-authored-by: Matti Picus <matti.picus@gmail.com>
* skip test on cygwin
* update API hash for changed signature
* TST: add gc.collect to make sure cycles are broken
* Implement thread-locality for PyPy
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
* Update numpy/core/tests/test_mem_policy.py
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
* fixes from review
* update circleci config
* fix test
* make the connection between OWNDATA and having a allocator handle more explicit
* improve docstring, fix flake8 for tests
* update PyDataMem_GetHandler() from review
* Implement allocator lifetime management
* update NEP and add best-effort handling of error in PyDataMem_UserFREE
* ENH: fix and test for blindly taking ownership of data
* Update doc/neps/nep-0049.rst
Co-authored-by: Elias Koromilas <elias.koromilas@gmail.com>
|
|
|
|
| |
No changes for the NumPy 1.21.x release.
|
| |
|
|
|
|
|
|
|
| |
The code that checks for AVX512 SKX intrisics compiler support has a bug
which always causes the check to fail and hence disables code that used
AVX512_SKX features. Introduced in
https://github.com/numpy/numpy/pull/16871/.
|
|
|
|
|
|
|
|
|
| |
Via prototype docstring autoreformatter; and cherry-picked to mostly
include spacing issues around colons in parameters and see also.
When no space is present numpydoc tend to miss-parse those sections
A couple of typos are fixed as well.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new tags look like '1.21.0.dev0+98.gaa0453721f', where '98' is the
number of commits since the 1.21.0 branch was started and 'aa0453721f'.
The chosen form may be specified in the 'setup.cfg' file. This PR adds
two new files 'numpy/_version.py' and 'numpy/version.py'. The latter
is kept because it is part of the public API and is actually used by
some downstream projects, but it is no longer dynamically created.
See https://github.com/python-versioneer/python-versioneer/ for more
information.
|
|
|
|
|
|
| |
- Update cversions.txt
- Update numpyconfig.h
- Update setup_common.py
|
|
|
|
|
|
| |
gcc-4.9 is missing a few AVX-512F intrisics, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61878. We use some of these
missing intrinsics to check for compiler support of AVX-512F.
|
|
|
|
|
|
|
| |
* ENH: Use AVX-512 for np.isnan, np.infinite, np.isinf and np.signbit
* TST: Add tests to validate isnan, isfinite, signbit and isinf ufuncs
* BENCH: Adding benchmarks for isnan, isinf, isfinite and signbit
|
| |
|
|\
| |
| | |
ENH: improve runtime detection of CPU features
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Put the old CPU detection code to rest
The current CPU detection code only supports x86 and
it's count on compiler built-in functions that not widely supported
by other compilers or platforms.
NOTE: `npy_cpu_supports` is removed rather than deprecated,
use the macro `NPY_CPU_HAVE(FEATURE_NAME_WITHOUT_QUOTES)` instead.
- Initialize the new CPU features runtime detector
Almost similar to GCC built-in functions,
so instead of `__builtin_cpu_init`, `__builtin_cpu_supports`
its provide `npy_cpu_init`, `npy_cpu_have` and `NPY_CPU_HAVE`.
NOTE: `npy_cpu_init` must be called before any use of
`npy_cpu_have` and `NPY_CPU_HAVE`, however `npy_cpu_init`
already called during the load of module `umath`
so there's no reason to call it again in most of the cases.
- Add X86 support
detect almost all x86 features, also provide
CPU feature groups that gather several features.
e.g. `AVX512_KNM` detect Knights Mill's `AVX512` features
- Add IBM/Power support
only supports Linux and count here on `glibc(getauxval)`
to detect VSX support and fail-back to the compiler definitions
for other platforms.
- Add ARM support
Same as IBM/Power but its parse `/proc/self/auxv`
if `glibc(getauxval)` isn't available.
- Update umath generator
- Add testing unit for Linux only
- Add new attribute `__cpu_features__` to umath module
`__cpu_features__` is a dictionary contains all supported
CPU feature names with runtime availability
|
| | |
|
|/ |
|
| |
|
|
|
|
|
| |
As numpy is Python 3 only, these import statements are now unnecessary
and don't alter runtime behavior.
|
| |
|
| |
|
|\
| |
| | |
BUG: Don't produce undefined behavior for a << b if b >= bitsof(a)
|
| |
| |
| |
| | |
Needed to make CI pass
|
|/
|
|
|
|
| |
Without an FMA, the output of AVX2 and AVX512 version differ. This
changes ensures the output across implementations remains exactly the
same.
|