Skip to content

Commit

Permalink
Merge pull request #1682 from williamfgc/blockinfo_rank
Browse files Browse the repository at this point in the history
Blockinfo rank
  • Loading branch information
williamfgc authored Aug 15, 2019
2 parents 6ceccc2 + d1becda commit e3ae2f9
Show file tree
Hide file tree
Showing 8 changed files with 298 additions and 273 deletions.
2 changes: 2 additions & 0 deletions bindings/CXX11/adios2/cxx11/Engine.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ ToBlocksInfo(const std::vector<typename core::Variable<
// blockInfo.m_Info = &coreBlockInfo;
blockInfo.Start = coreBlockInfo.Start;
blockInfo.Count = coreBlockInfo.Count;
blockInfo.WriterID = coreBlockInfo.WriterID;

blockInfo.IsValue = coreBlockInfo.IsValue;
blockInfo.IsReverseDims = coreBlockInfo.IsReverseDims;
if (blockInfo.IsValue)
Expand Down
6 changes: 4 additions & 2 deletions bindings/CXX11/adios2/cxx11/Variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ class Variable
IOType Max = IOType();
/** block Value, if IsValue is true */
IOType Value = IOType();
/** true: value, false: array */
bool IsValue = false;
/** WriterID, source for stream ID that produced this block */
int WriterID = 0;
/** blockID for Block Selection */
size_t BlockID = 0;
/** block corresponding step */
Expand All @@ -350,6 +350,8 @@ class Variable
const T *Data() const;
/** true: Dims were swapped from column-major, false: not swapped */
bool IsReverseDims = false;
/** true: value, false: array */
bool IsValue = false;

// allow Engine to set m_Info
friend class Engine;
Expand Down
8 changes: 6 additions & 2 deletions bindings/CXX11/adios2/cxx11/Variable.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ ToBlocksInfo(const std::vector<typename core::Variable<
typename Variable<T>::Info blockInfo;
blockInfo.Start = coreBlockInfo.Start;
blockInfo.Count = coreBlockInfo.Count;
blockInfo.BlockID = coreBlockInfo.BlockID;
blockInfo.Step = coreBlockInfo.Step;
blockInfo.WriterID = coreBlockInfo.WriterID;

blockInfo.IsReverseDims = coreBlockInfo.IsReverseDims;
blockInfo.IsValue = coreBlockInfo.IsValue;

if (blockInfo.IsValue)
{
blockInfo.Value = coreBlockInfo.Value;
Expand All @@ -48,8 +53,7 @@ ToBlocksInfo(const std::vector<typename core::Variable<
blockInfo.Min = coreBlockInfo.Min;
blockInfo.Max = coreBlockInfo.Max;
}
blockInfo.BlockID = coreBlockInfo.BlockID;
blockInfo.Step = coreBlockInfo.Step;

blocksInfo.push_back(blockInfo);
}

Expand Down
1 change: 1 addition & 0 deletions source/adios2/core/Variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class Variable : public VariableBase
T Value = T();
T *BufferP = nullptr;
std::vector<T> BufferV;
int WriterID = 0;
SelectionType Selection = SelectionType::BoundingBox;
bool IsValue = false;
bool IsReverseDims = false;
Expand Down
1 change: 1 addition & 0 deletions source/adios2/toolkit/format/bp3/BP3Deserializer.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,7 @@ std::vector<typename core::Variable<T>::Info> BP3Deserializer::BlocksInfoCommon(
blockInfo.Shape = blockCharacteristics.Shape;
blockInfo.Start = blockCharacteristics.Start;
blockInfo.Count = blockCharacteristics.Count;
blockInfo.WriterID = blockCharacteristics.Statistics.FileIndex;
blockInfo.IsReverseDims = m_ReverseDimensions;

if (m_ReverseDimensions)
Expand Down
1 change: 1 addition & 0 deletions source/adios2/toolkit/format/bp4/BP4Deserializer.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,7 @@ std::vector<typename core::Variable<T>::Info> BP4Deserializer::BlocksInfoCommon(
blockInfo.Shape = blockCharacteristics.Shape;
blockInfo.Start = blockCharacteristics.Start;
blockInfo.Count = blockCharacteristics.Count;
blockInfo.WriterID = blockCharacteristics.Statistics.FileIndex;
blockInfo.IsReverseDims = m_ReverseDimensions;

if (m_ReverseDimensions)
Expand Down
2 changes: 2 additions & 0 deletions testing/adios2/engine/bp/TestBPWriteReadBlockInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ void CheckAllStepsBlockInfo1D(
EXPECT_EQ(allStepsBlocksInfo[s][b].Start[0], b * Nx);
EXPECT_EQ(allStepsBlocksInfo[s][b].Count[0], Nx);
EXPECT_EQ(allStepsBlocksInfo[s][b].Step, s);
EXPECT_EQ(allStepsBlocksInfo[s][b].WriterID, b);
EXPECT_FALSE(allStepsBlocksInfo[s][b].IsReverseDims);
}
}
Expand All @@ -67,6 +68,7 @@ void CheckAllStepsBlockInfo2D(
EXPECT_EQ(allStepsBlocksInfo[s][b].Count[0], Ny);
EXPECT_EQ(allStepsBlocksInfo[s][b].Count[1], Nx);
EXPECT_EQ(allStepsBlocksInfo[s][b].Step, s);
EXPECT_EQ(allStepsBlocksInfo[s][b].WriterID, b);
EXPECT_FALSE(allStepsBlocksInfo[s][b].IsReverseDims);
}
}
Expand Down
Loading

0 comments on commit e3ae2f9

Please sign in to comment.