Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-numexpr for openSUSE:Factory checked in at 2022-07-12 11:12:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-numexpr (Old) and /work/SRC/openSUSE:Factory/.python-numexpr.new.1523 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-numexpr" Tue Jul 12 11:12:09 2022 rev:16 rq:988324 version:2.8.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-numexpr/python-numexpr.changes 2022-02-09 20:38:18.354247647 +0100 +++ /work/SRC/openSUSE:Factory/.python-numexpr.new.1523/python-numexpr.changes 2022-07-12 11:12:16.563685617 +0200 @@ -1,0 +2,31 @@ +Sat Jul 9 13:38:01 UTC 2022 - Arun Persaud <a...@gmx.de> + +- specfile: + * require python >= 3.7 + +- update to version 2.8.3: + * Support for Python 3.6 has been dropped due to the need to + substitute the flag NPY_ARRAY_WRITEBACKIFCOPY for + NPY_ARRAY_UPDATEIFCOPY. This flag change was initiated in NumPy + 1.14 and finalized in 1.23. The only changes were made to cases + where an unaligned constant was passed in with a pre-allocated + output variable: + ``` + x = np.empty(5, dtype=np.uint8)[1:].view(np.int32) ne.evaluate('3', out=x) + ``` + We think the risk of issues is very low, but if you are using + NumExpr as a expression evaluation tool you may want to write a + test for this edge case. + * Thanks to Matt Einhorn (@matham) for improvements to the GitHub + Actions build process to add support for Apple Silicon and + aarch64. + * Thanks to Biswapriyo Nath (@biswa96) for a fix to allow mingw + builds on Windows. + * There have been some changes made to not import platform.machine() + on sparc but it is highly advised to upgrade to Python 3.9+ to + avoid this issue with the Python core package platform. + +- changes from version 2.8.2: + * skipped due to an error in uploading to PyPi. + +------------------------------------------------------------------- Old: ---- numexpr-2.8.1.tar.gz New: ---- numexpr-2.8.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-numexpr.spec ++++++ --- /var/tmp/diff_new_pack.SI0vfh/_old 2022-07-12 11:12:17.899687365 +0200 +++ /var/tmp/diff_new_pack.SI0vfh/_new 2022-07-12 11:12:17.903687370 +0200 @@ -17,16 +17,15 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%global skip_python2 1 -%global skip_python36 1 Name: python-numexpr -Version: 2.8.1 +Version: 2.8.3 Release: 0 Summary: Numerical expression evaluator for NumPy License: MIT Group: Development/Languages/Python URL: https://github.com/pydata/numexpr/ Source: https://files.pythonhosted.org/packages/source/n/numexpr/numexpr-%{version}.tar.gz +BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module devel} BuildRequires: %{python_module numpy-devel >= 1.6} BuildRequires: %{python_module setuptools} ++++++ numexpr-2.8.1.tar.gz -> numexpr-2.8.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numexpr-2.8.1/ANNOUNCE.rst new/numexpr-2.8.3/ANNOUNCE.rst --- old/numexpr-2.8.1/ANNOUNCE.rst 2021-12-10 21:06:49.000000000 +0100 +++ new/numexpr-2.8.3/ANNOUNCE.rst 2022-06-25 22:25:22.000000000 +0200 @@ -1,24 +1,42 @@ ======================== -Announcing NumExpr 2.8.1 +Announcing NumExpr 2.8.3 ======================== Hi everyone, -This is another maintenance release to further modernize our install script for -distributions that do not include `setuptools` by default. Thanks to Antonio -Valentino for the changes. +Please find here another maintenance release of NumExpr. Support for Python 3.6 +has been dropped to enable support for NumPy 1.23 (and by extension Python 3.11 +when it is released). Wheels for ARM64 multilinux should be available again after +troubles with GitHub Actions and Apple Silicon wheels are also now available on +PyPi for download. Project documentation is available at: http://numexpr.readthedocs.io/ -Changes from 2.8.0 to 2.8.1 +Changes from 2.8.1 to 2.8.2 --------------------------- -* Fixed dependency list. -* Added ``pyproject.toml`` and modernize the ``setup.py`` script. Thanks to -Antonio Valentino for the PR. +* Support for Python 3.6 has been dropped due to the need to substitute the flag + `NPY_ARRAY_WRITEBACKIFCOPY` for `NPY_ARRAY_UPDATEIFCOPY`. This flag change was + initiated in NumPy 1.14 and finalized in 1.23. The only changes were made to + cases where an unaligned constant was passed in with a pre-allocated output + variable: + +``` + x = np.empty(5, dtype=np.uint8)[1:].view(np.int32) + ne.evaluate('3', out=x) +``` + + We think the risk of issues is very low, but if you are using NumExpr as a + expression evaluation tool you may want to write a test for this edge case. +* Thanks to Matt Einhorn (@matham) for improvements to the GitHub Actions build process to + add support for Apple Silicon and aarch64. +* Thanks to Biswapriyo Nath (@biswa96) for a fix to allow `mingw` builds on Windows. +* There have been some changes made to not import `platform.machine()` on `sparc` + but it is highly advised to upgrade to Python 3.9+ to avoid this issue with + the Python core package `platform`. What's Numexpr? --------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numexpr-2.8.1/PKG-INFO new/numexpr-2.8.3/PKG-INFO --- old/numexpr-2.8.1/PKG-INFO 2021-12-10 23:03:16.315434500 +0100 +++ new/numexpr-2.8.3/PKG-INFO 2022-06-25 22:35:21.620025000 +0200 @@ -1,23 +1,17 @@ Metadata-Version: 2.1 Name: numexpr -Version: 2.8.1 +Version: 2.8.3 Summary: Fast numerical expression evaluator for NumPy Home-page: https://github.com/pydata/numexpr Author: David M. Cooke, Francesc Alted, and others -Author-email: -david.m.co...@gmail.com -fal...@gmail.com Maintainer: Robert A. McLeod Maintainer-email: robbmcl...@gmail.com License: MIT -Description: UNKNOWN -Platform: UNKNOWN Classifier: Development Status :: 6 - Mature Classifier: Intended Audience :: Financial and Insurance Industry Classifier: Intended Audience :: Science/Research Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 @@ -25,5 +19,193 @@ Classifier: Operating System :: Microsoft :: Windows Classifier: Operating System :: POSIX Classifier: Operating System :: MacOS -Requires-Python: >=3.6 -Description-Content-Type: text/markdown +Requires-Python: >=3.7 +Description-Content-Type: text/x-rst +License-File: LICENSE.txt +License-File: AUTHORS.txt + +====================================================== +NumExpr: Fast numerical expression evaluator for NumPy +====================================================== + +:Author: David M. Cooke, Francesc Alted, and others. +:Maintainer: Robert A. McLeod +:Contact: robbmcl...@gmail.com +:URL: https://github.com/pydata/numexpr +:Documentation: http://numexpr.readthedocs.io/en/latest/ +:Travis CI: |travis| +:GitHub Actions: |actions| +:PyPi: |version| +:DOI: |doi| +:readthedocs: |docs| + +.. |actions| image:: https://github.com/pydata/numexpr/workflows/Build/badge.svg + :target: https://github.com/pydata/numexpr/actions +.. |travis| image:: https://travis-ci.org/pydata/numexpr.png?branch=master + :target: https://travis-ci.org/pydata/numexpr +.. |docs| image:: https://readthedocs.org/projects/numexpr/badge/?version=latest + :target: http://numexpr.readthedocs.io/en/latest +.. |doi| image:: https://zenodo.org/badge/doi/10.5281/zenodo.2483274.svg + :target: https://doi.org/10.5281/zenodo.2483274 +.. |version| image:: https://img.shields.io/pypi/v/numexpr.png + :target: https://pypi.python.org/pypi/numexpr + +What is NumExpr? +---------------- + +NumExpr is a fast numerical expression evaluator for NumPy. With it, +expressions that operate on arrays (like :code:`'3*a+4*b'`) are accelerated +and use less memory than doing the same calculation in Python. + +In addition, its multi-threaded capabilities can make use of all your +cores -- which generally results in substantial performance scaling compared +to NumPy. + +Last but not least, numexpr can make use of Intel's VML (Vector Math +Library, normally integrated in its Math Kernel Library, or MKL). +This allows further acceleration of transcendent expressions. + + +How NumExpr achieves high performance +------------------------------------- + +The main reason why NumExpr achieves better performance than NumPy is +that it avoids allocating memory for intermediate results. This +results in better cache utilization and reduces memory access in +general. Due to this, NumExpr works best with large arrays. + +NumExpr parses expressions into its own op-codes that are then used by +an integrated computing virtual machine. The array operands are split +into small chunks that easily fit in the cache of the CPU and passed +to the virtual machine. The virtual machine then applies the +operations on each chunk. It's worth noting that all temporaries and +constants in the expression are also chunked. Chunks are distributed among +the available cores of the CPU, resulting in highly parallelized code +execution. + +The result is that NumExpr can get the most of your machine computing +capabilities for array-wise computations. Common speed-ups with regard +to NumPy are usually between 0.95x (for very simple expressions like +:code:`'a + 1'`) and 4x (for relatively complex ones like :code:`'a*b-4.1*a > +2.5*b'`), although much higher speed-ups can be achieved for some functions +and complex math operations (up to 15x in some cases). + +NumExpr performs best on matrices that are too large to fit in L1 CPU cache. +In order to get a better idea on the different speed-ups that can be achieved +on your platform, run the provided benchmarks. + +Installation +------------ + +From wheels +^^^^^^^^^^^ + +NumExpr is available for install via `pip` for a wide range of platforms and +Python versions (which may be browsed at: https://pypi.org/project/numexpr/#files). +Installation can be performed as:: + + pip install numexpr + +If you are using the Anaconda or Miniconda distribution of Python you may prefer +to use the `conda` package manager in this case:: + + conda install numexpr + +From Source +^^^^^^^^^^^ + +On most `Nix systems your compilers will already be present. However if you +are using a virtual environment with a substantially newer version of Python than +your system Python you may be prompted to install a new version of `gcc` or `clang`. + +For Windows, you will need to install the Microsoft Visual C++ Build Tools +(which are free) first.The version depends on which version of Python you have +installed: + +https://wiki.python.org/moin/WindowsCompilers + +For Python 3.6+ simply installating the latest version of MSVC build tools should +be sufficient. Note that wheels found via pip do not include MKL support. Wheels +available via `conda` will have MKL, if the MKL backend is used for NumPy. + +See `requirements.txt` for the required version of NumPy. + +NumExpr is built in the standard Python way:: + + python setup.py build install + +You can test `numexpr` with:: + + python -c "import numexpr; numexpr.test()" + +Do not test NumExpr in the source directory or you will generate import errors. + +Enable Intel?? MKL support +^^^^^^^^^^^^^^^^^^^^^^^^^ + +NumExpr includes support for Intel's MKL library. This may provide better +performance on Intel architectures, mainly when evaluating transcendental +functions (trigonometrical, exponential...). + +If you have Intel's MKL, copy the `site.cfg.example` that comes with the +distribution to `site.cfg` and edit the latter file to provide correct paths to +the MKL libraries in your system. After doing this, you can proceed with the +usual building instructions listed above. + +Pay attention to the messages during the building process in order to know +whether MKL has been detected or not. Finally, you can check the speed-ups on +your machine by running the `bench/vml_timing.py` script (you can play with +different parameters to the `set_vml_accuracy_mode()` and `set_vml_num_threads()` +functions in the script so as to see how it would affect performance). + +Usage +----- + +:: + + >>> import numpy as np + >>> import numexpr as ne + + >>> a = np.arange(1e6) # Choose large arrays for better speedups + >>> b = np.arange(1e6) + + >>> ne.evaluate("a + 1") # a simple expression + array([ 1.00000000e+00, 2.00000000e+00, 3.00000000e+00, ..., + 9.99998000e+05, 9.99999000e+05, 1.00000000e+06]) + + >>> ne.evaluate('a*b-4.1*a > 2.5*b') # a more complex one + array([False, False, False, ..., True, True, True], dtype=bool) + + >>> ne.evaluate("sin(a) + arcsinh(a/b)") # you can also use functions + array([ NaN, 1.72284457, 1.79067101, ..., 1.09567006, + 0.17523598, -0.09597844]) + + >>> s = np.array([b'abba', b'abbb', b'abbcdef']) + >>> ne.evaluate("b'abba' == s") # string arrays are supported too + array([ True, False, False], dtype=bool) + + +Documentation +------------- + +Please see the official documentation at `numexpr.readthedocs.io <https://numexpr.readthedocs.io>`_. +Included is a user guide, benchmark results, and the reference API. + + +Authors +------- + +Please see `AUTHORS.txt <https://github.com/pydata/numexpr/blob/master/AUTHORS.txt>`_. + + +License +------- + +NumExpr is distributed under the `MIT <http://www.opensource.org/licenses/mit-license.php>`_ license. + + +.. Local Variables: +.. mode: text +.. coding: utf-8 +.. fill-column: 70 +.. End: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numexpr-2.8.1/RELEASE_NOTES.rst new/numexpr-2.8.3/RELEASE_NOTES.rst --- old/numexpr-2.8.1/RELEASE_NOTES.rst 2021-12-10 21:07:17.000000000 +0100 +++ new/numexpr-2.8.3/RELEASE_NOTES.rst 2022-06-25 22:25:22.000000000 +0200 @@ -1,7 +1,32 @@ ==================================== -Release notes for Numexpr 2.8 series +Release notes for NumExpr 2.8 series ==================================== +Changes from 2.8.1 to 2.8.3 +--------------------------- + +* 2.8.2 was skipped due to an error in uploading to PyPi. +* Support for Python 3.6 has been dropped due to the need to substitute the flag + `NPY_ARRAY_WRITEBACKIFCOPY` for `NPY_ARRAY_UPDATEIFCOPY`. This flag change was + initiated in NumPy 1.14 and finalized in 1.23. The only changes were made to + cases where an unaligned constant was passed in with a pre-allocated output + variable: + +``` + x = np.empty(5, dtype=np.uint8)[1:].view(np.int32) + ne.evaluate('3', out=x) +``` + + We think the risk of issues is very low, but if you are using NumExpr as a + expression evaluation tool you may want to write a test for this edge case. +* Thanks to Matt Einhorn (@matham) for improvements to the GitHub Actions build process to + add support for Apple Silicon and aarch64. +* Thanks to Biswapriyo Nath (@biswa96) for a fix to allow `mingw` builds on Windows. +* There have been some changes made to not import `platform.machine()` on `sparc` + but it is highly advised to upgrade to Python 3.9+ to avoid this issue with + the Python core package `platform`. + + Changes from 2.8.0 to 2.8.1 --------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numexpr-2.8.1/numexpr/interpreter.cpp new/numexpr-2.8.3/numexpr/interpreter.cpp --- old/numexpr-2.8.1/numexpr/interpreter.cpp 2018-07-12 19:49:43.000000000 +0200 +++ new/numexpr-2.8.3/numexpr/interpreter.cpp 2022-06-25 22:25:22.000000000 +0200 @@ -23,8 +23,11 @@ /* Some missing symbols and functions for Win */ #define fmax max #define fmin min -#define INFINITY (DBL_MAX+DBL_MAX) -#define NAN (INFINITY-INFINITY) +#define NE_INFINITY (DBL_MAX+DBL_MAX) +#define NE_NAN (INFINITY-INFINITY) +#else +#define NE_INFINITY INFINITY +#define NE_NAN NAN #endif #ifndef SIZE_MAX @@ -1243,6 +1246,11 @@ /* A case with a single constant output */ + PyArrayObject *singleton; + bool writeback; + // NOTE: cannot assign on declaration due to `goto` statements + singleton = NULL; + writeback = false; if (n_inputs == 0) { char retsig = get_return_sig(self->program); @@ -1255,8 +1263,7 @@ goto fail; } } - else { - PyArrayObject *a; + else { // Use the provided output array if (PyArray_SIZE(operands[0]) != 1) { PyErr_SetString(PyExc_ValueError, "output for a constant expression must have size 1"); @@ -1268,17 +1275,30 @@ goto fail; } Py_INCREF(dtypes[0]); - a = (PyArrayObject *)PyArray_FromArray(operands[0], dtypes[0], - NPY_ARRAY_ALIGNED|NPY_ARRAY_UPDATEIFCOPY); - if (a == NULL) { + + // NumPy folks suggested using WRITEBACKIFCOPY to resolve issue #397 + singleton = (PyArrayObject *)PyArray_FromArray(operands[0], dtypes[0], + NPY_ARRAY_ALIGNED|NPY_ARRAY_WRITEBACKIFCOPY); + if (singleton == NULL) { goto fail; } + writeback = true; Py_DECREF(operands[0]); - operands[0] = a; + operands[0] = singleton; } r = run_interpreter_const(self, PyArray_BYTES(operands[0]), &pc_error); + if (writeback) { + // Write-back our copy to the passed in output array if we had to make a copy + // (which only happens if the input was not aligned) + int retval = PyArray_ResolveWritebackIfCopy(singleton); + if (retval < 0) { + // 1 means it copied the value, 0 means no copy, only -1 is an error. + PyErr_Format(PyExc_ValueError, "Writeback to singleton failed with error code: %d", retval); + goto fail; + } + } ret = (PyObject *)operands[0]; Py_INCREF(ret); goto cleanup_and_exit; @@ -1409,7 +1429,7 @@ fill = PyLong_FromLong(1); } else if (PyArray_DESCR(a)->kind == 'f') { /* floating point min/max identity is NaN */ - fill = PyFloat_FromDouble(NAN); + fill = PyFloat_FromDouble(NE_NAN); } else if (op >= OP_MIN && op < OP_MAX) { /* integer min identity */ fill = PyLong_FromLong(LONG_MAX); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numexpr-2.8.1/numexpr/tests/test_numexpr.py new/numexpr-2.8.3/numexpr/tests/test_numexpr.py --- old/numexpr-2.8.1/numexpr/tests/test_numexpr.py 2021-12-03 21:14:17.000000000 +0100 +++ new/numexpr-2.8.3/numexpr/tests/test_numexpr.py 2022-06-25 22:25:22.000000000 +0200 @@ -481,6 +481,14 @@ else: self.fail() + def test_unaligned_singleton(self): + # Test for issue #397 whether singletons outputs assigned to consts must be + # aligned or not. + a = np.empty(5, dtype=np.uint8)[1:].view(np.int32) + evaluate('3', out=a) + assert_equal(a, 3) + + def test_ex_uses_vml(self): vml_funcs = [ "sin", "cos", "tan", "arcsin", "arccos", "arctan", "sinh", "cosh", "tanh", "arcsinh", "arccosh", "arctanh", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numexpr-2.8.1/numexpr/utils.py new/numexpr-2.8.3/numexpr/utils.py --- old/numexpr-2.8.1/numexpr/utils.py 2021-11-06 01:29:32.000000000 +0100 +++ new/numexpr-2.8.3/numexpr/utils.py 2022-06-25 22:25:22.000000000 +0200 @@ -17,6 +17,7 @@ from numexpr.interpreter import _set_num_threads, _get_num_threads, MAX_THREADS from numexpr import use_vml +from . import version if use_vml: from numexpr.interpreter import ( @@ -123,7 +124,7 @@ the virtual machine. """ # Any platform-specific short-circuits - if 'sparc' in platform.machine(): + if 'sparc' in version.platform_machine: log.warning('The number of threads have been set to 1 because problems related ' 'to threading have been reported on some sparc machine. ' 'The number of threads can be changed using the "set_num_threads" ' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numexpr-2.8.1/numexpr/version.py new/numexpr-2.8.3/numexpr/version.py --- old/numexpr-2.8.1/numexpr/version.py 2021-12-10 23:03:15.000000000 +0100 +++ new/numexpr-2.8.3/numexpr/version.py 2022-06-25 22:35:20.000000000 +0200 @@ -1,3 +1,4 @@ # THIS FILE IS GENERATED BY `SETUP.PY` -version = '2.8.1' -numpy_build_version = '1.20.2' +version = '2.8.3' +numpy_build_version = '1.21.6' +platform_machine = 'AMD64' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numexpr-2.8.1/numexpr.egg-info/PKG-INFO new/numexpr-2.8.3/numexpr.egg-info/PKG-INFO --- old/numexpr-2.8.1/numexpr.egg-info/PKG-INFO 2021-12-10 23:03:15.000000000 +0100 +++ new/numexpr-2.8.3/numexpr.egg-info/PKG-INFO 2022-06-25 22:35:20.000000000 +0200 @@ -1,23 +1,17 @@ Metadata-Version: 2.1 Name: numexpr -Version: 2.8.1 +Version: 2.8.3 Summary: Fast numerical expression evaluator for NumPy Home-page: https://github.com/pydata/numexpr Author: David M. Cooke, Francesc Alted, and others -Author-email: -david.m.co...@gmail.com -fal...@gmail.com Maintainer: Robert A. McLeod Maintainer-email: robbmcl...@gmail.com License: MIT -Description: UNKNOWN -Platform: UNKNOWN Classifier: Development Status :: 6 - Mature Classifier: Intended Audience :: Financial and Insurance Industry Classifier: Intended Audience :: Science/Research Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 @@ -25,5 +19,193 @@ Classifier: Operating System :: Microsoft :: Windows Classifier: Operating System :: POSIX Classifier: Operating System :: MacOS -Requires-Python: >=3.6 -Description-Content-Type: text/markdown +Requires-Python: >=3.7 +Description-Content-Type: text/x-rst +License-File: LICENSE.txt +License-File: AUTHORS.txt + +====================================================== +NumExpr: Fast numerical expression evaluator for NumPy +====================================================== + +:Author: David M. Cooke, Francesc Alted, and others. +:Maintainer: Robert A. McLeod +:Contact: robbmcl...@gmail.com +:URL: https://github.com/pydata/numexpr +:Documentation: http://numexpr.readthedocs.io/en/latest/ +:Travis CI: |travis| +:GitHub Actions: |actions| +:PyPi: |version| +:DOI: |doi| +:readthedocs: |docs| + +.. |actions| image:: https://github.com/pydata/numexpr/workflows/Build/badge.svg + :target: https://github.com/pydata/numexpr/actions +.. |travis| image:: https://travis-ci.org/pydata/numexpr.png?branch=master + :target: https://travis-ci.org/pydata/numexpr +.. |docs| image:: https://readthedocs.org/projects/numexpr/badge/?version=latest + :target: http://numexpr.readthedocs.io/en/latest +.. |doi| image:: https://zenodo.org/badge/doi/10.5281/zenodo.2483274.svg + :target: https://doi.org/10.5281/zenodo.2483274 +.. |version| image:: https://img.shields.io/pypi/v/numexpr.png + :target: https://pypi.python.org/pypi/numexpr + +What is NumExpr? +---------------- + +NumExpr is a fast numerical expression evaluator for NumPy. With it, +expressions that operate on arrays (like :code:`'3*a+4*b'`) are accelerated +and use less memory than doing the same calculation in Python. + +In addition, its multi-threaded capabilities can make use of all your +cores -- which generally results in substantial performance scaling compared +to NumPy. + +Last but not least, numexpr can make use of Intel's VML (Vector Math +Library, normally integrated in its Math Kernel Library, or MKL). +This allows further acceleration of transcendent expressions. + + +How NumExpr achieves high performance +------------------------------------- + +The main reason why NumExpr achieves better performance than NumPy is +that it avoids allocating memory for intermediate results. This +results in better cache utilization and reduces memory access in +general. Due to this, NumExpr works best with large arrays. + +NumExpr parses expressions into its own op-codes that are then used by +an integrated computing virtual machine. The array operands are split +into small chunks that easily fit in the cache of the CPU and passed +to the virtual machine. The virtual machine then applies the +operations on each chunk. It's worth noting that all temporaries and +constants in the expression are also chunked. Chunks are distributed among +the available cores of the CPU, resulting in highly parallelized code +execution. + +The result is that NumExpr can get the most of your machine computing +capabilities for array-wise computations. Common speed-ups with regard +to NumPy are usually between 0.95x (for very simple expressions like +:code:`'a + 1'`) and 4x (for relatively complex ones like :code:`'a*b-4.1*a > +2.5*b'`), although much higher speed-ups can be achieved for some functions +and complex math operations (up to 15x in some cases). + +NumExpr performs best on matrices that are too large to fit in L1 CPU cache. +In order to get a better idea on the different speed-ups that can be achieved +on your platform, run the provided benchmarks. + +Installation +------------ + +From wheels +^^^^^^^^^^^ + +NumExpr is available for install via `pip` for a wide range of platforms and +Python versions (which may be browsed at: https://pypi.org/project/numexpr/#files). +Installation can be performed as:: + + pip install numexpr + +If you are using the Anaconda or Miniconda distribution of Python you may prefer +to use the `conda` package manager in this case:: + + conda install numexpr + +From Source +^^^^^^^^^^^ + +On most `Nix systems your compilers will already be present. However if you +are using a virtual environment with a substantially newer version of Python than +your system Python you may be prompted to install a new version of `gcc` or `clang`. + +For Windows, you will need to install the Microsoft Visual C++ Build Tools +(which are free) first.The version depends on which version of Python you have +installed: + +https://wiki.python.org/moin/WindowsCompilers + +For Python 3.6+ simply installating the latest version of MSVC build tools should +be sufficient. Note that wheels found via pip do not include MKL support. Wheels +available via `conda` will have MKL, if the MKL backend is used for NumPy. + +See `requirements.txt` for the required version of NumPy. + +NumExpr is built in the standard Python way:: + + python setup.py build install + +You can test `numexpr` with:: + + python -c "import numexpr; numexpr.test()" + +Do not test NumExpr in the source directory or you will generate import errors. + +Enable Intel?? MKL support +^^^^^^^^^^^^^^^^^^^^^^^^^ + +NumExpr includes support for Intel's MKL library. This may provide better +performance on Intel architectures, mainly when evaluating transcendental +functions (trigonometrical, exponential...). + +If you have Intel's MKL, copy the `site.cfg.example` that comes with the +distribution to `site.cfg` and edit the latter file to provide correct paths to +the MKL libraries in your system. After doing this, you can proceed with the +usual building instructions listed above. + +Pay attention to the messages during the building process in order to know +whether MKL has been detected or not. Finally, you can check the speed-ups on +your machine by running the `bench/vml_timing.py` script (you can play with +different parameters to the `set_vml_accuracy_mode()` and `set_vml_num_threads()` +functions in the script so as to see how it would affect performance). + +Usage +----- + +:: + + >>> import numpy as np + >>> import numexpr as ne + + >>> a = np.arange(1e6) # Choose large arrays for better speedups + >>> b = np.arange(1e6) + + >>> ne.evaluate("a + 1") # a simple expression + array([ 1.00000000e+00, 2.00000000e+00, 3.00000000e+00, ..., + 9.99998000e+05, 9.99999000e+05, 1.00000000e+06]) + + >>> ne.evaluate('a*b-4.1*a > 2.5*b') # a more complex one + array([False, False, False, ..., True, True, True], dtype=bool) + + >>> ne.evaluate("sin(a) + arcsinh(a/b)") # you can also use functions + array([ NaN, 1.72284457, 1.79067101, ..., 1.09567006, + 0.17523598, -0.09597844]) + + >>> s = np.array([b'abba', b'abbb', b'abbcdef']) + >>> ne.evaluate("b'abba' == s") # string arrays are supported too + array([ True, False, False], dtype=bool) + + +Documentation +------------- + +Please see the official documentation at `numexpr.readthedocs.io <https://numexpr.readthedocs.io>`_. +Included is a user guide, benchmark results, and the reference API. + + +Authors +------- + +Please see `AUTHORS.txt <https://github.com/pydata/numexpr/blob/master/AUTHORS.txt>`_. + + +License +------- + +NumExpr is distributed under the `MIT <http://www.opensource.org/licenses/mit-license.php>`_ license. + + +.. Local Variables: +.. mode: text +.. coding: utf-8 +.. fill-column: 70 +.. End: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numexpr-2.8.1/setup.cfg new/numexpr-2.8.3/setup.cfg --- old/numexpr-2.8.1/setup.cfg 2021-12-10 23:03:16.315434500 +0100 +++ new/numexpr-2.8.3/setup.cfg 2022-06-25 22:35:21.621027200 +0200 @@ -1,16 +1,13 @@ [metadata] name = numexpr -version = 2.8.1 +version = 2.8.3 description = Fast numerical expression evaluator for NumPy author = David M. Cooke, Francesc Alted, and others -author_email = - david.m.co...@gmail.com - fal...@gmail.com maintainer = Robert A. McLeod maintainer_email = robbmcl...@gmail.com url = https://github.com/pydata/numexpr -long_description = file: README.md -long_description_content_type = text/markdown +long_description = file: README.rst +long_description_content_type = text/x-rst license = MIT classifiers = Development Status :: 6 - Mature @@ -18,7 +15,6 @@ Intended Audience :: Science/Research License :: OSI Approved :: MIT License Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 @@ -30,7 +26,7 @@ [options] zip_safe = False packages = find: -python_requires = >=3.6 +python_requires = >=3.7 [egg_info] tag_build = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numexpr-2.8.1/setup.py new/numexpr-2.8.3/setup.py --- old/numexpr-2.8.1/setup.py 2021-12-08 01:21:59.000000000 +0100 +++ new/numexpr-2.8.3/setup.py 2022-06-25 22:25:22.000000000 +0200 @@ -26,6 +26,7 @@ fh.write("numpy_build_version = '%s'\n" % np.__version__) except ImportError: pass + fh.write("platform_machine = '%s'\n" % platform.machine()) lib_dirs = [] inc_dirs = [np.get_include(), op.join('framestream')] @@ -39,7 +40,9 @@ extra_link_args = [] if platform.uname().system == 'Windows': - extra_cflags = ['/O2'] + # For MSVC only + if "MSC" in platform.python_compiler(): + extra_cflags = ['/O2'] extra_link_args = [] sources.append('numexpr/win32/pthread.c') else: