Skip to content

Commit

Permalink
Merge pull request #1131 from pnorbert/bpls
Browse files Browse the repository at this point in the history
Return one block for a Global Array which is made from Local Values a…
  • Loading branch information
pnorbert authored Feb 5, 2019
2 parents 1ea1f2c + 16d3f7e commit 6fde1d9
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
13 changes: 13 additions & 0 deletions source/adios2/toolkit/format/bp3/BP3Deserializer.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,8 @@ std::vector<typename core::Variable<T>::Info> BP3Deserializer::BlocksInfoCommon(
std::vector<typename core::Variable<T>::Info> blocksInfo;
blocksInfo.reserve(blocksIndexOffsets.size());

size_t n = 0;

for (const size_t blockIndexOffset : blocksIndexOffsets)
{
size_t position = blockIndexOffset;
Expand Down Expand Up @@ -1047,8 +1049,19 @@ std::vector<typename core::Variable<T>::Info> BP3Deserializer::BlocksInfoCommon(
blockInfo.Min = blockCharacteristics.Statistics.Min;
blockInfo.Max = blockCharacteristics.Statistics.Max;
}
if (blockInfo.Shape.size() == 1 &&
blockInfo.Shape.front() == LocalValueDim)
{
blockInfo.Shape = Dims{blocksIndexOffsets.size()};
blockInfo.Count = Dims{1};
blockInfo.Start = Dims{n};
blockInfo.Min = blockCharacteristics.Statistics.Value;
blockInfo.Max = blockCharacteristics.Statistics.Value;
++n;
}
blocksInfo.push_back(blockInfo);
}

return blocksInfo;
}

Expand Down
12 changes: 8 additions & 4 deletions source/utils/bpls/bpls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,11 @@ int printVariableInfo(core::Engine *fp, core::IO *io,
enum ADIOS_DATATYPES adiosvartype = type_to_enum(variable->m_Type);
int retval = 0;

if (!variable->m_SingleValue || nsteps > 1)
bool isGlobalValue = (nsteps == 0);
isGlobalValue &= variable->m_SingleValue;
isGlobalValue &= !(variable->m_ShapeID == ShapeID::GlobalArray);

if (!isGlobalValue)
{
fprintf(outf, " ");
if (nsteps > 1)
Expand Down Expand Up @@ -808,7 +812,7 @@ int printVariableInfo(core::Engine *fp, core::IO *io,
}
else
{
// scalar
// single GlobalValue without timesteps
fprintf(outf, " scalar");
if (longopt)
{
Expand Down Expand Up @@ -1629,8 +1633,8 @@ int readVarBlock(core::Engine *fp, core::IO *io, core::Variable<T> *variable,
// data)
uint64_t actualreadn; // our decision how much to read at once
uint64_t readn[MAX_DIMS]; // how big chunk to read in in each dimension?
bool incdim; // used in incremental reading in
int ndigits_dims[32]; // # of digits (to print) of each dimension
bool incdim; // used in incremental reading in
int ndigits_dims[32]; // # of digits (to print) of each dimension

const size_t elemsize = variable->m_ElementSize;
const int nsteps = static_cast<int>(variable->GetAvailableStepsCount());
Expand Down
2 changes: 1 addition & 1 deletion testing/utils/TestUtilsCWriter.bplsla.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
unsigned int aU32 attr = 2147483648
unsigned char aU8 attr = 128
string name attr = "TestUtilsCWrite"
int nproc scalar = 1
int nproc scalar = 1 / 1
int nwriters attr = 1
unsigned short shape2D attr = {4, 5}
string strarray attr = {"first", "second", "third", "fourth"}
Expand Down
2 changes: 1 addition & 1 deletion testing/utils/TestUtilsCWriter.bplsldDav.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ File info:
unsigned int aU32 attr = 2147483648
unsigned char aU8 attr = 128
string name attr = "TestUtilsCWrite"
int nproc scalar = 1
int nproc scalar = 1 / 1
step 0: 1 instances available
1
int nwriters attr = 1
Expand Down
2 changes: 1 addition & 1 deletion testing/utils/TestUtilsCWriter.bplsldDavvv.expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ set selection: start = { 0 0 } count = { 4 5 }
unsigned int aU32 attr = 2147483648
unsigned char aU8 attr = 128
string name attr = "TestUtilsCWrite"
int nproc scalar = 1
int nproc scalar = 1 / 1
step 0: 1 instances available
1
int nwriters attr = 1
Expand Down

0 comments on commit 6fde1d9

Please sign in to comment.