|
@@ -59,6 +59,9 @@
|
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
+/* Consider a rough 10% overhead cost */
|
|
|
+#define FREE_MARGIN 0.9
|
|
|
+
|
|
|
/* the number of CUDA devices */
|
|
|
static int ncudagpus = -1;
|
|
|
|
|
@@ -174,8 +177,7 @@ static void _starpu_cuda_limit_gpu_mem_if_needed(unsigned devid)
|
|
|
#if defined(STARPU_USE_CUDA) || defined(STARPU_SIMGRID)
|
|
|
if (limit == -1)
|
|
|
{
|
|
|
- /* Use 90% of the available memory by default. */
|
|
|
- limit = totalGlobalMem / (1024*1024) * 0.9;
|
|
|
+ limit = totalGlobalMem / (1024*1024) * FREE_MARGIN;
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -1749,7 +1751,7 @@ uintptr_t _starpu_cuda_malloc_on_node(unsigned dst_node, size_t size, int flags)
|
|
|
size_t cuda_mem_free, cuda_mem_total;
|
|
|
cudaError_t status;
|
|
|
status = cudaMemGetInfo(&cuda_mem_free, &cuda_mem_total);
|
|
|
- if (status == cudaSuccess && cuda_mem_free < (size*2))
|
|
|
+ if (status == cudaSuccess && cuda_mem_free * FREE_MARGIN < size)
|
|
|
{
|
|
|
addr = 0;
|
|
|
}
|