summaryrefslogtreecommitdiff
path: root/numpy/core/setup_common.py
Commit message (Collapse)AuthorAgeFilesLines
* Apply suggestions from code reviewSebastian Berg2023-04-281-2/+2
| | | Co-authored-by: Matti Picus <matti.picus@gmail.com>
* ENH: Allow compiling compatibly to old NumPy versionsSebastian Berg2023-04-041-1/+6
| | | | | | | | | | | | | | | | | 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...)
* BLD: Add support for NPY_TARGET_VERSION macroSebastian Berg2023-04-041-0/+5
| | | | | | | | | | | | | | 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!
* MAINT, SIMD: Removes compiler definitions of attribute-based CPU dispatchingSayed Adel2023-02-201-56/+0
|
* MAINT: restore npymath implementations needed for freebsdmattip2022-12-251-1/+3
|
* BLD: Help raspian arm + clang 13 about `__builtin_mul_overflow`Sebastian Berg2022-12-211-2/+4
| | | | | | | | | 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
* MAINT: refactor mandatory npymath functions to #define macrosmattip2022-10-201-0/+2
|
* Merge pull request #22168 from ↵Matti Picus2022-10-201-25/+28
|\ | | | | | | | | Developer-Ecosystem-Engineering/remove_Avx_when_not_used ENH: Remove AVX related functions from non x86 based builds
| * review feedback, make lint happyDeveloper-Ecosystem-Engineering2022-10-191-25/+26
| |
| * ENH: Remove AVX related functions from non x86 based buildsDeveloper-Ecosystem-Engineering2022-08-231-9/+11
| | | | | | | | | | | | | | | | | | | | | | 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.
* | BLD: Add mandatory complex math feature detection with signatureSebastian Berg2022-09-281-1/+3
| |
* | BUILD: move some never-blocked complex math functions to 'mandatory'mattip2022-09-271-2/+3
| |
* | Merge pull request #22152 from RinCat/mainRalf Gommers2022-08-311-1/+3
|\ \ | |/ |/| BUG: Support using libunwind for backtrack
| * BUG: Support using libunwind for backtrackRin Cat (鈴猫)2022-08-181-1/+3
| | | | | | | | | | | | | | Some system (e.g. musl) do not have "execinfo.h", and the backtracking is provided by libunwind. Fix: #22084
* | TASK: rename macros (from review)mattip2022-08-211-2/+0
| |
* | BUILD: convert HAVE_ macros to BLOCK_, cleanupmattip2022-08-211-32/+19
| |
* | remove duplicate C99 functions, ensure optional variant HAVE_ macros are ↵mattip2022-08-211-5/+5
| | | | | | | | generated
* | restore atan2 implementation, clean up c99 mandatory functionsmattip2022-08-211-22/+20
| |
* | move hypot to optional for windows, fix pow and log2mattip2022-08-211-1/+3
| | | | | | | | Signed-off-by: mattip <matti.picus@gmail.com>
* | restore HAVE_POWL for macOS blocklistingmattip2022-08-211-1/+3
| | | | | | | | Signed-off-by: mattip <matti.picus@gmail.com>
* | restore HAVE_LOG2 for cygwin blocklistingwmattip2022-08-211-5/+8
| |
* | make optional C99 double routines mandatorymattip2022-08-211-6/+4
|/
* Removed two unused importsCallum O'Riley2022-07-141-1/+0
|
* make MismatchCAPIWarnining into MismatchCAPIErrormattip2022-05-261-8/+7
|
* MAINT: Fix some API versions.Charles Harris2022-05-261-2/+5
| | | | These were missed in the 1.24.0 preparations.
* BUG: Move FPE clearing to work around issue on clangSebastian Berg2022-04-281-0/+2
| | | | | | | | | | | | | 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.
* MAINT, BLD Fix math feature detection for wasmHood Chatham2022-03-071-5/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* MAINT: Replace LooseVersion by _pep440.Charles Harris2022-02-051-11/+0
| | | | | | | | 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.
* REL: Prepare main for NumPy 1.23.0 developmentCharles Harris2021-11-161-0/+1
|
* ENH: Configurable allocator (#17582)Matti Picus2021-10-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* MAINT: Update cversions.Charles Harris2021-05-221-0/+2
| | | | No changes for the NumPy 1.21.x release.
* Split lineRaghuveer Devulapalli2021-05-201-1/+2
|
* BUG: Fix duplicate variable names in compiler check for AVX512_SKXRaghuveer Devulapalli2021-05-191-1/+1
| | | | | | | 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/.
* DOC: Misc numpydoc format fixesMatthias Bussonnier2021-01-271-2/+2
| | | | | | | | | 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.
* ENH: Use versioneer to manage numpy versions.Charles Harris2020-12-081-1/+1
| | | | | | | | | | | | 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.
* MAINT: Prepare for the NumPy 1.20.x branch.Charles Harris2020-11-261-1/+2
| | | | | | - Update cversions.txt - Update numpyconfig.h - Update setup_common.py
* BUG: Update compiler check for AVX-512FRaghuveer Devulapalli2020-07-151-1/+5
| | | | | | 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 (#16334)Raghuveer Devulapalli2020-05-311-0/+11
| | | | | | | * 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
* Small fixups/commentsSebastian Berg2020-03-181-1/+2
|
* Merge pull request #13421 from seiko2plus/core_improve_infa_runtimeMatti Picus2020-02-051-5/+0
|\ | | | | ENH: improve runtime detection of CPU features
| * ENH: improve runtime detection of CPU featuresSayed Adel2020-02-051-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* | MAINT: Clean up, mostly unused imports.Warren Weckesser2020-01-231-1/+0
| |
* | MAINT: remove internal functions required to handle Python2/3 logicMike Taves2020-01-221-26/+9
|/
* [MAINT] Cleanup python2 sys.version checksSeth Troisi2020-01-201-3/+3
|
* MAINT: Remove unnecessary 'from __future__ import ...' statementsJon Dufresne2020-01-031-2/+0
| | | | | As numpy is Python 3 only, these import statements are now unnecessary and don't alter runtime behavior.
* BLD: Review feedback for clang -flto fixChris Burr2019-11-051-1/+2
|
* BLD: Prevent -flto from optimising long double representation check awayChris Burr2019-11-041-1/+1
|
* Merge pull request #13739 from eric-wieser/bit_shiftsMatti Picus2019-09-141-0/+39
|\ | | | | BUG: Don't produce undefined behavior for a << b if b >= bitsof(a)
| * BUG: Disable -O3 on right_shift on compilers which emit an internal errorEric Wieser2019-09-131-0/+39
| | | | | | | | Needed to make CI pass
* | BUG: AVX2 impl of sin/cos requires an FMARaghuveer Devulapalli2019-08-031-2/+3
|/ | | | | | Without an FMA, the output of AVX2 and AVX512 version differ. This changes ensures the output across implementations remains exactly the same.