This repository has been archived by the owner on Dec 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
71 lines (58 loc) · 1.98 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
cmake_minimum_required(VERSION 3.13)
project(pdc_mini_aevol)
set(CMAKE_CXX_STANDARD 14)
set(DO_TRACES OFF CACHE BOOL "Whether to enable the Traces library")
set(USE_OMP OFF CACHE BOOL "Whether to enable OpenMP parallelization")
set(USE_CUDA OFF CACHE BOOL "Whether to enable CUDA parallelization")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_FLAGS_DEBUG "-pg -O2 -march=native -fopenmp -fopt-info-vec-all")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -march=native")
if ( DO_TRACES )
add_definitions(-DTRACES)
message( STATUS "Traces are activated" )
endif ( DO_TRACES )
if ( USE_CUDA )
# https://cliutils.gitlab.io/modern-cmake/chapters/packages/CUDA.html
find_package(CUDA REQUIRED)
include(CheckLanguage)
check_language(CUDA)
if(CMAKE_CUDA_COMPILER)
enable_language(CUDA)
set(CMAKE_CUDA_STANDARD 14)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
# https://arnon.dk/tag/nvcc-flags/
set(CMAKE_CUDA_FLAGS "-arch=sm_60")
set(CMAKE_CUDA_FLAGS_DEBUG "-Xcompiler -rdynamic -lineinfo")
else()
message(FATAL_ERROR "No CUDA support found")
endif()
endif ( USE_CUDA )
if ( USE_OMP )
find_package(OpenMP REQUIRED)
endif ( USE_OMP )
find_package(ZLIB REQUIRED)
add_library(micro_aevol
Abstract_ExpManager.cpp
ExpManager.cpp
AeTime.cpp
DnaMutator.cpp
MutationEvent.cpp
Organism.cpp
Stats.cpp
Threefry.cpp
Dna.cpp)
target_link_libraries(micro_aevol PUBLIC ZLIB::ZLIB)
if ( OPENMP_FOUND )
target_link_libraries(micro_aevol PUBLIC OpenMP::OpenMP_CXX)
target_compile_definitions(micro_aevol PUBLIC USE_OMP)
endif ()
add_executable(micro_aevol_cpu main.cpp)
target_link_libraries(micro_aevol_cpu micro_aevol)
if ( USE_CUDA )
add_subdirectory(cuda)
add_executable(micro_aevol_gpu main.cpp)
# nvToolsExt for enhanced profiling (ad-hoc chunks)
target_link_libraries(micro_aevol_gpu PUBLIC cuda_micro_aevol micro_aevol)
endif ()