forked from sakjain92/Fractional-GPUs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
213 lines (166 loc) · 7.97 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
set(TARGET sm_61)
# TODO: Which version do we want?
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(fractional_gpu VERSION 1.0.1 LANGUAGES CXX CUDA DESCRIPTION "Split GPU into Fractional GPUs")
# Include the file contanining CMake options
include(config.cmake.in)
# Check for contraints on configurations
# For memory coloring, computational coloring is a must
if(FGPU_MEM_COLORING_ENABLED AND NOT FGPU_COMP_COLORING_ENABLE)
message(FATAL_ERROR "FGPU_COMP_COLORING_ENABLE not defined")
endif()
# When userspace/test coloring is enabled, coloring must be enabled
if((FGPU_USER_MEM_COLORING_ENABLED AND NOT FGPU_MEM_COLORING_ENABLED) OR
(FGPU_TEST_MEM_COLORING_ENABLED AND NOT FGPU_MEM_COLORING_ENABLED))
message(FATAL_ERROR "FGPU_MEM_COLORING_ENABLED not defined")
endif()
# Only one can be selected at a time
if(FGPU_USER_MEM_COLORING_ENABLED AND FGPU_TEST_MEM_COLORING_ENABLED)
message(FATAL_ERROR "Both FGPU_USER_MEM_COLORING_ENABLED and FGPU_TEST_MEM_COLORING_ENABLED defined")
endif()
# Equivalent variables for kernel driver
if(FGPU_MEM_COLORING_ENABLED)
set(UVM_MEM_COLORING 1)
endif()
if(FGPU_USER_MEM_COLORING_ENABLED)
set(UVM_USER_MEM_COLORING 1)
endif()
if(FGPU_TEST_MEM_COLORING_ENABLED)
set(UVM_TEST_MEM_COLORING 1)
endif()
# Set configuration variables for FGPU source code
configure_file(include/fgpu_internal_build_config.hpp.in
"${PROJECT_SOURCE_DIR}/include/fgpu_internal_build_config.hpp")
# Set configuration variables for Kernel driver source code
configure_file(driver/NVIDIA-Linux-x86_64-390.48/kernel/common/inc/uvm_config.h.in
"${PROJECT_SOURCE_DIR}/driver/NVIDIA-Linux-x86_64-390.48/kernel/common/inc/uvm_config.h")
# Configure the build type
#set(CMAKE_BUILD_TYPE Debug)
#set(CMAKE_BUILD_TYPE RelWithDebInfo)
set(CMAKE_BUILD_TYPE Release)
find_package(CUDA REQUIRED)
include_directories("${CUDA_INCLUDE_DIRS}")
include_directories(include)
include_directories(programs/cuda_samples/common/inc)
include_directories(driver/NVIDIA-Linux-x86_64-390.48/kernel/nvidia-uvm/)
include_directories(driver/NVIDIA-Linux-x86_64-390.48/kernel/common/inc/)
string(APPEND CMAKE_CUDA_FLAGS " -m 64 -arch=${TARGET}")
# Add programs to be built using persistent threads model
# First arg is target name
# Second arg is include directory
# Rest of the args are the files to be compiled into target
function(add_persistent_target target include_dir)
add_executable(${target} ${ARGN})
target_compile_features(${target} PUBLIC cxx_std_11)
target_link_libraries(${target} fractional_gpu cuda cudart nvidia-ml)
target_include_directories(${target} PUBLIC ${include_dir})
endfunction(add_persistent_target)
# Add programs to be built _without_ using persistent threads model
# First arg is target name
# Second arg is include directory
# Rest of the args are the files to be compiled into target
function(add_native_target target include_dir)
add_executable(${target} ${ARGN})
target_compile_features(${target} PUBLIC cxx_std_11)
target_include_directories(${target} PUBLIC ${include_dir})
endfunction(add_native_target)
# Library
add_library(fractional_gpu SHARED
persistent/persistent.cu
persistent/memory.cu
persistent/allocator.cpp
)
set_property(TARGET fractional_gpu PROPERTY VERSION ${PROJECT_VERSION})
set_property(TARGET fractional_gpu PROPERTY PUBLIC_HEADER
include/fractional_gpu.h
include/fractional_gpu_cuda.cuh)
target_include_directories(fractional_gpu PRIVATE include)
target_include_directories(fractional_gpu PRIVATE persistent)
target_compile_features(fractional_gpu PUBLIC cxx_std_11)
target_link_libraries(fractional_gpu cuda cudart nvidia-ml)
#server
add_persistent_target(fgpu_server programs programs/server.cu)
# Dummy
add_persistent_target(dummy_persistent programs/dummy_persistent
programs/dummy_persistent/dummy_persistent.cu)
# Matrix Multiplication
add_native_target(matrixMul programs/cuda_samples/matrixMul
programs/cuda_samples/matrixMul/matrixMul.cu)
add_persistent_target(matrixMul_persistent programs/cuda_samples/matrixMul_persistent
programs/cuda_samples/matrixMul_persistent/matrixMul_persistent.cu)
# Sorting Algos
add_native_target(sortingNetworks programs/cuda_sample/sortingNetworks
programs/cuda_samples/sortingNetworks/main.cpp
programs/cuda_samples/sortingNetworks/bitonicSort.cu
programs/cuda_samples/sortingNetworks/oddEvenMergeSort.cu
programs/cuda_samples/sortingNetworks/sortingNetworks_validate.cpp)
add_persistent_target(sortingNetworks_persistent programs/cuda_sample/sortingNetworks_persistent
programs/cuda_samples/sortingNetworks_persistent/main.cpp
programs/cuda_samples/sortingNetworks_persistent/bitonicSort.cu
programs/cuda_samples/sortingNetworks_persistent/oddEvenMergeSort.cu
programs/cuda_samples/sortingNetworks_persistent/sortingNetworks_validate.cpp)
# Mandlebrot
add_native_target(mandlebrot programs/mandlebrot
programs/mandlebrot/main.cu programs/mandlebrot/bmp.cpp)
add_persistent_target(mandlebrot_persistent programs/mandlebrot_persistent
programs/mandlebrot_persistent/main.cu programs/mandlebrot_persistent/bmp.cpp)
# Vector Add
add_native_target(vector_add programs/vector_add
programs/vector_add/main.cu)
add_persistent_target(vector_add_persistent programs/vector_add_persistent
programs/vector_add_persistent/main.cu)
# Saxpy
add_native_target(saxpy programs/saxpy
programs/saxpy/saxpy.cu)
add_persistent_target(saxpy_persistent programs/saxpy_persistent
programs/saxpy_persistent/saxpy.cu)
# Membench
add_native_target(membench programs/membench
programs/membench/membench.cu)
add_persistent_target(membench_persistent programs/membench_persistent
programs/membench_persistent/membench.cu)
#add_persistent_target(test programs programs/test.cu)
# conjugateGradientMultiBlockCG
#add_native_target(conjugateGradientMultiBlockCG programs/cuda_samples/conjugateGradientMultiBlockCG
# programs/cuda_samples/conjugateGradientMultiBlockCG/conjugateGradientMultiBlockCG.cu)
#add_persistent_target(conjugateGradientMultiBlockCG_persistent programs/cuda_samples/conjugateGradientMultiBlockCG_persistent
# programs/cuda_samples/conjugateGradientMultiBlockCG_persistent/conjugateGradientMultiBlockCG_persistent.cu)
# Benchmarks
# Gausssian
add_persistent_target(rodinia_gaussian benchmarks/rodinia/cuda/gaussian
benchmarks/rodinia/cuda/gaussian/gaussian.cu)
# CFD (Computational Fluid Dynamics)
add_persistent_target(rodinia_cfd benchmarks/rodinia/cuda/cfd
benchmarks/rodinia/cuda/cfd/euler3d.cu)
# NN (Nearest Neighbours)
add_persistent_target(rodinia_nn benchmarks/rodinia/cuda/nn
benchmarks/rodinia/cuda/nn/nn_cuda.cu)
# Fast Walsh Transform
add_persistent_target(cudaSDK_fwt benchmarks/cudaSDK/fastWalshTransform
benchmarks/cudaSDK/fastWalshTransform/fastWalshTransform.cu
benchmarks/cudaSDK/fastWalshTransform/fastWalshTransform_gold.cpp
benchmarks/cudaSDK/fastWalshTransform/fastWalshTransform_kernel.cuh)
# Scalar Product
add_persistent_target(cudaSDK_sp benchmarks/cudaSDK/scalarProd
benchmarks/cudaSDK/scalarProd/scalarProd.cu
benchmarks/cudaSDK/scalarProd/scalarProd_cpu.cpp
benchmarks/cudaSDK/scalarProd/scalarProd_kernel.cuh)
# Vector Add
add_persistent_target(cudaSDK_va benchmarks/cudaSDK/vectorAdd
benchmarks/cudaSDK/vectorAdd/vectorAdd.cu)
# Matrix Multiplication with Shared mem
add_persistent_target(cudaSDK_mms benchmarks/cudaSDK/matrixMulShared
benchmarks/cudaSDK/matrixMulShared/matrixMul.cu)
# Sorting Networks
add_persistent_target(cudaSDK_sn benchmarks/cudaSDK/sortingNetworks
benchmarks/cudaSDK/sortingNetworks/main.cpp
benchmarks/cudaSDK/sortingNetworks/sortingNetworks_validate.cpp
benchmarks/cudaSDK/sortingNetworks/bitonicSort.cu)
# Reverse engineering code
if(FGPU_TEST_MEM_COLORING_ENABLED)
# DRAM Bank and Cache Lines Hash Function Finder for GPU
add_persistent_target(gpu_reverse_engineering reverse_engineering/
reverse_engineering/reverse_engineering.cpp
reverse_engineering/gpu.cu
reverse_engineering/hash_function.cpp)
endif()