Commit 45ea1e08 authored by Davis E. King's avatar Davis E. King

Merge pull request #3 from VisionSystemsInc/find_cudnn_fix

Find cudnn fix
parents d207348a 4fac9804
...@@ -455,6 +455,9 @@ if (NOT TARGET dlib) ...@@ -455,6 +455,9 @@ if (NOT TARGET dlib)
# linux). # linux).
list(APPEND CUDA_NVCC_FLAGS "-arch=sm_30;-std=c++11;-D__STRICT_ANSI__") 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) include(dnn/test_for_cudnn/find_cudnn.txt)
if (cudnn AND NOT DEFINED cuda_test_compile_worked AND NOT DEFINED cudnn_test_compile_worked) if (cudnn AND NOT DEFINED cuda_test_compile_worked AND NOT DEFINED cudnn_test_compile_worked)
...@@ -467,7 +470,8 @@ if (NOT TARGET dlib) ...@@ -467,7 +470,8 @@ if (NOT TARGET dlib)
else() else()
message(STATUS "Checking if you have the right version of cuDNN installed.") message(STATUS "Checking if you have the right version of cuDNN installed.")
try_compile(cudnn_test_compile_worked ${PROJECT_BINARY_DIR}/cudnn_test_build try_compile(cudnn_test_compile_worked ${PROJECT_BINARY_DIR}/cudnn_test_build
${PROJECT_SOURCE_DIR}/dnn/test_for_cudnn cudnn_test) ${PROJECT_SOURCE_DIR}/dnn/test_for_cudnn cudnn_test
CMAKE_FLAGS -DCUDNN_INCLUDE_DIR=${CUDNN_INCLUDE_DIR} -DCUDNN_LIBRARY_DIR=${CUDNN_LIBRARY_DIR})
if (cudnn_test_compile_worked) if (cudnn_test_compile_worked)
message(STATUS "Found cuDNN: " ${cudnn}) message(STATUS "Found cuDNN: " ${cudnn})
else() else()
......
...@@ -3,13 +3,12 @@ cmake_minimum_required(VERSION 2.8.4) ...@@ -3,13 +3,12 @@ cmake_minimum_required(VERSION 2.8.4)
project(cudnn_test) project(cudnn_test)
include(../../use_cpp_11.cmake) include(../../use_cpp_11.cmake)
include_directories(${cudnn_include})
find_package(CUDA 7.0 REQUIRED) find_package(CUDA 7.0 REQUIRED)
set(CUDA_HOST_COMPILATION_CPP ON) set(CUDA_HOST_COMPILATION_CPP ON)
list(APPEND CUDA_NVCC_FLAGS "-arch=sm_30;-std=c++11;-D__STRICT_ANSI__") list(APPEND CUDA_NVCC_FLAGS "-arch=sm_30;-std=c++11;-D__STRICT_ANSI__")
add_definitions(-DDLIB_USE_CUDA) add_definitions(-DDLIB_USE_CUDA)
include(find_cudnn.txt) include(find_cudnn.txt)
include_directories(${cudnn_include})
cuda_add_library(cudnn_test STATIC ../cudnn_dlibapi.cpp ${cudnn} ) cuda_add_library(cudnn_test STATIC ../cudnn_dlibapi.cpp ${cudnn} )
...@@ -3,12 +3,12 @@ message(STATUS "Looking for cuDNN install...") ...@@ -3,12 +3,12 @@ message(STATUS "Looking for cuDNN install...")
# Look for cudnn, we will look in the same place as other CUDA # Look for cudnn, we will look in the same place as other CUDA
# libraries and also a few other places as well. # libraries and also a few other places as well.
find_path(cudnn_include cudnn.h find_path(cudnn_include cudnn.h
HINTS ${CUDA_INCLUDE_DIRS} HINTS ${CUDA_INCLUDE_DIRS} ${CUDNN_INCLUDE_DIR} $ENV{CUDNN_INCLUDE_DIR}
PATHS /usr/local/include PATHS /usr/local/include
) )
get_filename_component(cudnn_hint_path ${CUDA_CUBLAS_LIBRARIES} PATH) get_filename_component(cudnn_hint_path ${CUDA_CUBLAS_LIBRARIES} PATH)
find_library(cudnn cudnn find_library(cudnn cudnn
HINTS ${cudnn_hint_path} HINTS ${cudnn_hint_path} ${CUDNN_LIBRARY_DIR} $ENV{CUDNN_LIBRARY_DIR}
PATHS /usr/local/lib64 PATHS /usr/local/lib64
/usr/local/cuda/lib64 /usr/local/cuda/lib64
/usr/local/cuda/lib /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