Skip to content

Instantly share code, notes, and snippets.

@mahendrapaipuri
Created July 26, 2023 14:37
Show Gist options
  • Select an option

  • Save mahendrapaipuri/16e436593ae3a8db5fa3ffb97013d4d5 to your computer and use it in GitHub Desktop.

Select an option

Save mahendrapaipuri/16e436593ae3a8db5fa3ffb97013d4d5 to your computer and use it in GitHub Desktop.
CUDA simple load test
# Nicked from https://github.com/waggle-sensor/gpu-stress-test/tree/main
import os
import sys
import time
import torch
x = torch.linspace(0, 4, 16 * 1024 ** 2).cuda()
runtime = 60
timeout = time.time() + runtime
print(f"Running GPU stress test loop [{runtime}s]")
while True:
x = x * (1.0 - x)
if time.time() > timeout:
sys.exit(os.EX_OK)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment