-
Notifications
You must be signed in to change notification settings - Fork 92
/
CMakeLists.txt
37 lines (26 loc) · 1.21 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
cmake_minimum_required (VERSION 2.6)
project (cudnn-training)
find_package(CUDA 6.5 REQUIRED)
# Uncomment the following line to use gflags
#set(USE_GFLAGS 1)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message("Debug mode")
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_50,code=compute_50;-std=c++11;-g;-lineinfo;-Xcompiler;-ggdb)
else()
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_50,code=compute_50;-std=c++11;-O3;-DNDEBUG;-Xcompiler;-DNDEBUG)
endif()
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
# Addresses a bug where code is not compiled as C++11 in non-CUDA code and older g++ versions
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
if(USE_GFLAGS)
add_definitions(-DUSE_GFLAGS)
endif()
include_directories($ENV{CUDNN_PATH} $ENV{CUDNN_PATH}/include)
link_directories($ENV{CUDNN_PATH} $ENV{CUDNN_PATH}/lib $ENV{CUDNN_PATH}/lib64)
cuda_add_executable(trainlenet lenet.cu readubyte.cpp)
cuda_add_cublas_to_target(trainlenet)
if(USE_GFLAGS)
target_link_libraries(trainlenet gflags cudnn)
else()
target_link_libraries(trainlenet cudnn)
endif()