NVIDIA GPU tools
Project description
It provides information about GPUs and their availability for computation.
Often we want to train a ML model on one of GPUs installed on a multi-GPU machine. Since TensorFlow allocates all memory, only one such process can use the GPU at a time. Unfortunately nvidia-smi provides only a text interface with information about GPUs. This packages wraps it with an easier to use CLI and Python interface.
It’s a quick and dirty solution calling nvidia-smi and parsing its output. We can take one or more GPUs availabile for computation based on relative memory usage, ie. it is OK with Xorg taking a few MB.
Installing
pip install nvgpu
Usage examples
Command-line interface:
# grab all available GPUs CUDA_VISIBLE_DEVICES=$(nvgpu available) # grab at most available GPU CUDA_VISIBLE_DEVICES=$(nvgpu available -l 1)
Python API:
import nvgpu nvgpu.available_gpus() # ['0', '2'] nvgpu.gpu_info() [{'index': '0', 'mem_total': 8119, 'mem_used': 7881, 'mem_used_percent': 97.06860450794433, 'type': 'GeForce GTX 1070', 'uuid': 'GPU-3aa99ee6-4a9f-470e-3798-70aaed942689'}, {'index': '1', 'mem_total': 11178, 'mem_used': 10795, 'mem_used_percent': 96.57362676686348, 'type': 'GeForce GTX 1080 Ti', 'uuid': 'GPU-60410ded-5218-7b06-9c7a-124b77a22447'}, {'index': '2', 'mem_total': 11178, 'mem_used': 10789, 'mem_used_percent': 96.51994990159241, 'type': 'GeForce GTX 1080 Ti', 'uuid': 'GPU-d0a77bd4-cc70-ca82-54d6-4e2018cfdca6'}, ... ]
TODO
order GPUs by priority (decreasing power, decreasing free memory)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nvgpu-0.1.1.tar.gz
.
File metadata
- Download URL: nvgpu-0.1.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
db45cb17013e52b70a80aa7e819284f4e13b8e1c6a9fc277d11ae37242a4411c
|
|
MD5 |
c4e07bd0844277033da9a27493f743b1
|
|
BLAKE2b-256 |
046d465f77bbb26c81f5b7ebf8f1d9df48f4b37b4f320f08bd9d7a570ae3fa2d
|
File details
Details for the file nvgpu-0.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: nvgpu-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
e6a5811c587af59df5f7f5b24a4438597b4fb14b829e9dd7a8c7f20aa1c6af63
|
|
MD5 |
82221654d9a688df477bb84783be4fd9
|
|
BLAKE2b-256 |
874408c09c1e1cea484e429123b84acfff086786d9d2fd59ddc01ead6ae8adae
|