From f4193eac95756005add49d6ad0de71c428a3b42f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=98=8E=E5=86=AC?= <78149749+winter-wang@users.noreply.github.com> Date: Fri, 26 Aug 2022 10:29:29 +0800 Subject: [PATCH] [NPU] fix CI error in new executor. (#45432) --- .../framework/new_executor/interpretercore.cc | 16 ++++++++++------ .../fluid/tests/unittests/npu/CMakeLists.txt | 3 +-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/paddle/fluid/framework/new_executor/interpretercore.cc b/paddle/fluid/framework/new_executor/interpretercore.cc index 6b6eb3f8d67..f57a99e84cc 100644 --- a/paddle/fluid/framework/new_executor/interpretercore.cc +++ b/paddle/fluid/framework/new_executor/interpretercore.cc @@ -566,12 +566,16 @@ void InterpreterCore::RunInstruction(const Instruction& instr_node) { : var_scope_.GetMutableScope(); #ifdef PADDLE_WITH_ASCEND_CL - // NOTE(wangxi): nan/inf cannot be detected on NPU by checking the variable - // values, but only through special `float_status` to checks whether - // the operation is overflow. More about `float_status`, see: - // https://gitee.com/ascend/modelzoo/issues/I3NF8V?from=project-issue - if (FLAGS_check_nan_inf) { - framework::details::NPUAllocAndClearFloatStatus(*op, *local_scope, place); + if (platform::is_npu_place(place)) { + auto dev_id = place.device; + platform::SetNPUDeviceId(dev_id); + // NOTE(wangxi): nan/inf cannot be detected on NPU by checking the variable + // values, but only through special `float_status` to checks whether + // the operation is overflow. More about `float_status`, see: + // https://gitee.com/ascend/modelzoo/issues/I3NF8V?from=project-issue + if (FLAGS_check_nan_inf) { + framework::details::NPUAllocAndClearFloatStatus(*op, *local_scope, place); + } } #endif diff --git a/python/paddle/fluid/tests/unittests/npu/CMakeLists.txt b/python/paddle/fluid/tests/unittests/npu/CMakeLists.txt index 0c868e45682..57e52206653 100644 --- a/python/paddle/fluid/tests/unittests/npu/CMakeLists.txt +++ b/python/paddle/fluid/tests/unittests/npu/CMakeLists.txt @@ -6,8 +6,7 @@ string(REPLACE ".py" "" TEST_OPS "${TEST_OPS}") if(WITH_ASCEND_CL) foreach(TEST_OP ${TEST_OPS}) - py_test_modules(${TEST_OP} MODULES ${TEST_OP} ENVS - FLAGS_USE_STANDALONE_EXECUTOR=0) + py_test_modules(${TEST_OP} MODULES ${TEST_OP}) endforeach() # NOTE: NPU `get_float_status` read the value from register, During the test, -- GitLab