Skip to content

Conversation

@QiJune
Copy link
Member

@QiJune QiJune commented Oct 11, 2017

Fix #3796
Unify CUDA stream in Tensor CopyFrom interface.

@QiJune QiJune changed the title Unify copy interface Unify CUDA stream in Tensor CopyFrom interface Oct 11, 2017
@QiJune QiJune force-pushed the unify_copy_interface branch from dd1023c to e162c74 Compare October 11, 2017 02:23
wangkuiyi
wangkuiyi previously approved these changes Oct 11, 2017
* @param[in] src The external vector.
* @param[in] ctx The device context contains place where to store.
* @param[in] src The external tensor.
* @param[in] ctx The device context contains CUDA stream.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suppose that we need to copy from GPU to CPU, what kind of DeviceContext here do we need -- CPUContext or CUDAContext? What if the reverse order -- from GPU to CPU? What if between CPU and FPGA?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we make Copy between devices, we have to pass a DeviceContext which contains device resources. In GPU, the device resource is CUDA stream. Copying from GPU to CPU, CPU to GPU and GPU to GPU all need a CUDA stream.

wangkuiyi
wangkuiyi previously approved these changes Oct 11, 2017
@wangkuiyi wangkuiyi merged commit 2603cb7 into PaddlePaddle:develop Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants