working around an unusual encounter when the joined_dim has actual value "max::size_t - 1"#1740
Conversation
| "[ADIOS2] Dataset access out of bounds."); | ||
| "[ADIOS2] Offset must be an empty vector in case of " | ||
| "joined " | ||
| "array."); |
There was a problem hiding this comment.
This duplicates the condition checked in the if branch from line 492 to 509.
Can't we just change the if condition in line 492 to:
if (joinedDim.has_value() || var.ShapeID() == adios2::ShapeID::JoinedArray)This would be a single-line change and do basically the same
There was a problem hiding this comment.
It will break the for loop at 500
There was a problem hiding this comment.
That issue only comes up when joinedDim.has_value() is false, but var.ShapeID() == adios2::ShapeID::JoinedArray is true, which we should treat as an error anyway?
I think I'll add a check for that circumstance.
guj
left a comment
There was a problem hiding this comment.
It will break the for loop at 500
| "[ADIOS2] Dataset access out of bounds."); | ||
| "[ADIOS2] Offset must be an empty vector in case of " | ||
| "joined " | ||
| "array."); |
There was a problem hiding this comment.
It will break the for loop at 500
|
I went through the implementation of joined arrays again and added some further safety guards. I think that I might have an idea on what's going on in your crashing simulations: Joined arrays were until now ignored in the |
b4be4a4 to
8c9845a
Compare
|
@guj Can you try if you still observe the crashes with the recent commits on this PR? I hope that I might have found and fixed the issue. |
Found and fixed the bug |
|
CI failures due to deployment of CMake 4.0 to CI runners, will be fixed with #1742. I'll select the bugfix for the double-write from unique-pointers into a separate PR as it has nothing to do with this PR. Will rebase this onto that then. |
de6838b to
9eb620f
Compare
The test job was finally scheduled. Yes this version works! |
OK I will submit another test to double check. |
Nice, thanks for checking!
I think it should not alter your use case since that's an entirely different issue, but feel free to run a test anyway |
9eb620f to
ef62f62
Compare
This one passed too |
value "max::size_t - 1"
for more information, see https://pre-commit.ci
ef62f62 to
240e25f
Compare
…lue "max::size_t - 1" (openPMD#1740) * working around an unusal encounter when the joined_dim has actual value "max::size_t - 1" * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add test for redundant resetDataset() * Merge check into above logic * Better error messages in verifyDataset * Add further safety guards to createDataset and extendDataset tasks * Move joinedDim logic into middle-end for extendDataset * Update include/openPMD/IO/ADIOS/ADIOS2IOHandler.hpp --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Franz Pöschel <franz.poeschel@gmail.com>
…lue "max::size_t - 1" (openPMD#1740) * working around an unusal encounter when the joined_dim has actual value "max::size_t - 1" * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add test for redundant resetDataset() * Merge check into above logic * Better error messages in verifyDataset * Add further safety guards to createDataset and extendDataset tasks * Move joinedDim logic into middle-end for extendDataset * Update include/openPMD/IO/ADIOS/ADIOS2IOHandler.hpp --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Franz Pöschel <franz.poeschel@gmail.com>
* Fix: Late unique_ptr puts without CLOSE_FILE or ADVANCE operations (#1744) * Add failing test * Add failing test * Revert "Add failing test" This reverts commit 5e04ece. * Reactivate writing from unique_ptr in finalize() * BP5+groupbased: allow only up to 100 steps (#1732) * BP5+groupbased: allow only up to 1000 steps * Configure this via env variable OPENPMD_BP5_GROUPENCODING_MAX_STEPS=1000 * Add documentation * Lower limit to 100 * Add compile-time check for #1720 (#1722) * WarpX: Repo Moved (#1733) Update a link to WarpX. * Fix zero-sized storeChunk for Span API in Python (#1738) * working around an unusual encounter when the joined_dim has actual value "max::size_t - 1" (#1740) * working around an unusal encounter when the joined_dim has actual value "max::size_t - 1" * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add test for redundant resetDataset() * Merge check into above logic * Better error messages in verifyDataset * Add further safety guards to createDataset and extendDataset tasks * Move joinedDim logic into middle-end for extendDataset * Update include/openPMD/IO/ADIOS/ADIOS2IOHandler.hpp --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Franz Pöschel <franz.poeschel@gmail.com> * ADIOS2 bugfix: Always use CurrentStep() in mode::Read (#1749) * Always use CurrentStep() in mode::Read * Remove manual step counting m_currentStep only necessary for SetStepSelection, it seems * Clean up logic that is no longer needed * Add test --------- Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> Co-authored-by: Junmin Gu <guj@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
from time to time, I see exception was caught for joined array cases here:
for (unsigned int i = 0; i < actualDim; i++)
{
if (!(joinedDim.has_value() && *joinedDim == i) &&
offset[i] + extent[i] > shape[I])
}
because offset is given as {} for joined array variable.
the shape of the joined var is 18446744073709551615
joined array:
- particle variable is initialized to openPMD::Dataset::JOINED_DIMENSION
- Dataset.hpp: JOINED_DIMENSION = std::numeric_limitsstd::uint64_t::max()
- ADIOS2IOHandler.cpp: finding if (dims[i] == adios2::JoinedDim)
- ADIOSTypes.h: constexpr uint64_t JoinedDim = MaxU64 - 1;
The reason it reached here is because the joined dimension from ADIOS is 18446744073709551614, one less than the supposed max of size_t, 18446744073709551615 , which is the shape of the variable.
This pull request checked the variable shape ID and acknowledge as joined array if adios2::ShapeID::JoinedArary is returned.