Skip to content

Commit

Permalink
[InMemoryDataset redesign] Object-oriented as_subchunk_map
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Sep 24, 2024
1 parent 3b58bdd commit f7f09fc
Show file tree
Hide file tree
Showing 3 changed files with 531 additions and 239 deletions.
7 changes: 4 additions & 3 deletions versioned_hdf5/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ cython_args = [

py.extension_module(
'hyperspace',
# FIXME This is a symlink. Can't find a way to convince Meson to compile
# with Cython pure-python .py files
# (read: https://cython.readthedocs.io/en/latest/src/tutorial/pure.html)
'hyperspace.pyx',
install: true,
subdir: 'versioned_hdf5',
Expand All @@ -59,10 +62,8 @@ py.extension_module(

py.extension_module(
'subchunk_map',
# FIXME This is a symlink. Can't find a way to convince Meson to compile
# with Cython pure-python .py files
# (read: https://cython.readthedocs.io/en/latest/src/tutorial/pure.html)
'subchunk_map.pyx',
install: true,
subdir: 'versioned_hdf5',
cython_args: cython_args,
)
25 changes: 25 additions & 0 deletions versioned_hdf5/subchunk_map.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file allows cimport'ing the functions declared below from other Cython modules

from cython cimport Py_ssize_t


cdef class IndexChunkMapper:
cdef readonly Py_ssize_t[:] chunk_indices
cdef readonly Py_ssize_t chunk_size
cdef readonly Py_ssize_t dset_size

cpdef tuple[object, object] chunk_submap(
self,
Py_ssize_t chunk_start_idx,
Py_ssize_t chunk_stop_idx,
bint shift,
)

# Private methods. Cython complains if we don't export _everything_.
cdef tuple[Py_ssize_t, Py_ssize_t] _chunk_start_stop(
self, Py_ssize_t a, Py_ssize_t b
)
cdef tuple[object, object, object] chunk_submap_compat(self, Py_ssize_t chunk_idx)

# Utility functions
cpdef Py_ssize_t ceil_a_over_b(Py_ssize_t a, Py_ssize_t b)
Loading

0 comments on commit f7f09fc

Please sign in to comment.