BREAKING CHANGES
- Explicit Command Requirement by Default: By default,
knock-on-gpus
now requires an explicit command to be passed after specifying GPU devices. This change was made to prevent accidental execution of subsequent commands without the correctCUDA_VISIBLE_DEVICES
environment variable being set. The explicit command requirement ensures that users are aware of the command being executed in the context of available GPUs, enhancing the tool's usability and safety.
$ knock-on-gpus -d "0,1,2,3" -- sh -c 'echo "devices=$CUDA_VISIBLE_DEVICES"'
# => devices=0,1,2,3
If GPUs are available, this will succeed. "devices=0,1,2,3" will be printed.
$ knock-on-gpus && sh -c 'echo "devices=$CUDA_VISIBLE_DEVICES"'
# => ERROR: Omitting the command is not allowed.
Even if GPUs are available, this will fail because no command passed to knock-on-gpus
.
Note that &&
has no effect to pass the command to knock-on-gpus
.
$ knock-on-gpus --allow-noop && sh -c 'echo "devices=$CUDA_VISIBLE_DEVICES"'
# => devices=
If GPUs are available, this will succeed.
BUT "devices=" is printed instead of "devices=0,1,2,3" because sh -c ...
is not passed to knock-on-gpus
.
New
- No-Operation Mode Support (
--allow-noop
): We've added the--allow-noop
flag to allowknock-on-gpus
to be run without specifying a subsequent command. This enhancement addresses the need for flexibility in scenarios where users may want to initiateknock-on-gpus
without immediately executing a follow-up task. This can be particularly useful in workflows or scripts where the objective is to prepare or validate the GPU environment prior to deciding on the execution of further commands. The--allow-noop
option prevents the tool from raising an error when no command is provided, offering a smoother experience in such cases.