-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
85 lines (74 loc) · 3.14 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(Cavs)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
INCLUDE_DIRECTORIES(BEFORE ${PROJECT_BINARY_DIR})
LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/module)
FIND_PACKAGE(MPI REQUIRED)
IF(MPI_CXX_FOUND)
MESSAGE(STATUS "MPI compiler found:" ${MPI_CXX_COMPILER})
MESSAGE(STATUS "MPI compile flags: " ${MPI_CXX_COMPILE_FLAGS})
MESSAGE(STATUS "MPI include path: " ${MPI_CXX_INCLUDE_PATH})
MESSAGE(STATUS "MPI LINK flags: " ${MPI_CXX_LINK_FLAGS})
MESSAGE(STATUS "MPI libraries: " ${MPI_CXX_LIBRARIES})
INCLUDE_DIRECTORIES(SYSTEM ${MPI_CXX_INCLUDE_PATH})
LIST(APPEND EXTERNAL_LIBS ${MPI_CXX_LIBRARIES})
ENDIF()
FIND_PACKAGE(CUDA 8.0 REQUIRED)
IF(CUDA_FOUND)
MESSAGE(STATUS "CUDA version:" ${CUDA_VERSION})
MESSAGE(STATUS "CUDA toolkit root dir:" ${CUDA_TOOLKIT_ROOT_DIR})
MESSAGE(STATUS "CUDA include dir:" ${CUDA_INCLUDE_DIRS})
MESSAGE(STATUS "CUDA librares:" ${CUDA_LIBRARIES})
MESSAGE(STATUS "CUDA cublas librares:" ${CUDA_CUBLAS_LIBRARIES})
INCLUDE_DIRECTORIES(SYSTEM ${CUDA_INCLUDE_DIRS})
SET(CUDA_PROPAGATE_HOST_FLAGS OFF)
#hard-code the gpu arch spec
LIST(APPEND CUDA_NVCC_FLAGS "-gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52")
LIST(APPEND CUDA_NVCC_FLAGS "-std=c++11")
LIST(APPEND EXTERNAL_LIBS ${CUDA_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES})
FIND_LIBRARY(CUDA_NVRTC_LIB nvrtc PATHS ${CUDA_TOOLKIT_ROOT_DIR} PATH_SUFFIXES lib64)
IF(CUDA_NVRTC_LIB)
MESSAGE(STATUS "NVRTC libraries:" ${CUDA_NVRTC_LIB})
LIST(APPEND EXTERNAL_LIBS ${CUDA_NVRTC_LIB})
ELSE()
MESSAGE(FATAL_ERROR "Cannot find libnvrtc.so")
ENDIF()
FIND_LIBRARY(CUDA_DRIVER_LIB cuda PATHS ${CUDA_TOOLKIT_ROOT_DIR} PATH_SUFFIXES lib64 lib64/stubs)
IF(CUDA_DRIVER_LIB)
MESSAGE(STATUS "cuda driver libraries:" ${CUDA_DRIVER_LIB})
LIST(APPEND EXTERNAL_LIBS ${CUDA_DRIVER_LIB})
ELSE()
MESSAGE(FATAL_ERROR "Cannot find libcuda.so")
ENDIF()
ENDIF()
FIND_PACKAGE(CuDNN 5.1 REQUIRED)
IF(CUDA_FOUND)
MESSAGE(STATUS "CUDNN include dirs:" ${CUDNN_INCLUDE_DIRS})
MESSAGE(STATUS "CUDNN libraries:" ${CUDNN_LIBRARIES})
MESSAGE(STATUS "CUDNN library dirs:" ${CUDA_LIBRARY_DIRS})
LIST(APPEND EXTERNAL_LIBS ${CUDNN_LIBRARIES})
ENDIF()
FIND_PACKAGE(Protobuf REQUIRED)
IF(PROTOBUF_FOUND)
MESSAGE(STATUS "PROTOBUF include dir:" ${PROTOBUF_INCLUDE_DIRS})
MESSAGE(STATUS "PROTOBUF libraries:" ${PROTOBUF_LIBRARIES})
MESSAGE(STATUS "PROTOBUF protoc executable:" ${PROTOBUF_PROTOC_EXECUTABLE})
LIST(APPEND EXTERNAL_LIBS ${PROTOBUF_LIBRARIES})
ENDIF()
FIND_PACKAGE(Glog REQUIRED)
IF(GLOG_FOUND)
MESSAGE(STATUS "GLOG include dirs:" ${GLOG_INCLUDE_DIRS})
MESSAGE(STATUS "GLOG libraries:" ${GLOG_LIBRARIES})
LIST(APPEND EXTERNAL_LIBS ${GLOG_LIBRARIES})
ENDIF()
FIND_PACKAGE(GFlags REQUIRED)
IF(GFLAGS_FOUND)
MESSAGE(STATUS "GFLAGS include dirs:" ${GFLAGS_INCLUDE_DIRS})
MESSAGE(STATUS "GFLAGS libraries:" ${GFLAGS_LIBRARIES})
LIST(APPEND EXTERNAL_LIBS ${GFLAGS_LIBRARIES})
ENDIF()
SET(EXECUTABLE_OUTPUT_PATH, "${PROJECT_SOURCE_DIR/bin}")
SET(LIBRARY_OUTPUT_PATH, "${PROJECT_SOURCE_DIR/lib}")
ADD_SUBDIRECTORY(cavs)
ADD_SUBDIRECTORY(apps)