A CLI tool for checking if GPUs are available before running your script that uses GPUs.
Project description
knock-on-gpus
A CLI tool for checking if GPUs are available before running your script that uses GPUs.
Installation
pip install knock-on-gpus
Quick start
Basic usage
You can use knock-on-gpus
to run a script that uses GPUs.
knock-on-gpus -- python my_script.py
If some GPUs are not available, knock-on-gpus
will return an error code and print a message to the console.
Using with CUDA_VISIBLE_DEVICES
You can also use knock-on-gpus
to run a script with specific GPUs.
CUDA_VISIBLE_DEVICES=0,1 knock-on-gpus -- python my_script.py
You can also use --devices
or -d
to specify the GPUs to use.
knock-on-gpus -d 0,1 -- python my_script.py
Set alias for python
You can set an alias for python
to use knock-on-gpus
by default.
alias unsafe-python="`which python`"
alias python="knock-on-gpus -- python"
Then you can run your script without knock-on-gpus
.
Options
--devices
(short: -d
)
Specifies the GPUs to use. The value is a comma-separated list of GPU IDs.
--memory-border-mib
Specifies the memory border (MiB) to treat as vacant. If the memory usage exceeds this value, the GPU will be treated as occupied.
--use-gpu-strictly
If true, use GPU strictly. If CUDA is not available, it will fail.
--min-gpus
Specifies the number of min GPUs to use.
--max-gpus
Specifies the number of max GPUs to use.
--cuda-visible-devices-env-key
Specifies the environment variable key to set visible devices.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for knock_on_gpus-0.0.1-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 243e57982bd852b41a29e624d2d14455874f6f2327fbf7a766c820b789e5ec78 |
|
MD5 | 1f26532edf2a00197a1240140315a9f0 |
|
BLAKE2b-256 | 0021654075cf7143bfc85923a46a8dc9b0ef4e22af748d3859301867ab8b6d52 |
Hashes for knock_on_gpus-0.0.1-py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b06d80673eed47cc2b1ba01c48f94b5db04f6b9174e6f991539266f02a872103 |
|
MD5 | a1bcab7d8f79e76f63a3f0c3be5225f9 |
|
BLAKE2b-256 | bff36d42820989a8b587d890e69682682719e695b90e28b68a601adfe05aeb1b |
Hashes for knock_on_gpus-0.0.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eef893abfd8e969c4e00b340c7756aaeab8ffb6e2d8d329bc1663c6acf197573 |
|
MD5 | cb67790fffa4f316ab7c07b979b640d4 |
|
BLAKE2b-256 | dcc774c6e9d9d164b9383fef57742fb44c22e6c4c54f1fdba90e426548f27895 |
Hashes for knock_on_gpus-0.0.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3eff68e7f0a3c540a190f197932e9d39657b139f1d7d1895bc57e2751923495e |
|
MD5 | 4631cd01054ceac0de1adc10280ac786 |
|
BLAKE2b-256 | 0e0d2060c55de84b8e7b564b6696244b9eaaba26890c3579c9b193dbdaf6cf38 |
Hashes for knock_on_gpus-0.0.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06dc1c7e48be5e19498386d5629590c7c9308d67a4cf5f388427388307c1aed4 |
|
MD5 | 6bfbe6a5ddaf4a9d4b8e4d8fcff414c5 |
|
BLAKE2b-256 | d1edf6e4c80d2047c369f57195960aa0c4cf51d17eb39524c4dfa1bb6519bbf0 |
Hashes for knock_on_gpus-0.0.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d08b4ec451142f51541be9c7f75b3f8913e08cc5f2c84bec876d72bb2f5cc4d8 |
|
MD5 | 7fdf601f79faf2c34a2ee24552fb89df |
|
BLAKE2b-256 | e6840ee76f0efdec0fa401217832e3f813bd08ca4759bd232d40cb56e59b45ab |
Hashes for knock_on_gpus-0.0.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 750f5ba890750efb154635a034f36864a35a6b90da37b381da31bbbdb6bbf9ea |
|
MD5 | 739780590ec45f67829eaf56c4b191df |
|
BLAKE2b-256 | 375d4dc2f7c713217991fba80657ebca12032d9c93a890d2645192c4bd7d44b3 |
Hashes for knock_on_gpus-0.0.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 148a07ffd3d312ef4b43d7e9b78b99254ad32a2e127f26fc1fc7fd63499c0911 |
|
MD5 | 3ce1f38a3a847e1945f04028ae2cfba3 |
|
BLAKE2b-256 | c8e4536d2137aa0686b86c2cdf29b4b73e16d1d44fe6a66629e5f2c33a29bc9e |
Hashes for knock_on_gpus-0.0.1-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 452b7688196b54bcfb693259208e0005768fd53b06c0a96c7b8d632f8627f9db |
|
MD5 | fb44cac0d4c0af6367fe0cf3d3c64e33 |
|
BLAKE2b-256 | 96476e71b9094fc8a6d8454172901befab6b7cbfdfb44ee2c772cb2cc77725c4 |
Hashes for knock_on_gpus-0.0.1-py3-none-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fab7d2e5b2040c294d9570a61a2df84370a1e4320ca3504bbb65e3f680ef6c9 |
|
MD5 | 9882a95bd633c50376a25b1308ac8b6c |
|
BLAKE2b-256 | b390a16966606a86b4b51a9cc29ce3d10c87fb2d2442af3dd75ad15df9c660ee |