File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -75,15 +75,19 @@ size_t GpuMaxChunkSize() {
75
75
GpuMemoryUsage (available, total);
76
76
77
77
// Reserving the rest memory for page tables, etc.
78
- size_t reserving = ( 1 - FLAGS_fraction_of_gpu_memory_to_use) * total;
78
+ size_t reserving = 0.05 * total;
79
79
80
80
// If available less than minimum chunk size, no usable memory exists.
81
- available = std::max (available, GpuMinChunkSize ()) - GpuMinChunkSize ();
81
+ available =
82
+ std::max (std::max (available, GpuMinChunkSize ()) - GpuMinChunkSize (),
83
+ reserving) -
84
+ reserving;
82
85
83
- // If available less than reserving, no usable memory exists.
84
- size_t usable = std::max (available, reserving) - reserving;
86
+ size_t allocating = FLAGS_fraction_of_gpu_memory_to_use * total;
85
87
86
- return usable;
88
+ PADDLE_ENFORCE_LT (allocating, available);
89
+
90
+ return allocating;
87
91
}
88
92
89
93
void GpuMemcpyAsync (void *dst, const void *src, size_t count,
You can’t perform that action at this time.
0 commit comments