From d82a5b222a3ccff8060e172f4ab26093dc70d6a6 Mon Sep 17 00:00:00 2001 From: Bruno Date: Sun, 1 Dec 2024 08:22:16 +0100 Subject: [PATCH] Fixed function to find GPU for matrix (forgot to query avail RAM on device, silly me !!) --- src/lib/geogram/NL/nl_cuda.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/geogram/NL/nl_cuda.c b/src/lib/geogram/NL/nl_cuda.c index 2d1a4a56b63..4cfcdf752c0 100644 --- a/src/lib/geogram/NL/nl_cuda.c +++ b/src/lib/geogram/NL/nl_cuda.c @@ -1701,6 +1701,7 @@ static int nlCUDAFindDeviceForMatrix(NLCRSMatrix* M) { continue; } nlCUDACheck(CUDA()->cudaSetDevice(dev_id)); + nlCUDACheck(CUDA()->cudaMemGetInfo(&free_RAM, &total_RAM)); if(free_RAM >= required_RAM) { nlCUDACheck(CUDA()->cudaSetDevice(CUDA()->main_device->devID)); return dev_id; @@ -1709,6 +1710,7 @@ static int nlCUDAFindDeviceForMatrix(NLCRSMatrix* M) { /** Oohh nooo, our matrix does not fit anywhere ! */ nlCUDACheck(CUDA()->cudaSetDevice(CUDA()->main_device->devID)); + nl_printf("Did not find a device with enough space for matrix"); return -1; }