diff --git a/algorithmic_efficiency/profiler.py b/algorithmic_efficiency/profiler.py index d52a532b2..fa2a1bee2 100644 --- a/algorithmic_efficiency/profiler.py +++ b/algorithmic_efficiency/profiler.py @@ -15,7 +15,7 @@ def _get_monotonic_time() -> float: - if torch.cuda.is_available(): + if torch.cuda.is_available() and torch.cuda.is_initialized(): torch.cuda.synchronize() return time.monotonic()