Allocate numpy arrays on NUMA nodes
Project description
npynuma
NUMA node allocation for NumPy arrays on Linux
Install System Requirements
# Ubuntu/Debian
sudo apt install libnuma-dev
# Fedora/CentOS
sudo dnf install numactl-devel
# Python package
git clone https://github.com/xsgeng/npynuma
cd npynuma
pip install .
pip install npynuma # not yet
Quick Start
import numpy as np
from npynuma import NumaPolicy
with NumaPolicy(node=1): # Allocate on NUMA node 1
large_array = np.empty(10_000_000) # 80MB array on node 1
# Works with existing numpy functions
with NumaPolicy(node=0):
random_data = np.random.normal(size=1_000_000)
Notes
- Requires Linux NUMA system (
numactlinstalled) - Node numbers must exist on your system
Thread Safety
⚠️ Not thread-safe - The NUMA policy context is global to the process.
Avoid using NumaPolicy contexts concurrently in:
- Multithreaded applications
- Async frameworks
- Any parallel code sharing NumPy allocations
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
npynuma-0.1.0.tar.gz
(5.0 kB
view details)
File details
Details for the file npynuma-0.1.0.tar.gz.
File metadata
- Download URL: npynuma-0.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10e6528fbdf6f9df4d53de0f150a8376ba5f96f95b38e255ab60d90f21dee40c
|
|
| MD5 |
fcc27dde37d1005ac1d1ef871aae920b
|
|
| BLAKE2b-256 |
9f1c75a80a16e2c8e12cb4d0dc6d0aafc04d6ff93388fe48238ddbdd339d7362
|
Provenance
The following attestation bundles were made for npynuma-0.1.0.tar.gz:
Publisher:
python-publish.yml on xsgeng/npynuma
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
npynuma-0.1.0.tar.gz -
Subject digest:
10e6528fbdf6f9df4d53de0f150a8376ba5f96f95b38e255ab60d90f21dee40c - Sigstore transparency entry: 197148575
- Sigstore integration time:
-
Permalink:
xsgeng/npynuma@4718005250649a9930ba1d09e0075bf2a96a1ee0 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/xsgeng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@4718005250649a9930ba1d09e0075bf2a96a1ee0 -
Trigger Event:
release
-
Statement type: