@@ -28,9 +28,15 @@ DEFINE_double(fraction_of_cpu_memory_to_use, 1,
28
28
" Default use 100% of CPU memory for PaddlePaddle,"
29
29
" reserve the rest for page tables, etc" );
30
30
31
- DEFINE_uint64 (
32
- initial_cpu_memory_in_mb, 500 ,
33
- " Default initial 500MB of CPU memory for PaddlePaddle, in MD unit." );
31
+ DEFINE_uint64 (initial_cpu_memory_in_mb,
32
+ #ifdef PADDLE_WITH_MKLDNN
33
+ /* Aligned with mozga-intel, MKLDNN need at least 5000 MB
34
+ * to obtain the best performance*/
35
+ 5000 ,
36
+ #else
37
+ 500 ,
38
+ #endif
39
+ " Initial CPU memory for PaddlePaddle, in MD unit." );
34
40
35
41
DEFINE_double (
36
42
fraction_of_cuda_pinned_memory_to_use, 0.5 ,
@@ -59,10 +65,7 @@ inline size_t CpuTotalPhysicalMemory() {
59
65
size_t CpuMaxAllocSize () {
60
66
// For distributed systems, it requires configuring and limiting
61
67
// the fraction of memory to use.
62
- return std::min (
63
- static_cast <size_t >(FLAGS_fraction_of_cpu_memory_to_use *
64
- CpuTotalPhysicalMemory ()),
65
- static_cast <size_t >(FLAGS_initial_cpu_memory_in_mb * 1 << 20 ));
68
+ return FLAGS_fraction_of_cpu_memory_to_use * CpuTotalPhysicalMemory ();
66
69
}
67
70
68
71
size_t CpuMinChunkSize () {
@@ -71,8 +74,11 @@ size_t CpuMinChunkSize() {
71
74
}
72
75
73
76
size_t CpuMaxChunkSize () {
74
- // Allow to allocate the maximum chunk size is roughly 3% of CPU memory.
75
- return CpuMaxAllocSize () / 32 ;
77
+ // Allow to allocate the maximum chunk size is roughly 3% of CPU memory,
78
+ // or the initial_cpu_memory_in_mb.
79
+ return std::min (
80
+ static_cast <size_t >(CpuMaxAllocSize () / 32 ),
81
+ static_cast <size_t >(FLAGS_initial_cpu_memory_in_mb * 1 << 20 ));
76
82
}
77
83
78
84
size_t CUDAPinnedMaxAllocSize () {
0 commit comments