MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / get_vram_usage

Function get_vram_usage

kernelbench/bench_kb.py:511–520  ·  view source on GitHub ↗

Get current GPU VRAM usage in MB.

()

Source from the content-addressed store, hash-verified

509# ---------------------------------------------------------------------------
510
511def get_vram_usage() -> Dict[str, float]:
512 """Get current GPU VRAM usage in MB."""
513 import torch
514 if not torch.cuda.is_available():
515 return {"allocated_mb": 0, "reserved_mb": 0, "peak_mb": 0}
516 return {
517 "allocated_mb": torch.cuda.memory_allocated() / 1e6,
518 "reserved_mb": torch.cuda.memory_reserved() / 1e6,
519 "peak_mb": torch.cuda.max_memory_allocated() / 1e6,
520 }
521
522
523# ---------------------------------------------------------------------------

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected