pytorch_run_on_recommended_gpu
A lightweight script that interactively updates CUDA_VISIBLE_DEVICES for pytorch
Install
pip install pytorch_run_on_recommended_gpu
Usage from CLI
Perform a dry run
pytorch_run_on_recommended_gpu
Run a script and select a GPU manually
pytorch_run_on_recommended_gpu <path_to_script>
Run a script from the next available GPU
pytorch_run_on_recommended_gpu --select * <path_to_script>
Run a script from the next two available GPUs
pytorch_run_on_recommended_gpu --select ** <path_to_script>
Run a script from GPU ids 6 and 7
pytorch_run_on_recommended_gpu --select 6 7 <path_to_script>
Usage from .py file
import os
from pytorch_run_on_recommended_gpu.run_on_recommended_gpu import get_cuda_environ_vars as get_vars
os.environ.update(get_vars('*')
print(get_vars('*')))
import torch # Import torch after you have updated the vars.
How it looks like
### Recommended gpus on this machine (descending order) ###
ID Card name Util Mem free Cuda User(s)
---- -------------------- ------- ---------- ---------------- ---------
4 Tesla V100-SXM3-32GB 0 % 31889 MiB 11.8 (470.82.01)
3 Tesla V100-SXM3-32GB 0 % 31887 MiB 11.8 (470.82.01)
5 Tesla V100-SXM3-32GB 0 % 31737 MiB 11.8 (470.82.01)
2 Tesla V100-SXM3-32GB 0 % 31341 MiB 11.8 (470.82.01)
0 Tesla V100-SXM3-32GB 0 % 31263 MiB 11.8 (470.82.01)
1 Tesla V100-SXM3-32GB 0 % 31038 MiB 11.8 (470.82.01)
11 Tesla V100-SXM3-32GB 0 % 23012 MiB 11.8 (470.82.01)
7 Tesla V100-SXM3-32GB 0 % 15481 MiB 11.8 (470.82.01)
10 Tesla V100-SXM3-32GB 21 % 1025 MiB 11.8 (470.82.01)
6 Tesla V100-SXM3-32GB 50 % 29296 MiB 11.8 (470.82.01)
8 Tesla V100-SXM3-32GB 50 % 28988 MiB 11.8 (470.82.01)
9 Tesla V100-SXM3-32GB 51 % 28988 MiB 11.8 (470.82.01)
15 Tesla V100-SXM3-32GB ! 99 % 22636 MiB 11.8 (470.82.01)
13 Tesla V100-SXM3-32GB ! 99 % 21441 MiB 11.8 (470.82.01)
14 Tesla V100-SXM3-32GB ! 100 % 22610 MiB 11.8 (470.82.01)
12 Tesla V100-SXM3-32GB ! 100 % 22141 MiB 11.8 (470.82.01)
Which GPUs shall be used? Give stars or ids. Input=* [ENTER]
Metadata
Release files for pytorch_run_on_recommended_gpu 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytorch_run_on_recommended_gpu-1.0.6.tar.gz | 19.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytorch_run_on_recommended_gpu-1.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.3 kB
Release files / pytorch_run_on_recommended_gpu-1.0.6.tar.gz
| Download URL | pytorch_run_on_recommended_gpu-1.0.6.tar.gz |
|---|---|
| Size | 19.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2721541c172ff4e46edcef6374013f03d05002b4bd93db30377ebbce07cd1f70
|
|
BLAKE2b-256 checksum How to use checksums |
ca22aa0791080adfd3fa401e9208203db8c083d53f81cec55b476379cfacedcb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.9.18 Linux/5.4.0-92-generic
|
Release files / pytorch_run_on_recommended_gpu-1.0.6-py3-none-any.whl
| Download URL | pytorch_run_on_recommended_gpu-1.0.6-py3-none-any.whl |
|---|---|
| Size | 21.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6490682ae51c7ea5425f4a7459b1352d1cb00c322543af75f3087a34eff05fb9
|
|
BLAKE2b-256 checksum How to use checksums |
31e347cf2ddaf51111bf824e315b123221e51e662fb38ce4f9b44a8ec2813cef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.9.18 Linux/5.4.0-92-generic
|