Skip to content

Commit

Permalink
NLCUDA multi-GPU matrices: Need to keep more RAM on main GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoLevy committed Dec 1, 2024
1 parent 08e1310 commit b34f1c9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/geogram/NL/nl_cuda.c
Original file line number Diff line number Diff line change
Expand Up @@ -1685,8 +1685,12 @@ static int nlCUDAFindDeviceForMatrix(NLCRSMatrix* M) {

/** Try main device first */
nlCUDACheck(CUDA()->cudaMemGetInfo(&free_RAM, &total_RAM));

/** On main device, we need to keep a bit of RAM for the rest */
free_RAM = (size_t)((double)free_RAM * 0.9);
if(CUDA()->nb_devices > 1) {
free_RAM = (size_t)((double)free_RAM * 0.8);
}

if(free_RAM >= required_RAM) {
return dev_id;
}
Expand Down

0 comments on commit b34f1c9

Please sign in to comment.