Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1bdb00c
Refactor, GIL management
kordejong Jul 31, 2025
65df375
Add support for building targets with examples (LUE_WITH_EXAMPLES)
kordejong Jul 31, 2025
3c587a3
Fix include
kordejong Oct 16, 2025
4cba397
Add Serializer to enable serializing tasks that must be called in order
kordejong Oct 16, 2025
9c075a0
Initialize value
kordejong Nov 24, 2025
fe52d9f
Fix preprocessor test for LUE_FRAMEWORK_WITH_PARALLEL_IO
kordejong Nov 24, 2025
427638e
clang-format
kordejong Nov 25, 2025
4a757c2
First version making write concurrent when HDF5 is threadsafe
kordejong Nov 25, 2025
e829767
Refactor
kordejong Nov 25, 2025
dc8f8cb
Serialize collective calls by call order
kordejong Nov 25, 2025
1b34f21
Move export macro to header
kordejong Nov 26, 2025
643c7b3
WIP to/from lue unit tests
kordejong Nov 26, 2025
4ddfd0c
pre-commit fixes
kordejong Dec 1, 2025
39b4a1c
pre-commit fixes
kordejong Dec 1, 2025
2e6c4dd
pre-commit fixes
kordejong Dec 1, 2025
b69ea89
pre-commit fixes
kordejong Dec 2, 2025
3628d3f
pre-commit fixes
kordejong Dec 2, 2025
5df3213
Turn off workflow for now
kordejong Dec 2, 2025
9fd64fc
pre-commit fixes
kordejong Dec 2, 2025
f6c92e5
Turn on workflows again
kordejong Dec 2, 2025
7c5ca2b
Force a threadsafe version of HDF5
kordejong Nov 28, 2025
6315b83
Refactor
kordejong Nov 28, 2025
1810db7
WIP serial I/O
kordejong Dec 3, 2025
5cf18e7
WIP serial threadsafe I/O
kordejong Dec 4, 2025
3b8d7ad
WIP serial I/O non-treadsafe
kordejong Dec 4, 2025
398a730
Fix include of configure.hpp
kordejong Dec 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@
Checks: >
-*,
bugprone-*,
-bugprone-easily-swappable-parameters,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-readability-magic-numbers,
modernize-*,
-modernize-use-nodiscard,
performance-*,
readability-*
...
-readability-redundant-member-init
CheckOptions:
- key: readability-identifier-length.IgnoredVariableNames
value: id
- key: readability-identifier-length.IgnoredParameterNames
value: id
1 change: 0 additions & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ jobs:
- name: analyse
if: matrix.compiler.cxx == 'g++-13' && matrix.python_version == '3.13'
run: |
sudo apt-get install clang-tidy
cd ${{ env.lue_source_directory }}
pre-commit install
ln -s ../${{ env.lue_build_directory }}/compile_commands.json .
Expand Down
23 changes: 12 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,29 +62,30 @@ repos:
hooks:
- id: typos
args: [] # Relevant: don't update files, just report
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
- repo: https://github.com/cpp-linter/cpp-linter-hooks
rev: v1.1.10
hooks:
# Keep clang-* versions in sync with environment/configuration/requirements-dev.txt
- id: clang-format
args: [-i]
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
args: [--version=21.1.6, --dry-run]
- id: clang-tidy
args: [--quiet]
# TODO Add directories not to be excluded
args: [--version=21.1.6, --quiet]
# TODO: Update code and remove excluded directories from this list
exclude: |
(?x)^(
source/.*|
source/data_model/cxx/.*|
source/data_model/cxx/test/.*|
source/data_model/gdal/.*|
source/data_model/gdal/include/lue/gdal/library.hpp|
source/data_model/hdf5/.*|
source/data_model/hdf5/test/.*|
source/data_model/hl/.*|
source/data_model/python/.*|
source/data_model/test/.*|
source/data_model/translate/.*|
source/data_model/utility/.*|
source/data_model/validate/.*|
source/framework/.*|
source/python/.*|
source/python/test/.*|
source/quality_assurance/.*|
source/view/.*|
)$
1 change: 1 addition & 0 deletions environment/cmake/Lue.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ message(STATUS "Build documentation : ${LUE_BUILD_DOCUMENTATION}")
message(STATUS "Build quality assurance : ${LUE_BUILD_QUALITY_ASSURANCE}")
message(STATUS "+ python api : ${LUE_QUALITY_ASSURANCE_WITH_PYTHON_API}")
message(STATUS "+ tests : ${LUE_QUALITY_ASSURANCE_WITH_TESTS}")
message(STATUS "With examples : ${LUE_WITH_EXAMPLES}")
message(STATUS "")
message(STATUS "CMAKE_GENERATOR : ${CMAKE_GENERATOR}")
message(STATUS "GENERATOR_IS_MULTI_CONFIG : ${GENERATOR_IS_MULTI_CONFIG}")
Expand Down
8 changes: 7 additions & 1 deletion environment/cmake/LueConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ option(LUE_BUILD_DOCUMENTATION
"Build documentation"
FALSE)

