mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-09 15:08:02 -05:00
hotfix: disk is okay in child process
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user