From ede7971adaeed96dd27d7f2241e9742b65379aed Mon Sep 17 00:00:00 2001 From: nimlgen <138685161+nimlgen@users.noreply.github.com> Date: Wed, 13 Dec 2023 02:26:27 +0300 Subject: [PATCH] save some lines (#2731) * remove unsused mem_cached var * one more --- tinygrad/helpers.py | 1 - tinygrad/runtime/ops_cuda.py | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/tinygrad/helpers.py b/tinygrad/helpers.py index e621bc2f34..349e6456c8 100644 --- a/tinygrad/helpers.py +++ b/tinygrad/helpers.py @@ -205,7 +205,6 @@ class GlobalCounters: time_sum_s: ClassVar[float] = 0.0 kernel_count: ClassVar[int] = 0 mem_used: ClassVar[int] = 0 # NOTE: this is not reset - mem_cached: ClassVar[int] = 0 # NOTE: this is not reset @staticmethod def reset(): GlobalCounters.global_ops, GlobalCounters.global_mem, GlobalCounters.time_sum_s, GlobalCounters.kernel_count = 0,0,0.0,0 diff --git a/tinygrad/runtime/ops_cuda.py b/tinygrad/runtime/ops_cuda.py index 3b45e1b386..8860878d37 100644 --- a/tinygrad/runtime/ops_cuda.py +++ b/tinygrad/runtime/ops_cuda.py @@ -70,8 +70,7 @@ class CUDADevice(Compiled): if not CUDACPU: check(cuda.cuInit(0)) check(cuda.cuDeviceGet(ctypes.byref(device := cuda.CUdevice()), device_id)) - check(cuda.cuCtxCreate_v2(ctypes.byref(context := cuda.CUcontext()), 0, device)) - self.context = context + self.context = init_c_var(cuda.CUcontext(), lambda x: check(cuda.cuCtxCreate_v2(ctypes.byref(x), 0, device))) check(cuda.cuDeviceComputeCapability(ctypes.byref(major := ctypes.c_int()), ctypes.byref(minor := ctypes.c_int()), device_id)) if device_id == 0: CUDADevice.default_arch_name = f"sm_{major.value}{minor.value}"