|
|
|
@ -215,7 +215,7 @@ class Vector {
|
|
|
|
auto stream = dev_ctx->stream();
|
|
|
|
auto stream = dev_ctx->stream();
|
|
|
|
void *src = gpu_->ptr();
|
|
|
|
void *src = gpu_->ptr();
|
|
|
|
void *dst = cpu_.data();
|
|
|
|
void *dst = cpu_.data();
|
|
|
|
memory::Copy(platform::CPUPlace(), dst, CUDAPlace().get(), src,
|
|
|
|
paddle::memory::Copy(platform::CPUPlace(), dst, CUDAPlace().get(), src,
|
|
|
|
gpu_->size(), stream);
|
|
|
|
gpu_->size(), stream);
|
|
|
|
dev_ctx->Wait();
|
|
|
|
dev_ctx->Wait();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -261,7 +261,7 @@ class Vector {
|
|
|
|
auto *dev_ctx = static_cast<platform::CUDADeviceContext *>(
|
|
|
|
auto *dev_ctx = static_cast<platform::CUDADeviceContext *>(
|
|
|
|
platform::DeviceContextPool::Instance().Get(place));
|
|
|
|
platform::DeviceContextPool::Instance().Get(place));
|
|
|
|
auto stream = dev_ctx->stream();
|
|
|
|
auto stream = dev_ctx->stream();
|
|
|
|
memory::Copy(CUDAPlace().get(), dst, platform::CPUPlace(), src,
|
|
|
|
paddle::memory::Copy(CUDAPlace().get(), dst, platform::CPUPlace(), src,
|
|
|
|
gpu_->size(), stream);
|
|
|
|
gpu_->size(), stream);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -284,7 +284,7 @@ class Vector {
|
|
|
|
bool IsInCPU() const { return flag_ & kDataInCPU; }
|
|
|
|
bool IsInCPU() const { return flag_ & kDataInCPU; }
|
|
|
|
|
|
|
|
|
|
|
|
mutable std::vector<T> cpu_;
|
|
|
|
mutable std::vector<T> cpu_;
|
|
|
|
mutable memory::AllocationPtr gpu_;
|
|
|
|
mutable paddle::memory::AllocationPtr gpu_;
|
|
|
|
mutable int flag_;
|
|
|
|
mutable int flag_;
|
|
|
|
|
|
|
|
|
|
|
|
mutable std::mutex mtx_;
|
|
|
|
mutable std::mutex mtx_;
|
|
|
|
|