From 3205fd8481cb1d07bbd984fcbd4c4da33e545568 Mon Sep 17 00:00:00 2001 From: nimlgen <138685161+nimlgen@users.noreply.github.com> Date: Thu, 25 Jan 2024 00:57:49 +0300 Subject: [PATCH] fix cuda device var rewrite (#3233) --- tinygrad/runtime/ops_cuda.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tinygrad/runtime/ops_cuda.py b/tinygrad/runtime/ops_cuda.py index f9ab931f04..d8a1ea2ef7 100644 --- a/tinygrad/runtime/ops_cuda.py +++ b/tinygrad/runtime/ops_cuda.py @@ -77,8 +77,8 @@ class CUDADevice(Compiled): device_id = int(device.split(":")[1]) if ":" in device else 0 if not CUDACPU: check(cuda.cuInit(0)) - check(cuda.cuDeviceGet(ctypes.byref(device := cuda.CUdevice()), device_id)) - self.context = init_c_var(cuda.CUcontext(), lambda x: check(cuda.cuCtxCreate_v2(ctypes.byref(x), 0, device))) + check(cuda.cuDeviceGet(ctypes.byref(cu_device := cuda.CUdevice()), device_id)) + self.context = init_c_var(cuda.CUcontext(), lambda x: check(cuda.cuCtxCreate_v2(ctypes.byref(x), 0, cu_device))) check(cuda.cuDeviceComputeCapability(ctypes.byref(major := ctypes.c_int()), ctypes.byref(minor := ctypes.c_int()), device_id)) self.arch = f"sm_{major.value}{minor.value}" if not CUDACPU else "sm_35"