forked from hfingler/ava
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
128 lines (100 loc) · 5.48 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
cmake_minimum_required(VERSION 3.13)
project(ava)
###### Options ######
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build configuration (Release/Debug)")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/install" CACHE PATH "Installation path of AvA" FORCE)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(AVA_BENCHMARK_DIR "" CACHE PATH "Path to AvA benchmarks")
message(STATUS "Build configuration: ${CMAKE_BUILD_TYPE}")
message(STATUS "Install directory: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Benchmark directory: ${AVA_BENCHMARK_DIR}")
###### Configure compiler ######
# generate compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
###### options ######
option(AVA_GEN_CUDADRV_SPEC OFF "Enable CUDA driver specification")
option(AVA_GEN_CUDART_SPEC OFF "Enable CUDA runtime specification")
option(AVA_GEN_DEMO_SPEC OFF "Enable demo specification")
option(AVA_GEN_GTI_SPEC OFF "Enable Gyrfalcon Plai specification")
option(AVA_GEN_NCSDK_SPEC OFF "Enable NCSDK v1 specification")
option(AVA_GEN_OPENCL_SPEC OFF "Enable OpenCL specification")
option(AVA_GEN_ONNXRT_DUMP_SPEC OFF "Enable CUDA specification for ONNXruntime (dump)")
option(AVA_GEN_ONNXRT_OPT_SPEC OFF "Enable CUDA specification for ONNXruntime (opt)")
option(AVA_GEN_PYTORCH_DUMP_SPEC OFF "Enable CUDA specification for PyTorch (dump)")
option(AVA_GEN_PYTORCH_OPT_SPEC OFF "Enable CUDA specification for PyTorch (opt)")
option(AVA_GEN_QAT_SPEC OFF "Enable QuickAssist specification")
option(AVA_GEN_TENSORFLOW_DUMP_SPEC OFF "Enable CUDA specification for TensorFlow (dump)")
option(AVA_GEN_TENSORFLOW_OPT_SPEC OFF "Enable CUDA specification for TensorFlow (opt)")
option(AVA_GEN_TEST_SPEC OFF "Enable test (libtrivial) specification")
option(AVA_GEN_TF_C_SPEC OFF "Enable TensorFlow (C) specification")
option(AVA_MANAGER_GALVANIC OFF "Build Galvanic manager")
option(AVA_MANAGER_KATANA OFF "Build Katana manager")
option(AVA_MANAGER_LEGACY OFF "Build legacy (r1.0) manager")
option(AVA_MANAGER_DEMO OFF "Build demo manager")
option(AVA_MANAGER_SVGPU OFF "Build serverless GPU manager")
message(STATUS "Build demo specification: ${AVA_GEN_DEMO_SPEC}")
message(STATUS "Build CUDA driver specification: ${AVA_GEN_CUDADRV_SPEC}")
message(STATUS "Build CUDA runtime specification: ${AVA_GEN_CUDART_SPEC}")
message(STATUS "Build GTI specification: ${AVA_GEN_GTI_SPEC}")
message(STATUS "Build ONNXruntime specification (dump): ${AVA_GEN_ONNXRT_DUMP_SPEC}")
message(STATUS "Build ONNXruntime specification (opt): ${AVA_GEN_ONNXRT_OPT_SPEC}")
message(STATUS "Build NCSDK specification: ${AVA_GEN_NCSDK_SPEC}")
message(STATUS "Build OpenCL specification: ${AVA_GEN_OPENCL_SPEC}")
message(STATUS "Build PyTorch CUDA specification (dump): ${AVA_GEN_PYTORCH_DUMP_SPEC}")
message(STATUS "Build PyTorch CUDA specification (opt): ${AVA_GEN_PYTORCH_OPT_SPEC}")
message(STATUS "Build QuickAssist specification: ${AVA_GEN_QAT_SPEC}")
message(STATUS "Build TensorFlow CUDA specification (dump): ${AVA_GEN_TENSORFLOW_DUMP_SPEC}")
message(STATUS "Build TensorFlow CUDA specification (opt): ${AVA_GEN_TENSORFLOW_OPT_SPEC}")
message(STATUS "Build test (libtrivial) specification: ${AVA_GEN_TEST_SPEC}")
message(STATUS "Build TensorFlow C specification: ${AVA_GEN_TF_C_SPEC}")
message(STATUS "Build Galvanic manager: ${AVA_MANAGER_GALVANIC}")
message(STATUS "Build Katana manager: ${AVA_MANAGER_KATANA}")
message(STATUS "Build legacy (r1.0) manager: ${AVA_MANAGER_LEGACY}")
message(STATUS "Build demo manager: ${AVA_MANAGER_DEMO}")
message(STATUS "Build serverless GPU manager: ${AVA_MANAGER_SVGPU}")
set(AVA_DEP_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/third_party" CACHE PATH "Installation path of AvA dependencies")
# Always include debug info
add_compile_options("$<$<COMPILE_LANGUAGE:CXX>:-g>")
###### Check dependencies ######
# Check options
# Check libraries
find_package(Python3 COMPONENTS Interpreter)
find_package(PkgConfig REQUIRED)
pkg_search_module(GLIB2 REQUIRED glib-2.0)
# Socket library
find_package(Boost 1.65 REQUIRED COMPONENTS system)
message(STATUS "Using Boost.asio ${Boost_LIB_VERSION}")
# Config parser library
find_library(Config++ NAMES libconfig++ config++ REQUIRED)
message(STATUS "Using libconfig++ ${Config++}")
# Check ClangLib
find_package(LLVM 7.0 CONFIG REQUIRED)
execute_process(
COMMAND ${Python3_EXECUTABLE} -c "import glob; glob.glob(\"/usr/lib*/clang/7*/include\")[0]"
RESULT_VARIABLE libclang-7_not_found
ERROR_QUIET
)
if (libclang-7_not_found)
message(FATAL_ERROR "libclang-7-dev is required to run CAvA.")
endif()
###### Dependent libraries ######
add_subdirectory(third_party/fmt)
add_subdirectory(third_party/abseil-cpp)
add_subdirectory(third_party/GSL)
###### Build AvA manager ######
add_subdirectory(worker)
###### Generate and build remoting stubs ######
add_subdirectory(cava)
###### tools ######
option(AVA_TOOL_DUMP_COMBINATOR OFF "Build CUDA dump combinator")
message(STATUS "Build CUDA dump combinator: ${AVA_TOOL_DUMP_COMBINATOR}")
add_subdirectory(tools)