Skip to main content

numpy2x

One switch. Two more cores. Your NumPy code, about 2x faster, with bit-identical results.

python -m numpy2x prog.py        # instead of: python prog.py

numpy2x runs ordinary NumPy programs on two extra CPU cores. No annotations, no rewrite, no new API: the same code, the same results down to the last bit, in less time. Free: Clear BSD license for the code; the patent license (PATENTS) allows use with two worker threads per process, also in your own cloud applications, but not on clusters.

How it works, in one paragraph

numpy2x adds AILP (array instruction level parallelism) to NumPy: every NumPy operation (a + b, np.sin(x), x.sum(axis=0), a @ b, ...) becomes a small task. Your Python thread only issues these tasks and runs ahead; two worker threads compute them as soon as their inputs are ready. Operations that do not depend on each other run at the same time, across loop iterations and function calls. Each one is still computed by your installed NumPy's own code, called exactly as NumPy calls it, so results are bit-identical to plain NumPy. The program waits only where it reads a value (print(x), float(s), if ...).

Examples

1. A loop you cannot parallelize by hand

for i in range(A.shape[1]):
    ES[:i + 1] = np.abs(np.sin(A[:, i])).sum()

Every iteration overwrites what the earlier ones wrote, so the iterations must not be reordered: multiprocessing, a thread pool or prange would give wrong results. numpy2x keeps exactly that order where it matters and overlaps everything else: 1.9x on a 1500 x 1500 matrix.

Example 1, 1500 x 1500: NumPy 1x, numpy2x 1.9x

2. k-means, the program from the ILNumerics Accelerator benchmarks: a plain loop over the points, per point the distances to all centers and argmin, then a center update per cluster (k = 50, k = 15 for the smallest size; 3 rounds). Already faster on small data, and the more work each operation does, the more numpy2x gets out of the two extra cores: 1.1x at 150 x 150 points, 1.9x at 500 x 500, 2.5x at 1500 x 1500.

k-means speedup vs. NumPy: 150x150 1.1x, 500x500 1.9x, 1000x1000 2.4x, 1500x1500 2.5x

3. Toy examples: no parallelism / too small data => no speed-up

Complexity becomes performance: programs that loop over single scalar values or have only a few instructions offer nothing to overlap and gain little; a single operation on small data can even be a little slower than NumPy. Large arrays gain even without parallelism, most likely because of more efficient memory management. The gain shows up as soon as a program does a few operations on arrays of about 100 x 100 elements or more, as examples 1 and 2 do, and real programs usually do much more than that.

Speedup of one op, no AILP, over rows x cols from 1 to 1000: 0.7-0.9x below about 300 elements, 1.0-1.2x above, up to 2.3x from about 300,000 elements

Intel Core i7-12700K, Windows 11, Python 3.13, NumPy 2.5.4, numpy2x with its 2 workers. Examples 1 and 2: medians of 4 rounds (best of several runs each); example 3: the seven single-op and dependent-chain programs of python/benchmarks/shape_map_cases.py. All results bit-identical to NumPy. python python/benchmarks/readme_examples.py reproduces all of it (results: python/benchmarks/results/readme); your numbers will depend on the machine and the program. How to measure your own code: docs/testing.md.

Usage

pip install git+https://github.com/ILNumerics/numpy2x

Needs Python >= 3.12 (64 bit), NumPy >= 2.5 and, until there are prebuilt wheels, a C++20 compiler (Visual Studio with the C++ workload on Windows, GCC or Clang on Linux). The build takes about a minute.

Then pick one:

python -m numpy2x prog.py        # run any program with numpy2x, no code change
NUMPY2X=1 python prog.py         # the same, through an environment variable
import numpy2x as np             # or change one import line

Inside the program, import numpy gives numpy2x; installed libraries (SciPy, pandas, ...) keep the real NumPy and read numpy2x arrays through NumPy's array protocols. Whatever numpy2x does not run itself, NumPy runs, with NumPy's behavior. To compare, run python prog.py against python -m numpy2x prog.py, or wrap a block in with numpy2x.disabled():.

