Skip to content
This repository was archived by the owner on Sep 2, 2026. It is now read-only.

Commit f9022ef

Browse files
authored
merge develop
2 parents 3c7297c + eb24c64 commit f9022ef

65 files changed

Lines changed: 3003 additions & 1075 deletions

File tree

Some content is hidden

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

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.24)
2-
project(hypertrie VERSION 0.9.6
3-
DESCRIPTION "A flexible data structure for low-rank, sparse tensors supporting slices by any dimension and einstein summation (einsum) and a flexible query interface")
2+
project(hypertrie VERSION 0.10.0
3+
DESCRIPTION "The hypertrie is powering the Tentris triple store.")
44

55
include(cmake/boilerplate_init.cmake)
66
boilerplate_init()

README.md

Lines changed: 75 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,91 @@
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
4598
tests/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-
```

libs/einsum/src/dice/einsum/internal/operators/Operator.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#ifndef HYPERTRIE_OPERATOR_HPP
22
#define HYPERTRIE_OPERATOR_HPP
33

4+
#include "dice/einsum/internal/operators/Operator_predeclare.hpp"
5+
46
#include "dice/einsum/internal/operators/CartesianOperator.hpp"
57
#include "dice/einsum/internal/operators/CountOperator.hpp"
68
#include "dice/einsum/internal/operators/EntryGeneratorOperator.hpp"
79
#include "dice/einsum/internal/operators/JoinOperator.hpp"
810
#include "dice/einsum/internal/operators/ResolveOperator.hpp"
911

10-
#include "dice/einsum/internal/operators/Operator_predeclare.hpp"
11-
1212

1313
#include <memory>
1414
#include <utility>

libs/hypertrie/CMakeLists.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,27 @@ set(lib_suffix "hypertrie")
33
set(lib "${PROJECT_NAME}-${lib_suffix}")
44

55
find_package(Threads REQUIRED)
6-
find_package(Boost REQUIRED COMPONENTS)
6+
find_package(Boost REQUIRED)
77
find_package(robin_hood REQUIRED)
88
find_package(dice-sparse-map REQUIRED)
99
find_package(dice-hash REQUIRED)
1010
find_package(dice-template-library REQUIRED)
1111

12+
# Define the library
1213
add_library(${lib} INTERFACE)
1314
add_library(${PROJECT_NAME}::${lib_suffix} ALIAS ${lib})
1415

16+
target_include_directories(${lib} INTERFACE
17+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
18+
1519
target_link_libraries(${lib} INTERFACE
1620
Threads::Threads
1721
Boost::headers
1822
robin_hood::robin_hood
1923
dice-hash::dice-hash
2024
dice-sparse-map::dice-sparse-map
2125
dice-template-library::dice-template-library
22-
)
23-
24-
target_include_directories(${lib} INTERFACE
25-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
26+
)
2627

2728
include(${CMAKE_SOURCE_DIR}/cmake/install_components.cmake)
28-
install_component(INTERFACE ${lib_suffix} src)
29+
install_component(INTERFACE ${lib_suffix} src)

libs/hypertrie/src/dice/hypertrie.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#ifndef HYPERTRIE_HYPERTRIE_SI_HPP
22
#define HYPERTRIE_HYPERTRIE_SI_HPP
33

4-
#include "dice/hypertrie/BulkInserter.hpp"
5-
#include "dice/hypertrie/HashJoin.hpp"
64
#include "dice/hypertrie/Hypertrie.hpp"
5+
#include "dice/hypertrie/BulkUpdater.hpp"
6+
#include "dice/hypertrie/HashJoin.hpp"
77
#include "dice/hypertrie/Hypertrie_version.hpp"
88

99
#include "dice/hypertrie/Hypertrie_default_traits.hpp"

libs/hypertrie/src/dice/hypertrie/BulkInserter.hpp

Lines changed: 0 additions & 180 deletions
This file was deleted.

0 commit comments

Comments
 (0)