Skip to content

Commit

Permalink
Fix direction of the copies from device to host
Browse files Browse the repository at this point in the history
  • Loading branch information
fwyzard authored Oct 28, 2019
1 parent 463b495 commit 49d83d6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions HeterogeneousCore/CUDAUtilities/interface/copyAsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace cudautils {
const cudautils::device::unique_ptr<T>& src,
cudaStream_t stream) {
static_assert(std::is_array<T>::value == false, "For array types, use the other overload with the size parameter");
cudaCheck(cudaMemcpyAsync(dst.get(), src.get(), sizeof(T), cudaMemcpyHostToDevice, stream));
cudaCheck(cudaMemcpyAsync(dst.get(), src.get(), sizeof(T), cudaMemcpyDeviceToHost, stream));
}

// Multiple elements
Expand All @@ -43,7 +43,7 @@ namespace cudautils {
const cudautils::device::unique_ptr<T[]>& src,
size_t nelements,
cudaStream_t stream) {
cudaCheck(cudaMemcpyAsync(dst.get(), src.get(), nelements * sizeof(T), cudaMemcpyHostToDevice, stream));
cudaCheck(cudaMemcpyAsync(dst.get(), src.get(), nelements * sizeof(T), cudaMemcpyDeviceToHost, stream));
}
} // namespace cudautils

Expand Down

0 comments on commit 49d83d6

Please sign in to comment.