1
1
# CuBool library Cmake config file
2
2
# Add this file as sub-directory to your project to use library functionality
3
+
3
4
cmake_minimum_required (VERSION 3.17 FATAL_ERROR)
4
- project (CUBOOL LANGUAGES CXX CUDA )
5
+ project (cubool LANGUAGES CXX)
5
6
6
7
# Exposed to the user build options
7
- option (CUBOOL_WITH_CUB "Build project with locally stored CUB library " ON )
8
- option (CUBOOL_WITH_NSPARSE "Build library with nsparse crs matrix multiplication backend" ON )
9
- option (CUBOOL_WITH_NAIVE "Build library with naive and naive-shared dense matrix multiplication" ON )
10
- option (CUBOOL_BUILD_TESTS "Build project unit-tests with gtest" ON )
8
+ option (CUBOOL_WITH_CUDA "Build library with cuda backend (default) " ON )
9
+ option (CUBOOL_WITH_CPU "Build library with cpu backend (fallback) " ON )
10
+ option (CUBOOL_WITH_NAIVE "Build library with naive and naive-shared dense matrix multiplication" ON )
11
+ option (CUBOOL_BUILD_TESTS "Build project unit-tests with gtest" ON )
11
12
12
13
set (CUBOOL_VERSION_MAJOR 1)
13
14
set (CUBOOL_VERSION_MINOR 0)
14
15
15
- # Configure dependencies
16
- if (CUBOOL_WITH_CUB )
16
+ # Configure cuda dependencies
17
+ if (CUBOOL_WITH_CUDA )
17
18
message (STATUS "Add cub as cuda utility" )
18
19
set (CUB_ENABLE_HEADER_TESTING OFF CACHE BOOL "" FORCE)
19
20
set (CUB_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
20
21
set (CUB_ENABLE_EXAMPLES OFF CACHE BOOL "" FORCE)
21
- add_subdirectory (thirdparty /cub)
22
+ add_subdirectory (deps /cub)
22
23
add_library (cub INTERFACE IMPORTED )
23
24
target_link_libraries (cub INTERFACE CUB::CUB)
24
- endif ()
25
25
26
- if (CUBOOL_WITH_NSPARSE)
27
26
message (STATUS "Add nsparse library as crs matrix multiplication backend" )
28
- add_subdirectory (thirdparty /nsparse-um)
27
+ add_subdirectory (deps /nsparse-um)
29
28
endif ()
30
29
31
30
if (CUBOOL_WITH_NAIVE)
32
31
message (STATUS "Add naive library as dense matrix multiplication implementation for benchmarks" )
33
- add_subdirectory (thirdparty /naive)
32
+ add_subdirectory (deps /naive)
34
33
endif ()
35
34
36
35
if (CUBOOL_BUILD_TESTS)
37
36
message (STATUS "Add googletest as unit-testing library" )
38
- add_subdirectory (thirdparty/googletest )
37
+ add_subdirectory (deps/gtest )
39
38
endif ()
40
39
41
- # Library sources
42
- set (CUBOOL_SOURCES
43
- # Public sources
44
- include /cubool/cubool.h
45
- # Private sources
46
- src/cubool/config.hpp
47
- src/cubool/cubool.cu
48
- src/cubool/version .hpp
49
- src/cubool/instance.cu
50
- src/cubool/instance.cpp
51
- src/cubool/instance.hpp
52
- src/cubool/matrix_base.hpp
53
- src/cubool/matrix_dense.cu
54
- src/cubool/matrix_dense.hpp
55
- src/cubool/matrix_csr.hpp
56
- src/cubool/matrix_csr.cu
57
- src/cubool/matrix_csr_multiply_sum.cu
58
- src/cubool/matrix_csr_multiply_add.cu
59
- src/cubool/matrix_csr_ewise_add.cu
60
- src/cubool/matrix_csr_kron.cu
61
- src/cubool/matrix_csr_transpose.cu
62
- src/cubool/kernels/matrix_dense_multiply_add.cuh
63
- src/cubool/kernels/matrix_dense_common.cuh
64
- src/cubool/kernels/matrix_csr_spkron.cuh
65
- src/cubool/kernels/matrix_csr_spmerge.cuh
66
- src/cubool/kernels/matrix_csr_sptranspose.cuh
67
- src/cubool/details/error.hpp
68
- src/cubool/details/device_allocator.cuh
69
- src/cubool/details/host_allocator.hpp
70
- )
71
-
72
- # Shared library object config
73
- add_library (cubool SHARED ${CUBOOL_SOURCES} )
74
-
75
- target_include_directories (cubool PUBLIC ${CMAKE_CURRENT_LIST_DIR} /include )
76
- target_include_directories (cubool PRIVATE ${CMAKE_CURRENT_LIST_DIR} /src)
77
-
78
- target_compile_definitions (cubool PRIVATE CUBOOL_VERSION_MAJOR=${CUBOOL_VERSION_MAJOR} )
79
- target_compile_definitions (cubool PRIVATE CUBOOL_VERSION_MINOR=${CUBOOL_VERSION_MINOR} )
80
-
81
- target_link_libraries (cubool PRIVATE nsparse_um)
82
- target_compile_features (cubool PUBLIC cxx_std_14)
83
-
84
- set_target_properties (cubool PROPERTIES CXX_STANDARD 17)
85
- set_target_properties (cubool PROPERTIES CXX_STANDARD_REQUIRED ON )
86
- set_target_properties (cubool PROPERTIES CUDA_STANDARD 14)
87
- set_target_properties (cubool PROPERTIES CUDA_STANDARD_REQUIRED ON )
88
- set_target_properties (cubool PROPERTIES CUDA_SEPARABLE_COMPILATION ON )
89
-
90
-
91
- set (CUBOOL_DUMMY_SOURCES
92
- include /cubool/cubool.h
93
- src/cubool-dummy/cubool.cpp
94
- src/cubool-dummy/version .hpp
95
- src/cubool-dummy/instance.hpp
96
- src/cubool-dummy/matrix.hpp
97
- )
98
-
99
- # Create dummy library instance for testing purposes
100
- add_library (cubool_dummy SHARED ${CUBOOL_DUMMY_SOURCES} )
101
-
102
- target_include_directories (cubool_dummy PUBLIC ${CMAKE_CURRENT_LIST_DIR} /include )
103
- target_include_directories (cubool_dummy PRIVATE ${CMAKE_CURRENT_LIST_DIR} /src)
104
-
105
- target_compile_definitions (cubool_dummy PRIVATE CUBOOL_VERSION_MAJOR=${CUBOOL_VERSION_MAJOR} )
106
- target_compile_definitions (cubool_dummy PRIVATE CUBOOL_VERSION_MINOR=${CUBOOL_VERSION_MINOR} )
107
-
108
- target_compile_features (cubool_dummy PUBLIC cxx_std_11)
109
-
110
- set_target_properties (cubool_dummy PROPERTIES CXX_STANDARD 11)
111
- set_target_properties (cubool_dummy PROPERTIES CXX_STANDARD_REQUIRED ON )
112
-
113
- # If tests enabled, add tests sources to the build
114
- if (CUBOOL_BUILD_TESTS)
115
- add_subdirectory (tests)
116
- endif ()
40
+ # Actual cxx implementation
41
+ add_subdirectory (cubool)
117
42
118
43
# Copy scripts into binary directory
119
44
file (COPY scripts DESTINATION ${CMAKE_BINARY_DIR} /)
120
45
121
46
# Copy python related stuff
122
- file (COPY python DESTINATION ${CMAKE_BINARY_DIR} /)
47
+ file (COPY pycubool DESTINATION ${CMAKE_BINARY_DIR} /)
0 commit comments