1- TODO: update readme
1+ # Hypertrie
22
3- # hypertrie
3+ ## Where is it used?
44
5- A flexible data structure for low-rank, sparse tensors supporting slices by any dimension and einstein summation (
6- einsum).
5+ - the backend of the [ commercial] ( https://github.com/tentris/tentris )
6+ and [ research-prototype] ( https://github.com/dice-group/tentris-research-project ) Tentris triple stores/RDF graph
7+ databases
8+ - a sparse tensor representation that supports slicing by any dimension and einstein summation
9+ - a monolithic index that supports worst-case optimal joins (WCOJ) by providing all collation orders in a single
10+ redundancy eliminating datastructure.
711
8- For details on the data structure refer to https://tentris.dice-research.org/
12+ ## What is it?
913
10- ## build
14+ Technically, a hypertrie stores $d$-tuples where $d$ is also called dimension (tensor) or depth (trie, index).
1115
12- ### prerequisites
16+ It allows incremental slicing (tensor) by any dimension or select and project by any predicate (relational algebra).
17+ These properties are important to support worst-case optimal joins (WCOJ) efficiently.
1318
14- install conan, cmake and a C++20 compiler.
19+ ## Asymptotic Guarantees
1520
16- and create a conan profile
21+ A depth-$d$ the hypertrie encoding a set of $z$ tuples requires at most $\mathcal O (z\cdot 2^{d-1}\cdot d)$ space. The
22+ runtime complexity of applying (inserting or deleting) a changeset set $\Delta$ of $d$-tuples to a depth-$d$ hypertrie
23+ is bound by the space complexity $\mathcal O (|\Delta| \cdot 2^{d-1}\cdot d)$ of a surrogate hypertrie that encodes the
24+ change set changeset $\Delta$.
1725
18- ``` shell script
19- conan profile new --detect default
20- conan profile update settings.compiler.libcxx=libstdc++11 default
21- ```
26+ # build
2227
23- You'll need some packages from DICE group's conan artifactory. Add it with:
28+ This is a template library. So there is nothing to build beyond tests.
2429
25- ``` shell script
26- conan remote add dice-group https://conan.dice-research.org/artifactory/api/conan/tentris
30+ ## prerequisites
31+
32+ Software was tested on Ubuntu-22.04 with gcc-13 and clang-17, both using libstdc++-13 as C++ STL.
33+
34+ Install with:
35+
36+ ``` shell
37+ # gcc-13
38+ sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
39+
40+ # clang-17
41+ source /etc/os-release
42+ echo " deb http://apt.llvm.org/${UBUNTU_CODENAME} / llvm-toolchain-${UBUNTU_CODENAME} -17 main" | sudo tee /etc/apt/sources.list.d/llvm-17.list
43+ curl https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/llvm.gpg > /dev/null
44+ # Ensure STL version
45+ sudo apt-get install -y libstdc++-13-dev
2746```
2847
29- ### build
48+ Ensure cmake >3.24 is installed.
3049
31- ``` shell script
32- mkdir build
33- cd build
34- conan install .. --build=missing
35- cmake ..
50+ ## Build the Tests
51+
52+ Download ` conan_provider.cmake ` to the project directory:
53+
54+ ``` shell
55+ wget https://github.com/conan-io/cmake-conan/raw/develop2/conan_provider.cmake -O conan_provider.cmake
56+ ```
57+
58+ (Optional) Some tests require libtorch. You can download it from https://pytorch.org/get-started/locally/ (works at
59+ least with Stable|Linux|LibTorch|C++|None). We tested with version 10.9.0. There have been reports about some newer
60+ versions being
61+ broken.
62+
63+ Configure CMake (replace ` path/to/libtorch ` or remove the line before excuting).
64+
65+ ``` shell
66+ cmake \
67+ -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=" conan_provider.cmake" \
68+ -DBUILD_TESTING=On \
69+ -DLIBTORCH_PATH=" path/to/libtorch" \
70+ -B build .
71+ ```
72+
73+ Build:
74+
75+ ``` shell
76+ cmake --build . --parallel
77+ ```
78+
79+ Run:
80+
81+ ``` shell
82+ ctest --parallel
83+ ```
84+
85+ If you want to exclude long-running validation tests, run:
86+
87+ ``` shell
88+ ctest --parallel --exclude-regex " (tests_RawHypertrieContext_systematic)|(tests_RawHypertrieContext_systematic_metall)|(tests_HypertrieContext_systematic_metall)|(tests_Einsum)|(tests_Einsum_metall)"
3689```
3790
3891# running tests
@@ -45,12 +98,3 @@ make -j tests
4598tests/tests
4699```
47100
48- Some tests are using [ pytorch] ( https://github.com/pytorch/pytorch ) which is not provided with the code.
49- Those tests are disabled by default.
50- To enable them, provide the path to the pytorch library via cmake variable ` hypertrie_LIBTORCH_PATH ` .
51- Prebuild binaries may be downloaded via https://pytorch.org/get-started/locally/ (works at least with
52- Stable|Linux|LibTorch|C++|None).
53-
54- ``` shell script
55- cmake -DDBUILD_TESTING=ON -DLIBTORCH_PATH=/path/to/libtorch ..
56- ```
0 commit comments