Metadata-Version: 2.4
Name: npynuma
Version: 0.1.0
Summary: Allocate numpy arrays on NUMA nodes
Author-email: xsgeng <xsgeng@siom.ac.cn>
License: Copyright (c) 2025 xsgeng.
        
        Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
        2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
        3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Project-URL: Homepage, https://github.com/xsgeng/npynuma
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: POSIX :: Linux
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.22
Dynamic: license-file

# npynuma
NUMA node allocation for NumPy arrays on Linux

## Install System Requirements
```bash
# 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
```python
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
