Skip to content

Commit 84f3291

Browse files
committed
Reorder the cmake import and add CUDNN_INCLUDE_DIR into anakin cmake module
1 parent 64d48f4 commit 84f3291

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ include(external/snappy) # download snappy
204204
include(external/snappystream)
205205
include(external/threadpool)
206206

207+
include(cudnn) # set cudnn libraries, must before configure
208+
include(cupti)
209+
include(configure) # add paddle env configuration
210+
207211
if(WITH_GPU)
208212
include(cuda)
209213
include(tensorrt)
@@ -212,9 +216,6 @@ elseif()
212216
set(WITH_ANAKIN OFF CACHE STRING "Anakin is used in GPU only now." FORCE)
213217
endif()
214218

215-
include(cudnn) # set cudnn libraries, must before configure
216-
include(cupti)
217-
include(configure) # add paddle env configuration
218219
include(generic) # simplify cmake module
219220
include(package) # set paddle packages
220221
include(ccache) # set ccache for compilation

cmake/configure.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,11 @@ if(WITH_GPU)
108108
if(${CUDNN_MAJOR_VERSION} VERSION_LESS 7)
109109
message(FATAL_ERROR "Anakin needs CUDNN >= 7.0 to compile")
110110
endif()
111-
set(ENV{CUDNN_INCLUDE_DIR} ${CUDNN_INCLUDE_DIR})
112-
set(ENV{CUDNN_LIBRARY} ${CUDNN_LIBRARY})
111+
set(ENV{CUDNN_INCLUDE_DIR} "${CUDNN_INCLUDE_DIR}/")
112+
get_filename_component(CUDNN_LIBRARY_DIR ${CUDNN_LIBRARY} DIRECTORY)
113+
set(ENV{CUDNN_LIBRARY} ${CUDNN_LIBRARY_DIR})
113114
message(STATUS "cudnn include header is ${CUDNN_INCLUDE_DIR}/cudnn.h")
114-
message(STATUS "cudnn library is ${CUDNN_LIBRARY}")
115+
message(STATUS "cudnn library is ${CUDNN_LIBRARY_DIR}")
115116
endif()
116117
elseif(WITH_AMD_GPU)
117118
add_definitions(-DPADDLE_WITH_HIP)

cmake/external/anakin.cmake

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ execute_process(COMMAND bash -c "cd ${ANAKIN_SOURCE_DIR}; wget -q --no-check-cer
1919
include_directories(${ANAKIN_INCLUDE})
2020
include_directories(${ANAKIN_INCLUDE}/saber/)
2121

22-
set(ANAKIN_COMPILE_EXTRA_FLAGS
22+
set(ANAKIN_COMPILE_EXTRA_FLAGS
2323
-Wno-error=unused-but-set-variable -Wno-unused-but-set-variable
24-
-Wno-error=unused-variable -Wno-unused-variable
24+
-Wno-error=unused-variable -Wno-unused-variable
2525
-Wno-error=format-extra-args -Wno-format-extra-args
26-
-Wno-error=comment -Wno-comment
27-
-Wno-error=format -Wno-format
26+
-Wno-error=comment -Wno-comment
27+
-Wno-error=format -Wno-format
2828
-Wno-error=switch -Wno-switch
29-
-Wno-error=return-type -Wno-return-type
29+
-Wno-error=return-type -Wno-return-type
3030
-Wno-error=non-virtual-dtor -Wno-non-virtual-dtor
3131
-Wno-sign-compare
32-
-Wno-reorder
32+
-Wno-reorder
3333
-Wno-error=cpp)
3434

3535
ExternalProject_Add(
@@ -47,6 +47,7 @@ ExternalProject_Add(
4747
-DPROTOBUF_ROOT=${THIRD_PARTY_PATH}/install/protobuf
4848
-DMKLML_ROOT=${THIRD_PARTY_PATH}/install/mklml
4949
-DCUDNN_ROOT=${CUDNN_ROOT}
50+
-DCUDNN_INCLUDE_DIR=${CUDNN_INCLUDE_DIR}
5051
${EXTERNAL_OPTIONAL_ARGS}
5152
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${ANAKIN_INSTALL_DIR}
5253
)

0 commit comments

Comments
 (0)