You SSH into your pod. You run your training script. The loss starts printing. Everything looks normal.
Except it is running at 24 seconds per iteration instead of 0.4.
That is how I found out torch.cuda.is_available() had returned False on a Vast.ai pod a failure that hits RunPod users equally. No exception. No warning. My script resolved to CPU and kept running. I was paying full GPU rates and training on CPU the entire time.
Why this happens without an error
torch.cuda.is_available() returns False when PyTorch cannot find a usable CUDA installation. The reasons vary:
None of these throw an exception at import time. PyTorch imports cleanly. nvidia-smi may show the GPU. The failure only surfaces when your code tries to use CUDA or never surfaces at all if your script silently falls back to CPU.
The silent fallback is the expensive case
Most training scripts use the standard pattern:
python
device = "cuda" if torch.cuda.is_available() else "cpu" When CUDA is unavailable, the script continues on CPU with no error and no warning. On a rented pod you typically will not notice until you check iteration speed or run nvidia-smi and see GPU utilisation at 0%.
By then you have already paid for the warmup time, the dependency install, and however long training ran before you caught it. The hard guard below stops your training script from running but the pod is still billing while you diagnose. The goal is to catch this before you start the job, not after.
Diagnose it in 10 seconds
python3 -c "import torch; print(torch.**version**, torch.version.cuda, torch.cuda.is_available())"
If is_available() prints False, check:
nvidia-smi
pip show torch | grep -i version
echo $CUDA_VISIBLE_DEVICES
If torch.version.cuda is None, you have a CPU-only build. That is the most common cause on a fresh pod with the wrong template selected. Fix by cause
Cause Fix
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
CPU-only build (torch.version.cuda is None) pip install --force-reinstall torch
--index-url .../whl/cu124
CUDA_VISIBLE_DEVICES set to "" or -1 unset CUDA_VISIBLE_DEVICES
or export CUDA_VISIBLE_DEVICES=0
Driver not loaded or incompatible Terminate the pod and rent a fresh one
driver issues don't resolve inside
the container
Reinstalling PyTorch: A plain pip install torch will often do nothing if torch is already installed pip sees the version requirement as satisfied. Force a clean replacement:
bash
pip install --force-reinstall torch --index-url https://download.pytorch.org/whl/cu124 Check pytorch.org/get-started/locally for the right CUDA build for your environment. Do not assume cu124 is correct for every pod.
Add a hard guard to your training script
The standard "cuda" if torch.cuda.is_available() else "cpu" pattern is a liability on rented compute. Replace it:
python
import torch
if not torch.cuda.is_available():
raise RuntimeError(
"CUDA not available. Check PyTorch build, CUDA_VISIBLE_DEVICES, "
"and nvidia-smi before starting a paid job."
)
device = torch.device("cuda")
This turns a silent CPU fallback into a hard error at line one.
Catch it automatically before every job
bash
uvx computefence doctor
Real output from a machine with no PyTorch installed:
ComputeFence v0.3.3 β Pre-flight diagnostic
ββββββββββββββββββββββββββββββββββββββββββββββββββ
4 WARNINGS Β· 0 BLOCKERS Β· 2 PASSED
Environment
β Python 3.14.3
β PyTorch not found β skipping GPU checks
Fix: pip install torch torchvision torchaudio --index-url [https://download.pytorch.org/whl/cu118](https://download.pytorch.org/whl/cu118)
This output is from a Mac with no PyTorch installed the fix command shows cu118 as a safe default. On a Linux pod the right CUDA wheel depends on your driver version; check pytorch.org/get-started/locally for the correct build. When PyTorch is present but CUDA is unavailable, the torch_cuda check fires instead.
Chain it with your training command so the job never starts if something is wrong:
bash
uvx computefence doctor && python train.py
GitHub: github.com/Francisco-Booth/ComputeFence
Install: pip install computefence