Metadata-Version: 2.4
Name: py-libnuma
Version: 1.2
Summary: Python3 libnuma ctypes wrapper
Home-page: https://github.com/eedalong/pynuma
Author: Xiulong Yuan, Zhan Lu, Zheng Zeng
Author-email: yuanxl19@mails.tsinghua.edu.cn, lu-z18@mails.tsinghua.edu.cn, zengz17@mails.tsinghua.edu.cn
License: License :: OSI Approved :: MIT License
Platform: Linux
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: platform
Dynamic: summary

# py-libnuma
py-libnuma is python3 interface to numa Linux library so that you can set task affinity and memory affinity in python
level for your process which can help you to improve your code's performence.

# Installation
    pip install py-libnuma

# Usage
py-libnuma categorize libnuma's apis into 3 groups :`memory`, `schedule` and `info`. You can set your tasks' cpu affinity, memory affinity and get information about your
systems's hardware with these 3 modules respectively. For more information about APIs, you can refer to [API.md](https://github.com/eedalong/pynuma/blob/main/API.md) in github


## schedule

`numa.schedule` helps you to set cpu affinity for your process, if you have multiple numa nodes, and you want your process to be scheduled on cpus from node1 and node2, you can use `numa.schedule` like this

    from numa import schedule
    schedule.run_on_nodes(1,2)

If you want a certain process with `pid` to run on specific cpus, you can use `numa.schedule` like this

    from numa import schedule
    schedule.run_on_cpus(pid, 1,3,4,6)


## memory

`numa.memory` helps you to set memory policy for your process, if you want your current process to allocate memory from multiple numa nodes
to balance local and remote memory access, you can use `numa.memory` like this:
    
    from numa import memory    
    memory.set_interleave_nodes(0,1)

or you can make your process to allocate from certain nodes by 

    from numa import memory    
    memory.set_membind_nodes(1)

## Info

`numa.info` helps you to get information about your numa hardware, you can check hardware information by:
    
    from numa import info    
    info.numa_hardware_info()

This will tell you distance between different numa nodes and node-cpu relation. You can also check cpu set for certain nodes by:

    from numa import info    
    info.node_to_cpus(1)

or check which node is a certain cpu belongs to by:

    from numa import info    
    info.cpu_to_node(1)

For more information about APIs, you can refer to [API.md](https://github.com/eedalong/pynuma/blob/main/API.md) in github

## Feedback

If you have any problems with using this package, feel free to create issues and you will get answered in no more than 24 hours



