forked from cjlin1/liblinear
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·46 lines (33 loc) · 1.44 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
cmake_minimum_required (VERSION 2.6)
project (liblinear)
set(CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda-10.1)
find_package(CUDA 10.0 REQUIRED)
include(FindCUDA)
find_package(OpenMP REQUIRED)
find_cuda_helper_libs(cusparse)
set(CUDA_CUSPARSE_LIBRARIES ${CUDA_cusparse_LIBRARY})
macro(CUDA_ADD_CUSPARSE_TO_TARGET target)
target_link_libraries(${target} ${CUDA_cusparse_LIBRARY})
endmacro()
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} -O3 ")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} -O3")
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-D_FORCE_INLINES -lineinfo)
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-O3)
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode arch=compute_35,code=sm_35)
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode arch=compute_52,code=sm_52)
set (CUDA_SAMPLES_DIR "${CUDA_TOOLKIT_ROOT_DIR}/samples/common/inc")
include_directories(blas)
add_subdirectory(blas)
include_directories("${CUDA_SAMPLES_DIR}")
include_directories(".")
# executable
cuda_add_executable(train ./train.c ./linear.cu ./tron.cu)
CUDA_ADD_CUBLAS_TO_TARGET (train)
CUDA_ADD_CUSPARSE_TO_TARGET (train)
target_link_libraries(train blas)
cuda_add_executable(predict ./predict.c ./linear.cu ./tron.cu)
CUDA_ADD_CUBLAS_TO_TARGET (predict)
CUDA_ADD_CUSPARSE_TO_TARGET (predict)
target_link_libraries(predict blas)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
install (TARGETS train predict DESTINATION .)