msg = ( "CUDA call failed lazily at initialization with error: {}\n\n" "CUDA call was originally invoked at:\n\n{}").format( str(e), orig_traceback) raise_from(DeferredCudaCallError(msg), e) def _after_fork(arg): global _initialized, _in_bad_fork if _initialized and _original_pid != os.getpid(): _initialized = False _in_bad_fork = True _CudaBase.__new__ = _lazy_new _register_after_fork(_after_fork, _after_fork) def cudart(): _lazy_init() return _cudart class cudaStatus(object): SUCCESS = 0 ERROR_NOT_READY = 34 class CudaError(RuntimeError): def __init__(self, code): msg = cudart().cudaGetErrorString(code).decode('utf-8')
queued_call() except Exception as e: msg = ("CUDA call failed lazily at initialization with error: {}\n\n" "CUDA call was originally invoked at:\n\n{}").format(str(e), orig_traceback) raise_from(DeferredCudaCallError(msg), e) def _after_fork(arg): global _initialized, _in_bad_fork if _initialized and _original_pid != os.getpid(): _initialized = False _in_bad_fork = True _CudaBase.__new__ = _lazy_new _register_after_fork(_after_fork, _after_fork) def cudart(): _lazy_init() return _cudart class cudaStatus(object): SUCCESS = 0 ERROR_NOT_READY = 34 class CudaError(RuntimeError): def __init__(self, code): msg = cudart().cudaGetErrorString(code).decode('utf-8')