Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable More BP5 Tests #2851

Merged
merged 3 commits into from
Sep 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion source/adios2/core/IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,8 @@ Engine &IO::Open(const std::string &name, const Mode mode, helper::Comm comm)
{
engineTypeLC = "hdf5";
}
else if (mode_to_use == Mode::Read)
else if ((mode_to_use == Mode::Read) ||
(mode_to_use == Mode::ReadRandomAccess))
{
if (adios2sys::SystemTools::FileIsDirectory(name))
{
Expand Down
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