@@ -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,14 @@ else()
111108 set (THIRD_PARTY_BUILD_TYPE Release)
112109endif ()
113110
111+ set (WITH_MKLML ${WITH_MKL} )
112+ if (WITH_MKL AND AVX2_FOUND)
113+ set (WITH_MKLDNN ON )
114+ else ()
115+ message (STATUS "Do not have AVX2 intrinsics and disabled MKL-DNN" )
116+ set (WITH_MKLDNN OFF )
117+ endif ()
118+
114119########################################################################################
115120
116121include (external/mklml) # download mklml package
@@ -158,14 +163,15 @@ set(EXTERNAL_LIBS
158163)
159164
160165if (WITH_GPU)
161- list (APPEND EXTERNAL_LIBS ${CUDA_LIBRARIES} ${CUDA_rt_LIBRARY} )
162- if (NOT WITH_DSO)
163- list (APPEND EXTERNAL_LIBS ${CUDNN_LIBRARY} ${CUDA_CUBLAS_LIBRARIES} ${CUDA_curand_LIBRARY} ${NCCL_LIBRARY} )
164- endif (NOT WITH_DSO)
166+ include (cuda)
165167endif (WITH_GPU)
166168
169+ if (WITH_MKLML)
170+ list (APPEND EXTERNAL_LIBS ${MKLML_IOMP_LIB} )
171+ endif ()
172+
167173if (WITH_MKLDNN)
168- list (APPEND EXTERNAL_LIBS ${MKLDNN_LIB} ${MKLDNN_IOMP_LIB} )
174+ list (APPEND EXTERNAL_LIBS ${MKLDNN_LIB} )
169175endif ()
170176
171177if (USE_NNPACK)
0 commit comments