From ac0d90204eedf97a3b2254a522e02f161dd1ffc1 Mon Sep 17 00:00:00 2001 From: "k.koide" Date: Thu, 18 Jul 2024 19:55:50 +0900 Subject: [PATCH] cuda_mem_get_info --- include/gtsam_points/cuda/cuda_memory.hpp | 2 ++ src/gtsam_points/cuda/cuda_memory.cu | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/gtsam_points/cuda/cuda_memory.hpp b/include/gtsam_points/cuda/cuda_memory.hpp index 867969a4..cda92d0d 100644 --- a/include/gtsam_points/cuda/cuda_memory.hpp +++ b/include/gtsam_points/cuda/cuda_memory.hpp @@ -21,6 +21,8 @@ void cuda_host_to_device(void* dst, const void* src, size_t size, CUstream_st* s void cuda_device_to_host(void* dst, const void* src, size_t size, CUstream_st* stream = nullptr); +void cuda_mem_get_info(size_t* free, size_t* total); + template T* cuda_new(CUstream_st* stream = nullptr) { return cuda_malloc(sizeof(T), stream); diff --git a/src/gtsam_points/cuda/cuda_memory.cu b/src/gtsam_points/cuda/cuda_memory.cu index 9339e065..b726f7e2 100644 --- a/src/gtsam_points/cuda/cuda_memory.cu +++ b/src/gtsam_points/cuda/cuda_memory.cu @@ -32,4 +32,8 @@ void cuda_device_to_host(void* dst, const void* src, size_t size, CUstream_st* s check_error << cudaMemcpyAsync(dst, src, size, cudaMemcpyDeviceToHost, stream); } +void cuda_mem_get_info(size_t* free, size_t* total) { + check_error << cudaMemGetInfo(free, total); +} + } // namespace gtsam_points