File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -21,12 +21,17 @@ limitations under the License. */
21
21
#include < unistd.h>
22
22
#endif
23
23
24
+ #include < algorithm>
24
25
#include " gflags/gflags.h"
25
26
26
27
DEFINE_double (fraction_of_cpu_memory_to_use, 1 ,
27
28
" Default use 100% of CPU memory for PaddlePaddle,"
28
29
" reserve the rest for page tables, etc" );
29
30
31
+ DEFINE_uint64 (
32
+ initial_cpu_memory_in_mb, 500 ,
33
+ " Default initial 500MB of CPU memory for PaddlePaddle, in MD unit." );
34
+
30
35
DEFINE_double (
31
36
fraction_of_cuda_pinned_memory_to_use, 0.5 ,
32
37
" Default use 50% of CPU memory as the pinned_memory for PaddlePaddle,"
@@ -54,7 +59,9 @@ inline size_t CpuTotalPhysicalMemory() {
54
59
size_t CpuMaxAllocSize () {
55
60
// For distributed systems, it requires configuring and limiting
56
61
// the fraction of memory to use.
57
- return FLAGS_fraction_of_cpu_memory_to_use * CpuTotalPhysicalMemory ();
62
+ return std::min (static_cast <size_t >(FLAGS_fraction_of_cpu_memory_to_use *
63
+ CpuTotalPhysicalMemory ()),
64
+ FLAGS_initial_cpu_memory_in_mb * 1 << 20 );
58
65
}
59
66
60
67
size_t CpuMinChunkSize () {
You can’t perform that action at this time.
0 commit comments