forked from intel/caffe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDLCP.cmake
29 lines (25 loc) · 1.09 KB
/
DLCP.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function(Download_DLCP)
find_program(HAS_ICPC NAMES icpc DOC "Intel Compiler")
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
set(DLCP_CXX "${CMAKE_CXX_COMPILER}" PARENT_SCOPE)
elseif(HAS_ICPC)
set(DLCP_CXX "icpc" PARENT_SCOPE)
else()
message(WARNING "weight grad compression is disabled because intel compiler is not found")
return()
endif()
set(EXTERNAL_DIR ${CMAKE_SOURCE_DIR}/external)
set(DLCP_IDEEPDIR ${EXTERNAL_DIR}/ideep)
set(DLCP_ROOTDIR ${DLCP_IDEEPDIR}/ideep/dlcp)
set(DLCP_INCLDIR "${DLCP_ROOTDIR}/include" PARENT_SCOPE)
set(DLCP_LIBDIR ${DLCP_ROOTDIR}/lib PARENT_SCOPE)
# Download dl compression lib source code if it doesn't exist
if (NOT EXISTS ${DLCP_INCLDIR}/dl_compression.h)
execute_process(COMMAND rm -rf ${DLCP_IDEEPDIR})
execute_process(COMMAND git clone https://github.com/intel/ideep.git -b dlcp ${DLCP_IDEEPDIR})
endif()
add_custom_target(DLCP_Build ALL
COMMAND export DLCP_CXX=${DLCP_CXX}
COMMAND make -j
WORKING_DIRECTORY ${DLCP_ROOTDIR})
endfunction(Download_DLCP)