Skip to main content

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 (numactl installed)
  • 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


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)

Uploaded Source

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

Hashes for npynuma-0.1.0.tar.gz
Algorithm Hash digest
SHA256 10e6528fbdf6f9df4d53de0f150a8376ba5f96f95b38e255ab60d90f21dee40c
MD5 fcc27dde37d1005ac1d1ef871aae920b
BLAKE2b-256 9f1c75a80a16e2c8e12cb4d0dc6d0aafc04d6ff93388fe48238ddbdd339d7362

See more details on using hashes here.

Provenance

The following attestation bundles were made for npynuma-0.1.0.tar.gz:

Publisher: python-publish.yml on xsgeng/npynuma

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page