Skip to content

Commit 077867a

Browse files
authored
Added base file structure with cmake. Added CI for building and running tests. Added regular_path_query algorithm. (#1)
1 parent a9759a9 commit 077867a

39 files changed

+660
-0
lines changed

.github/workflows/ubuntu.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Compile, run tests and check code style
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
build:
13+
runs-on: ${{ matrix.os }}
14+
15+
strategy:
16+
fail-fast: false
17+
18+
matrix:
19+
os: [ubuntu-24.04]
20+
c_compiler: [gcc-14]
21+
cpp_compiler: [g++-14]
22+
build_type: [Release, Debug]
23+
24+
steps:
25+
- uses: actions/checkout@v2
26+
with:
27+
submodules: recursive
28+
29+
- name: Setup enviroment
30+
run: |
31+
sudo apt update
32+
sudo apt install gcc-14
33+
sudo apt install g++-14
34+
sudo apt install cmake
35+
sudo apt install clang-format
36+
37+
- name: Configure CMake
38+
run: |
39+
cd ${{ github.workspace }}
40+
cmake -B build -S . \
41+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \
42+
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
43+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
44+
-DCUBOOL_GRAPH_ENABLE_TESTING=ON \
45+
-DCUBOOL_WITH_CUDA=OFF \
46+
-DCUBOOL_WITH_SEQUENTIAL=ON
47+
48+
- name: Build
49+
run: |
50+
cmake --build build -j10
51+
52+
- name: Run tests
53+
run: |
54+
./build/tests/cuboolgraph_tests

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,7 @@
3030
*.exe
3131
*.out
3232
*.app
33+
34+
build/*
35+
.cache/*
36+
.vscode/*

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[submodule "deps/googletest"]
2+
path = deps/googletest
3+
url = https://github.com/google/googletest
4+
[submodule "deps/fast_matrix_market"]
5+
path = deps/fast_matrix_market
6+
url = https://github.com/alugowski/fast_matrix_market
7+
[submodule "deps/cuBool"]
8+
path = deps/cuBool
9+
url = https://github.com/mitya-y/cuBool

CMakeLists.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
cmake_minimum_required(VERSION 3.25)
2+
3+
set(CMAKE_CXX_STANDARD 20)
4+
5+
set(CUBOOL_GRAPH_LIB_NAME cuboolgraph)
6+
project(${CUBOOL_GRAPH_LIB_NAME} LANGUAGES CXX)
7+
8+
add_library(${CUBOOL_GRAPH_LIB_NAME} SHARED "")
9+
10+
set(CUBOOL_COPY_TO_PY_PACKAGE OFF)
11+
set(CUBOOL_BUILD_TESTS OFF)
12+
add_subdirectory(deps/cuBool)
13+
14+
# cubool is a name of CMakeTarget cmake target
15+
target_link_libraries(${CUBOOL_GRAPH_LIB_NAME} PUBLIC cubool)
16+
17+
target_include_directories(${CUBOOL_GRAPH_LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
18+
19+
add_subdirectory(src)
20+
21+
option(CUBOOL_GRAPH_ENABLE_TESTING "Compile tests for algorithms" OFF)
22+
23+
if(CUBOOL_GRAPH_ENABLE_TESTING)
24+
add_subdirectory(deps/googletest)
25+
add_subdirectory(deps/fast_matrix_market)
26+
add_subdirectory(tests)
27+
endif()
28+

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
11
# cuBoolGraph
22
cuBool based graph analysis algorithms
3+
4+
## List of algorithms
5+
6+
regular_path_query - Single-Source Regular Path Query Algorithm in Terms of Linear Algebra
7+
8+
# Run tests
9+
cuBoolGraph supports Linux-based OS (tested on Ubuntu 24.04 and Manjaro 6.19).
10+
For building project are required gcc version 14 and later, CMake with version 3.25 and later, CUDA developing toolkint version 12.0 and later.
11+
12+
For build and run tests execute commands
13+
```
14+
git submodule update --init --recursive
15+
cmake -B build -DCUBOOL_GRAPH_ENABLE_TESTING=ON
16+
cmake --build build
17+
./build/tests/cuboolgraph_tests
18+
```

deps/cuBool

Submodule cuBool added at 69d38a6

deps/fast_matrix_market

Submodule fast_matrix_market added at b6172c9

deps/googletest

Submodule googletest added at 35b75a2

include/regular_path_query.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <vector>
2+
3+
#include <cubool/cubool.h>
4+
5+
cuBool_Matrix regular_path_query_with_transposed(
6+
// vector of sparse graph matrices for each label
7+
const std::vector<cuBool_Matrix> &graph, const std::vector<cuBool_Index> &source_vertices,
8+
// vector of sparse automaton matrices for each label
9+
const std::vector<cuBool_Matrix> &automaton, const std::vector<cuBool_Index> &start_states,
10+
// transposed matrices for graph and automaton
11+
const std::vector<cuBool_Matrix> &graph_transposed,
12+
const std::vector<cuBool_Matrix> &automaton_transposed,
13+
14+
const std::vector<bool> &inversed_labels = {}, bool all_labels_are_inversed = false);
15+
16+
cuBool_Matrix regular_path_query(
17+
// vector of sparse graph matrices for each label
18+
const std::vector<cuBool_Matrix> &graph, const std::vector<cuBool_Index> &source_vertices,
19+
// vector of sparse automaton matrices for each label
20+
const std::vector<cuBool_Matrix> &automaton, const std::vector<cuBool_Index> &start_states,
21+
22+
const std::vector<bool> &inversed_labels = {}, bool all_labels_are_inversed = false);

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target_sources(${CUBOOL_GRAPH_LIB_NAME} PRIVATE regular_path_query.cpp)

0 commit comments

Comments
 (0)