@@ -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
@@ -164,8 +172,12 @@ if(WITH_GPU)
164172 endif (NOT WITH_DSO)
165173endif (WITH_GPU)
166174
175+ if (WITH_MKLML)
176+ list (APPEND EXTERNAL_LIBS ${MKLML_IOMP_LIB} )
177+ endif ()
178+
167179if (WITH_MKLDNN)
168- list (APPEND EXTERNAL_LIBS ${MKLDNN_LIB} ${MKLDNN_IOMP_LIB} )
180+ list (APPEND EXTERNAL_LIBS ${MKLDNN_LIB} )
169181endif ()
170182
171183if (USE_NNPACK)
0 commit comments