@@ -36,8 +36,7 @@ include(simd)
3636################################ Configurations #######################################
3737option (WITH_GPU "Compile PaddlePaddle with NVIDIA GPU" ${CUDA_FOUND} )
3838option (WITH_AVX "Compile PaddlePaddle with AVX intrinsics" ${AVX_FOUND} )
39- option (WITH_MKLDNN "Compile PaddlePaddle with mkl-dnn support." ${AVX_FOUND} )
40- option (WITH_MKLML "Compile PaddlePaddle with mklml package." ${AVX_FOUND} )
39+ option (WITH_MKL "Compile PaddlePaddle with MKL support." ${AVX_FOUND} )
4140option (WITH_DSO "Compile PaddlePaddle with dynamic linked CUDA" ON )
4241option (WITH_TESTING "Compile PaddlePaddle with unit testing" ON )
4342option (WITH_SWIG_PY "Compile PaddlePaddle with inference api" ON )
@@ -82,10 +81,8 @@ if(ANDROID OR IOS)
8281 "Disable PYTHON when cross-compiling for Android and iOS" FORCE)
8382 set (WITH_RDMA OFF CACHE STRING
8483 "Disable RDMA when cross-compiling for Android and iOS" FORCE)
85- set (WITH_MKLDNN OFF CACHE STRING
86- "Disable MKLDNN when cross-compiling for Android and iOS" FORCE)
87- set (WITH_MKLML OFF CACHE STRING
88- "Disable MKLML package when cross-compiling for Android and iOS" FORCE)
84+ set (WITH_MKL OFF CACHE STRING
85+ "Disable MKL when cross-compiling for Android and iOS" FORCE)
8986
9087 # Compile PaddlePaddle mobile inference library
9188 if (NOT WITH_C_API)
@@ -111,6 +108,17 @@ else()
111108 set (THIRD_PARTY_BUILD_TYPE Release)
112109endif ()
113110
111+ if (WITH_MKL)
112+ set (WITH_MKLML ON )
113+ set (WITH_MKLDNN ${AVX2_FOUND} )
114+ if (NOT WITH_MKLDNN)
115+ message (WARNING "Do not have AVX2 intrinsics and disabled MKL-DNN" )
116+ endif ()
117+ else ()
118+ set (WITH_MKLML OFF )
119+ set (WITH_MKLDNN OFF )
120+ endif ()
121+
114122########################################################################################
115123
116124include (external/mklml) # download mklml package
@@ -161,8 +169,12 @@ if(WITH_GPU)
161169 include (cuda)
162170endif (WITH_GPU)
163171
172+ if (WITH_MKLML)
173+ list (APPEND EXTERNAL_LIBS ${MKLML_IOMP_LIB} )
174+ endif ()
175+
164176if (WITH_MKLDNN)
165- list (APPEND EXTERNAL_LIBS ${MKLDNN_LIB} ${MKLDNN_IOMP_LIB} )
177+ list (APPEND EXTERNAL_LIBS ${MKLDNN_LIB} )
166178endif ()
167179
168180if (USE_NNPACK)
0 commit comments