Skip to content

Commit

Permalink
Update to the latest tatami interface. (#6)
Browse files Browse the repository at this point in the history
We now handle differences in the TileDB attribute/dimension type compared to
the tatami interface types. This requires a lot of work to test that the
dimensions are computed correctly for a variety of signed/unsigned index types.

We improved the oracular caching to consolidate slabs into a single request to
the TileDB library. We switch to a variable slab cache for sparse oracular
extraction to improve cache utilitization. We also replace the SoloCore class
as we can achieve the same memory usage by reusing the other Cores with a chunk
length of 1 and a maximum number of cached slabs to 1.

We introduce a dedicated serialize() function to document and consolidate the
locks around the TileDB library. We actually need to implement a lock during
the parallelization tests because it occasionally deadlocks otherwise.

Updated the CI test workflow to use the latest versions, avoid using ctest,
and to pass along the Codecov token to report coverage.

Finally, updated the README.
  • Loading branch information
LTLA authored Sep 28, 2024
1 parent 01b1db1 commit 0573010
Show file tree
Hide file tree
Showing 18 changed files with 3,846 additions and 2,288 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Get latest CMake
uses: lukka/get-cmake@latest

- uses: actions/cache@v3
- uses: actions/cache@v4
id: cache
with:
path: libtiledb
Expand All @@ -51,7 +51,15 @@ jobs:
- name: Run the tests
run: |
cd build
ctest
# Avoid using ctest because it's so slow; it starts a
# new process for each individual test, which is crazy.
for exe in $(ctest --show-only=json-v1 | jq -r ".tests[] | .command | .[0]" | sort | uniq)
do
echo "#### RUNNING ${exe} ####"
echo
${exe} --gtest_brief=1
echo
done
- name: Generate code coverage
if: ${{ matrix.config.cov }}
Expand All @@ -61,6 +69,8 @@ jobs:
- name: Upload to Codecov
if: ${{ matrix.config.cov }}
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
directory: build/tests/CMakeFiles/
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,18 @@ Any matrix stored as a 2-dimensional TileDB array (dense or sparse) can be repre
```cpp
#include "tatami_tiledb/tatami_tiledb.hpp"

tatami_tiledb::TileDbDenseMatrix<double, int> dense_mat("some_dir", "attr_name");
tatami_tiledb::TileDbSparseMatrix<double, int> sparse_mat("some_dir", "attr_name");
```
If the dense/sparse nature is not known beforehand, we can use the `make_TileDbMatrix()` function to decide for us instead:
```cpp
auto some_mat = tatami_tiledb::make_TileDbMatrix("some_dir", "attr_name");
tatami_tiledb::DenseMatrix<double, int> dense_mat("some_dir", "attr_name");
tatami_tiledb::SparseMatrix<double, int> sparse_mat("some_dir", "attr_name");
```
Advanced users can fiddle with the options, in particular the size of the tile cache.
For example, we could force the matrix to use no more than 200 MB of memory in the cache:
```cpp
tatami_tiledb::TileDbOptions opt;
tatami_tiledb::DenseMatrixOptions opt;
opt.maximum_cache_size = 200000000;
opt.require_minimum_cache = false; // don't allow the cache to automatically expand.

auto some_mat2 = tatami_tiledb::make_TileDbMatrix("some_dir", "attr_name", opt);
tatami_tiledb::DenseMatrix<double, int> some_mat2("some_dir", "attr_name", opt);
```

Check out the [reference documentation](https://tatami-inc.github.io/tatami_tiledb) for more details.
Expand All @@ -50,7 +43,7 @@ If you're using CMake, you just need to add something like this to your `CMakeLi
include(FetchContent)
FetchContent_Declare(
tatami
tatami_tiledb
GIT_REPOSITORY https://github.com/tatami-inc/tatami_tiledb
GIT_TAG master # or any version of interest
)
Expand Down
Loading

0 comments on commit 0573010

Please sign in to comment.