Skip to content

Commit 922dee3

Browse files
committed
Wait input when data transform
1 parent 3fbfcd9 commit 922dee3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

paddle/fluid/framework/data_device_transform.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ void TransDataDevice(const Tensor &in, const platform::Place &dst_place,
2525
in.place().which(), dst_place.which(),
2626
"Currently, model parallelism is only supported between CPU and CUDA");
2727

28+
// NOTE(yy): TransDataDevice should wait for computation of input.
29+
platform::DeviceContextPool::Instance().Get(in.place())->Wait();
30+
platform::DeviceContextPool::Instance().Get(dst_place)->Wait();
31+
2832
// FIXME(zcd): TransDataDevice is used to transform data from GPU to CPU and
2933
// the enforced checkings have been done in GetDeviceContext, so the
3034
// `dev_ctx->Wait()` is necessary. But `dev_ctx->Wait()` will make the program

0 commit comments

Comments
 (0)