Skip to content

CICD-443 · CUDA compatibility testing ​

Encyclopedia · GPU and inference infrastructure · All snippets

Previous · CICD-442 · Next · CICD-444

1. Where it fits ​

  • Placement CI GPU validation.
  • Prerequisites dedicated GPU lab, approved images and model revision, fixed benchmark profile.
  • Platforms local-linux, github-actions, gitea-actions.

2. Copy the snippet ​

bash
python -c 'import torch; assert torch.cuda.is_available(); x=torch.ones(4, device="cuda"); assert x.sum().item() == 4; print(torch.version.cuda)'

3. How it works ​

Torch first checks CUDA readiness, then performs a tensor operation on the GPU and verifies its numeric result. This exercises more than driver detection.

4. Verify the result ​

A real tensor operation verifies more than loader discovery alone. Record driver and Torch CUDA runtime.

Validation syntax-validated (Bash parse). Status definitions.