Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Dec 16, 2024
1 parent d255eaa commit 058dc4c
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 19 deletions.
7 changes: 6 additions & 1 deletion include/openPMD/IO/ADIOS/ADIOS2IOHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,8 @@ class ADIOS2IOHandlerImpl
Offset const &offset,
Extent const &extent,
adios2::IO &IO,
std::string const &varName)
std::string const &varName,
std::optional<size_t> stepSelection)
{
{
auto requiredType = adios2::GetType<T>();
Expand All @@ -461,6 +462,10 @@ class ADIOS2IOHandlerImpl
throw std::runtime_error(
"[ADIOS2] Internal error: Failed opening ADIOS2 variable.");
}
if (stepSelection.has_value())
{
var.SetStepSelection({*stepSelection, 1});
}
// TODO leave this check to ADIOS?
adios2::Dims shape = var.Shape();
auto actualDim = shape.size();
Expand Down
20 changes: 12 additions & 8 deletions src/IO/ADIOS/ADIOS2File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,8 @@ void DatasetReader::call(
std::string const &fileName,
std::optional<size_t> stepSelection)
{
adios2::Variable<T> var =
impl->verifyDataset<T>(bp.param.offset, bp.param.extent, IO, bp.name);
if (stepSelection.has_value())
{
var.SetStepSelection({*stepSelection, 1});
}
adios2::Variable<T> var = impl->verifyDataset<T>(
bp.param.offset, bp.param.extent, IO, bp.name, stepSelection);
if (!var)
{
throw std::runtime_error(
Expand Down Expand Up @@ -96,7 +92,11 @@ void WriteDataset::call(ADIOS2File &ba, detail::BufferedPut &bp)
auto ptr = static_cast<T const *>(arg.get());

adios2::Variable<T> var = ba.m_impl->verifyDataset<T>(
bp.param.offset, bp.param.extent, ba.m_IO, bp.name);
bp.param.offset,
bp.param.extent,
ba.m_IO,
bp.name,
std::nullopt);

ba.getEngine().Put(var, ptr);
}
Expand Down Expand Up @@ -160,7 +160,11 @@ struct RunUniquePtrPut
{
auto ptr = static_cast<T const *>(bufferedPut.data.get());
adios2::Variable<T> var = ba.m_impl->verifyDataset<T>(
bufferedPut.offset, bufferedPut.extent, ba.m_IO, bufferedPut.name);
bufferedPut.offset,
bufferedPut.extent,
ba.m_IO,
bufferedPut.name,
std::nullopt);
ba.getEngine().Put(var, ptr);
}

Expand Down
4 changes: 2 additions & 2 deletions src/IO/ADIOS/ADIOS2IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,7 @@ namespace detail
auto &IO = ba.m_IO;
auto &engine = ba.getEngine();
adios2::Variable<T> variable = impl->verifyDataset<T>(
params.offset, params.extent, IO, varName);
params.offset, params.extent, IO, varName, std::nullopt);
adios2::Dims offset(params.offset.begin(), params.offset.end());
adios2::Dims extent(params.extent.begin(), params.extent.end());
variable.SetSelection({std::move(offset), std::move(extent)});
Expand Down Expand Up @@ -1439,7 +1439,7 @@ void ADIOS2IOHandlerImpl::readAttributeAllsteps(
auto engine = IO.Open(fullPath(*file), adios2::Mode::Read);
auto status = engine.BeginStep();
auto type = detail::attributeInfo(IO, name, /* verbose = */ true);
switchAdios2AttributeType<ReadAttributeAllsteps>(
switchType<ReadAttributeAllsteps>(
type, IO, engine, name, status, *param.resource);
engine.Close();
}
Expand Down
5 changes: 4 additions & 1 deletion src/IO/AbstractIOHandlerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,10 @@ std::future<void> AbstractIOHandlerImpl::flush()
i.writable->parent,
"->",
i.writable,
"] READ_DATASET");
"] READ_DATASET, offset=",
[&parameter]() { return vec_as_string(parameter.offset); },
", extent=",
[&parameter]() { return vec_as_string(parameter.extent); });
readDataset(i.writable, parameter);
break;
}
Expand Down
17 changes: 15 additions & 2 deletions src/IO/IOTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,23 @@ namespace internal
case Operation::AVAILABLE_CHUNKS:
return "AVAILABLE_CHUNKS";
break;
default:
return "unknown";
case Operation::CHECK_FILE:
return "CHECK_FILE";
break;
case Operation::READ_ATT_ALLSTEPS:
return "READ_ATT_ALLSTEPS";
break;
case Operation::DEREGISTER:
return "DEREGISTER";
break;
case Operation::TOUCH:
return "TOUCH";
break;
case Operation::SET_WRITTEN:
return "SET_WRITTEN";
break;
}
return "unknown";
}
} // namespace internal

Expand Down
3 changes: 2 additions & 1 deletion src/Iteration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ void Iteration::readGorVBased(
Parameter<Operation::ADVANCE> param;
param.mode = Parameter<Operation::ADVANCE>::StepSelection{
randomAccess.step};
IOHandler()->enqueue(IOTask(this, std::move(param)));
IOHandler()->enqueue(
IOTask(&retrieveSeries().writable(), std::move(param)));
},
},
doBeginStep);
Expand Down
12 changes: 8 additions & 4 deletions src/Series.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ void Series::flushGorVBased(
Parameter<Operation::ADVANCE> param;
param.mode = Parameter<Operation::ADVANCE>::StepSelection{
series.m_snapshotToStep.at(it->first)};
IOHandler()->enqueue(IOTask(&it->second, std::move(param)));
IOHandler()->enqueue(IOTask(this, std::move(param)));
}
it->second.flush(flushParams);
break;
Expand Down Expand Up @@ -2196,9 +2196,13 @@ creating new iterations.
* must happen after opening the first step.
*/
internal::BeginStep beginStep = randomAccessSteps()
? internal::
BeginStep{internal::BeginStepTypes::BeginStepRandomAccess{
series.m_snapshotToStep.at(it)}}
? (series.m_snapshotToStep.empty()
? internal::BeginStep{internal::BeginStepTypes::
DontBeginStep{}}
: internal::BeginStep{internal::BeginStepTypes::
BeginStepRandomAccess{
series.m_snapshotToStep.at(
it)}})
: internal::BeginStep{
internal::BeginStepTypes::BeginStepSynchronously{}};
if (auto err = internal::withRWAccess(
Expand Down

0 comments on commit 058dc4c

Please sign in to comment.