Skip to content

Commit ee88855

Browse files
author
Yibing Liu
committed
Fix the profiler's bug in multi-gpu mode
1 parent 0dbaad5 commit ee88855

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

paddle/fluid/framework/executor.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ limitations under the License. */
2525
#include "paddle/fluid/framework/op_registry.h"
2626
#include "paddle/fluid/framework/reader.h"
2727
#include "paddle/fluid/platform/place.h"
28-
#include "paddle/fluid/platform/profiler.h"
2928

3029
DECLARE_bool(benchmark);
3130
DEFINE_bool(check_nan_inf, false,
@@ -126,9 +125,6 @@ void Executor::Run(const ProgramDesc& pdesc, Scope* scope, int block_id,
126125
for (auto& op_desc : block.AllOps()) {
127126
auto op = paddle::framework::OpRegistry::CreateOp(*op_desc);
128127

129-
platform::DeviceContextPool& pool = platform::DeviceContextPool::Instance();
130-
platform::RecordEvent record_event(op->Type(), pool.Get(place_));
131-
132128
VLOG(3) << place_ << " " << op->DebugStringEx(local_scope);
133129
op->Run(*local_scope, place_);
134130

paddle/fluid/framework/operator.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ limitations under the License. */
2121
#include "paddle/fluid/framework/operator.h"
2222
#include "paddle/fluid/framework/shape_inference.h"
2323
#include "paddle/fluid/framework/var_type.h"
24+
#include "paddle/fluid/platform/profiler.h"
2425

2526
DECLARE_bool(benchmark);
2627

@@ -497,7 +498,8 @@ void OperatorWithKernel::RunImpl(const Scope& scope,
497498
this->InferShape(&infer_shape_ctx);
498499
platform::DeviceContextPool& pool = platform::DeviceContextPool::Instance();
499500
auto dev_ctx = pool.Get(place);
500-
501+
// profile
502+
platform::RecordEvent record_event(Type(), dev_ctx);
501503
// check if op[type] has kernel registered.
502504
auto& all_op_kernels = AllOpKernels();
503505
auto kernels_iter = all_op_kernels.find(type_);

0 commit comments

Comments
 (0)