numexpr 2.9.0__tar.gz → 2.10.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {numexpr-2.9.0 → numexpr-2.10.1}/ANNOUNCE.rst +15 -18
- {numexpr-2.9.0 → numexpr-2.10.1}/AUTHORS.txt +5 -1
- {numexpr-2.9.0 → numexpr-2.10.1}/MANIFEST.in +1 -1
- numexpr-2.10.1/PKG-INFO +27 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/README.rst +2 -3
- {numexpr-2.9.0 → numexpr-2.10.1}/RELEASE_NOTES.rst +34 -3
- numexpr-2.10.1/VERSION +1 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/__init__.py +0 -2
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/interpreter.cpp +8 -2
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/necompiler.py +1 -1
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/tests/test_numexpr.py +28 -12
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/utils.py +9 -8
- numexpr-2.10.1/numexpr/version.py +5 -0
- numexpr-2.10.1/numexpr.egg-info/PKG-INFO +27 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr.egg-info/SOURCES.txt +1 -2
- numexpr-2.10.1/numexpr.egg-info/requires.txt +1 -0
- numexpr-2.10.1/pyproject.toml +49 -0
- numexpr-2.10.1/requirements.txt +1 -0
- numexpr-2.10.1/setup.cfg +4 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/setup.py +12 -6
- numexpr-2.9.0/PKG-INFO +0 -213
- numexpr-2.9.0/numexpr/version.py +0 -4
- numexpr-2.9.0/numexpr.egg-info/PKG-INFO +0 -213
- numexpr-2.9.0/numexpr.egg-info/not-zip-safe +0 -1
- numexpr-2.9.0/numexpr.egg-info/requires.txt +0 -1
- numexpr-2.9.0/pyproject.toml +0 -3
- numexpr-2.9.0/requirements.txt +0 -1
- numexpr-2.9.0/setup.cfg +0 -34
- {numexpr-2.9.0 → numexpr-2.10.1}/LICENSE.txt +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/bench/boolean_timing.py +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/bench/issue-36.py +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/bench/issue-47.py +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/bench/multidim.py +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/bench/poly.py +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/bench/timing.py +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/bench/unaligned-simple.py +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/bench/varying-expr.py +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/bench/vml_timing.py +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/bench/vml_timing2.py +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/bench/vml_timing3.py +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/complex_functions.hpp +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/cpuinfo.py +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/expressions.py +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/functions.hpp +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/interp_body.cpp +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/interpreter.hpp +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/missing_posix_functions.hpp +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/module.cpp +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/module.hpp +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/msvc_function_stubs.hpp +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/numexpr_config.hpp +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/numexpr_object.cpp +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/numexpr_object.hpp +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/opcodes.hpp +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/str-two-way.hpp +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/tests/__init__.py +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/win32/pthread.c +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/win32/pthread.h +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr/win32/stdint.h +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr.egg-info/dependency_links.txt +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/numexpr.egg-info/top_level.txt +0 -0
- {numexpr-2.9.0 → numexpr-2.10.1}/site.cfg.example +0 -0
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
Announcing NumExpr 2.
|
|
3
|
-
|
|
1
|
+
=========================
|
|
2
|
+
Announcing NumExpr 2.10.1
|
|
3
|
+
=========================
|
|
4
4
|
|
|
5
5
|
Hi everyone,
|
|
6
6
|
|
|
7
|
-
NumExpr 2.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
NumExpr 2.10.1 continues to establize the support for NumPy 2.0.0.
|
|
8
|
+
Also, the default number of 'safe' threads has been upgraded to 16
|
|
9
|
+
(instead of previous 8). Finally, preliminary support for Python 3.13;
|
|
10
|
+
thanks to Karolina Surma.
|
|
11
11
|
|
|
12
12
|
Project documentation is available at:
|
|
13
13
|
|
|
14
14
|
http://numexpr.readthedocs.io/
|
|
15
15
|
|
|
16
|
-
Changes from 2.
|
|
17
|
-
|
|
16
|
+
Changes from 2.9.0 to 2.10.0
|
|
17
|
+
----------------------------
|
|
18
18
|
|
|
19
|
-
*
|
|
20
|
-
|
|
19
|
+
* Support for NumPy 2.0.0. This is still experimental, so please
|
|
20
|
+
report any issues you find. Thanks to Clément Robert and Thomas
|
|
21
|
+
Caswell for the work.
|
|
21
22
|
|
|
22
|
-
*
|
|
23
|
-
|
|
23
|
+
* Avoid erroring when OMP_NUM_THREADS is empty string. Thanks to
|
|
24
|
+
Patrick Hoefler.
|
|
24
25
|
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
* Replace npy_cdouble with C++ complex. Thanks to Teng Liu (@27rabbitlt).
|
|
28
|
-
* Add NE_MAXARGS for future numpy change NPY_MAXARGS. Now it is set to 64
|
|
29
|
-
to match NumPy 2.0 value. Thanks to Teng Liu (@27rabbitlt).
|
|
26
|
+
* Do not warn if OMP_NUM_THREAD set.
|
|
30
27
|
|
|
31
28
|
What's Numexpr?
|
|
32
29
|
---------------
|
|
@@ -24,4 +24,8 @@ Google Inc. contributed bug fixes.
|
|
|
24
24
|
David Cox improved readability of the Readme.
|
|
25
25
|
|
|
26
26
|
Robert A. McLeod contributed bug fixes and ported the documentation to
|
|
27
|
-
numexpr.readthedocs.io. He
|
|
27
|
+
numexpr.readthedocs.io. He has served as the maintainer of the package
|
|
28
|
+
since 2016 to 2023.
|
|
29
|
+
|
|
30
|
+
Teng Liu fixed many bugs, and in particular, contributed valuable fixes
|
|
31
|
+
to the new regex sanitizer for expressions.
|
numexpr-2.10.1/PKG-INFO
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: numexpr
|
|
3
|
+
Version: 2.10.1
|
|
4
|
+
Summary: Fast numerical expression evaluator for NumPy
|
|
5
|
+
Author-email: "David M. Cooke, Francesc Alted, and others" <blosc@blosc.org>
|
|
6
|
+
Maintainer-email: Blosc Development Team <blosc@blosc.org>
|
|
7
|
+
Project-URL: homepage, https://github.com/pydata/numexpr
|
|
8
|
+
Project-URL: documentation, https://numexpr.readthedocs.io
|
|
9
|
+
Project-URL: repository, https://github.com/pydata/numexpr
|
|
10
|
+
Classifier: Development Status :: 6 - Mature
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Information Technology
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: Unix
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
License-File: LICENSE.txt
|
|
26
|
+
License-File: AUTHORS.txt
|
|
27
|
+
Requires-Dist: numpy>=1.23.0
|
|
@@ -7,7 +7,6 @@ NumExpr: Fast numerical expression evaluator for NumPy
|
|
|
7
7
|
:Contact: faltet@gmail.com
|
|
8
8
|
:URL: https://github.com/pydata/numexpr
|
|
9
9
|
:Documentation: http://numexpr.readthedocs.io/en/latest/
|
|
10
|
-
:Travis CI: |travis|
|
|
11
10
|
:GitHub Actions: |actions|
|
|
12
11
|
:PyPi: |version|
|
|
13
12
|
:DOI: |doi|
|
|
@@ -21,7 +20,7 @@ NumExpr: Fast numerical expression evaluator for NumPy
|
|
|
21
20
|
:target: http://numexpr.readthedocs.io/en/latest
|
|
22
21
|
.. |doi| image:: https://zenodo.org/badge/doi/10.5281/zenodo.2483274.svg
|
|
23
22
|
:target: https://doi.org/10.5281/zenodo.2483274
|
|
24
|
-
.. |version| image:: https://img.shields.io/pypi/v/numexpr
|
|
23
|
+
.. |version| image:: https://img.shields.io/pypi/v/numexpr
|
|
25
24
|
:target: https://pypi.python.org/pypi/numexpr
|
|
26
25
|
|
|
27
26
|
|
|
@@ -148,7 +147,7 @@ Usage
|
|
|
148
147
|
array([ 1.00000000e+00, 2.00000000e+00, 3.00000000e+00, ...,
|
|
149
148
|
9.99998000e+05, 9.99999000e+05, 1.00000000e+06])
|
|
150
149
|
|
|
151
|
-
>>> ne.evaluate(
|
|
150
|
+
>>> ne.evaluate("a * b - 4.1 * a > 2.5 * b") # a more complex one
|
|
152
151
|
array([False, False, False, ..., True, True, True], dtype=bool)
|
|
153
152
|
|
|
154
153
|
>>> ne.evaluate("sin(a) + arcsinh(a/b)") # you can also use functions
|
|
@@ -1,6 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
Release notes for NumExpr 2.
|
|
3
|
-
|
|
1
|
+
=====================================
|
|
2
|
+
Release notes for NumExpr 2.10 series
|
|
3
|
+
=====================================
|
|
4
|
+
|
|
5
|
+
Changes from 2.10.0 to 2.10.1
|
|
6
|
+
-----------------------------
|
|
7
|
+
|
|
8
|
+
- The default number of 'safe' threads has been upgraded to 16 (instead of
|
|
9
|
+
previous 8). That means that if your CPU has > 16 cores, the default is
|
|
10
|
+
to use 16. You can always override this with the "NUMEXPR_MAX_THREADS"
|
|
11
|
+
environment variable.
|
|
12
|
+
|
|
13
|
+
- NumPy 1.23 is now the minimum supported.
|
|
14
|
+
|
|
15
|
+
- Preliminary support for Python 3.13. Thanks to Karolina Surma.
|
|
16
|
+
|
|
17
|
+
- Fix tests on nthreads detection (closes: #479). Thanks to @avalentino.
|
|
18
|
+
|
|
19
|
+
- The build process has been modernized and now uses the `pyproject.toml`
|
|
20
|
+
file for more of the configuration options.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
Changes from 2.9.0 to 2.10.0
|
|
24
|
+
----------------------------
|
|
25
|
+
|
|
26
|
+
* Support for NumPy 2.0.0. This is still experimental, so please
|
|
27
|
+
report any issues you find. Thanks to Clément Robert and Thomas
|
|
28
|
+
Caswell for the work.
|
|
29
|
+
|
|
30
|
+
* Avoid erroring when OMP_NUM_THREADS is empty string. Thanks to
|
|
31
|
+
Patrick Hoefler.
|
|
32
|
+
|
|
33
|
+
* Do not warn if OMP_NUM_THREAD set.
|
|
34
|
+
|
|
4
35
|
|
|
5
36
|
Changes from 2.8.8 to 2.9.0
|
|
6
37
|
---------------------------
|
numexpr-2.10.1/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.10.1
|
|
@@ -28,8 +28,6 @@ is_cpu_amd_intel = False # DEPRECATION WARNING: WILL BE REMOVED IN FUTURE RELEAS
|
|
|
28
28
|
# cpuinfo imports were moved into the test submodule function that calls them
|
|
29
29
|
# to improve import times.
|
|
30
30
|
|
|
31
|
-
import os, os.path
|
|
32
|
-
import platform
|
|
33
31
|
from numexpr.expressions import E
|
|
34
32
|
from numexpr.necompiler import (NumExpr, disassemble, evaluate, re_evaluate,
|
|
35
33
|
validate)
|
|
@@ -47,6 +47,12 @@
|
|
|
47
47
|
#define AVAILABLE(Haystack, Haystack_Len, J, Needle_Len) \
|
|
48
48
|
((Haystack_Len) >= (J) + (Needle_Len))
|
|
49
49
|
|
|
50
|
+
// To allow building with NumPy<2 locally define the new NumPy macros:
|
|
51
|
+
#if NPY_ABI_VERSION < 0x02000000
|
|
52
|
+
#define PyDataType_ELSIZE(descr) ((descr)->elsize)
|
|
53
|
+
#define PyDataType_SET_ELSIZE(descr, size) (descr)->elsize = size
|
|
54
|
+
#endif
|
|
55
|
+
|
|
50
56
|
#include "str-two-way.hpp"
|
|
51
57
|
|
|
52
58
|
#ifdef DEBUG
|
|
@@ -1203,7 +1209,7 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
|
|
|
1203
1209
|
Py_INCREF(dtypes[0]);
|
|
1204
1210
|
} else { // constant, like in '"foo"'
|
|
1205
1211
|
dtypes[0] = PyArray_DescrNewFromType(NPY_STRING);
|
|
1206
|
-
dtypes[0]
|
|
1212
|
+
PyDataType_SET_ELSIZE(dtypes[0], (npy_intp)self->memsizes[1]);
|
|
1207
1213
|
} // no string temporaries, so no third case
|
|
1208
1214
|
}
|
|
1209
1215
|
if (dtypes[0] == NULL) {
|
|
@@ -1449,7 +1455,7 @@ NumExpr_run(NumExprObject *self, PyObject *args, PyObject *kwds)
|
|
|
1449
1455
|
/* Get the sizes of all the operands */
|
|
1450
1456
|
dtypes_tmp = NpyIter_GetDescrArray(iter);
|
|
1451
1457
|
for (i = 0; i < n_inputs+1; ++i) {
|
|
1452
|
-
self->memsizes[i] = dtypes_tmp[i]
|
|
1458
|
+
self->memsizes[i] = PyDataType_ELSIZE(dtypes_tmp[i]);
|
|
1453
1459
|
}
|
|
1454
1460
|
|
|
1455
1461
|
/* For small calculations, just use 1 thread */
|
|
@@ -767,7 +767,7 @@ def getArguments(names, local_dict=None, global_dict=None, _frame_depth: int=2):
|
|
|
767
767
|
# If we generated local_dict via an explicit reference to f_locals,
|
|
768
768
|
# clear the dict to prevent creating extra ref counts in the caller's scope
|
|
769
769
|
# See https://github.com/pydata/numexpr/issues/310
|
|
770
|
-
if clear_local_dict:
|
|
770
|
+
if clear_local_dict and hasattr(local_dict, 'clear'):
|
|
771
771
|
local_dict.clear()
|
|
772
772
|
|
|
773
773
|
return arguments
|
|
@@ -33,6 +33,7 @@ from numpy import shape, allclose, array_equal, ravel, isnan, isinf
|
|
|
33
33
|
import numexpr
|
|
34
34
|
from numexpr import E, NumExpr, evaluate, re_evaluate, validate, disassemble, use_vml
|
|
35
35
|
from numexpr.expressions import ConstantNode
|
|
36
|
+
from numexpr.utils import detect_number_of_cores
|
|
36
37
|
|
|
37
38
|
import unittest
|
|
38
39
|
|
|
@@ -40,6 +41,7 @@ TestCase = unittest.TestCase
|
|
|
40
41
|
|
|
41
42
|
double = np.double
|
|
42
43
|
long = int
|
|
44
|
+
MAX_THREADS = 16
|
|
43
45
|
|
|
44
46
|
|
|
45
47
|
class test_numexpr(TestCase):
|
|
@@ -1158,6 +1160,20 @@ class test_threading_config(TestCase):
|
|
|
1158
1160
|
else:
|
|
1159
1161
|
self.assertEqual(5, numexpr._init_num_threads())
|
|
1160
1162
|
|
|
1163
|
+
def test_omp_num_threads_empty_string(self):
|
|
1164
|
+
with _environment('OMP_NUM_THREADS', ''):
|
|
1165
|
+
if 'sparc' in platform.machine():
|
|
1166
|
+
self.assertEqual(1, numexpr._init_num_threads())
|
|
1167
|
+
else:
|
|
1168
|
+
self.assertEqual(min(detect_number_of_cores(), MAX_THREADS), numexpr._init_num_threads())
|
|
1169
|
+
|
|
1170
|
+
def test_numexpr_max_threads_empty_string(self):
|
|
1171
|
+
with _environment('NUMEXPR_MAX_THREADS', ''):
|
|
1172
|
+
if 'sparc' in platform.machine():
|
|
1173
|
+
self.assertEqual(1, numexpr._init_num_threads())
|
|
1174
|
+
else:
|
|
1175
|
+
self.assertEqual(min(detect_number_of_cores(), MAX_THREADS), numexpr._init_num_threads())
|
|
1176
|
+
|
|
1161
1177
|
def test_vml_threads_round_trip(self):
|
|
1162
1178
|
n_threads = 3
|
|
1163
1179
|
if use_vml:
|
|
@@ -1300,28 +1316,28 @@ def suite():
|
|
|
1300
1316
|
add_method(func)
|
|
1301
1317
|
|
|
1302
1318
|
for n in range(niter):
|
|
1303
|
-
theSuite.addTest(unittest.
|
|
1319
|
+
theSuite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(test_numexpr))
|
|
1304
1320
|
if 'sparc' not in platform.machine():
|
|
1305
|
-
theSuite.addTest(unittest.
|
|
1306
|
-
theSuite.addTest(unittest.
|
|
1307
|
-
theSuite.addTest(unittest.
|
|
1308
|
-
theSuite.addTest(unittest.
|
|
1309
|
-
theSuite.addTest(unittest.
|
|
1310
|
-
theSuite.addTest(unittest.
|
|
1321
|
+
theSuite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(test_numexpr2))
|
|
1322
|
+
theSuite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(test_evaluate))
|
|
1323
|
+
theSuite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(TestExpressions))
|
|
1324
|
+
theSuite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(test_int32_int64))
|
|
1325
|
+
theSuite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(test_uint32_int64))
|
|
1326
|
+
theSuite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(test_strings))
|
|
1311
1327
|
theSuite.addTest(
|
|
1312
|
-
unittest.
|
|
1313
|
-
theSuite.addTest(unittest.
|
|
1314
|
-
theSuite.addTest(unittest.
|
|
1328
|
+
unittest.defaultTestLoader.loadTestsFromTestCase(test_irregular_stride))
|
|
1329
|
+
theSuite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(test_zerodim))
|
|
1330
|
+
theSuite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(test_threading_config))
|
|
1315
1331
|
|
|
1316
1332
|
# multiprocessing module is not supported on Hurd/kFreeBSD
|
|
1317
1333
|
if (pl.system().lower() not in ('gnu', 'gnu/kfreebsd')):
|
|
1318
|
-
theSuite.addTest(unittest.
|
|
1334
|
+
theSuite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(test_subprocess))
|
|
1319
1335
|
|
|
1320
1336
|
# I need to put this test after test_subprocess because
|
|
1321
1337
|
# if not, the test suite locks immediately before test_subproces.
|
|
1322
1338
|
# This only happens with Windows, so I suspect of a subtle bad
|
|
1323
1339
|
# interaction with threads and subprocess :-/
|
|
1324
|
-
theSuite.addTest(unittest.
|
|
1340
|
+
theSuite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(test_threading))
|
|
1325
1341
|
|
|
1326
1342
|
return theSuite
|
|
1327
1343
|
|
|
@@ -13,7 +13,6 @@ log = logging.getLogger(__name__)
|
|
|
13
13
|
|
|
14
14
|
import os
|
|
15
15
|
import subprocess
|
|
16
|
-
import platform
|
|
17
16
|
|
|
18
17
|
from numexpr.interpreter import _set_num_threads, _get_num_threads, MAX_THREADS
|
|
19
18
|
from numexpr import use_vml
|
|
@@ -134,7 +133,8 @@ def _init_num_threads():
|
|
|
134
133
|
|
|
135
134
|
env_configured = False
|
|
136
135
|
n_cores = detect_number_of_cores()
|
|
137
|
-
if 'NUMEXPR_MAX_THREADS' in os.environ
|
|
136
|
+
if ('NUMEXPR_MAX_THREADS' in os.environ and os.environ['NUMEXPR_MAX_THREADS'] != '' or
|
|
137
|
+
'OMP_NUM_THREADS' in os.environ and os.environ['OMP_NUM_THREADS'] != ''):
|
|
138
138
|
# The user has configured NumExpr in the expected way, so suppress logs.
|
|
139
139
|
env_configured = True
|
|
140
140
|
n_cores = MAX_THREADS
|
|
@@ -143,16 +143,17 @@ def _init_num_threads():
|
|
|
143
143
|
# configured NumExpr as desired, so we emit info logs.
|
|
144
144
|
if n_cores > MAX_THREADS:
|
|
145
145
|
log.info('Note: detected %d virtual cores but NumExpr set to maximum of %d, check "NUMEXPR_MAX_THREADS" environment variable.'%(n_cores, MAX_THREADS))
|
|
146
|
-
if n_cores >
|
|
147
|
-
#
|
|
148
|
-
log.info('Note: NumExpr detected %d cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of
|
|
149
|
-
n_cores =
|
|
146
|
+
if n_cores > 16:
|
|
147
|
+
# Back in 2019, 8 threads would be considered safe for performance. We are in 2024 now, so adjusting.
|
|
148
|
+
log.info('Note: NumExpr detected %d cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 16.'%n_cores)
|
|
149
|
+
n_cores = 16
|
|
150
150
|
|
|
151
151
|
# Now we check for 'NUMEXPR_NUM_THREADS' or 'OMP_NUM_THREADS' to set the
|
|
152
152
|
# actual number of threads used.
|
|
153
|
-
if 'NUMEXPR_NUM_THREADS' in os.environ:
|
|
153
|
+
if 'NUMEXPR_NUM_THREADS' in os.environ and os.environ['NUMEXPR_NUM_THREADS'] != '':
|
|
154
154
|
requested_threads = int(os.environ['NUMEXPR_NUM_THREADS'])
|
|
155
|
-
elif 'OMP_NUM_THREADS' in os.environ:
|
|
155
|
+
elif 'OMP_NUM_THREADS' in os.environ and os.environ['OMP_NUM_THREADS'] != '':
|
|
156
|
+
# Empty string is commonly used to unset the variable
|
|
156
157
|
requested_threads = int(os.environ['OMP_NUM_THREADS'])
|
|
157
158
|
else:
|
|
158
159
|
requested_threads = n_cores
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: numexpr
|
|
3
|
+
Version: 2.10.1
|
|
4
|
+
Summary: Fast numerical expression evaluator for NumPy
|
|
5
|
+
Author-email: "David M. Cooke, Francesc Alted, and others" <blosc@blosc.org>
|
|
6
|
+
Maintainer-email: Blosc Development Team <blosc@blosc.org>
|
|
7
|
+
Project-URL: homepage, https://github.com/pydata/numexpr
|
|
8
|
+
Project-URL: documentation, https://numexpr.readthedocs.io
|
|
9
|
+
Project-URL: repository, https://github.com/pydata/numexpr
|
|
10
|
+
Classifier: Development Status :: 6 - Mature
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Information Technology
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: Unix
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
License-File: LICENSE.txt
|
|
26
|
+
License-File: AUTHORS.txt
|
|
27
|
+
Requires-Dist: numpy>=1.23.0
|
|
@@ -4,9 +4,9 @@ LICENSE.txt
|
|
|
4
4
|
MANIFEST.in
|
|
5
5
|
README.rst
|
|
6
6
|
RELEASE_NOTES.rst
|
|
7
|
+
VERSION
|
|
7
8
|
pyproject.toml
|
|
8
9
|
requirements.txt
|
|
9
|
-
setup.cfg
|
|
10
10
|
setup.py
|
|
11
11
|
site.cfg.example
|
|
12
12
|
bench/boolean_timing.py
|
|
@@ -43,7 +43,6 @@ numexpr/version.py
|
|
|
43
43
|
numexpr.egg-info/PKG-INFO
|
|
44
44
|
numexpr.egg-info/SOURCES.txt
|
|
45
45
|
numexpr.egg-info/dependency_links.txt
|
|
46
|
-
numexpr.egg-info/not-zip-safe
|
|
47
46
|
numexpr.egg-info/requires.txt
|
|
48
47
|
numexpr.egg-info/top_level.txt
|
|
49
48
|
numexpr/win32/pthread.c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
numpy>=1.23.0
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"setuptools",
|
|
4
|
+
"wheel",
|
|
5
|
+
"numpy>=2.0.0",
|
|
6
|
+
]
|
|
7
|
+
build-backend = "setuptools.build_meta"
|
|
8
|
+
|
|
9
|
+
[tool.setuptools.packages.find]
|
|
10
|
+
include = ["numexpr"]
|
|
11
|
+
|
|
12
|
+
[project]
|
|
13
|
+
name = "numexpr"
|
|
14
|
+
description = "Fast numerical expression evaluator for NumPy"
|
|
15
|
+
authors = [{name = "David M. Cooke, Francesc Alted, and others", email = "blosc@blosc.org"}]
|
|
16
|
+
maintainers = [{ name = "Blosc Development Team", email = "blosc@blosc.org"}]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 6 - Mature",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Intended Audience :: Information Technology",
|
|
21
|
+
"Intended Audience :: Science/Research",
|
|
22
|
+
"License :: OSI Approved :: MIT License",
|
|
23
|
+
"Programming Language :: Python",
|
|
24
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
25
|
+
"Operating System :: Microsoft :: Windows",
|
|
26
|
+
"Operating System :: Unix",
|
|
27
|
+
"Programming Language :: Python :: 3",
|
|
28
|
+
"Programming Language :: Python :: 3.9",
|
|
29
|
+
"Programming Language :: Python :: 3.10",
|
|
30
|
+
"Programming Language :: Python :: 3.11",
|
|
31
|
+
"Programming Language :: Python :: 3.12",
|
|
32
|
+
]
|
|
33
|
+
requires-python = ">=3.9"
|
|
34
|
+
# Follow guidelines from https://scientific-python.org/specs/spec-0000/
|
|
35
|
+
dependencies = [
|
|
36
|
+
"numpy>=1.23.0",
|
|
37
|
+
]
|
|
38
|
+
dynamic = ["version"]
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
homepage = "https://github.com/pydata/numexpr"
|
|
42
|
+
documentation = "https://numexpr.readthedocs.io"
|
|
43
|
+
repository = "https://github.com/pydata/numexpr"
|
|
44
|
+
|
|
45
|
+
[tool.cibuildwheel]
|
|
46
|
+
skip = "cp36-* cp37-* pp37-* cp38-* pp* *-manylinux_i686 *_ppc64le *_s390x"
|
|
47
|
+
# Let's use a more recent version of the manylinux image for more modern compilers
|
|
48
|
+
manylinux-x86_64-image = "manylinux_2_28"
|
|
49
|
+
manylinux-aarch64-image = "manylinux_2_28"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
numpy >= 1.23.0 # keep in sync with NPY_TARGET_VERSION (setup.py)
|
numexpr-2.10.1/setup.cfg
ADDED
|
@@ -10,19 +10,21 @@
|
|
|
10
10
|
####################################################################
|
|
11
11
|
|
|
12
12
|
import os, os.path as op
|
|
13
|
-
from setuptools import setup, Extension
|
|
14
13
|
import platform
|
|
15
14
|
import configparser
|
|
16
15
|
import numpy as np
|
|
16
|
+
from setuptools import setup, Extension
|
|
17
|
+
|
|
17
18
|
|
|
18
19
|
with open('requirements.txt') as f:
|
|
19
20
|
requirements = f.read().splitlines()
|
|
20
21
|
|
|
22
|
+
version = open("VERSION").read().strip()
|
|
21
23
|
with open('numexpr/version.py', 'w') as fh:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
fh.write(
|
|
25
|
-
fh.write("version = '
|
|
24
|
+
# Create the version.py file
|
|
25
|
+
fh.write("# THIS FILE IS GENERATED BY `setup.py`\n")
|
|
26
|
+
fh.write(f"__version__ = '{version}'\n")
|
|
27
|
+
fh.write(f"version = '{version}'\n")
|
|
26
28
|
try:
|
|
27
29
|
fh.write("numpy_build_version = '%s'\n" % np.__version__)
|
|
28
30
|
except ImportError:
|
|
@@ -33,7 +35,10 @@ lib_dirs = []
|
|
|
33
35
|
inc_dirs = [np.get_include()]
|
|
34
36
|
libs = [] # Pre-built libraries ONLY, like python36.so
|
|
35
37
|
clibs = []
|
|
36
|
-
def_macros = [
|
|
38
|
+
def_macros = [
|
|
39
|
+
# keep in sync with minimal runtime requirement (requirements.txt)
|
|
40
|
+
('NPY_TARGET_VERSION', 'NPY_1_23_API_VERSION')
|
|
41
|
+
]
|
|
37
42
|
sources = ['numexpr/interpreter.cpp',
|
|
38
43
|
'numexpr/module.cpp',
|
|
39
44
|
'numexpr/numexpr_object.cpp']
|
|
@@ -95,6 +100,7 @@ def setup_package():
|
|
|
95
100
|
)
|
|
96
101
|
|
|
97
102
|
metadata = dict(
|
|
103
|
+
version=version,
|
|
98
104
|
install_requires=requirements,
|
|
99
105
|
libraries=clibs,
|
|
100
106
|
ext_modules=[
|
numexpr-2.9.0/PKG-INFO
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: numexpr
|
|
3
|
-
Version: 2.9.0
|
|
4
|
-
Summary: Fast numerical expression evaluator for NumPy
|
|
5
|
-
Home-page: https://github.com/pydata/numexpr
|
|
6
|
-
Author: David M. Cooke, Francesc Alted, and others
|
|
7
|
-
Maintainer: Francesc Alted
|
|
8
|
-
Maintainer-email: faltet@gmail.com
|
|
9
|
-
License: MIT
|
|
10
|
-
Classifier: Development Status :: 6 - Mature
|
|
11
|
-
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
12
|
-
Classifier: Intended Audience :: Science/Research
|
|
13
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
20
|
-
Classifier: Operating System :: POSIX
|
|
21
|
-
Classifier: Operating System :: MacOS
|
|
22
|
-
Requires-Python: >=3.9
|
|
23
|
-
Description-Content-Type: text/x-rst
|
|
24
|
-
License-File: LICENSE.txt
|
|
25
|
-
License-File: AUTHORS.txt
|
|
26
|
-
Requires-Dist: numpy>=1.13.3
|
|
27
|
-
|
|
28
|
-
======================================================
|
|
29
|
-
NumExpr: Fast numerical expression evaluator for NumPy
|
|
30
|
-
======================================================
|
|
31
|
-
|
|
32
|
-
:Author: David M. Cooke, Francesc Alted, and others.
|
|
33
|
-
:Maintainer: Francesc Alted
|
|
34
|
-
:Contact: faltet@gmail.com
|
|
35
|
-
:URL: https://github.com/pydata/numexpr
|
|
36
|
-
:Documentation: http://numexpr.readthedocs.io/en/latest/
|
|
37
|
-
:Travis CI: |travis|
|
|
38
|
-
:GitHub Actions: |actions|
|
|
39
|
-
:PyPi: |version|
|
|
40
|
-
:DOI: |doi|
|
|
41
|
-
:readthedocs: |docs|
|
|
42
|
-
|
|
43
|
-
.. |actions| image:: https://github.com/pydata/numexpr/workflows/Build/badge.svg
|
|
44
|
-
:target: https://github.com/pydata/numexpr/actions
|
|
45
|
-
.. |travis| image:: https://travis-ci.org/pydata/numexpr.png?branch=master
|
|
46
|
-
:target: https://travis-ci.org/pydata/numexpr
|
|
47
|
-
.. |docs| image:: https://readthedocs.org/projects/numexpr/badge/?version=latest
|
|
48
|
-
:target: http://numexpr.readthedocs.io/en/latest
|
|
49
|
-
.. |doi| image:: https://zenodo.org/badge/doi/10.5281/zenodo.2483274.svg
|
|
50
|
-
:target: https://doi.org/10.5281/zenodo.2483274
|
|
51
|
-
.. |version| image:: https://img.shields.io/pypi/v/numexpr.png
|
|
52
|
-
:target: https://pypi.python.org/pypi/numexpr
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
What is NumExpr?
|
|
56
|
-
----------------
|
|
57
|
-
|
|
58
|
-
NumExpr is a fast numerical expression evaluator for NumPy. With it,
|
|
59
|
-
expressions that operate on arrays (like :code:`'3*a+4*b'`) are accelerated
|
|
60
|
-
and use less memory than doing the same calculation in Python.
|
|
61
|
-
|
|
62
|
-
In addition, its multi-threaded capabilities can make use of all your
|
|
63
|
-
cores -- which generally results in substantial performance scaling compared
|
|
64
|
-
to NumPy.
|
|
65
|
-
|
|
66
|
-
Last but not least, numexpr can make use of Intel's VML (Vector Math
|
|
67
|
-
Library, normally integrated in its Math Kernel Library, or MKL).
|
|
68
|
-
This allows further acceleration of transcendent expressions.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
How NumExpr achieves high performance
|
|
72
|
-
-------------------------------------
|
|
73
|
-
|
|
74
|
-
The main reason why NumExpr achieves better performance than NumPy is
|
|
75
|
-
that it avoids allocating memory for intermediate results. This
|
|
76
|
-
results in better cache utilization and reduces memory access in
|
|
77
|
-
general. Due to this, NumExpr works best with large arrays.
|
|
78
|
-
|
|
79
|
-
NumExpr parses expressions into its own op-codes that are then used by
|
|
80
|
-
an integrated computing virtual machine. The array operands are split
|
|
81
|
-
into small chunks that easily fit in the cache of the CPU and passed
|
|
82
|
-
to the virtual machine. The virtual machine then applies the
|
|
83
|
-
operations on each chunk. It's worth noting that all temporaries and
|
|
84
|
-
constants in the expression are also chunked. Chunks are distributed among
|
|
85
|
-
the available cores of the CPU, resulting in highly parallelized code
|
|
86
|
-
execution.
|
|
87
|
-
|
|
88
|
-
The result is that NumExpr can get the most of your machine computing
|
|
89
|
-
capabilities for array-wise computations. Common speed-ups with regard
|
|
90
|
-
to NumPy are usually between 0.95x (for very simple expressions like
|
|
91
|
-
:code:`'a + 1'`) and 4x (for relatively complex ones like :code:`'a*b-4.1*a > 2.5*b'`),
|
|
92
|
-
although much higher speed-ups can be achieved for some functions and complex
|
|
93
|
-
math operations (up to 15x in some cases).
|
|
94
|
-
|
|
95
|
-
NumExpr performs best on matrices that are too large to fit in L1 CPU cache.
|
|
96
|
-
In order to get a better idea on the different speed-ups that can be achieved
|
|
97
|
-
on your platform, run the provided benchmarks.
|
|
98
|
-
|
|
99
|
-
Installation
|
|
100
|
-
------------
|
|
101
|
-
|
|
102
|
-
From wheels
|
|
103
|
-
^^^^^^^^^^^
|
|
104
|
-
|
|
105
|
-
NumExpr is available for install via `pip` for a wide range of platforms and
|
|
106
|
-
Python versions (which may be browsed at: https://pypi.org/project/numexpr/#files).
|
|
107
|
-
Installation can be performed as::
|
|
108
|
-
|
|
109
|
-
pip install numexpr
|
|
110
|
-
|
|
111
|
-
If you are using the Anaconda or Miniconda distribution of Python you may prefer
|
|
112
|
-
to use the `conda` package manager in this case::
|
|
113
|
-
|
|
114
|
-
conda install numexpr
|
|
115
|
-
|
|
116
|
-
From Source
|
|
117
|
-
^^^^^^^^^^^
|
|
118
|
-
|
|
119
|
-
On most \*nix systems your compilers will already be present. However if you
|
|
120
|
-
are using a virtual environment with a substantially newer version of Python than
|
|
121
|
-
your system Python you may be prompted to install a new version of `gcc` or `clang`.
|
|
122
|
-
|
|
123
|
-
For Windows, you will need to install the Microsoft Visual C++ Build Tools
|
|
124
|
-
(which are free) first. The version depends on which version of Python you have
|
|
125
|
-
installed:
|
|
126
|
-
|
|
127
|
-
https://wiki.python.org/moin/WindowsCompilers
|
|
128
|
-
|
|
129
|
-
For Python 3.6+ simply installing the latest version of MSVC build tools should
|
|
130
|
-
be sufficient. Note that wheels found via pip do not include MKL support. Wheels
|
|
131
|
-
available via `conda` will have MKL, if the MKL backend is used for NumPy.
|
|
132
|
-
|
|
133
|
-
See `requirements.txt` for the required version of NumPy.
|
|
134
|
-
|
|
135
|
-
NumExpr is built in the standard Python way::
|
|
136
|
-
|
|
137
|
-
python setup.py build install
|
|
138
|
-
|
|
139
|
-
You can test `numexpr` with::
|
|
140
|
-
|
|
141
|
-
python -c "import numexpr; numexpr.test()"
|
|
142
|
-
|
|
143
|
-
Do not test NumExpr in the source directory or you will generate import errors.
|
|
144
|
-
|
|
145
|
-
Enable Intel® MKL support
|
|
146
|
-
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
147
|
-
|
|
148
|
-
NumExpr includes support for Intel's MKL library. This may provide better
|
|
149
|
-
performance on Intel architectures, mainly when evaluating transcendental
|
|
150
|
-
functions (trigonometrical, exponential, ...).
|
|
151
|
-
|
|
152
|
-
If you have Intel's MKL, copy the `site.cfg.example` that comes with the
|
|
153
|
-
distribution to `site.cfg` and edit the latter file to provide correct paths to
|
|
154
|
-
the MKL libraries in your system. After doing this, you can proceed with the
|
|
155
|
-
usual building instructions listed above.
|
|
156
|
-
|
|
157
|
-
Pay attention to the messages during the building process in order to know
|
|
158
|
-
whether MKL has been detected or not. Finally, you can check the speed-ups on
|
|
159
|
-
your machine by running the `bench/vml_timing.py` script (you can play with
|
|
160
|
-
different parameters to the `set_vml_accuracy_mode()` and `set_vml_num_threads()`
|
|
161
|
-
functions in the script so as to see how it would affect performance).
|
|
162
|
-
|
|
163
|
-
Usage
|
|
164
|
-
-----
|
|
165
|
-
|
|
166
|
-
::
|
|
167
|
-
|
|
168
|
-
>>> import numpy as np
|
|
169
|
-
>>> import numexpr as ne
|
|
170
|
-
|
|
171
|
-
>>> a = np.arange(1e6) # Choose large arrays for better speedups
|
|
172
|
-
>>> b = np.arange(1e6)
|
|
173
|
-
|
|
174
|
-
>>> ne.evaluate("a + 1") # a simple expression
|
|
175
|
-
array([ 1.00000000e+00, 2.00000000e+00, 3.00000000e+00, ...,
|
|
176
|
-
9.99998000e+05, 9.99999000e+05, 1.00000000e+06])
|
|
177
|
-
|
|
178
|
-
>>> ne.evaluate('a*b-4.1*a > 2.5*b') # a more complex one
|
|
179
|
-
array([False, False, False, ..., True, True, True], dtype=bool)
|
|
180
|
-
|
|
181
|
-
>>> ne.evaluate("sin(a) + arcsinh(a/b)") # you can also use functions
|
|
182
|
-
array([ NaN, 1.72284457, 1.79067101, ..., 1.09567006,
|
|
183
|
-
0.17523598, -0.09597844])
|
|
184
|
-
|
|
185
|
-
>>> s = np.array([b'abba', b'abbb', b'abbcdef'])
|
|
186
|
-
>>> ne.evaluate("b'abba' == s") # string arrays are supported too
|
|
187
|
-
array([ True, False, False], dtype=bool)
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
Documentation
|
|
191
|
-
-------------
|
|
192
|
-
|
|
193
|
-
Please see the official documentation at `numexpr.readthedocs.io <https://numexpr.readthedocs.io>`_.
|
|
194
|
-
Included is a user guide, benchmark results, and the reference API.
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
Authors
|
|
198
|
-
-------
|
|
199
|
-
|
|
200
|
-
Please see `AUTHORS.txt <https://github.com/pydata/numexpr/blob/master/AUTHORS.txt>`_.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
License
|
|
204
|
-
-------
|
|
205
|
-
|
|
206
|
-
NumExpr is distributed under the `MIT <http://www.opensource.org/licenses/mit-license.php>`_ license.
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
.. Local Variables:
|
|
210
|
-
.. mode: text
|
|
211
|
-
.. coding: utf-8
|
|
212
|
-
.. fill-column: 70
|
|
213
|
-
.. End:
|
numexpr-2.9.0/numexpr/version.py
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: numexpr
|
|
3
|
-
Version: 2.9.0
|
|
4
|
-
Summary: Fast numerical expression evaluator for NumPy
|
|
5
|
-
Home-page: https://github.com/pydata/numexpr
|
|
6
|
-
Author: David M. Cooke, Francesc Alted, and others
|
|
7
|
-
Maintainer: Francesc Alted
|
|
8
|
-
Maintainer-email: faltet@gmail.com
|
|
9
|
-
License: MIT
|
|
10
|
-
Classifier: Development Status :: 6 - Mature
|
|
11
|
-
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
12
|
-
Classifier: Intended Audience :: Science/Research
|
|
13
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
20
|
-
Classifier: Operating System :: POSIX
|
|
21
|
-
Classifier: Operating System :: MacOS
|
|
22
|
-
Requires-Python: >=3.9
|
|
23
|
-
Description-Content-Type: text/x-rst
|
|
24
|
-
License-File: LICENSE.txt
|
|
25
|
-
License-File: AUTHORS.txt
|
|
26
|
-
Requires-Dist: numpy>=1.13.3
|
|
27
|
-
|
|
28
|
-
======================================================
|
|
29
|
-
NumExpr: Fast numerical expression evaluator for NumPy
|
|
30
|
-
======================================================
|
|
31
|
-
|
|
32
|
-
:Author: David M. Cooke, Francesc Alted, and others.
|
|
33
|
-
:Maintainer: Francesc Alted
|
|
34
|
-
:Contact: faltet@gmail.com
|
|
35
|
-
:URL: https://github.com/pydata/numexpr
|
|
36
|
-
:Documentation: http://numexpr.readthedocs.io/en/latest/
|
|
37
|
-
:Travis CI: |travis|
|
|
38
|
-
:GitHub Actions: |actions|
|
|
39
|
-
:PyPi: |version|
|
|
40
|
-
:DOI: |doi|
|
|
41
|
-
:readthedocs: |docs|
|
|
42
|
-
|
|
43
|
-
.. |actions| image:: https://github.com/pydata/numexpr/workflows/Build/badge.svg
|
|
44
|
-
:target: https://github.com/pydata/numexpr/actions
|
|
45
|
-
.. |travis| image:: https://travis-ci.org/pydata/numexpr.png?branch=master
|
|
46
|
-
:target: https://travis-ci.org/pydata/numexpr
|
|
47
|
-
.. |docs| image:: https://readthedocs.org/projects/numexpr/badge/?version=latest
|
|
48
|
-
:target: http://numexpr.readthedocs.io/en/latest
|
|
49
|
-
.. |doi| image:: https://zenodo.org/badge/doi/10.5281/zenodo.2483274.svg
|
|
50
|
-
:target: https://doi.org/10.5281/zenodo.2483274
|
|
51
|
-
.. |version| image:: https://img.shields.io/pypi/v/numexpr.png
|
|
52
|
-
:target: https://pypi.python.org/pypi/numexpr
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
What is NumExpr?
|
|
56
|
-
----------------
|
|
57
|
-
|
|
58
|
-
NumExpr is a fast numerical expression evaluator for NumPy. With it,
|
|
59
|
-
expressions that operate on arrays (like :code:`'3*a+4*b'`) are accelerated
|
|
60
|
-
and use less memory than doing the same calculation in Python.
|
|
61
|
-
|
|
62
|
-
In addition, its multi-threaded capabilities can make use of all your
|
|
63
|
-
cores -- which generally results in substantial performance scaling compared
|
|
64
|
-
to NumPy.
|
|
65
|
-
|
|
66
|
-
Last but not least, numexpr can make use of Intel's VML (Vector Math
|
|
67
|
-
Library, normally integrated in its Math Kernel Library, or MKL).
|
|
68
|
-
This allows further acceleration of transcendent expressions.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
How NumExpr achieves high performance
|
|
72
|
-
-------------------------------------
|
|
73
|
-
|
|
74
|
-
The main reason why NumExpr achieves better performance than NumPy is
|
|
75
|
-
that it avoids allocating memory for intermediate results. This
|
|
76
|
-
results in better cache utilization and reduces memory access in
|
|
77
|
-
general. Due to this, NumExpr works best with large arrays.
|
|
78
|
-
|
|
79
|
-
NumExpr parses expressions into its own op-codes that are then used by
|
|
80
|
-
an integrated computing virtual machine. The array operands are split
|
|
81
|
-
into small chunks that easily fit in the cache of the CPU and passed
|
|
82
|
-
to the virtual machine. The virtual machine then applies the
|
|
83
|
-
operations on each chunk. It's worth noting that all temporaries and
|
|
84
|
-
constants in the expression are also chunked. Chunks are distributed among
|
|
85
|
-
the available cores of the CPU, resulting in highly parallelized code
|
|
86
|
-
execution.
|
|
87
|
-
|
|
88
|
-
The result is that NumExpr can get the most of your machine computing
|
|
89
|
-
capabilities for array-wise computations. Common speed-ups with regard
|
|
90
|
-
to NumPy are usually between 0.95x (for very simple expressions like
|
|
91
|
-
:code:`'a + 1'`) and 4x (for relatively complex ones like :code:`'a*b-4.1*a > 2.5*b'`),
|
|
92
|
-
although much higher speed-ups can be achieved for some functions and complex
|
|
93
|
-
math operations (up to 15x in some cases).
|
|
94
|
-
|
|
95
|
-
NumExpr performs best on matrices that are too large to fit in L1 CPU cache.
|
|
96
|
-
In order to get a better idea on the different speed-ups that can be achieved
|
|
97
|
-
on your platform, run the provided benchmarks.
|
|
98
|
-
|
|
99
|
-
Installation
|
|
100
|
-
------------
|
|
101
|
-
|
|
102
|
-
From wheels
|
|
103
|
-
^^^^^^^^^^^
|
|
104
|
-
|
|
105
|
-
NumExpr is available for install via `pip` for a wide range of platforms and
|
|
106
|
-
Python versions (which may be browsed at: https://pypi.org/project/numexpr/#files).
|
|
107
|
-
Installation can be performed as::
|
|
108
|
-
|
|
109
|
-
pip install numexpr
|
|
110
|
-
|
|
111
|
-
If you are using the Anaconda or Miniconda distribution of Python you may prefer
|
|
112
|
-
to use the `conda` package manager in this case::
|
|
113
|
-
|
|
114
|
-
conda install numexpr
|
|
115
|
-
|
|
116
|
-
From Source
|
|
117
|
-
^^^^^^^^^^^
|
|
118
|
-
|
|
119
|
-
On most \*nix systems your compilers will already be present. However if you
|
|
120
|
-
are using a virtual environment with a substantially newer version of Python than
|
|
121
|
-
your system Python you may be prompted to install a new version of `gcc` or `clang`.
|
|
122
|
-
|
|
123
|
-
For Windows, you will need to install the Microsoft Visual C++ Build Tools
|
|
124
|
-
(which are free) first. The version depends on which version of Python you have
|
|
125
|
-
installed:
|
|
126
|
-
|
|
127
|
-
https://wiki.python.org/moin/WindowsCompilers
|
|
128
|
-
|
|
129
|
-
For Python 3.6+ simply installing the latest version of MSVC build tools should
|
|
130
|
-
be sufficient. Note that wheels found via pip do not include MKL support. Wheels
|
|
131
|
-
available via `conda` will have MKL, if the MKL backend is used for NumPy.
|
|
132
|
-
|
|
133
|
-
See `requirements.txt` for the required version of NumPy.
|
|
134
|
-
|
|
135
|
-
NumExpr is built in the standard Python way::
|
|
136
|
-
|
|
137
|
-
python setup.py build install
|
|
138
|
-
|
|
139
|
-
You can test `numexpr` with::
|
|
140
|
-
|
|
141
|
-
python -c "import numexpr; numexpr.test()"
|
|
142
|
-
|
|
143
|
-
Do not test NumExpr in the source directory or you will generate import errors.
|
|
144
|
-
|
|
145
|
-
Enable Intel® MKL support
|
|
146
|
-
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
147
|
-
|
|
148
|
-
NumExpr includes support for Intel's MKL library. This may provide better
|
|
149
|
-
performance on Intel architectures, mainly when evaluating transcendental
|
|
150
|
-
functions (trigonometrical, exponential, ...).
|
|
151
|
-
|
|
152
|
-
If you have Intel's MKL, copy the `site.cfg.example` that comes with the
|
|
153
|
-
distribution to `site.cfg` and edit the latter file to provide correct paths to
|
|
154
|
-
the MKL libraries in your system. After doing this, you can proceed with the
|
|
155
|
-
usual building instructions listed above.
|
|
156
|
-
|
|
157
|
-
Pay attention to the messages during the building process in order to know
|
|
158
|
-
whether MKL has been detected or not. Finally, you can check the speed-ups on
|
|
159
|
-
your machine by running the `bench/vml_timing.py` script (you can play with
|
|
160
|
-
different parameters to the `set_vml_accuracy_mode()` and `set_vml_num_threads()`
|
|
161
|
-
functions in the script so as to see how it would affect performance).
|
|
162
|
-
|
|
163
|
-
Usage
|
|
164
|
-
-----
|
|
165
|
-
|
|
166
|
-
::
|
|
167
|
-
|
|
168
|
-
>>> import numpy as np
|
|
169
|
-
>>> import numexpr as ne
|
|
170
|
-
|
|
171
|
-
>>> a = np.arange(1e6) # Choose large arrays for better speedups
|
|
172
|
-
>>> b = np.arange(1e6)
|
|
173
|
-
|
|
174
|
-
>>> ne.evaluate("a + 1") # a simple expression
|
|
175
|
-
array([ 1.00000000e+00, 2.00000000e+00, 3.00000000e+00, ...,
|
|
176
|
-
9.99998000e+05, 9.99999000e+05, 1.00000000e+06])
|
|
177
|
-
|
|
178
|
-
>>> ne.evaluate('a*b-4.1*a > 2.5*b') # a more complex one
|
|
179
|
-
array([False, False, False, ..., True, True, True], dtype=bool)
|
|
180
|
-
|
|
181
|
-
>>> ne.evaluate("sin(a) + arcsinh(a/b)") # you can also use functions
|
|
182
|
-
array([ NaN, 1.72284457, 1.79067101, ..., 1.09567006,
|
|
183
|
-
0.17523598, -0.09597844])
|
|
184
|
-
|
|
185
|
-
>>> s = np.array([b'abba', b'abbb', b'abbcdef'])
|
|
186
|
-
>>> ne.evaluate("b'abba' == s") # string arrays are supported too
|
|
187
|
-
array([ True, False, False], dtype=bool)
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
Documentation
|
|
191
|
-
-------------
|
|
192
|
-
|
|
193
|
-
Please see the official documentation at `numexpr.readthedocs.io <https://numexpr.readthedocs.io>`_.
|
|
194
|
-
Included is a user guide, benchmark results, and the reference API.
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
Authors
|
|
198
|
-
-------
|
|
199
|
-
|
|
200
|
-
Please see `AUTHORS.txt <https://github.com/pydata/numexpr/blob/master/AUTHORS.txt>`_.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
License
|
|
204
|
-
-------
|
|
205
|
-
|
|
206
|
-
NumExpr is distributed under the `MIT <http://www.opensource.org/licenses/mit-license.php>`_ license.
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
.. Local Variables:
|
|
210
|
-
.. mode: text
|
|
211
|
-
.. coding: utf-8
|
|
212
|
-
.. fill-column: 70
|
|
213
|
-
.. End:
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
numpy>=1.13.3
|
numexpr-2.9.0/pyproject.toml
DELETED
numexpr-2.9.0/requirements.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
numpy >= 1.13.3
|
numexpr-2.9.0/setup.cfg
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
[metadata]
|
|
2
|
-
name = numexpr
|
|
3
|
-
version = 2.9.0
|
|
4
|
-
description = Fast numerical expression evaluator for NumPy
|
|
5
|
-
author = David M. Cooke, Francesc Alted, and others
|
|
6
|
-
maintainer = Francesc Alted
|
|
7
|
-
maintainer_email = faltet@gmail.com
|
|
8
|
-
url = https://github.com/pydata/numexpr
|
|
9
|
-
long_description = file: README.rst
|
|
10
|
-
long_description_content_type = text/x-rst
|
|
11
|
-
license = MIT
|
|
12
|
-
classifiers =
|
|
13
|
-
Development Status :: 6 - Mature
|
|
14
|
-
Intended Audience :: Financial and Insurance Industry
|
|
15
|
-
Intended Audience :: Science/Research
|
|
16
|
-
License :: OSI Approved :: MIT License
|
|
17
|
-
Programming Language :: Python :: 3
|
|
18
|
-
Programming Language :: Python :: 3.9
|
|
19
|
-
Programming Language :: Python :: 3.10
|
|
20
|
-
Programming Language :: Python :: 3.11
|
|
21
|
-
Programming Language :: Python :: 3.12
|
|
22
|
-
Operating System :: Microsoft :: Windows
|
|
23
|
-
Operating System :: POSIX
|
|
24
|
-
Operating System :: MacOS
|
|
25
|
-
|
|
26
|
-
[options]
|
|
27
|
-
zip_safe = False
|
|
28
|
-
packages = find:
|
|
29
|
-
python_requires = >=3.9
|
|
30
|
-
|
|
31
|
-
[egg_info]
|
|
32
|
-
tag_build =
|
|
33
|
-
tag_date = 0
|
|
34
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|