mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-24 02:14:17 +00:00
fix cuda device var rewrite (#3233)
This commit is contained in:
parent
ed8a32722a
commit
3205fd8481
1 changed files with 2 additions and 2 deletions
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue