Find unoccupied GPUs on multi-user systems
Project description
nvsmpy
This package automatically manages your CUDA_VISIBLE_DEVICES environment variable to avoid using GPUs that are currently being used by other users on a multi-user, multi-gpu system. A RuntimeError will be raised if all GPUs are busy. If you pass the max_n_processes argument to available_devices() you may run multiple processes under your system username on a given GPU at the same time.
Installation
pip install nvsmpy
Usage
import os
from nvsmpy import CudaCluster
cluster = CudaCluster()
print(cluster)
# To limit access to any two unused GPUs:
with cluster.available_devices(n_devices=2):
print(os.environ["CUDA_VISIBLE_DEVICES"])
# your code goes here
# Alternatively limit access to GPUs 0 and 7, regardless of availability:
with cluster.visible_devices(0, 3, 7):
print(os.environ["CUDA_VISIBLE_DEVICES"])
# your code goes here
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nvsmpy-0.2.2.tar.gz.
File metadata
- Download URL: nvsmpy-0.2.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e882f57f111ed9d5327b249ceb44f4655674ab9d881a04c716fb54704a2c4534
|
|
| MD5 |
e1d08945096617e0cb530bea9fedc80a
|
|
| BLAKE2b-256 |
c397fbfa0cbfd5ac40562d7984e1e51906cbad5febdb3cd16ab54ebd3a906daa
|
File details
Details for the file nvsmpy-0.2.2-py3-none-any.whl.
File metadata
- Download URL: nvsmpy-0.2.2-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8457a76c4fcbafefe8075881c6b0a576105720b6f573dde6747b2749605817a9
|
|
| MD5 |
57caa132a04bfc1731d182a5218d8ca4
|
|
| BLAKE2b-256 |
3ac83165ce5eef27c636235bbb05aa477a8a43a4781884662aa183f7ea0e3444
|