Skip to content

Commit d5a6655

Browse files
authored
Merge pull request #4 from JetBrains-Research/master
Pulling changes
2 parents 78757f4 + eabed83 commit d5a6655

File tree

705 files changed

+8930590
-899
lines changed

Some content is hidden

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

705 files changed

+8930590
-899
lines changed

.github/workflows/ubuntu.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
- uses: actions/checkout@v2
2929
with:
3030
submodules: true
31+
- uses: actions/setup-python@v2
32+
with:
33+
python-version: '3.7'
3134

3235
- name: Install CUDA
3336
env:
@@ -60,4 +63,13 @@ jobs:
6063
- name: Run unit-tests (sequential backend)
6164
working-directory: ${{ env.build_dir }}
6265
run: bash scripts/tests_run_fallback.sh
63-
shell: bash
66+
shell: bash
67+
68+
- name: Run regression-tests (sequential backend)
69+
working-directory: ${{ env.build_dir }}
70+
run: |
71+
cd python
72+
export PYTHONPATH="`pwd`:$PYTHONPATH"
73+
cd tests
74+
python3 -m unittest discover -v
75+
shell: bash

README.md

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[![JB Research](https://jb.gg/badges/research-flat-square.svg)](https://research.jetbrains.org/)
66
[![Ubuntu](https://github.com/JetBrains-Research/cuBool/workflows/Ubuntu/badge.svg?branch=master)](https://github.com/JetBrains-Research/cuBool/actions)
77
[![License](https://img.shields.io/badge/license-MIT-orange)](https://github.com/JetBrains-Research/cuBool/blob/master/LICENSE)
8+
[![Package](https://img.shields.io/badge/pypi%20package-alpha-%233776ab)](https://test.pypi.org/project/pycubool/)
89

910
**cuBool** is a linear Boolean algebra library primitives and operations for
1011
work with sparse matrices written on the NVIDIA CUDA platform. The primary
@@ -28,26 +29,28 @@ prototyping algorithms on a local computer for later running on a powerful serve
2829

2930
- [X] Library C interface
3031
- [X] Library setup
31-
- [X] CSR matrix
32-
- [X] CSR multiplication
33-
- [X] CSR element-wise addition
34-
- [X] CSR kronecker
35-
- [X] CSR transpose
36-
- [X] CSR submatrix
37-
- [X] CSR matrix reduce
38-
- [X] CSR slicing
32+
- [X] Sparse matrix
33+
- [X] Sparse matrix multiplication
34+
- [X] Sparse matrix element-wise addition
35+
- [X] Sparse matrix kronecker
36+
- [X] Sparse matrix transpose
37+
- [X] Sparse matrix submatrix
38+
- [X] Sparse matrix reduce
39+
- [X] Sparse matrix slicing
40+
- [X] Matrix cached filling
3941
- [X] Sequential fallback backend for CPU
40-
- [ ] IO matrix loading from mtx file
41-
- [ ] IO matrix saving into mtx file
42+
- [X] Device capabilities query
43+
- [X] IO matrix loading from mtx file
44+
- [X] IO matrix saving into mtx file
4245
- [ ] IO matrix saving into gviz format
43-
- [ ] IO user-defined file logging
46+
- [X] IO user-defined file logging
4447
- [X] Wrapper for Python API
45-
- [ ] Wrapper syntax sugar
46-
- [ ] Tests for Python wrapper
48+
- [X] Wrapper syntax sugar
49+
- [X] Tests for Python wrapper
50+
- [X] Pip package
4751
- [ ] Code examples
4852
- [ ] User guide
4953
- [X] Unit Tests collection
50-
- [X] Dummy library implementation for testing
5154
- [ ] Publish built artifacts and shared libs
5255
- [ ] Publish stable source code archives
5356

@@ -65,7 +68,7 @@ prototyping algorithms on a local computer for later running on a powerful serve
6568

6669
### Cuda & Compiler Setup
6770

68-
> Skip thia section if you want to build library with only sequential backend
71+
> Skip this section if you want to build library with only sequential backend
6972
> without cuda backend support.
7073
7174
Before the CUDA setup process, validate your system NVIDIA driver with `nvidia-smi`
@@ -159,12 +162,22 @@ By default, the following cmake options will be automatically enabled:
159162
160163
### Python Wrapper
161164
162-
After the build process, the shared library object `libcubool.so` is placed
163-
inside the build directory. Export into the environment or add into bash
164-
profile the variable `CUBOOL_PATH=/path/to/the/libcubool.so` with appropriate
165-
path to your setup. Then you will be able to use `pycubool` python wrapper,
166-
which uses this variable in order to located library object.
165+
**Export** env variable `PYTHONPATH="/build_dir_path/python/:$PYTHONPATH"` if
166+
you want to use `pycubool` without installation into default python packages dir.
167+
This variable will help python find package if you import it as `import pycubool` in your python scripts.
167168
169+
**To run regression tests** within your build directory, open folder `/build_dir_path/python` and
170+
run the following command:
171+
172+
```shell script
173+
$ export PYTHONPATH="`pwd`:$PYTHONPATH"
174+
$ cd tests
175+
$ python3 -m unittest discover -v
176+
```
177+
178+
**Note:** after the build process, the shared library object `libcubool.so` will be placed
179+
inside the build directory in the folder with python wrapper `python/pycubool/`.
180+
So, the wrapper will be able to automatically locate required lib file.
168181
169182
## Usage
170183
@@ -205,7 +218,7 @@ wrapper can be used to compute the same transitive closure problem for the
205218
directed graph within python environment:
206219
207220
```python
208-
from python import pycubool
221+
import pycubool
209222
210223
def transitive_closure(a: pycubool.Matrix):
211224
"""
@@ -216,8 +229,8 @@ def transitive_closure(a: pycubool.Matrix):
216229
:return: The transitive closure adjacency matrix
217230
"""
218231
219-
t = a.dup() # Duplicate matrix where to store result
220-
total = 0 # Current number of values
232+
t = a.dup() # Duplicate matrix where to store result
233+
total = 0 # Current number of values
221234
222235
while total != t.nvals:
223236
total = t.nvals
@@ -263,12 +276,12 @@ cuBool
263276
## License
264277
265278
This project is licensed under MIT License. License text can be found in the
266-
[license file](https://github.com/JetBrains-Research/cuBool/blob/master/LICENSE).
279+
[license file](https://github.com/JetBrains-Research/cuBool/blob/master/LICENSE.md).
267280
268281
## Acknowledgments
269282
270283
This is a research project of the Programming Languages and Tools Laboratory
271-
at JetBrains Research company. Laboratory website [link](https://research.jetbrains.org/groups/plt_lab/).
284+
at JetBrains-Research. Laboratory website [link](https://research.jetbrains.org/groups/plt_lab/).
272285
273286
## Also
274287

cubool/CMakeLists.txt

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,27 @@ set(CUBOOL_SOURCES
2121
sources/core/library.cpp
2222
sources/core/library.hpp
2323
sources/core/matrix.cpp
24-
sources/core/matrix.hpp)
24+
sources/core/matrix.hpp
25+
sources/io/logger.cpp
26+
sources/io/logger.hpp
27+
sources/utils/exclusive_scan.hpp
28+
sources/utils/timer.hpp
29+
)
2530

2631
set(CUBOOL_C_API_SOURCES
2732
include/cubool/cubool.h
28-
sources/cuBool_Version_Get.cpp
29-
sources/cuBool_About_Get.cpp
30-
sources/cuBool_LicenseInfo_Get.cpp
33+
sources/cuBool_GetAbout.cpp
34+
sources/cuBool_GetVersion.cpp
35+
sources/cuBool_GetLicenseInfo.cpp
36+
sources/cuBool_GetDeviceCaps.cpp
3137
sources/cuBool_Initialize.cpp
3238
sources/cuBool_Finalize.cpp
39+
sources/cuBool_SetupLogger.cpp
3340
sources/cuBool_Matrix_New.cpp
3441
sources/cuBool_Matrix_Build.cpp
42+
sources/cuBool_Matrix_SetElement.cpp
43+
sources/cuBool_Matrix_SetMarker.cpp
44+
sources/cuBool_Matrix_Marker.cpp
3545
sources/cuBool_Matrix_ExtractPairs.cpp
3646
sources/cuBool_Matrix_ExtractSubMatrix.cpp
3747
sources/cuBool_Matrix_Duplicate.cpp
@@ -97,8 +107,7 @@ if (CUBOOL_WITH_SEQUENTIAL)
97107
sources/sequential/sq_reduce.cpp
98108
sources/sequential/sq_reduce.hpp
99109
sources/sequential/sq_submatrix.cpp
100-
sources/sequential/sq_submatrix.hpp
101-
sources/sequential/sq_exclusive_scan.hpp)
110+
sources/sequential/sq_submatrix.hpp)
102111
endif()
103112

104113
# Shared library object config
@@ -134,17 +143,14 @@ if (CUBOOL_WITH_CUDA)
134143

135144
# Settings: https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/
136145
target_compile_options(cubool PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:
137-
-arch=sm_30
138-
-gencode=arch=compute_50,code=sm_50
139-
-gencode=arch=compute_52,code=sm_52
140-
-gencode=arch=compute_60,code=sm_60
141-
-gencode=arch=compute_61,code=sm_61
142-
-gencode=arch=compute_70,code=sm_70
143-
-gencode=arch=compute_75,code=sm_75
144-
-gencode=arch=compute_75,code=compute_75>)
145-
146-
target_compile_options(cubool PRIVATE $<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:CUDA>>: -Xptxas -O2>)
147-
target_compile_options(cubool PRIVATE $<$<AND:$<CONFIG:Release>,$<COMPILE_LANGUAGE:CUDA>>: -Xptxas -O0>)
146+
-arch=sm_30
147+
-gencode=arch=compute_30,code=sm_30
148+
-gencode=arch=compute_35,code=sm_35
149+
-gencode=arch=compute_50,code=sm_50
150+
-gencode=arch=compute_52,code=sm_52
151+
-gencode=arch=compute_52,code=compute_52>)
152+
153+
target_compile_options(cubool PRIVATE $<$<COMPILE_LANGUAGE:CUDA>: -use_fast_math -Xptxas -O2>)
148154

149155
target_compile_definitions(cubool PRIVATE CUBOOL_WITH_CUDA)
150156
target_link_libraries(cubool PRIVATE nsparse_um)
@@ -164,4 +170,16 @@ if (CUBOOL_BUILD_TESTS)
164170

165171
message(STATUS "Add unit tests directory to the project")
166172
add_subdirectory(tests)
167-
endif()
173+
endif()
174+
175+
# todo: Different platforms has specific naming conventions
176+
set(LIBRARY_FILE_NAME "libcubool.so")
177+
178+
# Copy cubool library after build
179+
add_custom_command(
180+
TARGET cubool POST_BUILD
181+
COMMAND "${CMAKE_COMMAND}" -E
182+
copy
183+
"${CMAKE_BINARY_DIR}/cubool/${LIBRARY_FILE_NAME}"
184+
"${CMAKE_BINARY_DIR}/python/pycubool"
185+
COMMENT "Copy cubool lib into python folder")

0 commit comments

Comments
 (0)