forked from ap-hynninen/cutt
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
68 lines (53 loc) · 1.89 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
cmake_minimum_required(VERSION 3.10)
project(cuTT)
# enable CXX
enable_language(CXX)
if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
endif (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (NOT CMAKE_CXX_EXTENSIONS)
set(CMAKE_CXX_EXTENSIONS OFF)
endif (NOT CMAKE_CXX_EXTENSIONS)
# enable cuda
enable_language(CUDA)
if (NOT CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD 11)
endif (NOT CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
if (NOT CMAKE_CUDA_EXTENSIONS)
set(CMAKE_CUDA_EXTENSIONS OFF)
endif (NOT CMAKE_CUDA_EXTENSIONS)
message(STATUS "CUDA Include Dirs: " ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
message(STATUS "CUDA Host Compiler: " ${CMAKE_CUDA_HOST_COMPILER})
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
option(ENABLE_NVTOOLS "Enable nvvp profiling of CPU code" OFF)
option(ENABLE_NO_ALIGNED_ALLOC "Enable aligned_alloc() function implemented in cuTT" OFF)
option(ENABLE_UMPIRE "Enable umpire for memory management" OFF)
include(CheckFunctionExists)
# ENABLE_NVTOOLS
if(ENABLE_NVTOOLS)
add_definitions(-DENABLE_NVTOOLS)
list(APPEND CUDA_NVCC_FLAGS -lnvToolsExt)
link_libraries(-lnvToolsExt)
endif()
message(STATUS "Current CUDA_NVCC_FLAGS: ${CUDA_NVCC_FLAGS}")
# ENABLE_NO_ALIGNED_ALLOC
if(ENABLE_NO_ALIGNED_ALLOC)
add_definitions(-DNO_ALIGNED_ALLOC)
else()
# this is available in C11 N.B. std::aligned_alloc is available in C++17
CHECK_FUNCTION_EXISTS(aligned_alloc HAVE_ALIGNED_ALLOC)
if(NOT HAVE_ALIGNED_ALLOC)
add_definitions(-DNO_ALIGNED_ALLOC)
endif()
endif()
# ENABLE_UMPIRE
if (ENABLE_UMPIRE)
find_package(umpire REQUIRED)
if (NOT CUTT_USES_THIS_UMPIRE_ALLOCATOR)
set(CUTT_USES_THIS_UMPIRE_ALLOCATOR "UM")
endif(NOT CUTT_USES_THIS_UMPIRE_ALLOCATOR)
message(STATUS "Will use Umpire allocator named \"${CUTT_USES_THIS_UMPIRE_ALLOCATOR}\"")
endif ()
add_subdirectory(src)