mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-09 23:18:04 -05:00
@@ -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
|
||||
|
||||
|
||||
@@ -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}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user