Installation
Requirements
- Go 1.23+ (for building from source)
- Redis server running on localhost:6379
- GPUs with appropriate management tools:
- NVIDIA GPUs: nvidia-smi available
- AMD GPUs: amd-smi available (ROCm 5.7+)
- System access to
/proc
filesystem orps
command for user detection
Dependencies
Go Dependencies
If building from source, Go dependencies are automatically managed:
Redis Setup
Ubuntu/Debian
sudo apt update
sudo apt install redis-server
sudo systemctl start redis-server
sudo systemctl enable redis-server
macOS (via Homebrew)
CentOS/RHEL/Fedora
Verify Redis Installation
GPU Drivers
NVIDIA GPUs
Ensure nvidia-smi is available:
If not installed, install NVIDIA drivers for your system.
AMD GPUs
Ensure amd-smi is available:
If not installed, install ROCm drivers for your system:
Install canhazgpu
Option 1: Install from GitHub (Recommended)
# Install directly from GitHub using Go
go install github.com/russellb/canhazgpu@latest
# The binary will be installed to $GOPATH/bin or $HOME/go/bin
# Make sure this directory is in your PATH
export PATH="$HOME/go/bin:$PATH"
Option 2: Build from Source
# Clone the repository
git clone https://github.com/russellb/canhazgpu.git
cd canhazgpu
# Build and install using Makefile
make install
# Optional: Install documentation dependencies for building docs
make docs-deps
Option 3: Pre-built Binary
# Download pre-built binary (when available)
wget https://github.com/russellb/canhazgpu/releases/latest/download/canhazgpu
chmod +x canhazgpu
# Download bash completion script (optional)
wget https://raw.githubusercontent.com/russellb/canhazgpu/main/autocomplete_canhazgpu.sh
# Install system-wide
sudo cp canhazgpu /usr/local/bin/
sudo cp autocomplete_canhazgpu.sh /etc/bash_completion.d/
# Optional: Create short alias symlink
sudo ln -s /usr/local/bin/canhazgpu /usr/local/bin/chg
Option 4: Local Installation
Bash Completion
The bash completion script provides tab completion for canhazgpu commands and options. It also supports the short alias chg
if you've created the symlink.
Required for canhazgpu run
Commands
Installing bash completion is required for proper tab completion when using commands with canhazgpu run
. Without it, bash completion won't work for the commands you run after the --
separator.
Enable Completion
After installing the completion script to /etc/bash_completion.d/
, enable it:
Usage Examples
With bash completion enabled, you can use tab completion:
# Complete commands
canhazgpu <TAB>
# Shows: admin release report reserve run status web
# Complete commands (works with chg alias too)
chg <TAB>
# Shows: admin release report reserve run status web
# Complete options
canhazgpu run --<TAB>
# Shows: --gpus --help
# Complete duration formats
canhazgpu reserve --duration <TAB>
# Shows common duration examples
# Complete commands after 'canhazgpu run --'
canhazgpu run --gpus 1 -- python <TAB>
# Shows available Python files and completion
# Complete GPU management tool options
canhazgpu run --gpus 1 -- nvidia-smi --<TAB> # For NVIDIA
# Shows nvidia-smi options
canhazgpu run --gpus 1 -- amd-smi --<TAB> # For AMD
# Shows amd-smi options
Manual Installation
If the automatic installation doesn't work, you can source the completion script manually:
# Add to your ~/.bashrc
echo "source /path/to/autocomplete_canhazgpu.sh" >> ~/.bashrc
source ~/.bashrc
Verification
Test the installation:
You should see the help output with available commands.
Test bash completion (if installed):
Should show available commands.
Next Steps
- Quick Start Guide - Initialize and start using canhazgpu
- Configuration - Set up defaults and customize behavior