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

Add BlocksInfo in SSC naive #3194

Merged
merged 8 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 8 additions & 8 deletions source/adios2/engine/ssc/SscReaderGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ StepStatus SscReaderGeneric::BeginStep(const StepMode stepMode,
#undef declare_type
else
{
helper::Log("Engine", "SscReader", "BeginStep",
helper::Log("Engine", "SscReaderGeneric", "BeginStep",
"unknown data type", m_ReaderRank, m_ReaderRank,
0, m_Verbosity, helper::FATALERROR);
}
Expand Down Expand Up @@ -266,10 +266,10 @@ void SscReaderGeneric::PerformGets()
{
if (b.type == DataType::None)
{
helper::Log("Engine", "SscReader", "PerformGets",
"unknown data type", m_ReaderRank,
m_ReaderRank, 0, m_Verbosity,
helper::FATALERROR);
helper::Log("Engine", "SscReaderGeneric",
"PerformGets", "unknown data type",
m_ReaderRank, m_ReaderRank, 0,
m_Verbosity, helper::FATALERROR);
}
else if (b.type == DataType::String)
{
Expand Down Expand Up @@ -559,9 +559,9 @@ void SscReaderGeneric::GetDeferred(VariableBase &variable, void *data)
}
else
{
helper::Log("Engine", "SscReader", "GetDeferredCommon",
"unknown ShapeID", m_ReaderRank,
m_ReaderRank, 0, m_Verbosity,
helper::Log("Engine", "SscReaderGeneric",
"GetDeferredCommon", "unknown ShapeID",
m_ReaderRank, m_ReaderRank, 0, m_Verbosity,
helper::LogMode::FATALERROR);
}
}
Expand Down
1 change: 0 additions & 1 deletion source/adios2/engine/ssc/SscReaderGeneric.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ std::vector<typename Variable<T>::BPInfo>
SscReaderGeneric::BlocksInfoCommon(const Variable<T> &variable,
const size_t step) const
{

std::vector<typename Variable<T>::BPInfo> ret;

for (const auto &r : m_GlobalWritePattern)
Expand Down
44 changes: 44 additions & 0 deletions source/adios2/engine/ssc/SscReaderNaive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,50 @@ StepStatus SscReaderNaive::BeginStep(const StepMode stepMode,
pos, b, m_IO, true);
b.bufferStart += start;
m_BlockMap[b.name].push_back(b);
if (b.shapeId == ShapeID::GlobalValue ||
b.shapeId == ShapeID::LocalValue)
{
std::vector<char> value(b.bufferCount);
std::memcpy(value.data(), b.value.data(), b.value.size());

if (b.type == DataType::String)
{
auto variable =
m_IO.InquireVariable<std::string>(b.name);
if (variable)
{
variable->m_Value =
std::string(value.begin(), value.end());
variable->m_Min =
std::string(value.begin(), value.end());
variable->m_Max =
std::string(value.begin(), value.end());
}
}
#define declare_type(T) \
else if (b.type == helper::GetDataType<T>()) \
{ \
auto variable = m_IO.InquireVariable<T>(b.name); \
if (variable) \
{ \
std::memcpy(reinterpret_cast<char *>(&variable->m_Min), \
value.data(), value.size()); \
std::memcpy(reinterpret_cast<char *>(&variable->m_Max), \
value.data(), value.size()); \
std::memcpy(reinterpret_cast<char *>(&variable->m_Value), \
value.data(), value.size()); \
} \
}
ADIOS2_FOREACH_STDTYPE_1ARG(declare_type)
#undef declare_type
else
{
helper::Log("Engine", "SscReaderNaive", "BeginStep",
"unknown data type", m_ReaderRank,
m_ReaderRank, 0, m_Verbosity,
helper::FATALERROR);
}
}
}
}
}
Expand Down
28 changes: 28 additions & 0 deletions source/adios2/engine/ssc/SscReaderNaive.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,34 @@ SscReaderNaive::BlocksInfoCommon(const Variable<T> &variable,
const size_t step) const
{
std::vector<typename Variable<T>::BPInfo> ret;
auto it = m_BlockMap.find(variable.m_Name);
if (it != m_BlockMap.end())
{
for (const auto &v : it->second)
{
ret.emplace_back();
auto &b = ret.back();
b.Start = v.start;
b.Count = v.count;
b.Shape = v.shape;
b.Step = m_CurrentStep;
b.StepsStart = m_CurrentStep;
b.StepsCount = 1;
if (m_IO.m_ArrayOrder != ArrayOrdering::RowMajor)
{
std::reverse(b.Start.begin(), b.Start.end());
std::reverse(b.Count.begin(), b.Count.end());
std::reverse(b.Shape.begin(), b.Shape.end());
}
if (v.shapeId == ShapeID::GlobalValue ||
v.shapeId == ShapeID::LocalValue)
{
b.IsValue = true;
std::memcpy(reinterpret_cast<char *>(&b.Value), v.value.data(),
v.value.size());
}
}
}
return ret;
}

Expand Down
Loading