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.1.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.1-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for keep_gpu-0.3.1.tar.gz
Algorithm Hash digest
SHA256 ca7edc8e17db702524d02e098342d084d3c7cd0be891bc57f1bfbfe1aa86211c
MD5 74ab8b1926beba9cd1b8a2c91fec7425
BLAKE2b-256 ac0e8e88a4171664fe299a6c34a2a2ee278adbe8536e85021d89ac5e0538f42a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: keep_gpu-0.3.1-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.13.7

File hashes

Hashes for keep_gpu-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cf31afb4731117121cdfd2b21c7f0a2605a68cb70532d227c3fd0a779827f3f0
MD5 a6b51909835b192c1fec5c82e72cfbb9
BLAKE2b-256 636d7330d5371b52ae878c7453b91f13a1040c3fea06dd7bc7b5165cd779cf54

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