diff --git a/python/paddle/fluid/__init__.py b/python/paddle/fluid/__init__.py index 13b964274fde270a86deeecff34d03a55e242104..8dbeb3eeb27c3ff3279171dd9c9da39b12fdb426 100644 --- a/python/paddle/fluid/__init__.py +++ b/python/paddle/fluid/__init__.py @@ -227,7 +227,9 @@ if core.is_compiled_with_npu(): atexit.register(core.npu_finalize) # NOTE(Aurelius84): clean up ExecutorCacheInfo in advance manually. atexit.register(core.clear_executor_cache) + # NOTE(Aganlengzi): clean up KernelFactory in advance manually. -atexit.register(core.clear_kernel_factory) # NOTE(wangran16): clean up DeviceManger in advance manually. +# Keep clear_kernel_factory running before clear_device_manager atexit.register(core.clear_device_manager) +atexit.register(core.clear_kernel_factory)