Skip to content

Commit

Permalink
Fixed function to find GPU for matrix
Browse files Browse the repository at this point in the history
(forgot to query avail RAM on device, silly me !!)
  • Loading branch information
BrunoLevy committed Dec 1, 2024
1 parent 4d7591e commit d82a5b2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/geogram/NL/nl_cuda.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down

0 comments on commit d82a5b2

Please sign in to comment.