diff --git a/cpp/include/raft/core/cudart_utils.hpp b/cpp/include/raft/core/cudart_utils.hpp index a1e7e6bc32..ce0d2a7025 100644 --- a/cpp/include/raft/core/cudart_utils.hpp +++ b/cpp/include/raft/core/cudart_utils.hpp @@ -36,7 +36,6 @@ #include #include #include -#include ///@todo: enable once logging has been enabled in raft //#include "logger.hpp" @@ -303,10 +302,10 @@ void print_device_vector(const char* variable_name, size_t componentsCount, OutStream& out) { - std::vector host_mem(componentsCount); - CUDA_CHECK( - cudaMemcpy(host_mem.data(), devMem, componentsCount * sizeof(T), cudaMemcpyDeviceToHost)); - print_host_vector(variable_name, host_mem.data(), componentsCount, out); + T* host_mem = new T[componentsCount]; + CUDA_CHECK(cudaMemcpy(host_mem, devMem, componentsCount * sizeof(T), cudaMemcpyDeviceToHost)); + print_host_vector(variable_name, host_mem, componentsCount, out); + delete[] host_mem; } /**