From 33a8a9fccb114a5f7cfe0d4aea98a0b38d0bb9e7 Mon Sep 17 00:00:00 2001 From: Priya Kasimbeg Date: Thu, 21 Sep 2023 21:00:32 +0000 Subject: [PATCH] add guards for cuda context initializion --- algorithmic_efficiency/profiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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()