A simple tool to select the first available GPU(s) and run Python
Project description
Cuthon is a simple Python script to avoid setting CUDA_VISIBLE_DEVICES when running python programs on a GPU. The script will find the first unused GPU(s) then run the program as usual. At its simplest:
cuthon my_program.py
This tool is intended for a fairly niche use case: running python programs on an interactive node which has more than one GPU. For those that have done this often you may be relieved at never having to run nvidia-smi followed by setting CUDA_VISIBLE_DEVICES again (when running a python program that is).
Install
Install with pip:
pip install cuthon
Usage
In general, use cuthon just like you would use python.
cuthon to launch a python repl.
cuthon -V to see the python version number.
cuthon train_model.py to run your program.
For help on available cuthon options type:
cuthon -h --
The output will be:
usage: cuthon.py [-h] [-n NUM_GPUS] [-l] Select the first unused GPU(s) and run Python. To pass the script arguments specify '--' between cuthon arguments and arguments to be passed through to your script. If '--' is not specified, then all arguments will be passed through. optional arguments: -h, --help show this help message and exit -n NUM_GPUS, --num_gpus NUM_GPUS The number of GPUs to use. -l, --least_used Switch from an unused to a least-used policy.
For example, to run on two available GPUs execute:
cuthon -n 2 -- train_model.py
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
Built Distribution
File details
Details for the file cuthon-0.5.tar.gz
.
File metadata
- Download URL: cuthon-0.5.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6b4cd3eec72db841b864bfaa481bccbf7b186663e0b2f760b6baca8189f1f68 |
|
MD5 | 04a02f1ebe28cfd98dc627e7979d72a8 |
|
BLAKE2b-256 | 0e08b9e4e1ea51f3b8e9b6b6eedfb0d388b4a9448e709a2648bd13cf0a6a2826 |
File details
Details for the file cuthon-0.5-py2.py3-none-any.whl
.
File metadata
- Download URL: cuthon-0.5-py2.py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e5e3aa859fe52120f9f2c5ca29dd0fc6b0b3abcd838becae8023b530d8c7c7f |
|
MD5 | c7089dcb8722a3bba6d9e0a2be75c4c7 |
|
BLAKE2b-256 | 0e49617d50784b9763ab07b2b7dd45fae42a8487ffc1e887d853e4aad5157e27 |