From e2eab9c2b3e6aacd3d2fd7176f06a8e673c3c9fb Mon Sep 17 00:00:00 2001 From: George Hotz Date: Sat, 4 May 2024 18:18:31 +0000 Subject: [PATCH] hotfix: disk is okay in child process --- tinygrad/device.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tinygrad/device.py b/tinygrad/device.py index a09fbdf724..8a7ed1d653 100644 --- a/tinygrad/device.py +++ b/tinygrad/device.py @@ -25,7 +25,7 @@ class _Device: @functools.lru_cache(maxsize=None) # this class is a singleton, pylint: disable=method-cache-max-size-none def __get_canonicalized_item(self, ix:str) -> Compiled: if DEBUG >= 1: print(f"opening device {ix} from pid:{os.getpid()}") - assert multiprocessing.current_process().name == "MainProcess", "can only open device from parent process" + assert multiprocessing.current_process().name == "MainProcess" or ix.split(":")[0] == "DISK", f"can only open device {ix} from parent" x = ix.split(":")[0].upper() return [cls for cname, cls in inspect.getmembers(importlib.import_module(f'tinygrad.runtime.ops_{x.lower()}')) if (cname.lower() == x.lower() + "device") and x in self._devices][0](ix) # noqa: E501 @functools.cached_property