提交 f18f3826 编写于 作者: D dzhwinter

"parallel op set lod after copy "

上级 239fafb0
...@@ -54,7 +54,7 @@ class Vector : public std::vector<T> { ...@@ -54,7 +54,7 @@ class Vector : public std::vector<T> {
CopyToCUDA(); CopyToCUDA();
PADDLE_ENFORCE_NOT_NULL( PADDLE_ENFORCE_NOT_NULL(
cuda_ptr_, "No data or Insufficient CUDA memory to allocation"); cuda_ptr_, "No data or Insufficient CUDA memory to allocation");
return static_cast<T *>(cuda_ptr_); return static_cast<T *>(cuda_ptr_.get());
} }
/* Get host vector */ /* Get host vector */
...@@ -127,7 +127,7 @@ void Vector<T>::CopyToCUDA() { ...@@ -127,7 +127,7 @@ void Vector<T>::CopyToCUDA() {
#ifdef PADDLE_WITH_CUDA #ifdef PADDLE_WITH_CUDA
if (cuda_size_ < this->size() || cuda_ptr_ == nullptr) { if (cuda_size_ < this->size() || cuda_ptr_ == nullptr) {
cuda_ptr_.reset( cuda_ptr_.reset(
memory::Alloc<platform::CUDAPlace>(this->size() * sizeof(T)), memory::Alloc<platform::CUDAPlace>(place_, this->size() * sizeof(T)),
memory::PlainDeleter<void, platform::CUDAPlace>(place_)); memory::PlainDeleter<void, platform::CUDAPlace>(place_));
} }
cuda_size_ = this->size(); cuda_size_ = this->size();
......
...@@ -79,7 +79,7 @@ inline void CopyOrShare(const framework::Variable &src, ...@@ -79,7 +79,7 @@ inline void CopyOrShare(const framework::Variable &src,
} else { } else {
Copy(src.Get<LoDTensor>(), dst_place, dst->GetMutable<LoDTensor>()); Copy(src.Get<LoDTensor>(), dst_place, dst->GetMutable<LoDTensor>());
} }
dst->set_lod(src.lod()); dst->GetMutable<LoDTensor>()->set_lod(src.Get<LoDTensor>().lod());
} else if (src.IsType<SelectedRows>()) { } else if (src.IsType<SelectedRows>()) {
auto &src_sr = src.Get<SelectedRows>(); auto &src_sr = src.Get<SelectedRows>();
auto *dst_sr = dst->GetMutable<SelectedRows>(); auto *dst_sr = dst->GetMutable<SelectedRows>();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册