Skip to main content

Keep GPU is a simple CLI app that keeps your GPUs running

Project description

Keep GPU

PyPI Version Docs Status

Keep GPU is a simple CLI app that keeps your GPUs running.


Contributions Welcome!

If you have ideas for new features or improvements, feel free to open an issue or submit a pull request.

This project does not yet fully support ROCm GPUs, so any contributions, suggestions, or testing help in that area are especially welcome!


Features

  • Simple command-line interface
  • Uses PyTorch and nvidia-smi to monitor and load GPUs
  • Easy to extend for your own keep-alive logic

Installation

pip install keep-gpu

Usage

Use keep-gpu as a cli tool

keep-gpu

Specify the interval in microseconds between GPU usage checks (default is 300 seconds):

keep-gpu --interval 100

Specify GPU IDs to run on (default is all available GPUs):

keep-gpu --gpu-ids 0,1,2

Use keep-gpu api in your code

Non-blocking gpu keeping logic with CudaGPUController:

from keep_gpu.single_gpu_controller.cuda_gpu_controller import CudaGPUController
ctrl = CudaGPUController(rank=0, interval=0.5)
# occupy GPU while you do CPU-only work
# this is non-blocking
ctrl.keep()
dataset.process()
ctrl.release()        # give GPU memory back
model.train_start()   # now run real GPU training

Use CudaGPUController as a context manager:

from keep_gpu.single_gpu_controller.cuda_gpu_controller import CudaGPUController
with CudaGPUController(rank=0, interval=0.5):
    dataset.process()  # GPU occupied inside this block
model.train_start()    # GPU free after exiting block

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Contributors

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

keep_gpu-0.3.0.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

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

keep_gpu-0.3.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file keep_gpu-0.3.0.tar.gz.

File metadata

  • Download URL: keep_gpu-0.3.0.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for keep_gpu-0.3.0.tar.gz
Algorithm Hash digest
SHA256 53cbb1aac70c5adec4f09f98e592557a8f2075bcf37a0813da90a93d99d8ffa0
MD5 abea1d3a160ac25b66dc08b36f9b7714
BLAKE2b-256 036b61cb783cb14967531274749d546a3a56804bad385895f38d60d2f8ed51b6

See more details on using hashes here.

File details

Details for the file keep_gpu-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: keep_gpu-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for keep_gpu-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd916f532d163daf6fa70dc70a2597327b70ca863ab2793e65e9ef656c0241a3
MD5 4f639ba5aa0aea971ca63ceb6cd74aab
BLAKE2b-256 768b090a18ff5f2e375fb5b50ac0666fd28cca00fb09810e3f0b6c735ff81150

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