Skip to content

Commit 90fbc19

Browse files
authored
Merge pull request #12830 from velconia/015_for_dqn_local
Reorder the cmake import and add CUDNN_INCLUDE_DIR into anakin cmake
2 parents 12ac073 + 216c621 commit 90fbc19

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,11 @@ if(WITH_GPU)
110110
message(WARNING "Anakin needs CUDNN >= 7.0 to compile. Force WITH_ANAKIN=OFF")
111111
set(WITH_ANAKIN OFF CACHE STRING "Anakin is valid only when CUDNN >= 7.0." FORCE)
112112
endif()
113-
endif()
114-
if(WITH_ANAKIN)
115-
set(ENV{CUDNN_INCLUDE_DIR} ${CUDNN_INCLUDE_DIR})
116-
set(ENV{CUDNN_LIBRARY} ${CUDNN_LIBRARY})
113+
set(ENV{CUDNN_INCLUDE_DIR} "${CUDNN_INCLUDE_DIR}/")
114+
get_filename_component(CUDNN_LIBRARY_DIR ${CUDNN_LIBRARY} DIRECTORY)
115+
set(ENV{CUDNN_LIBRARY} ${CUDNN_LIBRARY_DIR})
116+
message(STATUS "cudnn include header is ${CUDNN_INCLUDE_DIR}/cudnn.h")
117+
message(STATUS "cudnn library is ${CUDNN_LIBRARY_DIR}")
117118
endif()
118119
elseif(WITH_AMD_GPU)
119120
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)