option(LUE_WITH_EXAMPLES
"Include examples"
FALSE)

option(LUE_BUILD_QUALITY_ASSURANCE
"Include support for quality assurance"
FALSE)
Expand Down Expand Up @@ -635,8 +639,10 @@ if(LUE_HDF5_REQUIRED)
endif()
endif()

set(CMAKE_REQUIRED_INCLUDES ${HDF5_INCLUDE_DIRS})
check_symbol_exists(H5_HAVE_THREADSAFE "hdf5.h" HDF5_IS_THREADSAFE)
unset(CMAKE_REQUIRED_INCLUDED)
check_symbol_exists(H5_HAVE_PARALLEL "hdf5.h" HDF5_IS_PARALLEL)
unset(CMAKE_REQUIRED_INCLUDES)

message(STATUS "HDF5_IS_PARALLEL : ${HDF5_IS_PARALLEL}")
message(STATUS "HDF5_IS_THREADSAFE : ${HDF5_IS_THREADSAFE}")
Expand Down
5 changes: 4 additions & 1 deletion environment/configuration/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ types-python-dateutil==2.9.0.20241003
# Build against numpy 2, while also supporting running against numpy 1
numpy>=2.0

clang-format==20.1.8
# Keep clang-* versions in sync with ../../.pre-commit-config.yaml
clang-format==21.1.6
clang-tidy==21.1.6

pre-commit==4.3.0

