From 262ea02a8a5eb7977b2582bd13eb8c2b62666a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B2=A7=E5=A4=9C?= Date: Thu, 6 Apr 2023 11:52:50 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=98=87=E8=85=BE=E5=92=8C=E5=AF=92?= =?UTF-8?q?=E6=AD=A6=E7=BA=AA=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81=E9=80=80?= =?UTF-8?q?=E5=9C=BA=E3=80=91No.9=20=E6=B8=85=E7=90=86=20PADDLE=5FWITH=5FA?= =?UTF-8?q?SCEND=20=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81=20(#52403)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- paddle/fluid/operators/ascend_trigger_op.h | 13 --------- paddle/fluid/pybind/parallel_executor.cc | 21 ++++++-------- paddle/fluid/pybind/place.cc | 21 ++++++-------- paddle/fluid/pybind/pybind.cc | 32 ++++++++-------------- paddle/fluid/pybind/tensor.cc | 21 ++++++-------- 5 files changed, 39 insertions(+), 69 deletions(-) diff --git a/paddle/fluid/operators/ascend_trigger_op.h b/paddle/fluid/operators/ascend_trigger_op.h index 09e160d8f6a..8cdc2ea9b8b 100644 --- a/paddle/fluid/operators/ascend_trigger_op.h +++ b/paddle/fluid/operators/ascend_trigger_op.h @@ -17,10 +17,6 @@ #include #include "paddle/fluid/framework/op_registry.h" -#ifdef PADDLE_WITH_ASCEND -#include "paddle/fluid/framework/fleet/ascend_wrapper.h" -#include "paddle/fluid/framework/tensor.h" -#endif namespace paddle { namespace operators { @@ -29,17 +25,8 @@ template class AscendTriggerCPUKernel : public framework::OpKernel { public: void Compute(const framework::ExecutionContext &ctx) const override { -#ifdef PADDLE_WITH_ASCEND - auto ascend_ptr = paddle::framework::AscendInstance::GetInstance(); - auto graph_idx = ctx.Attr("graph_idx"); - VLOG(4) << "AscendTrigger Kernel, begin to run graph: " << graph_idx; - auto inputs = ctx.MultiInput("FeedList"); - auto outputs = ctx.MultiOutput("FetchList"); - ascend_ptr->RunAscendSubgraph(graph_idx, inputs, &outputs); -#else PADDLE_THROW(platform::errors::PreconditionNotMet( "Please compile WITH_ASCEND option to enable ascend_trigger op")); -#endif } }; diff --git a/paddle/fluid/pybind/parallel_executor.cc b/paddle/fluid/pybind/parallel_executor.cc index a871b6f6b9a..2ceef819e75 100644 --- a/paddle/fluid/pybind/parallel_executor.cc +++ b/paddle/fluid/pybind/parallel_executor.cc @@ -87,25 +87,16 @@ limitations under the License. */ #include "paddle/fluid/platform/profiler/event_python.h" #include "paddle/fluid/platform/profiler/event_tracing.h" #include "paddle/fluid/platform/profiler/profiler.h" -#include "paddle/fluid/pybind/cuda_streams_py.h" -#include "paddle/fluid/pybind/distributed_py.h" -#include "paddle/fluid/pybind/eager.h" -#include "paddle/fluid/pybind/imperative.h" -#include "paddle/fluid/pybind/io.h" -#include "paddle/phi/backends/cpu/cpu_info.h" -#include "paddle/phi/core/compat/convert_utils.h" -#include "paddle/phi/core/lod_utils.h" -#include "paddle/utils/none.h" -#ifdef PADDLE_WITH_ASCEND -#include "paddle/fluid/pybind/ascend_wrapper_py.h" -#endif #include "paddle/fluid/pybind/bind_cost_model.h" #include "paddle/fluid/pybind/bind_fleet_executor.h" #include "paddle/fluid/pybind/box_helper_py.h" #include "paddle/fluid/pybind/communication.h" #include "paddle/fluid/pybind/compatible.h" #include "paddle/fluid/pybind/const_value.h" +#include "paddle/fluid/pybind/cuda_streams_py.h" #include "paddle/fluid/pybind/data_set_py.h" +#include "paddle/fluid/pybind/distributed_py.h" +#include "paddle/fluid/pybind/eager.h" #include "paddle/fluid/pybind/exception.h" #include "paddle/fluid/pybind/fleet_wrapper_py.h" #include "paddle/fluid/pybind/generator_py.h" @@ -113,12 +104,18 @@ limitations under the License. */ #include "paddle/fluid/pybind/gloo_context_py.h" #include "paddle/fluid/pybind/gloo_wrapper_py.h" #include "paddle/fluid/pybind/heter_wrapper_py.h" +#include "paddle/fluid/pybind/imperative.h" #include "paddle/fluid/pybind/inference_api.h" +#include "paddle/fluid/pybind/io.h" #include "paddle/fluid/pybind/ir.h" #include "paddle/fluid/pybind/metrics_py.h" #include "paddle/fluid/pybind/ps_gpu_wrapper_py.h" #include "paddle/fluid/pybind/pybind_variant_caster.h" +#include "paddle/phi/backends/cpu/cpu_info.h" #include "paddle/phi/backends/device_manager.h" +#include "paddle/phi/core/compat/convert_utils.h" +#include "paddle/phi/core/lod_utils.h" +#include "paddle/utils/none.h" #if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL) #include "paddle/fluid/pybind/nccl_wrapper_py.h" diff --git a/paddle/fluid/pybind/place.cc b/paddle/fluid/pybind/place.cc index 79dfa27e6dd..145f3822abe 100644 --- a/paddle/fluid/pybind/place.cc +++ b/paddle/fluid/pybind/place.cc @@ -87,25 +87,16 @@ limitations under the License. */ #include "paddle/fluid/platform/profiler/event_python.h" #include "paddle/fluid/platform/profiler/event_tracing.h" #include "paddle/fluid/platform/profiler/profiler.h" -#include "paddle/fluid/pybind/cuda_streams_py.h" -#include "paddle/fluid/pybind/distributed_py.h" -#include "paddle/fluid/pybind/eager.h" -#include "paddle/fluid/pybind/imperative.h" -#include "paddle/fluid/pybind/io.h" -#include "paddle/phi/backends/cpu/cpu_info.h" -#include "paddle/phi/core/compat/convert_utils.h" -#include "paddle/phi/core/lod_utils.h" -#include "paddle/utils/none.h" -#ifdef PADDLE_WITH_ASCEND -#include "paddle/fluid/pybind/ascend_wrapper_py.h" -#endif #include "paddle/fluid/pybind/bind_cost_model.h" #include "paddle/fluid/pybind/bind_fleet_executor.h" #include "paddle/fluid/pybind/box_helper_py.h" #include "paddle/fluid/pybind/communication.h" #include "paddle/fluid/pybind/compatible.h" #include "paddle/fluid/pybind/const_value.h" +#include "paddle/fluid/pybind/cuda_streams_py.h" #include "paddle/fluid/pybind/data_set_py.h" +#include "paddle/fluid/pybind/distributed_py.h" +#include "paddle/fluid/pybind/eager.h" #include "paddle/fluid/pybind/exception.h" #include "paddle/fluid/pybind/fleet_wrapper_py.h" #include "paddle/fluid/pybind/generator_py.h" @@ -113,12 +104,18 @@ limitations under the License. */ #include "paddle/fluid/pybind/gloo_context_py.h" #include "paddle/fluid/pybind/gloo_wrapper_py.h" #include "paddle/fluid/pybind/heter_wrapper_py.h" +#include "paddle/fluid/pybind/imperative.h" #include "paddle/fluid/pybind/inference_api.h" +#include "paddle/fluid/pybind/io.h" #include "paddle/fluid/pybind/ir.h" #include "paddle/fluid/pybind/metrics_py.h" #include "paddle/fluid/pybind/ps_gpu_wrapper_py.h" #include "paddle/fluid/pybind/pybind_variant_caster.h" +#include "paddle/phi/backends/cpu/cpu_info.h" #include "paddle/phi/backends/device_manager.h" +#include "paddle/phi/core/compat/convert_utils.h" +#include "paddle/phi/core/lod_utils.h" +#include "paddle/utils/none.h" #if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL) #include "paddle/fluid/pybind/nccl_wrapper_py.h" diff --git a/paddle/fluid/pybind/pybind.cc b/paddle/fluid/pybind/pybind.cc index 88a98424449..1583102865f 100644 --- a/paddle/fluid/pybind/pybind.cc +++ b/paddle/fluid/pybind/pybind.cc @@ -95,21 +95,6 @@ limitations under the License. */ #include "paddle/fluid/platform/profiler/event_python.h" #include "paddle/fluid/platform/profiler/event_tracing.h" #include "paddle/fluid/platform/profiler/profiler.h" -#include "paddle/fluid/pybind/cuda_streams_py.h" -#include "paddle/fluid/pybind/custom_device_py.h" -#include "paddle/fluid/pybind/distributed_py.h" -#include "paddle/fluid/pybind/eager.h" -#include "paddle/fluid/pybind/imperative.h" -#include "paddle/fluid/pybind/io.h" -#include "paddle/fluid/pybind/jit.h" -#include "paddle/fluid/pybind/xpu_streams_py.h" -#include "paddle/phi/backends/cpu/cpu_info.h" -#include "paddle/phi/core/compat/convert_utils.h" -#include "paddle/phi/core/lod_utils.h" -#include "paddle/utils/none.h" -#ifdef PADDLE_WITH_ASCEND -#include "paddle/fluid/pybind/ascend_wrapper_py.h" -#endif #include "paddle/fluid/pybind/auto_parallel_py.h" #include "paddle/fluid/pybind/bind_cost_model.h" #include "paddle/fluid/pybind/bind_fleet_executor.h" @@ -117,7 +102,11 @@ limitations under the License. */ #include "paddle/fluid/pybind/communication.h" #include "paddle/fluid/pybind/compatible.h" #include "paddle/fluid/pybind/const_value.h" +#include "paddle/fluid/pybind/cuda_streams_py.h" +#include "paddle/fluid/pybind/custom_device_py.h" #include "paddle/fluid/pybind/data_set_py.h" +#include "paddle/fluid/pybind/distributed_py.h" +#include "paddle/fluid/pybind/eager.h" #include "paddle/fluid/pybind/exception.h" #include "paddle/fluid/pybind/fleet_wrapper_py.h" #include "paddle/fluid/pybind/generator_py.h" @@ -125,12 +114,20 @@ limitations under the License. */ #include "paddle/fluid/pybind/gloo_context_py.h" #include "paddle/fluid/pybind/gloo_wrapper_py.h" #include "paddle/fluid/pybind/heter_wrapper_py.h" +#include "paddle/fluid/pybind/imperative.h" #include "paddle/fluid/pybind/inference_api.h" +#include "paddle/fluid/pybind/io.h" #include "paddle/fluid/pybind/ir.h" +#include "paddle/fluid/pybind/jit.h" #include "paddle/fluid/pybind/metrics_py.h" #include "paddle/fluid/pybind/ps_gpu_wrapper_py.h" #include "paddle/fluid/pybind/pybind_variant_caster.h" +#include "paddle/fluid/pybind/xpu_streams_py.h" +#include "paddle/phi/backends/cpu/cpu_info.h" #include "paddle/phi/backends/device_manager.h" +#include "paddle/phi/core/compat/convert_utils.h" +#include "paddle/phi/core/lod_utils.h" +#include "paddle/utils/none.h" #if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL) #include "paddle/fluid/pybind/nccl_wrapper_py.h" @@ -2794,11 +2791,6 @@ All parameter, weight, gradient are variables in Paddle. #ifndef PADDLE_NO_PYTHON BindDistributed(&m); #endif -#ifdef PADDLE_WITH_ASCEND - BindAscendWrapper(&m); - BindAscendGraph(&m); - BindAscendDevice(&m); -#endif #ifdef PADDLE_WITH_CRYPTO BindCrypto(&m); #endif diff --git a/paddle/fluid/pybind/tensor.cc b/paddle/fluid/pybind/tensor.cc index b854fa37ac0..f7f4d2585d7 100644 --- a/paddle/fluid/pybind/tensor.cc +++ b/paddle/fluid/pybind/tensor.cc @@ -87,25 +87,16 @@ limitations under the License. */ #include "paddle/fluid/platform/profiler/event_python.h" #include "paddle/fluid/platform/profiler/event_tracing.h" #include "paddle/fluid/platform/profiler/profiler.h" -#include "paddle/fluid/pybind/cuda_streams_py.h" -#include "paddle/fluid/pybind/distributed_py.h" -#include "paddle/fluid/pybind/eager.h" -#include "paddle/fluid/pybind/imperative.h" -#include "paddle/fluid/pybind/io.h" -#include "paddle/phi/backends/cpu/cpu_info.h" -#include "paddle/phi/core/compat/convert_utils.h" -#include "paddle/phi/core/lod_utils.h" -#include "paddle/utils/none.h" -#ifdef PADDLE_WITH_ASCEND -#include "paddle/fluid/pybind/ascend_wrapper_py.h" -#endif #include "paddle/fluid/pybind/bind_cost_model.h" #include "paddle/fluid/pybind/bind_fleet_executor.h" #include "paddle/fluid/pybind/box_helper_py.h" #include "paddle/fluid/pybind/communication.h" #include "paddle/fluid/pybind/compatible.h" #include "paddle/fluid/pybind/const_value.h" +#include "paddle/fluid/pybind/cuda_streams_py.h" #include "paddle/fluid/pybind/data_set_py.h" +#include "paddle/fluid/pybind/distributed_py.h" +#include "paddle/fluid/pybind/eager.h" #include "paddle/fluid/pybind/exception.h" #include "paddle/fluid/pybind/fleet_wrapper_py.h" #include "paddle/fluid/pybind/generator_py.h" @@ -113,12 +104,18 @@ limitations under the License. */ #include "paddle/fluid/pybind/gloo_context_py.h" #include "paddle/fluid/pybind/gloo_wrapper_py.h" #include "paddle/fluid/pybind/heter_wrapper_py.h" +#include "paddle/fluid/pybind/imperative.h" #include "paddle/fluid/pybind/inference_api.h" +#include "paddle/fluid/pybind/io.h" #include "paddle/fluid/pybind/ir.h" #include "paddle/fluid/pybind/metrics_py.h" #include "paddle/fluid/pybind/ps_gpu_wrapper_py.h" #include "paddle/fluid/pybind/pybind_variant_caster.h" +#include "paddle/phi/backends/cpu/cpu_info.h" #include "paddle/phi/backends/device_manager.h" +#include "paddle/phi/core/compat/convert_utils.h" +#include "paddle/phi/core/lod_utils.h" +#include "paddle/utils/none.h" #if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL) #include "paddle/fluid/pybind/nccl_wrapper_py.h" -- GitLab