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.
Metadata
Release files for knock-on-gpus 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| knock_on_gpus-0.0.2.tar.gz | 10.9 kB | Details |
Built distributions (wheels)
Total release size: 9.8 MB
Release files / knock_on_gpus-0.0.2.tar.gz
| Download URL | knock_on_gpus-0.0.2.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e78c38f1d7c2c3dce55d0fad8f870c5e6d3d845c3f2dc0d6523e3e73d790391d
|
|
BLAKE2b-256 checksum How to use checksums |
503d2f8142fddbe2c2fded46dca1c324ee4f4fab0ea16df7131b40dc38b8235f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.4.0
|
Release files / knock_on_gpus-0.0.2-py3-none-win_amd64.whl
| Download URL | knock_on_gpus-0.0.2-py3-none-win_amd64.whl |
|---|---|
| Size | 915.0 kB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c6ca9cd74a9aff4286ebc393e40488ad7b002b0df5bc9e36d31b430b33b67872
|
|
BLAKE2b-256 checksum How to use checksums |
b13c63c2ab5758e073b5b9c092962bddfd8b5ae68753362c160fd39df95247f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.4.0
|
Release files / knock_on_gpus-0.0.2-py3-none-win32.whl
| Download URL | knock_on_gpus-0.0.2-py3-none-win32.whl |
|---|---|
| Size | 832.2 kB |
| Tags | Python 3 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
8e1e7eac9030d20a4d297572858a0181457f03faf85546221ec75b957f3c6e2d
|
|
BLAKE2b-256 checksum How to use checksums |
644337099cbf856b4ba1b7e02b6fe0a1715a02aa217bbc48a9071bdc66bf49b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.4.0
|
Release files / knock_on_gpus-0.0.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | knock_on_gpus-0.0.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
990332650d9953f5ecd9854e001f3c4cc9f86f837e3e1c9b0bd3c13af1498723
|
|
BLAKE2b-256 checksum How to use checksums |
1613ab6ae495329230c1b79c2b74029b7b27df010237038e8564f4a21e714991
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.4.0
|
Release files / knock_on_gpus-0.0.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl
| Download URL | knock_on_gpus-0.0.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Linux glibc 2.17+ IBM System/390x Python 3 |
|
SHA-256 checksum How to use checksums |
073027e964cf1bef00e81070e733ba35e67da152965e2c3c1e070b1b8538397e
|
|
BLAKE2b-256 checksum How to use checksums |
7d26efe7d87fc0789f3543bd2a973313277ed3a596def4bbfb874a4f4bd4e132
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.4.0
|
Release files / knock_on_gpus-0.0.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
| Download URL | knock_on_gpus-0.0.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Linux glibc 2.17+ PowerPC 64-le Python 3 |
|
SHA-256 checksum How to use checksums |
4f609aabbb6c02573987409a0f828978d1c2948d69771e5736b1f422113d0920
|
|
BLAKE2b-256 checksum How to use checksums |
c096453b005bf99dbe2111123198c970129d0248964382095d31aec78092f5ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.4.0
|
Release files / knock_on_gpus-0.0.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl
| Download URL | knock_on_gpus-0.0.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Linux glibc 2.17+ x86-32 Python 3 |
|
SHA-256 checksum How to use checksums |
17aa8ab890fba2202211708c02b5a6ccb2eabf03cd6332a7aa1c1f346ba20188
|
|
BLAKE2b-256 checksum How to use checksums |
afd720530a33c3385c04fa02da54c7ea3d256c7c0b0b14c498c39cce18a6abfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.4.0
|
Release files / knock_on_gpus-0.0.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
| Download URL | knock_on_gpus-0.0.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl |
|---|---|
| Size | 890.8 kB |
| Tags | Linux glibc 2.17+ ARMv7l Python 3 |
|
SHA-256 checksum How to use checksums |
f742caaf49d508fbfe275c3beaaa901269eb03b1be5806b940737a52b55cfde5
|
|
BLAKE2b-256 checksum How to use checksums |
dd912d1dc2c42d03c43be4d205578ddb69e6de2352db18588b60bfdc0bfccca0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.4.0
|
Release files / knock_on_gpus-0.0.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | knock_on_gpus-0.0.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 925.5 kB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
ea8c2503c7b3e82a9987b97cbfd4170f060ac285d89a476391a183c3d3e29ad3
|
|
BLAKE2b-256 checksum How to use checksums |
5992b38f37d6ab078e9501f73f73f52c5f04787a27d8f0de96d34fa342ec0c67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.4.0
|
Release files / knock_on_gpus-0.0.2-py3-none-macosx_11_0_arm64.whl
| Download URL | knock_on_gpus-0.0.2-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 926.0 kB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c6e4081362e4959eb340224235307601ac777268f09680907a3782d27a42699e
|
|
BLAKE2b-256 checksum How to use checksums |
93f762079e59e3bacd56d0c0c95eb7770e7c7f96e220b3d74499f16eaedbef70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.4.0
|
Release files / knock_on_gpus-0.0.2-py3-none-macosx_10_12_x86_64.whl
| Download URL | knock_on_gpus-0.0.2-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
cec6f0cb5c8240a61604e9ed81efb5008ff2c0297454288d0f674d0e4ca97fe8
|
|
BLAKE2b-256 checksum How to use checksums |
d773541982ee32149316c89e231993179b9362e95b80495162e60eecc6bcb14f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.4.0
|