ruamel.yaml==0.18.14
Expand Down
8 changes: 4 additions & 4 deletions source/data_model/cxx/include/lue/object/dataset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@ namespace lue {

auto operator=(Dataset&&) -> Dataset& = default;

[[nodiscard]] auto lue_version() const -> std::string;
auto lue_version() const -> std::string;

auto add_universe(std::string const& name) -> Universe&;

auto add_phenomenon(std::string const& name, std::string const& description = "")
-> Phenomenon&;

[[nodiscard]] auto description() const -> std::string const&;
auto description() const -> std::string const&;

[[nodiscard]] auto universes() const -> Universes const&;
auto universes() const -> Universes const&;

auto universes() -> Universes&;

[[nodiscard]] auto phenomena() const -> Phenomena const&;
auto phenomena() const -> Phenomena const&;

auto phenomena() -> Phenomena&;

Expand Down
2 changes: 1 addition & 1 deletion source/data_model/cxx/include/lue/test/dataset_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace lue::data_model {

auto operator=(DatasetFixture&&) -> DatasetFixture& = delete;

[[nodiscard]] auto pathname() const -> std::string const&;
auto pathname() const -> std::string const&;

auto dataset() -> Dataset&;

Expand Down
68 changes: 35 additions & 33 deletions source/data_model/hdf5/include/lue/hdf5/attribute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ namespace lue::hdf5 {
namespace detail {

template<typename T>
inline std::enable_if_t<!std::is_base_of<std::vector<::hsize_t>, T>::value> read_attribute(
Identifier const& id, Datatype const& datatype, Dataspace const& /* dataspace */, T& value)
requires(!std::is_base_of_v<std::vector<::hsize_t>, T>)
void read_attribute(
Identifier const& id,
Datatype const& datatype,
[[maybe_unused]] Dataspace const& dataspace,
T& value)
{
::herr_t const status{::H5Aread(id, datatype.id(), &value)};
herr_t const status{H5Aread(id, datatype.id(), &value)};

if (status < 0)
{
Expand All @@ -27,20 +31,19 @@ namespace lue::hdf5 {
inline void read_attribute<std::string>(
Identifier const& id,
Datatype const& datatype,
Dataspace const& /* dataspace */,
[[maybe_unused]] Dataspace const& dataspace,
std::string& value)
{
static_assert(
std::is_same<std::string::value_type, char>::value,
"expect std::string::value_type to be char");
std::is_same_v<std::string::value_type, char>, "expect std::string::value_type to be char");

assert(datatype.encoding() == ::H5T_CSET_UTF8);
assert(datatype.encoding() == H5T_CSET_UTF8);

std::size_t const nr_bytes{datatype.size()};

value.resize(nr_bytes, 'x');

::herr_t const status{::H5Aread(id, datatype.id(), value.data())};
herr_t const status{H5Aread(id, datatype.id(), value.data())};
assert(value.size() == nr_bytes);

if (status < 0)
Expand All @@ -51,14 +54,14 @@ namespace lue::hdf5 {


template<typename T>
inline void read_attribute(
void read_attribute(
Identifier const& id, Datatype const& datatype, Dataspace const& dataspace, std::vector<T>& value)
{
::hssize_t const nr_elements{dataspace.nr_elements()};
hssize_t const nr_elements{dataspace.nr_elements()};

value.resize(nr_elements);

::herr_t const status{::H5Aread(id, datatype.id(), value.data())};
herr_t const status{H5Aread(id, datatype.id(), value.data())};
assert(value.size() == static_cast<std::size_t>(nr_elements));

if (status < 0)
Expand All @@ -69,10 +72,10 @@ namespace lue::hdf5 {


template<typename T>
inline std::enable_if_t<!std::is_base_of<std::vector<::hsize_t>, T>::value> write_attribute(
Identifier const& id, Datatype const& datatype, T const& value)
requires(!std::is_base_of_v<std::vector<::hsize_t>, T>)
void write_attribute(Identifier const& id, Datatype const& datatype, T const& value)
{
::herr_t const status{::H5Awrite(id, datatype.id(), &value)};
herr_t const status{H5Awrite(id, datatype.id(), &value)};

if (status < 0)
{
Expand All @@ -85,7 +88,7 @@ namespace lue::hdf5 {
inline void write_attribute<std::string>(
Identifier const& id, Datatype const& datatype, std::string const& value)
{
::herr_t const status{::H5Awrite(id, datatype.id(), value.c_str())};
herr_t const status{H5Awrite(id, datatype.id(), value.c_str())};

if (status < 0)
{
Expand All @@ -95,10 +98,9 @@ namespace lue::hdf5 {


template<typename T>
inline void write_attribute(
Identifier const& id, Datatype const& datatype, std::vector<T> const& value)
void write_attribute(Identifier const& id, Datatype const& datatype, std::vector<T> const& value)
{
::herr_t const status{::H5Awrite(id, datatype.id(), value.data())};
herr_t const status{H5Awrite(id, datatype.id(), value.data())};

if (status < 0)
{
Expand All @@ -119,23 +121,23 @@ namespace lue::hdf5 {

Attribute(Identifier const& location, std::string const& name);

Attribute(Attribute const&) = default;
Attribute(Attribute const& other) = default;

Attribute(Attribute&&) = default;
Attribute(Attribute&& other) = default;

Attribute(Identifier&& id);

~Attribute() = default;

auto operator=(Attribute const&) -> Attribute& = default;
auto operator=(Attribute const& other) -> Attribute& = default;

auto operator=(Attribute&&) -> Attribute& = default;
auto operator=(Attribute&& other) -> Attribute& = default;

[[nodiscard]] auto id() const -> Identifier const&;
auto id() const -> Identifier const&;

[[nodiscard]] auto datatype() const -> Datatype const&;
auto datatype() const -> Datatype const&;

[[nodiscard]] auto dataspace() const -> Dataspace const&;
auto dataspace() const -> Dataspace const&;


/*!
Expand Down Expand Up @@ -195,11 +197,11 @@ namespace lue::hdf5 {
};


LUE_HDF5_EXPORT Attribute create_attribute(
LUE_HDF5_EXPORT auto create_attribute(
Identifier const& location,
std::string const& name,
Datatype const& datatype,
Dataspace const& dataspace);
Dataspace const& dataspace) -> Attribute;


/*!
Expand All @@ -215,11 +217,11 @@ namespace lue::hdf5 {
overload for std::vector<T> for Shape, for example.
*/
template<typename T>
inline std::enable_if_t<!std::is_base_of<std::vector<hsize_t>, T>::value, Attribute> create_attribute(
Identifier const& location, std::string const& name, T const& value)
requires(!std::is_base_of_v<std::vector<hsize_t>, T>)
auto create_attribute(Identifier const& location, std::string const& name, T const& value) -> Attribute
{
Datatype const datatype{NativeDatatypeTraits<T>::type_id()};
Dataspace const dataspace{::H5S_SCALAR};
Dataspace const dataspace{H5S_SCALAR};
Attribute attribute{create_attribute(location, name, datatype, dataspace)};

attribute.write(value);
Expand All @@ -233,7 +235,7 @@ namespace lue::hdf5 {
Identifier const& location, std::string const& name, std::string const& value) -> Attribute
{
Datatype const datatype{create_datatype(value.size())};
Dataspace const dataspace{Dataspace{::H5S_SCALAR}};
Dataspace const dataspace{Dataspace{H5S_SCALAR}};
Attribute attribute{create_attribute(location, name, datatype, dataspace)};

attribute.write(value);
Expand All @@ -243,8 +245,8 @@ namespace lue::hdf5 {


template<typename T>
inline Attribute create_attribute(
Identifier const& location, std::string const& name, std::vector<T> const& value)
auto create_attribute(Identifier const& location, std::string const& name, std::vector<T> const& value)
-> Attribute
{
Datatype const datatype{Datatype{NativeDatatypeTraits<T>::type_id()}};
Dataspace const dataspace{create_dataspace(Shape{value.size()})};
Expand Down
8 changes: 4 additions & 4 deletions source/data_model/hdf5/include/lue/hdf5/attributes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace lue::hdf5 {

public:

explicit Attributes(Identifier const& id);
explicit Attributes(Identifier id);

auto add(std::string const& name, Datatype const& file_datatype, Dataspace const& dataspace)
-> Attribute;
Expand Down Expand Up @@ -51,11 +51,11 @@ namespace lue::hdf5 {
}


[[nodiscard]] auto exists(std::string const& name) const -> bool;
auto exists(std::string const& name) const -> bool;

[[nodiscard]] auto attribute(std::string const& name) const -> Attribute;
auto attribute(std::string const& name) const -> Attribute;

[[nodiscard]] auto datatype(std::string const& name) const -> Datatype;
auto datatype(std::string const& name) const -> Datatype;

private:

Expand Down
34 changes: 16 additions & 18 deletions source/data_model/hdf5/include/lue/hdf5/chunk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,28 @@
#include "lue/hdf5/shape.hpp"


namespace lue {
namespace hdf5 {
namespace lue::hdf5 {

std::size_t lower_chunk_size_limit();
auto lower_chunk_size_limit() -> std::size_t;

std::size_t upper_chunk_size_limit();
auto upper_chunk_size_limit() -> std::size_t;

LUE_HDF5_EXPORT Shape chunk_shape(Shape const& value_shape, std::size_t size_of_element);
LUE_HDF5_EXPORT auto chunk_shape(Shape const& value_shape, std::size_t size_of_element) -> Shape;

Shape::value_type size_of_chunk(Shape const& chunk, std::size_t size_of_element);
auto size_of_chunk(Shape const& chunk, std::size_t size_of_element) -> Shape::value_type;


template<typename T>
inline Shape chunk_shape(Shape const& value_shape)
{
return chunk_shape(value_shape, sizeof(T));
}
template<typename T>
auto chunk_shape(Shape const& value_shape) -> Shape
{
return chunk_shape(value_shape, sizeof(T));
}


template<typename T>
inline Shape::value_type size_of_chunk(Shape const& value_shape)
{
return size_of_chunk(value_shape, sizeof(T));
}
template<typename T>
auto size_of_chunk(Shape const& value_shape) -> Shape::value_type
{
return size_of_chunk(value_shape, sizeof(T));
}

} // namespace hdf5
} // namespace lue
} // namespace lue::hdf5
Loading
Loading