https://github.com/samermakni/cuda-selector
A simple tool to select the optimal CUDA device based custom criteria.
https://github.com/samermakni/cuda-selector
automation gpu-monitoring machine-learning
Last synced: 6 months ago
JSON representation
A simple tool to select the optimal CUDA device based custom criteria.
- Host: GitHub
- URL: https://github.com/samermakni/cuda-selector
- Owner: SamerMakni
- Created: 2024-10-17T11:45:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-10T10:22:01.000Z (over 1 year ago)
- Last Synced: 2026-01-07T14:36:43.919Z (6 months ago)
- Topics: automation, gpu-monitoring, machine-learning
- Language: Python
- Homepage: https://samermakni.github.io/cuda-selector/
- Size: 69.3 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README




# Auto Cuda Selector
A simple tool to select the optimal CUDA device based on memory, power, temperature, or utilization. It supports fallback to CPU and custom sorting functions. Supports CUDA devices on Linux and MPS devices on macOS. Full documentation be found [here](https://samermakni.github.io/cuda-selector/)
### Install
```bash
pip install cuda-selector
```
### Usage
```python
from cuda_selector import auto_cuda
# Select the CUDA device with the most memory available
device = auto_cuda()
# Select the CUDA device with the lowest power usage
device = auto_cuda('power')
# Select the CUDA device with the lowest GPU utilization
device = auto_cuda('utilization')
# Select the CUDA device with the lowest temperature
device = auto_cuda('temperature')
# Select multiple devices with the most free memory
devices = auto_cuda(n=3)
# Exclude specific devices by their index
devices = auto_cuda(exclude=[0, 1])
# Apply thresholds for power usage and utilization
devices = auto_cuda(thresholds={'power': 150, 'utilization': 70})
# Use a custom ranking function for selecting devices
devices = auto_cuda(sort_fn=lambda d: d['memory_free'] * 0.7 + d['utilization'] * 0.3)
```