Skip to content

Commit e918e41

Browse files
authored
Merge pull request #3 from JetBrains-Research/master
Pull changes
2 parents cb1c13b + 4996e2e commit e918e41

File tree

203 files changed

+6993
-5151
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+6993
-5151
lines changed

.github/workflows/ubuntu.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,9 @@ jobs:
5555

5656
- name: Build library sources
5757
working-directory: ${{ env.build_dir }}
58-
run: cmake --build . --target all --verbose -j `nproc`
58+
run: cmake --build . --target all --verbose -j `nproc`
59+
60+
- name: Run unit-tests (sequential backend)
61+
working-directory: ${{ env.build_dir }}
62+
run: bash scripts/tests_run_fallback.sh
63+
shell: bash

.gitmodules

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
[submodule "thirdparty/googletest"]
2-
path = thirdparty/googletest
1+
[submodule "deps/gtest"]
2+
path = deps/gtest
33
url = https://github.com/google/googletest.git
4-
[submodule "thirdparty/cub"]
5-
path = thirdparty/cub
4+
[submodule "deps/cub"]
5+
path = deps/cub
66
url = https://github.com/NVIDIA/cub.git

CMakeLists.txt

Lines changed: 30 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,60 @@
11
# CuBool library Cmake config file
22
# Add this file as sub-directory to your project to use library functionality
3+
34
cmake_minimum_required(VERSION 3.17 FATAL_ERROR)
4-
project(CUBOOL LANGUAGES CXX CUDA)
5+
project(cubool LANGUAGES CXX)
56

67
# 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_SEQUENTIAL "Build library with cpu sequential backend (fallback)" ON)
10+
option(CUBOOL_WITH_NAIVE "Build library with naive and naive-shared dense matrix multiplication" OFF)
11+
option(CUBOOL_BUILD_TESTS "Build project unit-tests with gtest" ON)
1112

1213
set(CUBOOL_VERSION_MAJOR 1)
1314
set(CUBOOL_VERSION_MINOR 0)
15+
set(CUBOOL_VERSION_SUB 0)
16+
17+
set(CUBOOL_DEBUG OFF)
18+
set(CUBOOL_RELEASE OFF)
19+
20+
if (${CMAKE_BUILD_TYPE} MATCHES Release)
21+
message(STATUS "Build cubool in release mode")
22+
set(CUBOOL_RELEASE ON)
23+
elseif (${CMAKE_BUILD_TYPE} MATCHES Debug)
24+
message(STATUS "Build cubool in debug mode")
25+
set(CUBOOL_DEBUG ON)
26+
else()
27+
message(STATUS "Build cubool in release mode (default: was not specified)")
28+
set(CUBOOL_RELEASE ON)
29+
set(CMAKE_BUILD_TYPE Release)
30+
endif()
1431

15-
# Configure dependencies
16-
if (CUBOOL_WITH_CUB)
32+
# Configure cuda dependencies
33+
if (CUBOOL_WITH_CUDA)
1734
message(STATUS "Add cub as cuda utility")
1835
set(CUB_ENABLE_HEADER_TESTING OFF CACHE BOOL "" FORCE)
1936
set(CUB_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
2037
set(CUB_ENABLE_EXAMPLES OFF CACHE BOOL "" FORCE)
21-
add_subdirectory(thirdparty/cub)
38+
add_subdirectory(deps/cub)
2239
add_library(cub INTERFACE IMPORTED)
2340
target_link_libraries(cub INTERFACE CUB::CUB)
24-
endif()
2541

26-
if (CUBOOL_WITH_NSPARSE)
2742
message(STATUS "Add nsparse library as crs matrix multiplication backend")
28-
add_subdirectory(thirdparty/nsparse-um)
43+
add_subdirectory(deps/nsparse-um)
2944
endif()
3045

3146
if (CUBOOL_WITH_NAIVE)
3247
message(STATUS "Add naive library as dense matrix multiplication implementation for benchmarks")
33-
add_subdirectory(thirdparty/naive)
48+
add_subdirectory(deps/naive)
3449
endif()
3550

3651
if (CUBOOL_BUILD_TESTS)
3752
message(STATUS "Add googletest as unit-testing library")
38-
add_subdirectory(thirdparty/googletest)
53+
add_subdirectory(deps/gtest)
3954
endif()
4055

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()
56+
# Actual cxx implementation
57+
add_subdirectory(cubool)
11758

11859
# Copy scripts into binary directory
11960
file(COPY scripts DESTINATION ${CMAKE_BINARY_DIR}/)

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22

3-
Copyright (c) 2020 JetBrains-Research
3+
Copyright (c) 2020, 2021 JetBrains-Research
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)