From 17a99760d13a49ebd37b629f36136b7da6cb8571 Mon Sep 17 00:00:00 2001 From: ronnywang <524019753@qq.com> Date: Fri, 13 Aug 2021 01:10:24 -0500 Subject: [PATCH] fix npu_finalize (#34857) --- paddle/fluid/pybind/pybind.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/paddle/fluid/pybind/pybind.cc b/paddle/fluid/pybind/pybind.cc index 589ea088a6c..7137115ac0a 100644 --- a/paddle/fluid/pybind/pybind.cc +++ b/paddle/fluid/pybind/pybind.cc @@ -2221,6 +2221,7 @@ All parameter, weight, gradient are variables in Paddle. auto &pool = platform::DeviceContextPool::Instance(); auto devices = platform::GetSelectedNPUDevices(); for (size_t i = 0; i < devices.size(); ++i) { + platform::NPUDeviceGuard guard(devices[i]); pool.Get(platform::NPUPlace(devices[i]))->Wait(); } platform::AclInstance::Instance().Finalize(); -- GitLab