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
Auto selection
You can use --auto-select
to automatically allocate the number of GPUs.
knock-on-gpus --auto-select 2 -- python my_script.py
If GPU:0, GPU:1, and GPU:3 are unavailable, knock-on-gpus
will use GPU:2 and GPU:4.
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
(Alias: -d
, --device
)
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.
--verbose
If true, print verbose logs.
--auto-select
(Alias: -a
, --auto
)
If a number is given, it will automatically allocate the number of GPUs.
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.2-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6ca9cd74a9aff4286ebc393e40488ad7b002b0df5bc9e36d31b430b33b67872 |
|
MD5 | 2c4bc9d781f45807c9e71643d48c5f63 |
|
BLAKE2b-256 | b13c63c2ab5758e073b5b9c092962bddfd8b5ae68753362c160fd39df95247f3 |
Hashes for knock_on_gpus-0.0.2-py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e1e7eac9030d20a4d297572858a0181457f03faf85546221ec75b957f3c6e2d |
|
MD5 | 8cfe7087b0b299cb423eb28f5adcdd32 |
|
BLAKE2b-256 | 644337099cbf856b4ba1b7e02b6fe0a1715a02aa217bbc48a9071bdc66bf49b9 |
Hashes for knock_on_gpus-0.0.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 990332650d9953f5ecd9854e001f3c4cc9f86f837e3e1c9b0bd3c13af1498723 |
|
MD5 | 19d859f1ee5ea0f416ee2d30615f9f75 |
|
BLAKE2b-256 | 1613ab6ae495329230c1b79c2b74029b7b27df010237038e8564f4a21e714991 |
Hashes for knock_on_gpus-0.0.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 073027e964cf1bef00e81070e733ba35e67da152965e2c3c1e070b1b8538397e |
|
MD5 | 377c6bbdacc68b1bb8337c5a228988a5 |
|
BLAKE2b-256 | 7d26efe7d87fc0789f3543bd2a973313277ed3a596def4bbfb874a4f4bd4e132 |
Hashes for knock_on_gpus-0.0.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f609aabbb6c02573987409a0f828978d1c2948d69771e5736b1f422113d0920 |
|
MD5 | 8be6c47e99a57517d8358195b3b5e758 |
|
BLAKE2b-256 | c096453b005bf99dbe2111123198c970129d0248964382095d31aec78092f5ee |
Hashes for knock_on_gpus-0.0.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17aa8ab890fba2202211708c02b5a6ccb2eabf03cd6332a7aa1c1f346ba20188 |
|
MD5 | 84e268f5cd7b3cda2c6c664afd9253f2 |
|
BLAKE2b-256 | afd720530a33c3385c04fa02da54c7ea3d256c7c0b0b14c498c39cce18a6abfd |
Hashes for knock_on_gpus-0.0.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f742caaf49d508fbfe275c3beaaa901269eb03b1be5806b940737a52b55cfde5 |
|
MD5 | 4db99e9ca3730da12476849a030171c0 |
|
BLAKE2b-256 | dd912d1dc2c42d03c43be4d205578ddb69e6de2352db18588b60bfdc0bfccca0 |
Hashes for knock_on_gpus-0.0.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea8c2503c7b3e82a9987b97cbfd4170f060ac285d89a476391a183c3d3e29ad3 |
|
MD5 | 5690856cdab9b3152d5c26a6dc22c35d |
|
BLAKE2b-256 | 5992b38f37d6ab078e9501f73f73f52c5f04787a27d8f0de96d34fa342ec0c67 |
Hashes for knock_on_gpus-0.0.2-py3-none-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6e4081362e4959eb340224235307601ac777268f09680907a3782d27a42699e |
|
MD5 | bc7c84b11acbed7e0eb6da2e164ad981 |
|
BLAKE2b-256 | 93f762079e59e3bacd56d0c0c95eb7770e7c7f96e220b3d74499f16eaedbef70 |
Hashes for knock_on_gpus-0.0.2-py3-none-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cec6f0cb5c8240a61604e9ed81efb5008ff2c0297454288d0f674d0e4ca97fe8 |
|
MD5 | 0f2a5e6da1e332c03fc20f53445f8b6f |
|
BLAKE2b-256 | d773541982ee32149316c89e231993179b9362e95b80495162e60eecc6bcb14f |