Commit 96324948 authored by Davis King's avatar Davis King

Changed the cmake scripts to forward CMAKE_PREFIX_PATH to the

try_compile statements rather than a cuDNN specific variable.
parent 45ea1e08
......@@ -455,23 +455,27 @@ if (NOT TARGET dlib)
# linux).
list(APPEND CUDA_NVCC_FLAGS "-arch=sm_30;-std=c++11;-D__STRICT_ANSI__")
set(CUDNN_INCLUDE_DIR "" CACHE PATH "Directory in which to look for cudnn include files")
set(CUDNN_LIBRARY_DIR "" CACHE PATH "Directory in which to look for cudnn library")
include(dnn/test_for_cudnn/find_cudnn.txt)
if (cudnn AND NOT DEFINED cuda_test_compile_worked AND NOT DEFINED cudnn_test_compile_worked)
# make sure cuda is really working by doing a test compile
message(STATUS "Building a CUDA test project to see if your compiler is compatible with CUDA...")
try_compile(cuda_test_compile_worked ${PROJECT_BINARY_DIR}/cuda_test_build
${PROJECT_SOURCE_DIR}/dnn/test_for_cuda cuda_test)
${PROJECT_SOURCE_DIR}/dnn/test_for_cuda cuda_test
CMAKE_FLAGS "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
"-DCMAKE_INCLUDE_PATH=${CMAKE_INCLUDE_PATH}"
"-DCMAKE_LIBRARY_PATH=${CMAKE_LIBRARY_PATH}"
)
if (NOT cuda_test_compile_worked)
message(STATUS "*** CUDA was found but your compiler failed to compile a simple CUDA program so dlib isn't going to use CUDA. ***")
else()
message(STATUS "Checking if you have the right version of cuDNN installed.")
try_compile(cudnn_test_compile_worked ${PROJECT_BINARY_DIR}/cudnn_test_build
${PROJECT_SOURCE_DIR}/dnn/test_for_cudnn cudnn_test
CMAKE_FLAGS -DCUDNN_INCLUDE_DIR=${CUDNN_INCLUDE_DIR} -DCUDNN_LIBRARY_DIR=${CUDNN_LIBRARY_DIR})
CMAKE_FLAGS "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
"-DCMAKE_INCLUDE_PATH=${CMAKE_INCLUDE_PATH}"
"-DCMAKE_LIBRARY_PATH=${CMAKE_LIBRARY_PATH}"
)
if (cudnn_test_compile_worked)
message(STATUS "Found cuDNN: " ${cudnn})
else()
......@@ -501,6 +505,7 @@ if (NOT TARGET dlib)
toggle_preprocessor_switch(DLIB_USE_CUDA)
if (NOT cudnn OR NOT cudnn_include OR NOT cudnn_test_compile_worked)
message(STATUS "*** cuDNN V4.0 OR GREATER NOT FOUND. DLIB WILL NOT USE CUDA. ***")
message(STATUS "*** If you have cuDNN then set CMAKE_PREFIX_PATH to include cuDNN's folder.")
endif()
if (NOT COMPILER_CAN_DO_CPP_11)
message(STATUS "*** Dlib CUDA support requires C++11 but your compiler doesn't support it. ***")
......
......@@ -3,12 +3,12 @@ message(STATUS "Looking for cuDNN install...")
# Look for cudnn, we will look in the same place as other CUDA
# libraries and also a few other places as well.
find_path(cudnn_include cudnn.h
HINTS ${CUDA_INCLUDE_DIRS} ${CUDNN_INCLUDE_DIR} $ENV{CUDNN_INCLUDE_DIR}
HINTS ${CUDA_INCLUDE_DIRS} $ENV{CUDNN_INCLUDE_DIR}
PATHS /usr/local/include
)
get_filename_component(cudnn_hint_path ${CUDA_CUBLAS_LIBRARIES} PATH)
find_library(cudnn cudnn
HINTS ${cudnn_hint_path} ${CUDNN_LIBRARY_DIR} $ENV{CUDNN_LIBRARY_DIR}
HINTS ${cudnn_hint_path} $ENV{CUDNN_LIBRARY_DIR}
PATHS /usr/local/lib64
/usr/local/cuda/lib64
/usr/local/cuda/lib
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment