Skip to content

xsgeng/npynuma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

# pypi
pip install npynuma

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published