mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
merged
This commit is contained in:
commit
92ca28e955
@ -462,13 +462,21 @@ if (NOT TARGET dlib)
|
||||
# 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)
|
||||
${PROJECT_SOURCE_DIR}/dnn/test_for_cudnn cudnn_test
|
||||
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()
|
||||
@ -498,6 +506,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,8 +3,6 @@ cmake_minimum_required(VERSION 2.8.4)
|
||||
project(cudnn_test)
|
||||
include(../../use_cpp_11.cmake)
|
||||
|
||||
include_directories(${cudnn_include})
|
||||
|
||||
find_package(CUDA 7.0 REQUIRED)
|
||||
set(CUDA_HOST_COMPILATION_CPP ON)
|
||||
list(APPEND CUDA_NVCC_FLAGS "-arch=sm_30;-std=c++11;-D__STRICT_ANSI__")
|
||||
@ -12,4 +10,6 @@ add_definitions(-DDLIB_USE_CUDA)
|
||||
|
||||
include(find_cudnn.txt)
|
||||
|
||||
include_directories(${cudnn_include})
|
||||
|
||||
cuda_add_library(cudnn_test STATIC ../cudnn_dlibapi.cpp ${cudnn} )
|
||||
|
@ -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}
|
||||
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}
|
||||
HINTS ${cudnn_hint_path} $ENV{CUDNN_LIBRARY_DIR}
|
||||
PATHS /usr/local/lib64
|
||||
/usr/local/cuda/lib64
|
||||
/usr/local/cuda/lib
|
||||
|
Loading…
Reference in New Issue
Block a user