@@ -25,6 +25,11 @@ if(PERFORMANCE_MONITORING)
2525 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPERFORMANCE_MONITORING" )
2626endif ()
2727
28+ # ---[ CPU DATA READONLY CO SIM
29+ if (CO_SIM)
30+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCO_SIM" )
31+ endif ()
32+
2833# ---[ Google-glog
2934include ("cmake/External/glog.cmake" )
3035include_directories (SYSTEM ${GLOG_INCLUDE_DIRS} )
@@ -191,8 +196,10 @@ if(NOT APPLE)
191196 set (MKL_INCLUDE_DIR "${MKL_ROOT_DIR} /include/" )
192197 if ( ${MKL_EXTERNAL} EQUAL 1 )
193198 set (MKL_LIBRARIES "${MKL_ROOT_DIR} /lib/lib${MKL_LIBRARIES} .so" )
199+ set (CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} :${MKL_ROOT_DIR} /lib/)
194200 else ()
195201 set (MKL_LIBRARIES "${MKL_ROOT_DIR} /lib/intel64/lib${MKL_LIBRARIES} .so" )
202+ set (CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} :${MKL_ROOT_DIR} /lib/intel64/)
196203 endif ()
197204 message (STATUS "Found MKL: ${MKL_INCLUDE_DIR} " )
198205 message (STATUS "Found MKL (include: ${MKL_INCLUDE_DIR} , lib: ${MKL_LIBRARIES} " )
@@ -237,6 +244,14 @@ endif()
237244
238245# ---[ MKLDNN
239246if (DEFINED ENV{MKLDNNROOT})
247+ if (DISABLE_MKLDNN_DOWNLOAD)
248+ message (STATUS "MKLDNN download is disabled by customized setting!" )
249+ message (STATUS "MKLDNNROOT is already set in the ENV, will use ENV MKLDNNROOT in the following compile steps!" )
250+ add_definitions ("-DDISABLE_MKLDNN_DOWNLOAD=1" )
251+ else ()
252+ message (STATUS "MKLDNN download is enabled by customized setting!" )
253+ add_definitions ("-DDISABLE_MKLDNN_DOWNLOAD=0" )
254+ endif ()
240255 set (MKLDNNROOT_DIR $ENV{MKLDNNROOT} )
241256 if (NOT ${MKLDNNROOT_DIR} STREQUAL "" )
242257 set (MKLDNNROOT_INCLUDE_DIR "${MKLDNNROOT_DIR} /include/" )
@@ -249,6 +264,7 @@ if(DEFINED ENV{MKLDNNROOT})
249264 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_MKLDNN_AS_DEFAULT_ENGINE" )
250265 endif ()
251266 list (APPEND Caffe_LINKER_LIBS "${MKLDNNROOT_DIR} /lib/libmkldnn.so" )
267+ set (CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} :${MKLDNNROOT_DIR} /lib/)
252268 include_directories (SYSTEM ${MKLDNNROOT_INCLUDE_DIR} )
253269 else ()
254270 message (STATUS "MKLDNN not found. MKLDNN_INCLUDE_DIR = ${MKLDNNROOT_INCLUDE_DIR} " )
@@ -259,18 +275,27 @@ if(DEFINED ENV{MKLDNNROOT})
259275 endif ()
260276 endif ()
261277else ()
262- Download_MKLDNN()
278+ if (DISABLE_MKLDNN_DOWNLOAD)
279+ message (STATUS "MKLDNN download is disabled by customized setting!" )
280+ message (STATUS "MKLDNNROOT is not set in the ENV, will cause compile error in the following steps!" )
281+ add_definitions ("-DDISABLE_MKLDNN_DOWNLOAD=1" )
282+ else ()
283+ message (STATUS "MKLDNN download is enabled by customized setting!" )
284+ add_definitions ("-DDISABLE_MKLDNN_DOWNLOAD=0" )
285+ Download_MKLDNN()
263286
264- message (STATUS "MKLDNN will be downloaded from github and installed in ${MKLDNN_INSTALL_DIR} " )
265- message (STATUS "MKLDNN include directory: ${MKLDNN_INCLUDE_DIR} " )
266- set (MKLDNN_SUPPORTED ON )
267- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMKLDNN_SUPPORTED -std=c++11" )
268- if (USE_MKLDNN_AS_DEFAULT_ENGINE)
269- message (STATUS "MKLDNN engine will be used as a default engine" )
270- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_MKLDNN_AS_DEFAULT_ENGINE" )
287+ message (STATUS "MKLDNN will be downloaded from github and installed in ${MKLDNN_INSTALL_DIR} " )
288+ message (STATUS "MKLDNN include directory: ${MKLDNN_INCLUDE_DIR} " )
289+ set (MKLDNN_SUPPORTED ON )
290+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMKLDNN_SUPPORTED -std=c++11" )
291+ if (USE_MKLDNN_AS_DEFAULT_ENGINE)
292+ message (STATUS "MKLDNN engine will be used as a default engine" )
293+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_MKLDNN_AS_DEFAULT_ENGINE" )
294+ endif ()
295+ list (APPEND Caffe_LINKER_LIBS "${MKLDNN_INSTALL_DIR} /lib/libmkldnn.so" )
296+ set (CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} :${MKLDNN_INSTALL_DIR} /lib/)
297+ include_directories (${MKLDNN_INCLUDE_DIR} )
271298 endif ()
272- list (APPEND Caffe_LINKER_LIBS "${MKLDNN_INSTALL_DIR} /lib/libmkldnn.so" )
273- include_directories (${MKLDNN_INCLUDE_DIR} )
274299endif ()
275300
276301# ---[ Python
0 commit comments