From ce1cbb42bf3e5f8f4952f44ea17d0c76392478e9 Mon Sep 17 00:00:00 2001 From: Olivier BICHLER <olivier.bichler@cea.fr> Date: Tue, 5 Dec 2023 16:54:55 +0100 Subject: [PATCH] Updated --- include/aidge/backend/cuda/data/TensorImpl.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/aidge/backend/cuda/data/TensorImpl.hpp b/include/aidge/backend/cuda/data/TensorImpl.hpp index 7f2ee40..80fc8d6 100644 --- a/include/aidge/backend/cuda/data/TensorImpl.hpp +++ b/include/aidge/backend/cuda/data/TensorImpl.hpp @@ -128,7 +128,7 @@ class TensorImpl_cuda : public TensorImpl, public TensorImpl_cuda_ { CHECK_CUDA_STATUS(cudaMemcpy(rawPtr(), src, length * sizeof(T), cudaMemcpyHostToDevice)); } - void copyToHost(void *dst, NbElts_t length) override { + void copyToHost(void *dst, NbElts_t length) const override { CHECK_CUDA_STATUS(cudaMemcpy(dst, rawPtr(), length * sizeof(T), cudaMemcpyDeviceToHost)); } @@ -137,8 +137,9 @@ class TensorImpl_cuda : public TensorImpl, public TensorImpl_cuda_ { return mData; }; - void *hostPtr() override { - return nullptr; + const void *rawPtr() const override { + AIDGE_ASSERT(mData != nullptr, "accessing uninitialized const rawPtr"); + return mData; }; void* getRaw(std::size_t idx) { -- GitLab