Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

knock_on_gpus-0.0.2.tar.gz (10.9 kB view details)

Uploaded Source

Built Distributions

knock_on_gpus-0.0.2-py3-none-win_amd64.whl (915.0 kB view details)

Uploaded Python 3Windows x86-64

knock_on_gpus-0.0.2-py3-none-win32.whl (832.2 kB view details)

Uploaded Python 3Windows x86

knock_on_gpus-0.0.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

knock_on_gpus-0.0.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl (1.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ s390x

knock_on_gpus-0.0.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (1.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ppc64le

knock_on_gpus-0.0.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl (1.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ i686

knock_on_gpus-0.0.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (890.8 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARMv7l

knock_on_gpus-0.0.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (925.5 kB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

knock_on_gpus-0.0.2-py3-none-macosx_11_0_arm64.whl (926.0 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

knock_on_gpus-0.0.2-py3-none-macosx_10_12_x86_64.whl (1.0 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file knock_on_gpus-0.0.2.tar.gz.

File metadata

  • Download URL: knock_on_gpus-0.0.2.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.4.0

File hashes

Hashes for knock_on_gpus-0.0.2.tar.gz
Algorithm Hash digest
SHA256 e78c38f1d7c2c3dce55d0fad8f870c5e6d3d845c3f2dc0d6523e3e73d790391d
MD5 847b03f8420b2187322722907640c4d8
BLAKE2b-256 503d2f8142fddbe2c2fded46dca1c324ee4f4fab0ea16df7131b40dc38b8235f

See more details on using hashes here.

File details

Details for the file knock_on_gpus-0.0.2-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for knock_on_gpus-0.0.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 c6ca9cd74a9aff4286ebc393e40488ad7b002b0df5bc9e36d31b430b33b67872
MD5 2c4bc9d781f45807c9e71643d48c5f63
BLAKE2b-256 b13c63c2ab5758e073b5b9c092962bddfd8b5ae68753362c160fd39df95247f3

See more details on using hashes here.

File details

Details for the file knock_on_gpus-0.0.2-py3-none-win32.whl.

File metadata

File hashes

Hashes for knock_on_gpus-0.0.2-py3-none-win32.whl
Algorithm Hash digest
SHA256 8e1e7eac9030d20a4d297572858a0181457f03faf85546221ec75b957f3c6e2d
MD5 8cfe7087b0b299cb423eb28f5adcdd32
BLAKE2b-256 644337099cbf856b4ba1b7e02b6fe0a1715a02aa217bbc48a9071bdc66bf49b9

See more details on using hashes here.

File details

Details for the file knock_on_gpus-0.0.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file knock_on_gpus-0.0.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file knock_on_gpus-0.0.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file knock_on_gpus-0.0.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file knock_on_gpus-0.0.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file knock_on_gpus-0.0.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file knock_on_gpus-0.0.2-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

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

See more details on using hashes here.

File details

Details for the file knock_on_gpus-0.0.2-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

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

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page