未验证 提交 21bece3f 编写于 作者: L Leo Chen 提交者: GitHub

enable flags_benchmark for dygraph (#36686)

上级 93c591e2
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "paddle/fluid/platform/xpu/xpu_op_list.h" #include "paddle/fluid/platform/xpu/xpu_op_list.h"
#endif #endif
DECLARE_bool(check_nan_inf); DECLARE_bool(check_nan_inf);
DECLARE_bool(benchmark);
namespace paddle { namespace paddle {
namespace imperative { namespace imperative {
...@@ -208,6 +209,19 @@ static void PreparedOpRunImpl( ...@@ -208,6 +209,19 @@ static void PreparedOpRunImpl(
op.Type(), outs, dev_ctx->GetPlace()); op.Type(), outs, dev_ctx->GetPlace());
} }
/*For profiling/benchmark only*/
if (FLAGS_benchmark) {
dev_ctx->Wait();
#if defined(PADDLE_WITH_CUDA)
PADDLE_ENFORCE_CUDA_SUCCESS(cudaGetLastError());
VLOG(4) << "Operator(" << op.Type() << "): context wait and get last error";
#endif
#if defined(PADDLE_WITH_HIP)
PADDLE_ENFORCE_CUDA_SUCCESS(hipGetLastError());
VLOG(4) << "Operator(" << op.Type() << "): context wait and get last error";
#endif
}
/** /**
* [ Why need handle complex gradient to real gradient? ] * [ Why need handle complex gradient to real gradient? ]
* *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册