From af9a521042ffc2823f60e12018db9e0a29120628 Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Mon, 3 Apr 2017 21:46:07 +0200 Subject: Fixes the CUDA wrapper (now actually tested on a system with CUDA) --- test/wrapper_cuda.hpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'test/wrapper_cuda.hpp') diff --git a/test/wrapper_cuda.hpp b/test/wrapper_cuda.hpp index 0f24d0d9..509de9d1 100644 --- a/test/wrapper_cuda.hpp +++ b/test/wrapper_cuda.hpp @@ -22,7 +22,7 @@ #include "utilities/utilities.hpp" #ifdef CLBLAST_REF_CUBLAS - #include + #include #include #endif @@ -32,33 +32,33 @@ namespace clblast { // Copies data from the CUDA device to the host and frees-up the CUDA memory afterwards #ifdef CLBLAST_REF_CUBLAS template - void CUDAToHost(const T* buffer_cuda, const std::vector &buffer_host, const size_t size) { + void CUDAToHost(T* buffer_cuda, std::vector &buffer_host, const size_t size) { cudaMemcpy( - std::reinterpret_cast(buffer_host.data()), - std::reinterpret_cast(buffer_cuda), + reinterpret_cast(buffer_host.data()), + reinterpret_cast(buffer_cuda), size*sizeof(T), cudaMemcpyDeviceToHost ); cudaFree(buffer_cuda); } #else - template void CUDAToHost(const T*, const std::vector&, const size_t) { } + template void CUDAToHost(T*, const std::vector&, const size_t) { } #endif // Allocates space on the CUDA device and copies in data from the host #ifdef CLBLAST_REF_CUBLAS template - void HostToCUDA(const T* buffer_cuda, const std::vector &buffer_host, const size_t size) { - cudaMalloc(std::reinterpret_cast&buffer_cuda, size*sizeof(T)); + void HostToCUDA(T* buffer_cuda, std::vector &buffer_host, const size_t size) { + cudaMalloc(reinterpret_cast(&buffer_cuda), size*sizeof(T)); cudaMemcpy( - std::reinterpret_cast(buffer_cuda), - std::reinterpret_cast(buffer_host.data()), + reinterpret_cast(buffer_cuda), + reinterpret_cast(buffer_host.data()), size*sizeof(T), cudaMemcpyHostToDevice ); } #else - template void HostToCUDA(const T*, const std::vector&, const size_t) { } + template void HostToCUDA(T*, const std::vector&, const size_t) { } #endif // ================================================================================================= -- cgit v1.2.3