From 9884be2ad5ea38d7046d5a080af7bb65b91bdb8e Mon Sep 17 00:00:00 2001 From: George Hotz Date: Mon, 7 Nov 2022 21:21:35 -0800 Subject: [PATCH] ugh, that too --- test/test_speed_v_torch.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test_speed_v_torch.py b/test/test_speed_v_torch.py index a65f10108f..95419c88d6 100644 --- a/test/test_speed_v_torch.py +++ b/test/test_speed_v_torch.py @@ -6,11 +6,12 @@ import time import numpy as np from tinygrad.tensor import Tensor from tinygrad.nn import Conv2d -from tinygrad.llops.ops_gpu import CL try: from termcolor import colored + from tinygrad.llops.ops_gpu import CL except ImportError: colored = None + CL = None IN_CHANS = [int(x) for x in os.getenv("IN_CHANS", "4,16,64").split(",")] @@ -34,7 +35,7 @@ def test_speed(f1, *args): del ret st = time.monotonic() ret = f1(*args) - if ret.device in ["GPU", "OPENCL"]: + if CL is not None and ret.device in ["GPU", "OPENCL"]: CL.cl_queue.finish() et = (time.monotonic() - st) * 1000 ets.append(et)