Skip to content

Commit 1eb5d0b

Browse files
authored
Merge pull request #17 from SparseLinearAlgebra/self-hosted-runner
Configure CI on self-hosted runner
2 parents ab425e1 + d4e0432 commit 1eb5d0b

Some content is hidden

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

41 files changed

+929
-106
lines changed

.github/workflows/self-hosted.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Self-Hosted
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
workflow_dispatch:
9+
10+
env:
11+
build_dir: "build"
12+
13+
jobs:
14+
build:
15+
name: Build ${{ matrix.os }} GCC ${{ matrix.gcc }} CUDA ${{ matrix.cuda }}
16+
runs-on: self-hosted
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- os: ubuntu-24.04
22+
cuda: "12.8"
23+
gcc: 13
24+
env:
25+
config: "Release"
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
submodules: recursive
31+
32+
- name: Set environment variables
33+
run: |
34+
echo "CUDA_PATH=/usr/local/cuda-12.8" >> $GITHUB_ENV
35+
echo "${CUDA_PATH}/bin" >> $GITHUB_PATH
36+
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib64:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
37+
echo "CC=/usr/bin/gcc-${{ matrix.gcc }}" >> $GITHUB_ENV
38+
echo "CXX=/usr/bin/g++-${{ matrix.gcc }}" >> $GITHUB_ENV
39+
echo "CUDAHOSTCXX=/usr/bin/g++-${{ matrix.gcc }}" >> $GITHUB_ENV
40+
echo "CUDACXX=/usr/local/cuda-${{ matrix.cuda }}/bin/nvcc" >> $GITHUB_ENV
41+
42+
- name: Configure CMake build
43+
run: |
44+
cmake . -B ${{ env.build_dir }} -DCMAKE_BUILD_TYPE=${{ env.config }} -DCUBOOL_BUILD_TESTS=ON
45+
46+
- name: Build library sources
47+
run: |
48+
cmake --build ${{ env.build_dir }} --target all --verbose -j `nproc`
49+
50+
test:
51+
name: Test GPU ${{ matrix.gpu }} CUDA ${{ matrix.cuda }}
52+
needs: build
53+
runs-on: self-hosted
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
include:
58+
- gpu: NVIDIA-GeForce-GT-1030
59+
cuda: "12.9"
60+
env:
61+
unit-test-file: gpu_test_all.log
62+
regression-test-file: gpu_test_regression.log
63+
64+
steps:
65+
- name: Run unit-tests
66+
working-directory: ${{ env.build_dir }}
67+
run: |
68+
bash scripts/run_tests_all.sh | tee ${{ env.unit-test-file }}
69+
70+
- name: Upload unit tests resutls
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: ${{ env.unit-test-file }}
74+
path: ${{ env.build_dir }}/${{ env.unit-test-file }}
75+
76+
- name: Check for unit tests results
77+
working-directory: ${{ env.build_dir }}
78+
run: |
79+
! grep -q "FAILED" ${{ env.unit-test-file }}
80+
81+
- name: Run regression-tests
82+
working-directory: ${{ env.build_dir }}/python
83+
run: |
84+
bash run_tests.sh 2>&1 | tee ${{ env.regression-test-file }}
85+
86+
- name: Upload regression tests resutls
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: ${{ env.regression-test-file }}
90+
path: ${{ env.build_dir }}/python/${{ env.regression-test-file }}
91+
92+
- name: Check for regression tests results
93+
working-directory: ${{ env.build_dir }}/python
94+
run: |
95+
! grep -q "FAILED" ${{ env.regression-test-file }}
96+
97+
clean:
98+
name: Cleanup workspace
99+
needs: test
100+
if: always()
101+
runs-on: self-hosted
102+
103+
steps:
104+
- name: Cleanup workspace
105+
run: |
106+
rm -rf ${{ github.workspace }}/*
107+
rm -rf ${{ github.workspace }}/.*

.github/workflows/ubuntu.yml

Lines changed: 69 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Original script from https://github.com/ptheywood/cuda-cmake-github-actions
2-
31
name: Ubuntu
42

53
on:
@@ -9,74 +7,97 @@ on:
97
branches: [ master ]
108
workflow_dispatch:
119

10+
env:
11+
build_dir: "build"
12+
artifact: "cubool-ubuntu-build.tar.xz"
13+
1214
jobs:
1315
build:
14-
name: Build ${{ matrix.os }} GCC ${{ matrix.gcc }} CUDA ${{ matrix.cuda }}
16+
name: Build ${{ matrix.os }}
1517
runs-on: ${{ matrix.os }}
1618
strategy:
1719
fail-fast: false
1820
matrix:
1921
include:
20-
- os: ubuntu-18.04
21-
cuda: "10.1"
22-
gcc: 8
22+
- os: ubuntu-22.04
2323
env:
24-
build_dir: "build"
2524
config: "Release"
26-
artifact: "cubool-ubuntu-build.tar.xz"
2725

2826
steps:
29-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v4
3028
with:
3129
submodules: true
32-
- uses: actions/setup-python@v2
33-
with:
34-
python-version: '3.7'
3530

36-
- name: Install CUDA
37-
env:
38-
cuda: ${{ matrix.cuda }}
31+
- name: Configure CMake build
3932
run: |
40-
source ./scripts/install_cuda_ubuntu.sh
41-
if [[ $? -eq 0 ]]; then
42-
# Set paths for subsequent steps, using ${CUDA_PATH}
43-
echo "Adding CUDA to CUDA_PATH, PATH and LD_LIBRARY_PATH"
44-
echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV
45-
echo "${CUDA_PATH}/bin" >> $GITHUB_PATH
46-
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
47-
fi
48-
shell: bash
49-
50-
- name: Install and configure GCC and GXX
33+
cmake . -B ${{ env.build_dir }} -DCMAKE_BUILD_TYPE=${{ env.config }} -DCUBOOL_BUILD_TESTS=ON -DCUBOOL_WITH_CUDA=OFF
34+
35+
- name: Build library sources
5136
run: |
52-
sudo apt-get install -y gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
53-
echo "СС=/usr/bin/gcc-${{ matrix.gcc }}" >> $GITHUB_ENV
54-
echo "CXX=/usr/bin/g++-${{ matrix.gcc }}" >> $GITHUB_ENV
55-
echo "CUDAHOSTCXX=/usr/bin/g++-${{ matrix.gcc }}" >> $GITHUB_ENV
37+
cmake --build ${{ env.build_dir }} --target all --verbose -j `nproc`
5638
57-
- name: Configure CMake build
58-
run: cmake . -B ${{ env.build_dir }} -DCMAKE_BUILD_TYPE=${{ env.config }} -DCUBOOL_BUILD_TESTS=YES
39+
- name: Prepare upload binary
40+
run: |
41+
tar cfz ${{ env.artifact }} ${{ env.build_dir }}
5942
60-
- name: Build library sources
43+
- name: Upload binary
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: ${{ env.artifact }}
47+
path: ${{ env.artifact }}
48+
49+
test:
50+
name: Test CPU ${{ matrix.cpu }}
51+
needs: build
52+
runs-on: ${{ matrix.os }}
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
include:
57+
- os: ubuntu-22.04
58+
cpu: AMD-EPYC-7763
59+
env:
60+
unit-test-file: cpu_test_all.log
61+
regression-test-file: cpu_test_regression.log
62+
63+
steps:
64+
- uses: actions/download-artifact@v4
65+
with:
66+
name: ${{ env.artifact }}
67+
68+
- name: Unarchive artifact
69+
run: |
70+
tar xzf ${{ env.artifact }}
71+
rm ${{ env.artifact }}
72+
73+
- name: Run unit-tests
6174
working-directory: ${{ env.build_dir }}
62-
run: cmake --build . --target all --verbose -j `nproc`
75+
run: |
76+
bash scripts/run_tests_all.sh | tee ${{ env.unit-test-file }}
77+
78+
- name: Upload unit tests resutls
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: ${{ env.unit-test-file }}
82+
path: ${{ env.build_dir }}/${{ env.unit-test-file }}
6383

64-
- name: Run unit-tests (sequential backend)
84+
- name: Check for unit tests results
6585
working-directory: ${{ env.build_dir }}
66-
run: bash scripts/run_tests_fallback.sh
67-
shell: bash
86+
run: |
87+
! grep -q "FAILED" ${{ env.unit-test-file }}
6888
69-
- name: Run regression-tests (sequential backend)
89+
- name: Run regression-tests
7090
working-directory: ${{ env.build_dir }}/python
71-
run: bash run_tests.sh
72-
shell: bash
73-
74-
- name: Prepare upload binary
75-
shell: bash
76-
run: tar cfz ${{ env.artifact }} ${{ env.build_dir }}
91+
run: |
92+
bash run_tests.sh 2>&1 | tee ${{ env.regression-test-file }}
7793
78-
- name: Upload binary
79-
uses: actions/upload-artifact@v2
94+
- name: Upload regression tests resutls
95+
uses: actions/upload-artifact@v4
8096
with:
81-
name: ${{ env.artifact }}
82-
path: ${{ env.artifact }}
97+
name: ${{ env.regression-test-file }}
98+
path: ${{ env.build_dir }}/python/${{ env.regression-test-file }}
99+
100+
- name: Check for regression tests results
101+
working-directory: ${{ env.build_dir }}/python
102+
run: |
103+
! grep -q "FAILED" ${{ env.regression-test-file }}

.gitmodules

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

CMakeLists.txt

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ option(CUBOOL_WITH_NAIVE "Build library with naive and naive-shared dens
1111
option(CUBOOL_BUILD_TESTS "Build project unit-tests with gtest" ON)
1212
option(CUBOOL_COPY_TO_PY_PACKAGE "Copy compiled shared library into python package folder (for package use purposes)" ON)
1313

14+
option(CUBOOL_USE_NSPARSE_MERGE_FUNCTOR "Use nsparse optimiztion for matrix addition function" ON)
15+
1416
set(CUBOOL_VERSION_MAJOR 1)
1517
set(CUBOOL_VERSION_MINOR 0)
1618
set(CUBOOL_VERSION_SUB 0)
@@ -32,14 +34,6 @@ endif()
3234

3335
# Configure cuda dependencies
3436
if (CUBOOL_WITH_CUDA)
35-
message(STATUS "Add cub as cuda utility")
36-
set(CUB_ENABLE_HEADER_TESTING OFF CACHE BOOL "" FORCE)
37-
set(CUB_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
38-
set(CUB_ENABLE_EXAMPLES OFF CACHE BOOL "" FORCE)
39-
add_subdirectory(deps/cub)
40-
add_library(cub INTERFACE IMPORTED)
41-
target_link_libraries(cub INTERFACE CUB::CUB)
42-
4337
message(STATUS "Add nsparse library as crs matrix multiplication backend")
4438
add_subdirectory(deps/nsparse-um)
4539
endif()
@@ -61,4 +55,4 @@ add_subdirectory(cubool)
6155
file(COPY scripts DESTINATION ${CMAKE_BINARY_DIR}/)
6256

6357
# Copy python related stuff
64-
file(COPY python DESTINATION ${CMAKE_BINARY_DIR}/)
58+
file(COPY python DESTINATION ${CMAKE_BINARY_DIR}/)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ $ bash ./scripts/run_tests_all.sh
214214
By default, the following cmake options will be automatically enabled:
215215

216216
- `CUBOOL_WITH_CUDA` - build library with actual cuda backend
217-
- `CUBOOL_WITH_SEQUENTIAL` - build library witt cpu based backend
217+
- `CUBOOL_WITH_SEQUENTIAL` - build library with cpu based backend
218218
- `CUBOOL_WITH_TESTS` - build library unit-tests collection
219219

220220
> Note: in order to provide correct GCC version for CUDA sources compiling,

cubool/CMakeLists.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ set(CUBOOL_C_API_SOURCES
8787
sources/cuBool_Matrix_Reduce2.cpp
8888
sources/cuBool_Matrix_EWiseAdd.cpp
8989
sources/cuBool_Matrix_EWiseMult.cpp
90+
sources/cuBool_Matrix_EWiseMultInverted.cpp
9091
sources/cuBool_Vector_New.cpp
9192
sources/cuBool_Vector_Build.cpp
9293
sources/cuBool_Vector_SetElement.cpp
@@ -125,6 +126,7 @@ if (CUBOOL_WITH_CUDA)
125126
sources/cuda/cuda_matrix.cu
126127
sources/cuda/cuda_matrix_ewiseadd.cu
127128
sources/cuda/cuda_matrix_ewisemult.cu
129+
sources/cuda/cuda_matrix_ewisemult_inverted.cu
128130
sources/cuda/cuda_matrix_kronecker.cu
129131
sources/cuda/cuda_matrix_multiply.cu
130132
sources/cuda/cuda_matrix_transpose.cu
@@ -147,6 +149,7 @@ if (CUBOOL_WITH_CUDA)
147149
sources/cuda/kernels/spgemv_t.cuh
148150
sources/cuda/kernels/spewiseadd.cuh
149151
sources/cuda/kernels/spewisemult.cuh
152+
sources/cuda/kernels/spewisemultinverted.cuh
150153
sources/cuda/kernels/sptranspose.cuh
151154
sources/cuda/kernels/sptranspose2.cuh
152155
sources/cuda/kernels/spkron.cuh
@@ -173,6 +176,8 @@ if (CUBOOL_WITH_SEQUENTIAL)
173176
sources/sequential/sq_ewiseadd.hpp
174177
sources/sequential/sq_ewisemult.cpp
175178
sources/sequential/sq_ewisemult.hpp
179+
sources/sequential/sq_ewisemultinverted.cpp
180+
sources/sequential/sq_ewisemultinverted.hpp
176181
sources/sequential/sq_spgemm.cpp
177182
sources/sequential/sq_spgemm.hpp
178183
sources/sequential/sq_spgemv.cpp
@@ -201,11 +206,9 @@ target_compile_definitions(cubool PRIVATE CUBOOL_VERSION_MAJOR=${CUBOOL_VERSION_
201206
target_compile_definitions(cubool PRIVATE CUBOOL_VERSION_MINOR=${CUBOOL_VERSION_MINOR})
202207
target_compile_definitions(cubool PRIVATE CUBOOL_VERSION_SUB=${CUBOOL_VERSION_SUB})
203208

204-
target_compile_features(cubool PUBLIC cxx_std_14)
209+
target_compile_definitions(cubool PRIVATE CUBOOL_USE_NSPARSE_MERGE_FUNCTOR=$<BOOL:${CUBOOL_USE_NSPARSE_MERGE_FUNCTOR}>)
205210

206-
target_compile_options(cubool PRIVATE $<$<COMPILE_LANGUAGE:CXX>: -Wall>)
207-
target_compile_options(cubool PRIVATE $<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:CXX>>: -O2>)
208-
target_compile_options(cubool PRIVATE $<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUAGE:CXX>>: -O0>)
211+
target_compile_features(cubool PUBLIC cxx_std_17)
209212

210213
set_target_properties(cubool PROPERTIES CXX_STANDARD 17)
211214
set_target_properties(cubool PROPERTIES CXX_STANDARD_REQUIRED ON)
@@ -219,7 +222,6 @@ endforeach()
219222
if (CUBOOL_WITH_CUDA)
220223
set_target_properties(cubool PROPERTIES CUDA_STANDARD 14)
221224
set_target_properties(cubool PROPERTIES CUDA_STANDARD_REQUIRED ON)
222-
set_target_properties(cubool PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
223225

224226
# Settings: https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/
225227

@@ -256,4 +258,4 @@ if (CUBOOL_COPY_TO_PY_PACKAGE)
256258
"${CMAKE_BINARY_DIR}/cubool/${LIBRARY_FILE_NAME}"
257259
"${CMAKE_BINARY_DIR}/python/pycubool"
258260
COMMENT "Copy ${LIBRARY_FILE_NAME} compiled lib into python folder")
259-
endif()
261+
endif()

cubool/include/cubool/cubool.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,4 +925,30 @@ CUBOOL_EXPORT CUBOOL_API cuBool_Status cuBool_Kronecker(
925925
cuBool_Hints hints
926926
);
927927

928+
/**
929+
* Performs result = matrix * ~mask, where
930+
* '*' is boolean semiring 'and' operation
931+
* '~' is operation for invert matrix (0 swaps to 1 and 1 to 0)
932+
*
933+
* @note To perform this operation matrices must be compatible
934+
* dim(matrix) = M x T
935+
* dim(mask) = T x N
936+
* dim(result) = M x N
937+
*
938+
* @note Pass `CUBOOL_HINT_TIME_CHECK` hint to measure operation time
939+
*
940+
* @param result[out] Destination matrix to store result
941+
* @param left Source matrix to be multiplied
942+
* @param right Source matrix to be inverted and multiplied
943+
* @param hints Hints for the operation
944+
*
945+
* @return Error code on this operation
946+
*/
947+
CUBOOL_EXPORT CUBOOL_API cuBool_Status cuBool_Matrix_EWiseMulInverted(
948+
cuBool_Matrix result,
949+
cuBool_Matrix matrix,
950+
cuBool_Matrix mask,
951+
cuBool_Hints hints
952+
);
953+
928954
#endif //CUBOOL_CUBOOL_H

0 commit comments

Comments
 (0)