Skip to content

nuinonnull/setcuda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

setcuda

A simple Bash tool for managing GPU visibility in your shell environment by configuring CUDA_VISIBLE_DEVICES.

Features

Commands for Controlling GPU Visibility

Command Description Implementation
setcuda any Enables all GPUs Unsets CUDA_VISIBLE_DEVICES
setcuda none Disables all GPUs Sets CUDA_VISIBLE_DEVICES to an empty value
setcuda <gpu_ids> Enables specified GPU(s) Sets CUDA_VISIBLE_DEVICES to gpu_ids after validation

Dynamic Shell Prompt Indicating Current CUDA Environment

When all GPUs are enabled:

[cuda:any] user@host:~$

When no GPUs are enabled:

[cuda:none] user@host:~$

When GPU 0 is enabled:

[cuda:0] user@host:~$

When GPUs 0 and 2 are enabled:

[cuda:0,2] user@host:~$

Installation

  1. Download setcuda.sh to your preferred directory (e.g., ~/.local/bin/setcuda.sh).

  2. Append the following line to your ~/.bashrc:

    source /path/to/setcuda.sh

About

A simple Bash tool for managing GPU visibility in your shell environment by configuring CUDA_VISIBLE_DEVICES.

Resources

License

Stars

Watchers

Forks

Contributors

Languages