Skip to main content

Python3 libnuma ctypes wrapper

Project description

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 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 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

Project details


Release history Release notifications | RSS feed

This version

1.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py-libnuma-1.2.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

py_libnuma-1.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file py-libnuma-1.2.tar.gz.

File metadata

  • Download URL: py-libnuma-1.2.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.2

File hashes

Hashes for py-libnuma-1.2.tar.gz
Algorithm Hash digest
SHA256 e9d67ad04f274015e9acac497d642ce92f8a96d1d4e7be24e39124b24320b95a
MD5 97f3eb5af1911d642cb2a5b17d834afb
BLAKE2b-256 7b9ce06382505da25f8e62e1234f1d76b4cf607e74275e6a48692014b6768324

See more details on using hashes here.

File details

Details for the file py_libnuma-1.2-py3-none-any.whl.

File metadata

  • Download URL: py_libnuma-1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.2

File hashes

Hashes for py_libnuma-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a4c0b9188c03a1ba23b994e9c99f67ef25a090fadce90db94d46e229bd258fb9
MD5 cee27710ce3a78b782195ffd997b3003
BLAKE2b-256 203ee1f727f0ce0e26a0eac27fb5a6de043d41e04d76710063606a801b690c08

See more details on using hashes here.

Supported by

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