Skip to content

Commit

Permalink
Enable More BP5 Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eisenhauer committed Sep 10, 2021
1 parent 5fcc669 commit bc3024a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 11 deletions.
2 changes: 2 additions & 0 deletions source/adios2/toolkit/format/bp5/BP5Deserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,8 @@ void BP5Deserializer::InstallMetaData(void *MetadataBlock, size_t BlockLen,
VarRec->Variable = ArrayVarSetup(
m_Engine, VarRec->VarName, VarRec->Type, meta_base->Dims,
meta_base->Shape, meta_base->Offsets, meta_base->Count);
static_cast<VariableBase *>(VarRec->Variable)->m_Engine =
m_Engine;
VarByKey[VarRec->Variable] = VarRec;
VarRec->LastTSAdded = Step; // starts at 1
}
Expand Down
9 changes: 8 additions & 1 deletion source/adios2/toolkit/format/bp5/BP5Serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "adios2/core/Attribute.h"
#include "adios2/core/IO.h"
#include "adios2/core/VariableBase.h"
#include "adios2/helper/adiosMemory.h"
#include "adios2/toolkit/format/buffer/ffs/BufferFFS.h"
#include <stddef.h> // max_align_t
Expand Down Expand Up @@ -453,12 +454,18 @@ void BP5Serializer::Marshal(void *Variable, const char *Name,
BufferV::BufferPos *Span)
{

core::VariableBase *VB = static_cast<core::VariableBase *>(Variable);

FFSMetadataInfoStruct *MBase;

BP5WriterRec Rec = LookupWriterRec(Variable);

bool DeferAddToVec;

if (VB->m_SingleValue)
{
DimCount = 0;
}
if (!Rec)
{
Rec = CreateWriterRec(Variable, Name, Type, ElemSize, DimCount);
Expand All @@ -482,7 +489,7 @@ void BP5Serializer::Marshal(void *Variable, const char *Name,
int AlreadyWritten = FFSBitfieldTest(MBase, Rec->FieldID);
FFSBitfieldSet(MBase, Rec->FieldID);

if (Rec->DimCount == 0)
if (VB->m_SingleValue)
{
if (Type != DataType::String)
memcpy((char *)(MetadataBuf) + Rec->MetaOffset, Data, ElemSize);
Expand Down
16 changes: 13 additions & 3 deletions source/utils/bpls/bpls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,14 @@ int doList(const char *path)
io.SetEngine(engineName);
try
{
fp = &io.Open(path, Mode::Read);
if (timestep)
{
fp = &io.Open(path, Mode::Read);
}
else
{
fp = &io.Open(path, Mode::ReadRandomAccess);
}
if (engineName == "FileStream")
{
filestream = true;
Expand Down Expand Up @@ -1550,8 +1557,11 @@ int doList(const char *path)
if (verbose)
{
printf("File info:\n");
printf(" of variables: %zu\n", io.GetVariables().size());
printf(" of attributes: %zu\n", io.GetAttributes().size());
if (!timestep)
{
printf(" of variables: %zu\n", io.GetVariables().size());
printf(" of attributes: %zu\n", io.GetAttributes().size());
}
// printf(" of meshes: %d\n", fp->nmeshes);
// print_file_size(fp->file_size);
// printf(" bp version: %d\n", fp->version);
Expand Down
4 changes: 2 additions & 2 deletions testing/adios2/engine/bp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ bp3_bp4_gtest_add_tests_helper(ChangingShape MPI_ALLOW)
bp3_bp4_gtest_add_tests_helper(WriteReadBlockInfo MPI_ALLOW)
bp_gtest_add_tests_helper(WriteReadVariableSpan MPI_ALLOW)
bp3_bp4_gtest_add_tests_helper(TimeAggregation MPI_ALLOW)
bp3_bp4_gtest_add_tests_helper(NoXMLRecovery MPI_ALLOW)
bp_gtest_add_tests_helper(NoXMLRecovery MPI_ALLOW)
bp3_bp4_gtest_add_tests_helper(StepsFileGlobalArray MPI_ALLOW)
bp3_bp4_gtest_add_tests_helper(StepsFileLocalArray MPI_ALLOW)
bp3_bp4_gtest_add_tests_helper(SelectSteps MPI_ALLOW)
Expand All @@ -71,7 +71,7 @@ if(NOT MSVC)
endif()

if(ADIOS2_HAVE_MPI)
bp3_bp4_gtest_add_tests_helper(WriteAggregateRead MPI_ONLY)
bp_gtest_add_tests_helper(WriteAggregateRead MPI_ONLY)
endif()

# BP3 only for now
Expand Down
9 changes: 6 additions & 3 deletions testing/adios2/engine/bp/TestBPWriteAggregateRead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ void WriteAggRead1D8(const std::string substreams)
io.SetEngine(engineName);
}

adios2::Engine bpReader = io.Open(fname, adios2::Mode::Read);
adios2::Engine bpReader =
io.Open(fname, adios2::Mode::ReadRandomAccess);

auto var_iString = io.InquireVariable<std::string>("iString");
EXPECT_TRUE(var_iString);
Expand Down Expand Up @@ -491,7 +492,8 @@ void WriteAggRead2D4x2(const std::string substreams)
io.SetEngine(engineName);
}

adios2::Engine bpReader = io.Open(fname, adios2::Mode::Read);
adios2::Engine bpReader =
io.Open(fname, adios2::Mode::ReadRandomAccess);

auto var_iString = io.InquireVariable<std::string>("iString");
EXPECT_TRUE(var_iString);
Expand Down Expand Up @@ -808,7 +810,8 @@ void WriteAggRead2D2x4(const std::string substreams)
{
io.SetEngine(engineName);
}
adios2::Engine bpReader = io.Open(fname, adios2::Mode::Read);
adios2::Engine bpReader =
io.Open(fname, adios2::Mode::ReadRandomAccess);

auto var_i8 = io.InquireVariable<int8_t>("i8");
EXPECT_TRUE(var_i8);
Expand Down
6 changes: 4 additions & 2 deletions testing/adios2/engine/bp/TestBPWriteReadBlockInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ TEST_F(BPWriteReadBlockInfo, BPWriteReadBlockInfo1D8)
{
io.SetEngine("BPFile");
}
adios2::Engine bpReader = io.Open(fname, adios2::Mode::Read);
adios2::Engine bpReader =
io.Open(fname, adios2::Mode::ReadRandomAccess);

auto var_local = io.InquireVariable<int32_t>("local");
auto var_localStr = io.InquireVariable<std::string>("localStr");
Expand Down Expand Up @@ -556,7 +557,8 @@ TEST_F(BPWriteReadBlockInfo, BPWriteReadBlockInfo2D2x4)
// Create the BP Engine
io.SetEngine("BPFile");
}
adios2::Engine bpReader = io.Open(fname, adios2::Mode::Read);
adios2::Engine bpReader =
io.Open(fname, adios2::Mode::ReadRandomAccess);

auto var_iString = io.InquireVariable<std::string>("iString");
auto var_i8 = io.InquireVariable<int8_t>("i8");
Expand Down

0 comments on commit bc3024a

Please sign in to comment.