Skip to main content

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


Download files

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

Source Distribution

nvsmpy-0.2.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nvsmpy-0.2.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

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

Hashes for nvsmpy-0.2.2.tar.gz
Algorithm Hash digest
SHA256 e882f57f111ed9d5327b249ceb44f4655674ab9d881a04c716fb54704a2c4534
MD5 e1d08945096617e0cb530bea9fedc80a
BLAKE2b-256 c397fbfa0cbfd5ac40562d7984e1e51906cbad5febdb3cd16ab54ebd3a906daa

See more details on using hashes here.

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

Hashes for nvsmpy-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8457a76c4fcbafefe8075881c6b0a576105720b6f573dde6747b2749605817a9
MD5 57caa132a04bfc1731d182a5218d8ca4
BLAKE2b-256 3ac83165ce5eef27c636235bbb05aa477a8a43a4781884662aa183f7ea0e3444

See more details on using hashes here.

Supported by

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