Known differences, IDE setup and how to report results: docs/testing.md.

Where it comes from

numpy2x gets its core from viproc, a remake of the ILNumerics Accelerator (proprietary, .NET). ILNumerics develops and uses strong-scaling methods that find the parallel potential in sequentially written algorithms automatically and turn it into parallel performance at runtime. numpy2x brings this to NumPy and runs on CPU cores. viproc and the ILNumerics Accelerator also work on including GPUs and other OpenCL devices automatically.

References

License

The code is under the Clear BSD License (LICENSE). numpy2x implements methods patented by ILNumerics; their use is licensed separately in PATENTS: free for numpy2x with at most two worker threads per process, also with your own fixes and builds and in your own applications and services, including on cloud infrastructure. Not covered: clusters (except for testing, development and evaluation), offering numpy2x as part of a platform or managed service, and products that offer NumPy-like array functions or objects computed with numpy2x. Those need a commercial license from ILNumerics. Patents of ILNumerics: ilnumerics.net/patents.html. Third-party notices: NOTICE.

Building from source, tests and Docker images: docs/development.md.

Metadata

Release files for numpy2x 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for numpy2x 1.0.0
File Size Uploaded Provenance Actions
numpy2x-1.0.0.tar.gz 390.1 kB With provenance Details for numpy2x-1.0.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for numpy2x 1.0.0
File Actions
numpy2x-1.0.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for numpy2x-1.0.0-cp313-cp313-win_amd64.whl
numpy2x-1.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for numpy2x-1.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
numpy2x-1.0.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for numpy2x-1.0.0-cp312-cp312-win_amd64.whl
numpy2x-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for numpy2x-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Total release size: 2.3 MB

Release files / numpy2x-1.0.0.tar.gz

Download URL numpy2x-1.0.0.tar.gz
Size 390.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b9c99a31578e8e21a34ef845e4e70aa6ea4c240f4e7b67e91190b85ce88be6a1
BLAKE2b-256 checksum
How to use checksums
c6d4cddcd306d4e12ebe28c794606ac2e4afc4284be00898c3aaf44dd67a671a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / numpy2x-1.0.0-cp313-cp313-win_amd64.whl

Download URL numpy2x-1.0.0-cp313-cp313-win_amd64.whl
Size 507.1 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
531103e7097f02f97e454727f48428ba045d05c4b6860d809eb7b9e5c92a6c19
BLAKE2b-256 checksum
How to use checksums
7880928dff98280eda812601c854547430d95e56a2755b0ced7ad9ee883d88f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / numpy2x-1.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL numpy2x-1.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 430.8 kB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
428dff3f7ac474dbb0dd511dc52da3fcf8d84a7ded58a7c1e93b0ec19e0b3ff2
BLAKE2b-256 checksum
How to use checksums
2b8086e449373da0a0137feb6688f2e0479474ba91dc18626bd38635bb1ece59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / numpy2x-1.0.0-cp312-cp312-win_amd64.whl

Download URL numpy2x-1.0.0-cp312-cp312-win_amd64.whl
Size 507.0 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
4ea8d05fe8762a9f1d5e13b091ded3d4fd8d2d073d096011655e6d19529e1556
BLAKE2b-256 checksum
How to use checksums
5357b7b064b6f097094a734238d87af504c53e8c461e7aab56735cdcbe2c888a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Release files / numpy2x-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL numpy2x-1.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 430.8 kB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
a0e5df4c58615cbe2924942bcc6dcf7da57aaae747bb2fedd3b4302bba10ff87
BLAKE2b-256 checksum
How to use checksums
5804f7203d871cbf9c573d4d620721e013296bce096e595907cc327636c05813
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

Security for numpy2x 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for numpy2x-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

5 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page