Skip to content

Commit

Permalink
Merge pull request #3194 from JasonRuonanWang/ssc
Browse files Browse the repository at this point in the history
Add BlocksInfo in SSC naive
  • Loading branch information
JasonRuonanWang committed May 2, 2022
2 parents 49c13c0 + 8ceba51 commit d5c30c3
Show file tree
Hide file tree
Showing 9 changed files with 453 additions and 416 deletions.
16 changes: 8 additions & 8 deletions source/adios2/engine/ssc/SscReaderGeneric.cpp
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
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
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
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

0 comments on commit d5c30c3

Please sign in to comment.