-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
65 lines (54 loc) · 2.23 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
cmake_minimum_required (VERSION 3.6)
project (UNIPAR)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -lpthread")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -lpthread")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) # To allow CMake to locate our Find*.cmake files
message("CMAKE BINARY DIR: ${CMAKE_BINARY_DIR}")
message("CMAKE CXX COMPILER: ${CMAKE_CXX_COMPILER}")
message("CMAKE CXX FLAGS: ${CMAKE_CXX_FLAGS}")
add_subdirectory(sub)
add_subdirectory(hash)
find_package(OpenMP REQUIRED)
if (OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
else ()
# icpc
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
message(icpc)
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -qopenmp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qopenmp")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
message(g++)
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
endif ()
endif ()
set(SOURCE_FILES
./src/comm.c ./src/contig.c ./src/dbgraph.c
./src/msp.c ./src/preprocess.c
./src/main.c)
add_executable(unipar ${SOURCE_FILES})
find_package("CUDA" REQUIRED)
macro(cuda_add_compile_options options)
list(APPEND CUDA_NVCC_FLAGS "${options}")
endmacro()
cuda_add_compile_options("--gpu-architecture=sm_35 -Xptxas -dlcm=cg")
cuda_add_compile_options("-std=c++11 -g -G -lpthread")
cuda_add_compile_options("-Xcompiler ${OpenMP_CXX_FLAGS}")
cuda_add_library(culib SHARED
./src/comm.cu ./src/contig.cu ./src/all2all.cu
./src/dbgraph.cu ./src/msp.cu ./src/preprocess.cu)
link_directories(${CMAKE_BINARY_DIR}/hash)
link_directories(${CMAKE_BINARY_DIR}/sub)
target_link_libraries(unipar ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(unipar tbbsort)
target_link_libraries(unipar distribute)
target_link_libraries(unipar sublib)
target_link_libraries(unipar hash)
target_link_libraries(unipar culib)
target_link_libraries(unipar subculib)
set_target_properties(unipar PROPERTIES CUDA_SEPARABLE_COMPILATION ON)