2
2
# GraphBLAS/CUDA/CMakeLists.txt: cmake script for GraphBLAS/CUDA
3
3
#-------------------------------------------------------------------------------
4
4
5
- # SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2023 , All Rights Reserved.
5
+ # SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2024 , All Rights Reserved.
6
6
7
7
# Some files in this folder are (c) NVIDIA or (c) Google. Please refer
8
8
# to their individual licenses (Apache, BSD, or others).
12
12
13
13
cmake_minimum_required ( VERSION 3.20 ) # GraphBLAS can be built stand-alone
14
14
15
- # CMake build for generating googletest c++ files that can be compiled and
16
- # executed in parallel. Build can be customized to speed up development by
17
- # allowing the targeting of specific specific parameters. The output of this
18
- # build is an executable that can be used to run the gtests.
19
-
20
15
project ( GRAPHBLAS_CUDA
21
16
VERSION "${GraphBLAS_VERSION_MAJOR} .${GraphBLAS_VERSION_MINOR} .${GraphBLAS_VERSION_SUB} "
22
17
LANGUAGES CXX CUDA )
@@ -29,7 +24,6 @@ set ( CMAKE_CUDA_FLAGS "-cudart=static -lineinfo " )
29
24
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++17 -fPIC " )
30
25
31
26
add_compile_definitions ( GBNCPUFEAT )
32
- add_compile_definitions ( GBCUDA_CPLUSPLUS )
33
27
34
28
message ( STATUS "C++ flags for CUDA: ${CMAKE_CXX_FLAGS} " )
35
29
@@ -160,126 +154,13 @@ if ( NOT MSVC )
160
154
endif ( )
161
155
162
156
#-------------------------------------------------------------------------------
163
- # test suite for the CUDA kernels
157
+ # report
164
158
#-------------------------------------------------------------------------------
165
159
166
- if ( 0 )
167
-
168
- # 1. Execute enumify/stringify/jitify logic to compile ptx kernels and
169
- # compile/link w/ relevant *.cu files.
170
-
171
- # TODO: Need to do this piece in cmake
172
-
173
- # 2. Generate test .cu files named "{semiring_operation}_test_instances.hpp"
174
- set ( CUDA_TEST_SUITES
175
- AxB_dot3
176
- # reduce_to_scalar
177
- )
178
-
179
- #
180
- set ( CUDA_TEST_MONOIDS PLUS MIN MAX ) # TIMES ANY )
181
- set ( CUDA_TEST_BINOPS TIMES PLUS MIN MAX DIV ) #MINUS RDIV RMINUS FIRST SECOND PAIR )
182
- set ( CUDA_TEST_SEMIRINGS PLUS_TIMES MIN_PLUS MAX_PLUS )
183
- set ( CUDA_TEST_DATATYPES int32_t int64_t uint32_t uint64_t float double )
184
- set ( CUDA_TEST_KERNELS vsvs ) # mp vsvs dndn spdn vssp )
185
- set ( CUDA_TEST_FORMATS sparse dense sparse_dense reduce )
186
-
187
- # TODO: Update testGen.py to accept the above CUDA_TEST_* params as arguments
188
-
189
- # Note: I don't believe there's a way to do this particular piece in parallel but
190
- # once all the files are written, we should be able to compile them in parallel
191
-
192
- # Separate individual kernels from larger "overview" test (e.g. 2-level testing structure)
193
- # We want to test all the *_cuda versions
194
-
195
- # TODO: make this a shorter test
196
- set (CUDA_TEST_CPP_FILES "" )
197
- if ( FALSE ) # TODO: use a cmake option
198
- foreach (var ${CUDA_TEST_SUITES} )
199
- foreach (semiring ${CUDA_TEST_SEMIRINGS} )
200
- foreach (kernel ${CUDA_TEST_KERNELS} )
201
- foreach (format ${CUDA_TEST_FORMATS} )
202
- # TODO: Have Python script also build separate cudaTest.cpp (named something
203
- # like AxB_dot3_cuda_tests.cpp) for each suite. This way we should be able to
204
- # easily ignore them from the build
205
- add_custom_command (
206
- OUTPUT
207
- ${CMAKE_CURRENT_BINARY_DIR} /${var}_${semiring}_${format}_test_instances.hpp
208
- ${CMAKE_CURRENT_BINARY_DIR} /${var}_${semiring}_${format}_cuda_tests.cpp
209
- # DEPENDS
210
- # jitFactory.hpp
211
- COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR} /test/testGen_cmake.py "\" ${CMAKE_CURRENT_SOURCE_DIR} \" " "\" ${var} \" " "\" ${CUDA_TEST_MONOIDS} \" "
212
- "\" ${CUDA_TEST_BINOPS} \" " "\" ${semiring} \" " "\" ${CUDA_TEST_DATATYPES} \" "
213
- "\" ${kernel} \" "
214
- )
215
- # Construct final list of files to compile (in parallel)
216
- list (APPEND CUDA_TEST_CPP_FILES ${CMAKE_CURRENT_BINARY_DIR} /${var}_${semiring}_${format}_cuda_tests.cpp )
217
- endforeach ()
218
- endforeach ()
219
- endforeach ()
220
- endforeach ()
221
- endif ( )
222
-
223
- include (FetchContent )
224
- FetchContent_Declare (
225
- googletest
226
- # Specify the commit you depend on and update it regularly.
227
- URL https://github.com/google/googletest/archive/e2239ee6043f73722e7aa812a459f54a28552929.zip
228
- )
229
- # For Windows: Prevent overriding the parent project's compiler/linker settings
230
- set (gtest_force_shared_crt ON CACHE BOOL "" FORCE )
231
- FetchContent_GetProperties (googletest )
232
- if (NOT googletest_POPULATED )
233
- FetchContent_Populate (googletest )
234
- add_subdirectory (${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL )
235
- endif ()
236
-
237
- #FetchContent_MakeAvailable(googletest EC)
238
-
239
-
240
- #file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/external_includes)
241
- #execute_process(
242
- # COMMAND git clone "https://github.com/google/googletest.git" googletest
243
- # WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/external_includes)
244
- #
245
- #include_directories(${CMAKE_CURRENT_BINARY_DIR}/external_includes/googletest/googletest/include)
246
-
247
- #add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/external_includes/googletest/googletest/)
248
-
249
- # 3. Compile/link individual {test_suite_name}_cuda_tests.cpp files into a gtest executable
250
- set (GRAPHBLAS_CUDA_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} /test )
160
+ message ( STATUS "CMAKE_CUDA_ARCHITECTURES: ${CMAKE_CUDA_ARCHITECTURES} " )
161
+ message ( STATUS "CMAKE_CUDA_COMPILER: ${CMAKE_CUDA_COMPILER} " )
162
+ message ( STATUS "CMAKE_CUDA_FLAGS: ${CMAKE_CUDA_FLAGS} " )
163
+ message ( STATUS "CMAKE_CUDA_FLAGS_RELEASE: ${CMAKE_CUDA_FLAGS_RELEASE} " )
164
+ message ( STATUS "CMAKE_CUDA_FLAGS_DEBUG: ${CMAKE_CUDA_FLAGS_DEBUG} " )
251
165
252
- message (STATUS "CUDA tests files: " "${CUDA_TEST_CPP_FILES} " )
253
166
254
- add_executable (graphblascuda_test ${CUDA_TEST_CPP_FILES} ${CMAKE_CURRENT_SOURCE_DIR} /test/run_tests.cpp )
255
-
256
- set_target_properties (graphblascuda_test PROPERTIES POSITION_INDEPENDENT_CODE ON )
257
- set_target_properties (graphblascuda_test PROPERTIES CUDA_SEPARABLE_COMPILATION ON )
258
- set_target_properties (graphblascuda_test PROPERTIES CUDA_ARCHITECTURES "52;75;80" )
259
-
260
- include (GoogleTest )
261
-
262
- if ( ENABLE_SHARED_LIBS )
263
- target_link_libraries ( graphblascuda_test PUBLIC GraphBLAS )
264
- else ( )
265
- target_link_libraries ( graphblascuda_test PUBLIC GraphBLAS_static )
266
- endif ( )
267
-
268
- target_link_libraries ( graphblascuda_test
269
- PUBLIC
270
- GraphBLAS_CUDA
271
- RMM_wrap
272
- CUDA::cudart_static
273
- CUDA::nvrtc
274
- ${ADDITIONAL_DEPS}
275
- PRIVATE
276
- gtest_main )
277
-
278
- target_include_directories ( graphblascuda_test
279
- PUBLIC
280
- rmm_wrap
281
- ${ADDITIONAL_INCLUDES}
282
- ${CUDAToolkit_INCLUDE_DIRS}
283
- ${GRAPHBLAS_CUDA_INCLUDES} )
284
-
285
- endif ( )
0 commit comments