Skip to content

Commit

Permalink
Merge pull request #3018 from JasonRuonanWang/operator
Browse files Browse the repository at this point in the history
removed identity operation
  • Loading branch information
JasonRuonanWang authored Jan 25, 2022
2 parents 3fd1ea7 + 8a168ce commit f6cf3d8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 66 deletions.
5 changes: 0 additions & 5 deletions source/adios2/toolkit/format/bp/bp3/BP3Deserializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,6 @@ class BP3Deserializer : virtual public BP3Base
BlocksInfoCommon(const core::Variable<T> &variable,
const std::vector<size_t> &blocksIndexOffsets) const;

template <class T>
bool IdentityOperation(
const std::vector<std::shared_ptr<core::Operator>> &operations) const
noexcept;

const helper::BlockOperationInfo &InitPostOperatorBlockData(
const std::vector<helper::BlockOperationInfo> &blockOperationsInfo)
const;
Expand Down
32 changes: 4 additions & 28 deletions source/adios2/toolkit/format/bp/bp3/BP3Deserializer.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -471,20 +471,13 @@ void BP3Deserializer::PreDataRead(
{
if (subStreamBoxInfo.OperationsInfo.size() > 0)
{
const bool identity = IdentityOperation<T>(blockInfo.Operations);

// if identity is true, just read the entire block content as-is
const helper::BlockOperationInfo &blockOperationInfo =
InitPostOperatorBlockData(subStreamBoxInfo.OperationsInfo);

if (!identity)
{
m_ThreadBuffers[threadID][1].resize(blockOperationInfo.PayloadSize,
'\0');
}
m_ThreadBuffers[threadID][1].resize(blockOperationInfo.PayloadSize,
'\0');

buffer = identity ? reinterpret_cast<char *>(blockInfo.Data)
: m_ThreadBuffers[threadID][1].data();
buffer = m_ThreadBuffers[threadID][1].data();

payloadSize = blockOperationInfo.PayloadSize;
payloadOffset = blockOperationInfo.PayloadOffset;
Expand All @@ -505,8 +498,7 @@ void BP3Deserializer::PostDataRead(
const helper::SubStreamBoxInfo &subStreamBoxInfo,
const bool isRowMajorDestination, const size_t threadID)
{
if (subStreamBoxInfo.OperationsInfo.size() > 0 &&
!IdentityOperation<T>(blockInfo.Operations))
if (subStreamBoxInfo.OperationsInfo.size() > 0)
{
const helper::BlockOperationInfo &blockOperationInfo =
InitPostOperatorBlockData(subStreamBoxInfo.OperationsInfo);
Expand Down Expand Up @@ -1114,22 +1106,6 @@ BP3Deserializer::BlocksInfoCommon(
return blocksInfo;
}

template <class T>
bool BP3Deserializer::IdentityOperation(
const std::vector<std::shared_ptr<core::Operator>> &operations) const
noexcept
{
bool identity = false;
for (const auto &op : operations)
{
if (op->m_TypeString == "identity")
{
identity = true;
}
}
return identity;
}

} // end namespace format
} // end namespace adios2

Expand Down
5 changes: 0 additions & 5 deletions source/adios2/toolkit/format/bp/bp4/BP4Deserializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,6 @@ class BP4Deserializer : virtual public BP4Base
BlocksInfoCommon(const core::Variable<T> &variable,
const std::vector<size_t> &blocksIndexOffsets) const;

template <class T>
bool IdentityOperation(
const std::vector<std::shared_ptr<core::Operator>> &operations) const
noexcept;

const helper::BlockOperationInfo &InitPostOperatorBlockData(
const std::vector<helper::BlockOperationInfo> &blockOperationsInfo)
const;
Expand Down
32 changes: 4 additions & 28 deletions source/adios2/toolkit/format/bp/bp4/BP4Deserializer.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -475,20 +475,13 @@ void BP4Deserializer::PreDataRead(
{
if (subStreamBoxInfo.OperationsInfo.size() > 0)
{
const bool identity = IdentityOperation<T>(blockInfo.Operations);

// if identity is true, just read the entire block content as-is
const helper::BlockOperationInfo &blockOperationInfo =
InitPostOperatorBlockData(subStreamBoxInfo.OperationsInfo);

if (!identity)
{
m_ThreadBuffers[threadID][1].resize(blockOperationInfo.PayloadSize,
'\0');
}
m_ThreadBuffers[threadID][1].resize(blockOperationInfo.PayloadSize,
'\0');

buffer = identity ? reinterpret_cast<char *>(blockInfo.Data)
: m_ThreadBuffers[threadID][1].data();
buffer = m_ThreadBuffers[threadID][1].data();

payloadSize = blockOperationInfo.PayloadSize;
payloadOffset = blockOperationInfo.PayloadOffset;
Expand All @@ -509,8 +502,7 @@ void BP4Deserializer::PostDataRead(
const helper::SubStreamBoxInfo &subStreamBoxInfo,
const bool isRowMajorDestination, const size_t threadID)
{
if (subStreamBoxInfo.OperationsInfo.size() > 0 &&
!IdentityOperation<T>(blockInfo.Operations))
if (subStreamBoxInfo.OperationsInfo.size() > 0)
{
const helper::BlockOperationInfo &blockOperationInfo =
InitPostOperatorBlockData(subStreamBoxInfo.OperationsInfo);
Expand Down Expand Up @@ -1210,22 +1202,6 @@ BP4Deserializer::BlocksInfoCommon(
return blocksInfo;
}

template <class T>
bool BP4Deserializer::IdentityOperation(
const std::vector<std::shared_ptr<core::Operator>> &operations) const
noexcept
{
bool identity = false;
for (const auto &op : operations)
{
if (op->m_TypeString == "identity")
{
identity = true;
}
}
return identity;
}

} // end namespace format
} // end namespace adios2

Expand Down

0 comments on commit f6cf3d8

Please sign in to comment.