Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Unify Random-Access API and Streaming API into Series::snapshots() #1592

Open
wants to merge 97 commits into
base: dev
Choose a base branch
from

Conversation

franzpoeschel
Copy link
Contributor

@franzpoeschel franzpoeschel commented Jan 29, 2024

description soon

TODO:

  • Merge Filename extensions: Allow specifying wildcards #1584 first
  • Better logic for READ_WRITE mode
  • backwards compatibility: using definitions, empty headers
  • documentation, change examples
  • maybe snapshots(Snapshots::RandomAccess) vs snapshots(Snapshots::CollectiveAccess) or so
  • Follow-up: Container API: How to deal with erased Iterations? Answer: Iterations currently only being closed, not erased. Problem for later.
  • snapshots().begin() -> reset to start, add sth like snapshots().current()
  • Follow-up: Flush open iterations instead of dirty iterations.
  • default: defer_iteration_parsing in READ_LINEAR mode
  • Check that the last iteration is closed implicitly upon destruction
  • follow-up: delete closed iterations in Append mode

Diff: franzpoeschel/openPMD-api@shared-attributable-data...topic-iterator

src/Series.cpp Fixed Show fixed Hide fixed
Comment on lines 100 to 235
switch (series.iterationEncoding())
{
using IE = IterationEncoding;
case IE::fileBased:
series.readFileBased();
break;
case IE::groupBased:
case IE::variableBased: {
Parameter<Operation::OPEN_FILE> fOpen;
fOpen.name = series.get().m_name;
series.IOHandler()->enqueue(IOTask(&series, fOpen));
series.IOHandler()->flush(internal::defaultFlushParams);
using PP = Parameter<Operation::OPEN_FILE>::ParsePreference;
switch (*fOpen.out_parsePreference)
{
case PP::PerStep:
series.advance(AdvanceMode::BEGINSTEP);
series.readGorVBased(
/* do_always_throw_errors = */ false, /* init = */ true);
break;
case PP::UpFront:
series.readGorVBased(
/* do_always_throw_errors = */ false, /* init = */ true);
/*
* In linear read mode (where no parsing at all is done upon
* constructing the Series), it might turn out after parsing
* that what we expected to be a group-based Series was in fact
* a single file of a file-based Series.
* (E.g. when opening "data00000100.h5" directly instead of
* "data%T.h5")
* So we need to check the current value of
* `iterationEncoding()` once more.
*/
if (series.iterationEncoding() != IterationEncoding::fileBased)
{
series.advance(AdvanceMode::BEGINSTEP);
}
break;
}
data.parsePreference = *fOpen.out_parsePreference;
break;
}
}

Check notice

Code scanning / CodeQL

Long switch case Note

Switch has at least one case that is too long:
variableBased (38 lines)
.
@franzpoeschel franzpoeschel force-pushed the topic-iterator branch 3 times, most recently from 3845ed7 to b5e4217 Compare February 16, 2024 13:35
@franzpoeschel franzpoeschel marked this pull request as ready for review February 23, 2024 15:37
src/Series.cpp Fixed Show fixed Hide fixed
src/Series.cpp Outdated
Access at,
std::string const &options,
// Either an MPI_Comm or none, the template works for both options
MPI_Communicator &&...comm)

Check notice

Code scanning / CodeQL

Unused local variable Note

Variable comm is not used.
test/CoreTest.cpp Fixed Show fixed Hide fixed
src/snapshots/ContainerImpls.cpp Fixed Show fixed Hide fixed
test/ParallelIOTest.cpp Fixed Show fixed Hide fixed
Comment on lines +88 to +117
// increment/decrement
// ChildClass &operator++();
// ChildClass &operator--();
// ChildClass &operator++(int);
// ChildClass &operator--(int);

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
Comment on lines +82 to +109
// dereference
// value_type const &operator*() const = 0;
// value_type &operator*() = 0;

Check notice

Code scanning / CodeQL

Commented-out code Note

This comment appears to contain commented-out code.
@@ -185,6 +196,7 @@
}
// ~Series intentionally not yet called

// std::cout << "READ " << filename << std::endl;

Check notice

Code scanning / CodeQL

Commented-out code Note test

This comment appears to contain commented-out code.
@@ -163,6 +173,7 @@
auxiliary::getEnvNum("OPENPMD_TEST_NFILES_MAX", 1030);
std::string filename =
"../samples/many_iterations/many_iterations_%T." + ext;
// std::cout << "WRITE " << filename << std::endl;

Check notice

Code scanning / CodeQL

Commented-out code Note test

This comment appears to contain commented-out code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants