From 49d83d653727c19433d45a732ce4ca7d958d06f4 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Mon, 28 Oct 2019 18:26:42 +0100 Subject: [PATCH] Fix direction of the copies from device to host --- HeterogeneousCore/CUDAUtilities/interface/copyAsync.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HeterogeneousCore/CUDAUtilities/interface/copyAsync.h b/HeterogeneousCore/CUDAUtilities/interface/copyAsync.h index 5726736166fdc..bfa1bdee9a03d 100644 --- a/HeterogeneousCore/CUDAUtilities/interface/copyAsync.h +++ b/HeterogeneousCore/CUDAUtilities/interface/copyAsync.h @@ -26,7 +26,7 @@ namespace cudautils { const cudautils::device::unique_ptr& src, cudaStream_t stream) { static_assert(std::is_array::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 @@ -43,7 +43,7 @@ namespace cudautils { const cudautils::device::unique_ptr& 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