diff --git a/source/adios2/engine/ssc/SscReaderGeneric.cpp b/source/adios2/engine/ssc/SscReaderGeneric.cpp index 2874b6df22..8744f98125 100644 --- a/source/adios2/engine/ssc/SscReaderGeneric.cpp +++ b/source/adios2/engine/ssc/SscReaderGeneric.cpp @@ -132,7 +132,7 @@ StepStatus SscReaderGeneric::BeginStep(const StepMode stepMode, #undef declare_type else { - helper::Log("Engine", "SscReader", "BeginStep", + helper::Log("Engine", "SscReaderGeneric", "BeginStep", "unknown data type", m_ReaderRank, m_ReaderRank, 0, m_Verbosity, helper::FATALERROR); } @@ -266,10 +266,10 @@ void SscReaderGeneric::PerformGets() { if (b.type == DataType::None) { - helper::Log("Engine", "SscReader", "PerformGets", - "unknown data type", m_ReaderRank, - m_ReaderRank, 0, m_Verbosity, - helper::FATALERROR); + helper::Log("Engine", "SscReaderGeneric", + "PerformGets", "unknown data type", + m_ReaderRank, m_ReaderRank, 0, + m_Verbosity, helper::FATALERROR); } else if (b.type == DataType::String) { @@ -559,9 +559,9 @@ void SscReaderGeneric::GetDeferred(VariableBase &variable, void *data) } else { - helper::Log("Engine", "SscReader", "GetDeferredCommon", - "unknown ShapeID", m_ReaderRank, - m_ReaderRank, 0, m_Verbosity, + helper::Log("Engine", "SscReaderGeneric", + "GetDeferredCommon", "unknown ShapeID", + m_ReaderRank, m_ReaderRank, 0, m_Verbosity, helper::LogMode::FATALERROR); } } diff --git a/source/adios2/engine/ssc/SscReaderGeneric.tcc b/source/adios2/engine/ssc/SscReaderGeneric.tcc index fe1fe4edd3..5a7db33202 100644 --- a/source/adios2/engine/ssc/SscReaderGeneric.tcc +++ b/source/adios2/engine/ssc/SscReaderGeneric.tcc @@ -28,7 +28,6 @@ std::vector::BPInfo> SscReaderGeneric::BlocksInfoCommon(const Variable &variable, const size_t step) const { - std::vector::BPInfo> ret; for (const auto &r : m_GlobalWritePattern) diff --git a/source/adios2/engine/ssc/SscReaderNaive.cpp b/source/adios2/engine/ssc/SscReaderNaive.cpp index 65b2371853..7c8f37137f 100644 --- a/source/adios2/engine/ssc/SscReaderNaive.cpp +++ b/source/adios2/engine/ssc/SscReaderNaive.cpp @@ -86,6 +86,50 @@ StepStatus SscReaderNaive::BeginStep(const StepMode stepMode, pos, b, m_IO, true); b.bufferStart += start; m_BlockMap[b.name].push_back(b); + if (b.shapeId == ShapeID::GlobalValue || + b.shapeId == ShapeID::LocalValue) + { + std::vector value(b.bufferCount); + std::memcpy(value.data(), b.value.data(), b.value.size()); + + if (b.type == DataType::String) + { + auto variable = + m_IO.InquireVariable(b.name); + if (variable) + { + variable->m_Value = + std::string(value.begin(), value.end()); + variable->m_Min = + std::string(value.begin(), value.end()); + variable->m_Max = + std::string(value.begin(), value.end()); + } + } +#define declare_type(T) \ + else if (b.type == helper::GetDataType()) \ + { \ + auto variable = m_IO.InquireVariable(b.name); \ + if (variable) \ + { \ + std::memcpy(reinterpret_cast(&variable->m_Min), \ + value.data(), value.size()); \ + std::memcpy(reinterpret_cast(&variable->m_Max), \ + value.data(), value.size()); \ + std::memcpy(reinterpret_cast(&variable->m_Value), \ + value.data(), value.size()); \ + } \ + } + ADIOS2_FOREACH_STDTYPE_1ARG(declare_type) +#undef declare_type + else + { + helper::Log("Engine", "SscReaderNaive", "BeginStep", + "unknown data type", m_ReaderRank, + m_ReaderRank, 0, m_Verbosity, + helper::FATALERROR); + } + } } } } diff --git a/source/adios2/engine/ssc/SscReaderNaive.tcc b/source/adios2/engine/ssc/SscReaderNaive.tcc index ed5c77a583..d118118e45 100644 --- a/source/adios2/engine/ssc/SscReaderNaive.tcc +++ b/source/adios2/engine/ssc/SscReaderNaive.tcc @@ -29,6 +29,34 @@ SscReaderNaive::BlocksInfoCommon(const Variable &variable, const size_t step) const { std::vector::BPInfo> ret; + auto it = m_BlockMap.find(variable.m_Name); + if (it != m_BlockMap.end()) + { + for (const auto &v : it->second) + { + ret.emplace_back(); + auto &b = ret.back(); + b.Start = v.start; + b.Count = v.count; + b.Shape = v.shape; + b.Step = m_CurrentStep; + b.StepsStart = m_CurrentStep; + b.StepsCount = 1; + if (m_IO.m_ArrayOrder != ArrayOrdering::RowMajor) + { + std::reverse(b.Start.begin(), b.Start.end()); + std::reverse(b.Count.begin(), b.Count.end()); + std::reverse(b.Shape.begin(), b.Shape.end()); + } + if (v.shapeId == ShapeID::GlobalValue || + v.shapeId == ShapeID::LocalValue) + { + b.IsValue = true; + std::memcpy(reinterpret_cast(&b.Value), v.value.data(), + v.value.size()); + } + } + } return ret; } diff --git a/testing/adios2/engine/dataman/TestDataMan1D.cpp b/testing/adios2/engine/dataman/TestDataMan1D.cpp index b7dde64607..d83a143fc6 100644 --- a/testing/adios2/engine/dataman/TestDataMan1D.cpp +++ b/testing/adios2/engine/dataman/TestDataMan1D.cpp @@ -90,9 +90,9 @@ void DataManWriter(const Dims &shape, const Dims &start, const Dims &count, size_t datasize = std::accumulate(count.begin(), count.end(), 1, std::multiplies()); adios2::ADIOS adios; - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("DataMan"); - dataManIO.SetParameters(engineParams); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("DataMan"); + io.SetParameters(engineParams); std::vector myChars(datasize); std::vector myUChars(datasize); std::vector myShorts(datasize); @@ -103,33 +103,29 @@ void DataManWriter(const Dims &shape, const Dims &start, const Dims &count, std::vector myDoubles(datasize); std::vector> myComplexes(datasize); std::vector> myDComplexes(datasize); - auto bpChars = - dataManIO.DefineVariable("bpChars", shape, start, count); - auto bpUChars = dataManIO.DefineVariable("bpUChars", shape, - start, count); - auto bpShorts = - dataManIO.DefineVariable("bpShorts", shape, start, count); - auto bpUShorts = dataManIO.DefineVariable( - "bpUShorts", shape, start, count); - auto bpInts = dataManIO.DefineVariable("bpInts", shape, start, count); - auto bpUInts = - dataManIO.DefineVariable("bpUInts", shape, start, count); - auto bpFloats = - dataManIO.DefineVariable("bpFloats", shape, start, count); - auto bpDoubles = - dataManIO.DefineVariable("bpDoubles", shape, start, count); - auto bpComplexes = dataManIO.DefineVariable>( - "bpComplexes", shape, start, count); - auto bpDComplexes = dataManIO.DefineVariable>( - "bpDComplexes", shape, start, count); - auto bpUInt64s = dataManIO.DefineVariable("bpUInt64s"); - auto scalarString = dataManIO.DefineVariable("scalarString"); - dataManIO.DefineAttribute("AttInt", 110); - adios2::Engine dataManWriter = - dataManIO.Open("stream", adios2::Mode::Write); + auto varChars = io.DefineVariable("varChars", shape, start, count); + auto varUChars = + io.DefineVariable("varUChars", shape, start, count); + auto varShorts = io.DefineVariable("varShorts", shape, start, count); + auto varUShorts = + io.DefineVariable("varUShorts", shape, start, count); + auto varInts = io.DefineVariable("varInts", shape, start, count); + auto varUInts = + io.DefineVariable("varUInts", shape, start, count); + auto varFloats = io.DefineVariable("varFloats", shape, start, count); + auto varDoubles = + io.DefineVariable("varDoubles", shape, start, count); + auto varComplexes = io.DefineVariable>( + "varComplexes", shape, start, count); + auto varDComplexes = io.DefineVariable>( + "varDComplexes", shape, start, count); + auto varUInt64s = io.DefineVariable("varUInt64s"); + auto varString = io.DefineVariable("varString"); + io.DefineAttribute("AttInt", 110); + adios2::Engine engine = io.Open("stream", adios2::Mode::Write); for (uint64_t i = 0; i < steps; ++i) { - dataManWriter.BeginStep(); + engine.BeginStep(); GenData(myChars, i); GenData(myUChars, i); GenData(myShorts, i); @@ -140,22 +136,21 @@ void DataManWriter(const Dims &shape, const Dims &start, const Dims &count, GenData(myDoubles, i); GenData(myComplexes, i); GenData(myDComplexes, i); - dataManWriter.Put(bpChars, myChars.data(), adios2::Mode::Sync); - dataManWriter.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - dataManWriter.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpInts, myInts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - dataManWriter.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - dataManWriter.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - dataManWriter.Put(bpDComplexes, myDComplexes.data(), - adios2::Mode::Sync); - dataManWriter.Put(bpUInt64s, i); - dataManWriter.Put(scalarString, std::string("some text")); - dataManWriter.EndStep(); + engine.Put(varChars, myChars.data(), adios2::Mode::Sync); + engine.Put(varUChars, myUChars.data(), adios2::Mode::Sync); + engine.Put(varShorts, myShorts.data(), adios2::Mode::Sync); + engine.Put(varUShorts, myUShorts.data(), adios2::Mode::Sync); + engine.Put(varInts, myInts.data(), adios2::Mode::Sync); + engine.Put(varUInts, myUInts.data(), adios2::Mode::Sync); + engine.Put(varFloats, myFloats.data(), adios2::Mode::Sync); + engine.Put(varDoubles, myDoubles.data(), adios2::Mode::Sync); + engine.Put(varComplexes, myComplexes.data(), adios2::Mode::Sync); + engine.Put(varDComplexes, myDComplexes.data(), adios2::Mode::Sync); + engine.Put(varUInt64s, i); + engine.Put(varString, std::string("some text")); + engine.EndStep(); } - dataManWriter.Close(); + engine.Close(); } void DataManReader(const Dims &shape, const Dims &start, const Dims &count, @@ -164,10 +159,10 @@ void DataManReader(const Dims &shape, const Dims &start, const Dims &count, size_t datasize = std::accumulate(count.begin(), count.end(), 1, std::multiplies()); adios2::ADIOS adios; - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("DataMan"); - dataManIO.SetParameters(engineParams); - adios2::Engine dataManReader = dataManIO.Open("stream", adios2::Mode::Read); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("DataMan"); + io.SetParameters(engineParams); + adios2::Engine engine = io.Open("stream", adios2::Mode::Read); std::vector myChars(datasize); std::vector myUChars(datasize); @@ -183,67 +178,64 @@ void DataManReader(const Dims &shape, const Dims &start, const Dims &count, size_t currentStep; while (true) { - adios2::StepStatus status = dataManReader.BeginStep(StepMode::Read, 5); + adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { received_steps = true; - const auto &vars = dataManIO.AvailableVariables(); + const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 12); - currentStep = dataManReader.CurrentStep(); - adios2::Variable bpChars = - dataManIO.InquireVariable("bpChars"); - adios2::Variable bpUChars = - dataManIO.InquireVariable("bpUChars"); - adios2::Variable bpShorts = - dataManIO.InquireVariable("bpShorts"); - adios2::Variable bpUShorts = - dataManIO.InquireVariable("bpUShorts"); - adios2::Variable bpInts = - dataManIO.InquireVariable("bpInts"); - adios2::Variable bpUInts = - dataManIO.InquireVariable("bpUInts"); - adios2::Variable bpFloats = - dataManIO.InquireVariable("bpFloats"); - adios2::Variable bpDoubles = - dataManIO.InquireVariable("bpDoubles"); - adios2::Variable> bpComplexes = - dataManIO.InquireVariable>("bpComplexes"); - adios2::Variable> bpDComplexes = - dataManIO.InquireVariable>("bpDComplexes"); - adios2::Variable bpUInt64s = - dataManIO.InquireVariable("bpUInt64s"); - adios2::Variable scalarString = - dataManIO.InquireVariable("scalarString"); - auto charsBlocksInfo = dataManReader.AllStepsBlocksInfo(bpChars); - bpChars.SetSelection({start, count}); - bpUChars.SetSelection({start, count}); - bpShorts.SetSelection({start, count}); - bpUShorts.SetSelection({start, count}); - bpInts.SetSelection({start, count}); - bpUInts.SetSelection({start, count}); - bpFloats.SetSelection({start, count}); - bpDoubles.SetSelection({start, count}); - bpComplexes.SetSelection({start, count}); - bpDComplexes.SetSelection({start, count}); - dataManReader.Get(bpChars, myChars.data(), adios2::Mode::Sync); - dataManReader.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - dataManReader.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - dataManReader.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - dataManReader.Get(bpInts, myInts.data(), adios2::Mode::Sync); - dataManReader.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); - dataManReader.Get(bpFloats, myFloats.data(), adios2::Mode::Sync); - dataManReader.Get(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - dataManReader.Get(bpComplexes, myComplexes.data(), - adios2::Mode::Sync); - dataManReader.Get(bpDComplexes, myDComplexes.data(), - adios2::Mode::Sync); + currentStep = engine.CurrentStep(); + adios2::Variable varChars = + io.InquireVariable("varChars"); + adios2::Variable varUChars = + io.InquireVariable("varUChars"); + adios2::Variable varShorts = + io.InquireVariable("varShorts"); + adios2::Variable varUShorts = + io.InquireVariable("varUShorts"); + adios2::Variable varInts = io.InquireVariable("varInts"); + adios2::Variable varUInts = + io.InquireVariable("varUInts"); + adios2::Variable varFloats = + io.InquireVariable("varFloats"); + adios2::Variable varDoubles = + io.InquireVariable("varDoubles"); + adios2::Variable> varComplexes = + io.InquireVariable>("varComplexes"); + adios2::Variable> varDComplexes = + io.InquireVariable>("varDComplexes"); + adios2::Variable varUInt64s = + io.InquireVariable("varUInt64s"); + adios2::Variable varString = + io.InquireVariable("varString"); + auto charsBlocksInfo = engine.AllStepsBlocksInfo(varChars); + varChars.SetSelection({start, count}); + varUChars.SetSelection({start, count}); + varShorts.SetSelection({start, count}); + varUShorts.SetSelection({start, count}); + varInts.SetSelection({start, count}); + varUInts.SetSelection({start, count}); + varFloats.SetSelection({start, count}); + varDoubles.SetSelection({start, count}); + varComplexes.SetSelection({start, count}); + varDComplexes.SetSelection({start, count}); + engine.Get(varChars, myChars.data(), adios2::Mode::Sync); + engine.Get(varUChars, myUChars.data(), adios2::Mode::Sync); + engine.Get(varShorts, myShorts.data(), adios2::Mode::Sync); + engine.Get(varUShorts, myUShorts.data(), adios2::Mode::Sync); + engine.Get(varInts, myInts.data(), adios2::Mode::Sync); + engine.Get(varUInts, myUInts.data(), adios2::Mode::Sync); + engine.Get(varFloats, myFloats.data(), adios2::Mode::Sync); + engine.Get(varDoubles, myDoubles.data(), adios2::Mode::Sync); + engine.Get(varComplexes, myComplexes.data(), adios2::Mode::Sync); + engine.Get(varDComplexes, myDComplexes.data(), adios2::Mode::Sync); std::string readString; - dataManReader.Get(scalarString, readString, adios2::Mode::Sync); + engine.Get(varString, readString, adios2::Mode::Sync); ASSERT_EQ(readString, "some text"); uint64_t stepValue; - dataManReader.Get(bpUInt64s, &stepValue, adios2::Mode::Sync); + engine.Get(varUInt64s, &stepValue, adios2::Mode::Sync); ASSERT_EQ(currentStep, stepValue); VerifyData(myChars, currentStep); VerifyData(myUChars, currentStep); @@ -255,7 +247,7 @@ void DataManReader(const Dims &shape, const Dims &start, const Dims &count, VerifyData(myDoubles, currentStep); VerifyData(myComplexes, currentStep); VerifyData(myDComplexes, currentStep); - dataManReader.EndStep(); + engine.EndStep(); } else if (status == adios2::StepStatus::EndOfStream) { @@ -268,10 +260,10 @@ void DataManReader(const Dims &shape, const Dims &start, const Dims &count, } if (received_steps) { - auto attInt = dataManIO.InquireAttribute("AttInt"); + auto attInt = io.InquireAttribute("AttInt"); ASSERT_EQ(110, attInt.Data()[0]); } - dataManReader.Close(); + engine.Close(); } class DataManEngineTest : public ::testing::Test diff --git a/testing/adios2/engine/dataman/TestDataMan1DSuperLarge.cpp b/testing/adios2/engine/dataman/TestDataMan1DSuperLarge.cpp index fed32ad812..2a306d36e9 100644 --- a/testing/adios2/engine/dataman/TestDataMan1DSuperLarge.cpp +++ b/testing/adios2/engine/dataman/TestDataMan1DSuperLarge.cpp @@ -85,9 +85,9 @@ void DataManWriter(const Dims &shape, const Dims &start, const Dims &count, size_t datasize = std::accumulate(count.begin(), count.end(), 1, std::multiplies()); adios2::ADIOS adios; - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("DataMan"); - dataManIO.SetParameters(engineParams); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("DataMan"); + io.SetParameters(engineParams); std::vector myChars(datasize); std::vector myUChars(datasize); std::vector myShorts(datasize); @@ -98,32 +98,28 @@ void DataManWriter(const Dims &shape, const Dims &start, const Dims &count, std::vector myDoubles(datasize); std::vector> myComplexes(datasize); std::vector> myDComplexes(datasize); - auto bpChars = - dataManIO.DefineVariable("bpChars", shape, start, count); - auto bpUChars = dataManIO.DefineVariable("bpUChars", shape, - start, count); - auto bpShorts = - dataManIO.DefineVariable("bpShorts", shape, start, count); - auto bpUShorts = dataManIO.DefineVariable( - "bpUShorts", shape, start, count); - auto bpInts = dataManIO.DefineVariable("bpInts", shape, start, count); - auto bpUInts = - dataManIO.DefineVariable("bpUInts", shape, start, count); - auto bpFloats = - dataManIO.DefineVariable("bpFloats", shape, start, count); - auto bpDoubles = - dataManIO.DefineVariable("bpDoubles", shape, start, count); - auto bpComplexes = dataManIO.DefineVariable>( - "bpComplexes", shape, start, count); - auto bpDComplexes = dataManIO.DefineVariable>( - "bpDComplexes", shape, start, count); - auto bpUInt64s = dataManIO.DefineVariable("bpUInt64s"); - dataManIO.DefineAttribute("AttInt", 110); - adios2::Engine dataManWriter = - dataManIO.Open("stream", adios2::Mode::Write); + auto varChars = io.DefineVariable("varChars", shape, start, count); + auto varUChars = + io.DefineVariable("varUChars", shape, start, count); + auto varShorts = io.DefineVariable("varShorts", shape, start, count); + auto varUShorts = + io.DefineVariable("varUShorts", shape, start, count); + auto varInts = io.DefineVariable("varInts", shape, start, count); + auto varUInts = + io.DefineVariable("varUInts", shape, start, count); + auto varFloats = io.DefineVariable("varFloats", shape, start, count); + auto varDoubles = + io.DefineVariable("varDoubles", shape, start, count); + auto varComplexes = io.DefineVariable>( + "varComplexes", shape, start, count); + auto varDComplexes = io.DefineVariable>( + "varDComplexes", shape, start, count); + auto varUInt64s = io.DefineVariable("varUInt64s"); + io.DefineAttribute("AttInt", 110); + adios2::Engine engine = io.Open("stream", adios2::Mode::Write); for (uint64_t i = 0; i < steps; ++i) { - dataManWriter.BeginStep(); + engine.BeginStep(); GenData(myChars, i); GenData(myUChars, i); GenData(myShorts, i); @@ -134,21 +130,20 @@ void DataManWriter(const Dims &shape, const Dims &start, const Dims &count, GenData(myDoubles, i); GenData(myComplexes, i); GenData(myDComplexes, i); - dataManWriter.Put(bpChars, myChars.data(), adios2::Mode::Sync); - dataManWriter.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - dataManWriter.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpInts, myInts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - dataManWriter.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - dataManWriter.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - dataManWriter.Put(bpDComplexes, myDComplexes.data(), - adios2::Mode::Sync); - dataManWriter.Put(bpUInt64s, i); - dataManWriter.EndStep(); + engine.Put(varChars, myChars.data(), adios2::Mode::Sync); + engine.Put(varUChars, myUChars.data(), adios2::Mode::Sync); + engine.Put(varShorts, myShorts.data(), adios2::Mode::Sync); + engine.Put(varUShorts, myUShorts.data(), adios2::Mode::Sync); + engine.Put(varInts, myInts.data(), adios2::Mode::Sync); + engine.Put(varUInts, myUInts.data(), adios2::Mode::Sync); + engine.Put(varFloats, myFloats.data(), adios2::Mode::Sync); + engine.Put(varDoubles, myDoubles.data(), adios2::Mode::Sync); + engine.Put(varComplexes, myComplexes.data(), adios2::Mode::Sync); + engine.Put(varDComplexes, myDComplexes.data(), adios2::Mode::Sync); + engine.Put(varUInt64s, i); + engine.EndStep(); } - dataManWriter.Close(); + engine.Close(); } void DataManReader(const Dims &shape, const Dims &start, const Dims &count, @@ -157,10 +152,10 @@ void DataManReader(const Dims &shape, const Dims &start, const Dims &count, size_t datasize = std::accumulate(count.begin(), count.end(), 1, std::multiplies()); adios2::ADIOS adios; - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("DataMan"); - dataManIO.SetParameters(engineParams); - adios2::Engine dataManReader = dataManIO.Open("stream", adios2::Mode::Read); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("DataMan"); + io.SetParameters(engineParams); + adios2::Engine engine = io.Open("stream", adios2::Mode::Read); std::vector myChars(datasize); std::vector myUChars(datasize); @@ -176,60 +171,57 @@ void DataManReader(const Dims &shape, const Dims &start, const Dims &count, size_t currentStep; while (true) { - adios2::StepStatus status = dataManReader.BeginStep(StepMode::Read, 5); + adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { received_steps = true; - const auto &vars = dataManIO.AvailableVariables(); + const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 11); - currentStep = dataManReader.CurrentStep(); - adios2::Variable bpChars = - dataManIO.InquireVariable("bpChars"); - adios2::Variable bpUChars = - dataManIO.InquireVariable("bpUChars"); - adios2::Variable bpShorts = - dataManIO.InquireVariable("bpShorts"); - adios2::Variable bpUShorts = - dataManIO.InquireVariable("bpUShorts"); - adios2::Variable bpInts = - dataManIO.InquireVariable("bpInts"); - adios2::Variable bpUInts = - dataManIO.InquireVariable("bpUInts"); - adios2::Variable bpFloats = - dataManIO.InquireVariable("bpFloats"); - adios2::Variable bpDoubles = - dataManIO.InquireVariable("bpDoubles"); - adios2::Variable> bpComplexes = - dataManIO.InquireVariable>("bpComplexes"); - adios2::Variable> bpDComplexes = - dataManIO.InquireVariable>("bpDComplexes"); - adios2::Variable bpUInt64s = - dataManIO.InquireVariable("bpUInt64s"); - auto charsBlocksInfo = dataManReader.AllStepsBlocksInfo(bpChars); - bpChars.SetSelection({start, count}); - bpUChars.SetSelection({start, count}); - bpShorts.SetSelection({start, count}); - bpUShorts.SetSelection({start, count}); - bpInts.SetSelection({start, count}); - bpUInts.SetSelection({start, count}); - bpFloats.SetSelection({start, count}); - bpDoubles.SetSelection({start, count}); - bpComplexes.SetSelection({start, count}); - bpDComplexes.SetSelection({start, count}); - dataManReader.Get(bpChars, myChars.data(), adios2::Mode::Sync); - dataManReader.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - dataManReader.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - dataManReader.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - dataManReader.Get(bpInts, myInts.data(), adios2::Mode::Sync); - dataManReader.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); - dataManReader.Get(bpFloats, myFloats.data(), adios2::Mode::Sync); - dataManReader.Get(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - dataManReader.Get(bpComplexes, myComplexes.data(), - adios2::Mode::Sync); - dataManReader.Get(bpDComplexes, myDComplexes.data(), - adios2::Mode::Sync); + currentStep = engine.CurrentStep(); + adios2::Variable varChars = + io.InquireVariable("varChars"); + adios2::Variable varUChars = + io.InquireVariable("varUChars"); + adios2::Variable varShorts = + io.InquireVariable("varShorts"); + adios2::Variable varUShorts = + io.InquireVariable("varUShorts"); + adios2::Variable varInts = io.InquireVariable("varInts"); + adios2::Variable varUInts = + io.InquireVariable("varUInts"); + adios2::Variable varFloats = + io.InquireVariable("varFloats"); + adios2::Variable varDoubles = + io.InquireVariable("varDoubles"); + adios2::Variable> varComplexes = + io.InquireVariable>("varComplexes"); + adios2::Variable> varDComplexes = + io.InquireVariable>("varDComplexes"); + adios2::Variable varUInt64s = + io.InquireVariable("varUInt64s"); + auto charsBlocksInfo = engine.AllStepsBlocksInfo(varChars); + varChars.SetSelection({start, count}); + varUChars.SetSelection({start, count}); + varShorts.SetSelection({start, count}); + varUShorts.SetSelection({start, count}); + varInts.SetSelection({start, count}); + varUInts.SetSelection({start, count}); + varFloats.SetSelection({start, count}); + varDoubles.SetSelection({start, count}); + varComplexes.SetSelection({start, count}); + varDComplexes.SetSelection({start, count}); + engine.Get(varChars, myChars.data(), adios2::Mode::Sync); + engine.Get(varUChars, myUChars.data(), adios2::Mode::Sync); + engine.Get(varShorts, myShorts.data(), adios2::Mode::Sync); + engine.Get(varUShorts, myUShorts.data(), adios2::Mode::Sync); + engine.Get(varInts, myInts.data(), adios2::Mode::Sync); + engine.Get(varUInts, myUInts.data(), adios2::Mode::Sync); + engine.Get(varFloats, myFloats.data(), adios2::Mode::Sync); + engine.Get(varDoubles, myDoubles.data(), adios2::Mode::Sync); + engine.Get(varComplexes, myComplexes.data(), adios2::Mode::Sync); + engine.Get(varDComplexes, myDComplexes.data(), adios2::Mode::Sync); uint64_t stepValue; - dataManReader.Get(bpUInt64s, &stepValue, adios2::Mode::Sync); + engine.Get(varUInt64s, &stepValue, adios2::Mode::Sync); ASSERT_EQ(currentStep, stepValue); VerifyData(myChars, currentStep); VerifyData(myUChars, currentStep); @@ -241,7 +233,7 @@ void DataManReader(const Dims &shape, const Dims &start, const Dims &count, VerifyData(myDoubles, currentStep); VerifyData(myComplexes, currentStep); VerifyData(myDComplexes, currentStep); - dataManReader.EndStep(); + engine.EndStep(); } else if (status == adios2::StepStatus::EndOfStream) { @@ -254,11 +246,11 @@ void DataManReader(const Dims &shape, const Dims &start, const Dims &count, } if (received_steps) { - auto attInt = dataManIO.InquireAttribute("AttInt"); + auto attInt = io.InquireAttribute("AttInt"); ASSERT_EQ(110, attInt.Data()[0]); ASSERT_NE(111, attInt.Data()[0]); } - dataManReader.Close(); + engine.Close(); } class DataManEngineTest : public ::testing::Test diff --git a/testing/adios2/engine/dataman/TestDataMan2DMemSelect.cpp b/testing/adios2/engine/dataman/TestDataMan2DMemSelect.cpp index 73fd7d05c2..99fa0d80cd 100644 --- a/testing/adios2/engine/dataman/TestDataMan2DMemSelect.cpp +++ b/testing/adios2/engine/dataman/TestDataMan2DMemSelect.cpp @@ -106,9 +106,9 @@ void DataManWriterP2PMemSelect(const Dims &shape, const Dims &start, size_t datasize = std::accumulate(count.begin(), count.end(), 1, std::multiplies()); adios2::ADIOS adios; - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("DataMan"); - dataManIO.SetParameters(engineParams); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("DataMan"); + io.SetParameters(engineParams); std::vector myChars(datasize); std::vector myUChars(datasize); std::vector myShorts(datasize); @@ -119,31 +119,27 @@ void DataManWriterP2PMemSelect(const Dims &shape, const Dims &start, std::vector myDoubles(datasize); std::vector> myComplexes(datasize); std::vector> myDComplexes(datasize); - auto bpChars = - dataManIO.DefineVariable("bpChars", shape, start, count); - auto bpUChars = dataManIO.DefineVariable("bpUChars", shape, - start, count); - auto bpShorts = - dataManIO.DefineVariable("bpShorts", shape, start, count); - auto bpUShorts = dataManIO.DefineVariable( - "bpUShorts", shape, start, count); - auto bpInts = dataManIO.DefineVariable("bpInts", shape, start, count); - auto bpUInts = - dataManIO.DefineVariable("bpUInts", shape, start, count); - auto bpFloats = - dataManIO.DefineVariable("bpFloats", shape, start, count); - auto bpDoubles = - dataManIO.DefineVariable("bpDoubles", shape, start, count); - auto bpComplexes = dataManIO.DefineVariable>( - "bpComplexes", shape, start, count); - auto bpDComplexes = dataManIO.DefineVariable>( - "bpDComplexes", shape, start, count); - dataManIO.DefineAttribute("AttInt", 110); - adios2::Engine dataManWriter = - dataManIO.Open("stream", adios2::Mode::Write); + auto varChars = io.DefineVariable("varChars", shape, start, count); + auto varUChars = + io.DefineVariable("varUChars", shape, start, count); + auto varShorts = io.DefineVariable("varShorts", shape, start, count); + auto varUShorts = + io.DefineVariable("varUShorts", shape, start, count); + auto varInts = io.DefineVariable("varInts", shape, start, count); + auto varUInts = + io.DefineVariable("varUInts", shape, start, count); + auto varFloats = io.DefineVariable("varFloats", shape, start, count); + auto varDoubles = + io.DefineVariable("varDoubles", shape, start, count); + auto varComplexes = io.DefineVariable>( + "varComplexes", shape, start, count); + auto varDComplexes = io.DefineVariable>( + "varDComplexes", shape, start, count); + io.DefineAttribute("AttInt", 110); + adios2::Engine engine = io.Open("stream", adios2::Mode::Write); for (size_t i = 0; i < steps; ++i) { - dataManWriter.BeginStep(); + engine.BeginStep(); GenData(myChars, i, start, count, shape); GenData(myUChars, i, start, count, shape); GenData(myShorts, i, start, count, shape); @@ -154,20 +150,19 @@ void DataManWriterP2PMemSelect(const Dims &shape, const Dims &start, GenData(myDoubles, i, start, count, shape); GenData(myComplexes, i, start, count, shape); GenData(myDComplexes, i, start, count, shape); - dataManWriter.Put(bpChars, myChars.data(), adios2::Mode::Sync); - dataManWriter.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - dataManWriter.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpInts, myInts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - dataManWriter.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - dataManWriter.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - dataManWriter.Put(bpDComplexes, myDComplexes.data(), - adios2::Mode::Sync); - dataManWriter.EndStep(); + engine.Put(varChars, myChars.data(), adios2::Mode::Sync); + engine.Put(varUChars, myUChars.data(), adios2::Mode::Sync); + engine.Put(varShorts, myShorts.data(), adios2::Mode::Sync); + engine.Put(varUShorts, myUShorts.data(), adios2::Mode::Sync); + engine.Put(varInts, myInts.data(), adios2::Mode::Sync); + engine.Put(varUInts, myUInts.data(), adios2::Mode::Sync); + engine.Put(varFloats, myFloats.data(), adios2::Mode::Sync); + engine.Put(varDoubles, myDoubles.data(), adios2::Mode::Sync); + engine.Put(varComplexes, myComplexes.data(), adios2::Mode::Sync); + engine.Put(varDComplexes, myDComplexes.data(), adios2::Mode::Sync); + engine.EndStep(); } - dataManWriter.Close(); + engine.Close(); } void DataManReaderP2PMemSelect(const Dims &shape, const Dims &start, @@ -176,10 +171,10 @@ void DataManReaderP2PMemSelect(const Dims &shape, const Dims &start, const adios2::Params &engineParams) { adios2::ADIOS adios; - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("DataMan"); - dataManIO.SetParameters(engineParams); - adios2::Engine dataManReader = dataManIO.Open("stream", adios2::Mode::Read); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("DataMan"); + io.SetParameters(engineParams); + adios2::Engine engine = io.Open("stream", adios2::Mode::Read); size_t datasize = std::accumulate(memCount.begin(), memCount.end(), 1, std::multiplies()); @@ -197,13 +192,13 @@ void DataManReaderP2PMemSelect(const Dims &shape, const Dims &start, size_t currentStep; while (true) { - adios2::StepStatus status = dataManReader.BeginStep(); + adios2::StepStatus status = engine.BeginStep(); if (status == adios2::StepStatus::OK) { received_steps = true; - const auto &vars = dataManIO.AvailableVariables(); + const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 10); - currentStep = dataManReader.CurrentStep(); + currentStep = engine.CurrentStep(); GenData(myChars, currentStep, memStart, memCount, shape); GenData(myUChars, currentStep, memStart, memCount, shape); GenData(myShorts, currentStep, memStart, memCount, shape); @@ -214,62 +209,59 @@ void DataManReaderP2PMemSelect(const Dims &shape, const Dims &start, GenData(myDoubles, currentStep, memStart, memCount, shape); GenData(myComplexes, currentStep, memStart, memCount, shape); GenData(myDComplexes, currentStep, memStart, memCount, shape); - adios2::Variable bpChars = - dataManIO.InquireVariable("bpChars"); - adios2::Variable bpUChars = - dataManIO.InquireVariable("bpUChars"); - adios2::Variable bpShorts = - dataManIO.InquireVariable("bpShorts"); - adios2::Variable bpUShorts = - dataManIO.InquireVariable("bpUShorts"); - adios2::Variable bpInts = - dataManIO.InquireVariable("bpInts"); - adios2::Variable bpUInts = - dataManIO.InquireVariable("bpUInts"); - adios2::Variable bpFloats = - dataManIO.InquireVariable("bpFloats"); - adios2::Variable bpDoubles = - dataManIO.InquireVariable("bpDoubles"); - adios2::Variable> bpComplexes = - dataManIO.InquireVariable>("bpComplexes"); - adios2::Variable> bpDComplexes = - dataManIO.InquireVariable>("bpDComplexes"); - auto charsBlocksInfo = dataManReader.AllStepsBlocksInfo(bpChars); + adios2::Variable varChars = + io.InquireVariable("varChars"); + adios2::Variable varUChars = + io.InquireVariable("varUChars"); + adios2::Variable varShorts = + io.InquireVariable("varShorts"); + adios2::Variable varUShorts = + io.InquireVariable("varUShorts"); + adios2::Variable varInts = io.InquireVariable("varInts"); + adios2::Variable varUInts = + io.InquireVariable("varUInts"); + adios2::Variable varFloats = + io.InquireVariable("varFloats"); + adios2::Variable varDoubles = + io.InquireVariable("varDoubles"); + adios2::Variable> varComplexes = + io.InquireVariable>("varComplexes"); + adios2::Variable> varDComplexes = + io.InquireVariable>("varDComplexes"); + auto charsBlocksInfo = engine.AllStepsBlocksInfo(varChars); - bpChars.SetSelection({start, count}); - bpUChars.SetSelection({start, count}); - bpShorts.SetSelection({start, count}); - bpUShorts.SetSelection({start, count}); - bpInts.SetSelection({start, count}); - bpUInts.SetSelection({start, count}); - bpFloats.SetSelection({start, count}); - bpDoubles.SetSelection({start, count}); - bpComplexes.SetSelection({start, count}); - bpDComplexes.SetSelection({start, count}); + varChars.SetSelection({start, count}); + varUChars.SetSelection({start, count}); + varShorts.SetSelection({start, count}); + varUShorts.SetSelection({start, count}); + varInts.SetSelection({start, count}); + varUInts.SetSelection({start, count}); + varFloats.SetSelection({start, count}); + varDoubles.SetSelection({start, count}); + varComplexes.SetSelection({start, count}); + varDComplexes.SetSelection({start, count}); - bpChars.SetMemorySelection({memStart, memCount}); - bpUChars.SetMemorySelection({memStart, memCount}); - bpShorts.SetMemorySelection({memStart, memCount}); - bpUShorts.SetMemorySelection({memStart, memCount}); - bpInts.SetMemorySelection({memStart, memCount}); - bpUInts.SetMemorySelection({memStart, memCount}); - bpFloats.SetMemorySelection({memStart, memCount}); - bpDoubles.SetMemorySelection({memStart, memCount}); - bpComplexes.SetMemorySelection({memStart, memCount}); - bpDComplexes.SetMemorySelection({memStart, memCount}); + varChars.SetMemorySelection({memStart, memCount}); + varUChars.SetMemorySelection({memStart, memCount}); + varShorts.SetMemorySelection({memStart, memCount}); + varUShorts.SetMemorySelection({memStart, memCount}); + varInts.SetMemorySelection({memStart, memCount}); + varUInts.SetMemorySelection({memStart, memCount}); + varFloats.SetMemorySelection({memStart, memCount}); + varDoubles.SetMemorySelection({memStart, memCount}); + varComplexes.SetMemorySelection({memStart, memCount}); + varDComplexes.SetMemorySelection({memStart, memCount}); - dataManReader.Get(bpChars, myChars.data(), adios2::Mode::Sync); - dataManReader.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - dataManReader.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - dataManReader.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - dataManReader.Get(bpInts, myInts.data(), adios2::Mode::Sync); - dataManReader.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); - dataManReader.Get(bpFloats, myFloats.data(), adios2::Mode::Sync); - dataManReader.Get(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - dataManReader.Get(bpComplexes, myComplexes.data(), - adios2::Mode::Sync); - dataManReader.Get(bpDComplexes, myDComplexes.data(), - adios2::Mode::Sync); + engine.Get(varChars, myChars.data(), adios2::Mode::Sync); + engine.Get(varUChars, myUChars.data(), adios2::Mode::Sync); + engine.Get(varShorts, myShorts.data(), adios2::Mode::Sync); + engine.Get(varUShorts, myUShorts.data(), adios2::Mode::Sync); + engine.Get(varInts, myInts.data(), adios2::Mode::Sync); + engine.Get(varUInts, myUInts.data(), adios2::Mode::Sync); + engine.Get(varFloats, myFloats.data(), adios2::Mode::Sync); + engine.Get(varDoubles, myDoubles.data(), adios2::Mode::Sync); + engine.Get(varComplexes, myComplexes.data(), adios2::Mode::Sync); + engine.Get(varDComplexes, myDComplexes.data(), adios2::Mode::Sync); VerifyData(myChars.data(), currentStep, memStart, memCount, shape); VerifyData(myUChars.data(), currentStep, memStart, memCount, shape); VerifyData(myShorts.data(), currentStep, memStart, memCount, shape); @@ -284,7 +276,7 @@ void DataManReaderP2PMemSelect(const Dims &shape, const Dims &start, shape); VerifyData(myDComplexes.data(), currentStep, memStart, memCount, shape); - dataManReader.EndStep(); + engine.EndStep(); } else if (status == adios2::StepStatus::EndOfStream) { @@ -297,10 +289,10 @@ void DataManReaderP2PMemSelect(const Dims &shape, const Dims &start, } if (received_steps) { - auto attInt = dataManIO.InquireAttribute("AttInt"); + auto attInt = io.InquireAttribute("AttInt"); ASSERT_EQ(110, attInt.Data()[0]); } - dataManReader.Close(); + engine.Close(); print_lines = 0; } diff --git a/testing/adios2/engine/dataman/TestDataMan2DSz.cpp b/testing/adios2/engine/dataman/TestDataMan2DSz.cpp index 4b6ec25270..4e50973324 100644 --- a/testing/adios2/engine/dataman/TestDataMan2DSz.cpp +++ b/testing/adios2/engine/dataman/TestDataMan2DSz.cpp @@ -104,10 +104,10 @@ void DataManWriterP2PMemSelect(const Dims &shape, const Dims &start, size_t datasize = std::accumulate(count.begin(), count.end(), 1, std::multiplies()); adios2::ADIOS adios; - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("DataMan"); - dataManIO.SetParameters(engineParams); - dataManIO.AddOperation("bpFloats", "sz", {{"accuracy", "0.01"}}); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("DataMan"); + io.SetParameters(engineParams); + io.AddOperation("varFloats", "sz", {{"accuracy", "0.01"}}); std::vector myChars(datasize); std::vector myUChars(datasize); std::vector myShorts(datasize); @@ -118,31 +118,27 @@ void DataManWriterP2PMemSelect(const Dims &shape, const Dims &start, std::vector myDoubles(datasize); std::vector> myComplexes(datasize); std::vector> myDComplexes(datasize); - auto bpChars = - dataManIO.DefineVariable("bpChars", shape, start, count); - auto bpUChars = dataManIO.DefineVariable("bpUChars", shape, - start, count); - auto bpShorts = - dataManIO.DefineVariable("bpShorts", shape, start, count); - auto bpUShorts = dataManIO.DefineVariable( - "bpUShorts", shape, start, count); - auto bpInts = dataManIO.DefineVariable("bpInts", shape, start, count); - auto bpUInts = - dataManIO.DefineVariable("bpUInts", shape, start, count); - auto bpFloats = - dataManIO.DefineVariable("bpFloats", shape, start, count); - auto bpDoubles = - dataManIO.DefineVariable("bpDoubles", shape, start, count); - auto bpComplexes = dataManIO.DefineVariable>( - "bpComplexes", shape, start, count); - auto bpDComplexes = dataManIO.DefineVariable>( - "bpDComplexes", shape, start, count); - dataManIO.DefineAttribute("AttInt", 110); - adios2::Engine dataManWriter = - dataManIO.Open("stream", adios2::Mode::Write); + auto varChars = io.DefineVariable("varChars", shape, start, count); + auto varUChars = + io.DefineVariable("varUChars", shape, start, count); + auto varShorts = io.DefineVariable("varShorts", shape, start, count); + auto varUShorts = + io.DefineVariable("varUShorts", shape, start, count); + auto varInts = io.DefineVariable("varInts", shape, start, count); + auto varUInts = + io.DefineVariable("varUInts", shape, start, count); + auto varFloats = io.DefineVariable("varFloats", shape, start, count); + auto varDoubles = + io.DefineVariable("varDoubles", shape, start, count); + auto varComplexes = io.DefineVariable>( + "varComplexes", shape, start, count); + auto varDComplexes = io.DefineVariable>( + "varDComplexes", shape, start, count); + io.DefineAttribute("AttInt", 110); + adios2::Engine engine = io.Open("stream", adios2::Mode::Write); for (size_t i = 0; i < steps; ++i) { - dataManWriter.BeginStep(); + engine.BeginStep(); GenData(myChars, i, start, count, shape); GenData(myUChars, i, start, count, shape); GenData(myShorts, i, start, count, shape); @@ -153,20 +149,19 @@ void DataManWriterP2PMemSelect(const Dims &shape, const Dims &start, GenData(myDoubles, i, start, count, shape); GenData(myComplexes, i, start, count, shape); GenData(myDComplexes, i, start, count, shape); - dataManWriter.Put(bpChars, myChars.data(), adios2::Mode::Sync); - dataManWriter.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - dataManWriter.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpInts, myInts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - dataManWriter.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - dataManWriter.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - dataManWriter.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - dataManWriter.Put(bpDComplexes, myDComplexes.data(), - adios2::Mode::Sync); - dataManWriter.EndStep(); + engine.Put(varChars, myChars.data(), adios2::Mode::Sync); + engine.Put(varUChars, myUChars.data(), adios2::Mode::Sync); + engine.Put(varShorts, myShorts.data(), adios2::Mode::Sync); + engine.Put(varUShorts, myUShorts.data(), adios2::Mode::Sync); + engine.Put(varInts, myInts.data(), adios2::Mode::Sync); + engine.Put(varUInts, myUInts.data(), adios2::Mode::Sync); + engine.Put(varFloats, myFloats.data(), adios2::Mode::Sync); + engine.Put(varDoubles, myDoubles.data(), adios2::Mode::Sync); + engine.Put(varComplexes, myComplexes.data(), adios2::Mode::Sync); + engine.Put(varDComplexes, myDComplexes.data(), adios2::Mode::Sync); + engine.EndStep(); } - dataManWriter.Close(); + engine.Close(); } void DataManReaderP2PMemSelect(const Dims &shape, const Dims &start, @@ -175,10 +170,10 @@ void DataManReaderP2PMemSelect(const Dims &shape, const Dims &start, const adios2::Params &engineParams) { adios2::ADIOS adios; - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("DataMan"); - dataManIO.SetParameters(engineParams); - adios2::Engine dataManReader = dataManIO.Open("stream", adios2::Mode::Read); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("DataMan"); + io.SetParameters(engineParams); + adios2::Engine engine = io.Open("stream", adios2::Mode::Read); size_t datasize = std::accumulate(memCount.begin(), memCount.end(), 1, std::multiplies()); @@ -196,13 +191,13 @@ void DataManReaderP2PMemSelect(const Dims &shape, const Dims &start, size_t currentStep; while (true) { - adios2::StepStatus status = dataManReader.BeginStep(); + adios2::StepStatus status = engine.BeginStep(); if (status == adios2::StepStatus::OK) { received_steps = true; - const auto &vars = dataManIO.AvailableVariables(); + const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 10); - currentStep = dataManReader.CurrentStep(); + currentStep = engine.CurrentStep(); GenData(myChars, currentStep, memStart, memCount, shape); GenData(myUChars, currentStep, memStart, memCount, shape); GenData(myShorts, currentStep, memStart, memCount, shape); @@ -213,62 +208,59 @@ void DataManReaderP2PMemSelect(const Dims &shape, const Dims &start, GenData(myDoubles, currentStep, memStart, memCount, shape); GenData(myComplexes, currentStep, memStart, memCount, shape); GenData(myDComplexes, currentStep, memStart, memCount, shape); - adios2::Variable bpChars = - dataManIO.InquireVariable("bpChars"); - adios2::Variable bpUChars = - dataManIO.InquireVariable("bpUChars"); - adios2::Variable bpShorts = - dataManIO.InquireVariable("bpShorts"); - adios2::Variable bpUShorts = - dataManIO.InquireVariable("bpUShorts"); - adios2::Variable bpInts = - dataManIO.InquireVariable("bpInts"); - adios2::Variable bpUInts = - dataManIO.InquireVariable("bpUInts"); - adios2::Variable bpFloats = - dataManIO.InquireVariable("bpFloats"); - adios2::Variable bpDoubles = - dataManIO.InquireVariable("bpDoubles"); - adios2::Variable> bpComplexes = - dataManIO.InquireVariable>("bpComplexes"); - adios2::Variable> bpDComplexes = - dataManIO.InquireVariable>("bpDComplexes"); - auto charsBlocksInfo = dataManReader.AllStepsBlocksInfo(bpChars); + adios2::Variable varChars = + io.InquireVariable("varChars"); + adios2::Variable varUChars = + io.InquireVariable("varUChars"); + adios2::Variable varShorts = + io.InquireVariable("varShorts"); + adios2::Variable varUShorts = + io.InquireVariable("varUShorts"); + adios2::Variable varInts = io.InquireVariable("varInts"); + adios2::Variable varUInts = + io.InquireVariable("varUInts"); + adios2::Variable varFloats = + io.InquireVariable("varFloats"); + adios2::Variable varDoubles = + io.InquireVariable("varDoubles"); + adios2::Variable> varComplexes = + io.InquireVariable>("varComplexes"); + adios2::Variable> varDComplexes = + io.InquireVariable>("varDComplexes"); + auto charsBlocksInfo = engine.AllStepsBlocksInfo(varChars); - bpChars.SetSelection({start, count}); - bpUChars.SetSelection({start, count}); - bpShorts.SetSelection({start, count}); - bpUShorts.SetSelection({start, count}); - bpInts.SetSelection({start, count}); - bpUInts.SetSelection({start, count}); - bpFloats.SetSelection({start, count}); - bpDoubles.SetSelection({start, count}); - bpComplexes.SetSelection({start, count}); - bpDComplexes.SetSelection({start, count}); + varChars.SetSelection({start, count}); + varUChars.SetSelection({start, count}); + varShorts.SetSelection({start, count}); + varUShorts.SetSelection({start, count}); + varInts.SetSelection({start, count}); + varUInts.SetSelection({start, count}); + varFloats.SetSelection({start, count}); + varDoubles.SetSelection({start, count}); + varComplexes.SetSelection({start, count}); + varDComplexes.SetSelection({start, count}); - bpChars.SetMemorySelection({memStart, memCount}); - bpUChars.SetMemorySelection({memStart, memCount}); - bpShorts.SetMemorySelection({memStart, memCount}); - bpUShorts.SetMemorySelection({memStart, memCount}); - bpInts.SetMemorySelection({memStart, memCount}); - bpUInts.SetMemorySelection({memStart, memCount}); - bpFloats.SetMemorySelection({memStart, memCount}); - bpDoubles.SetMemorySelection({memStart, memCount}); - bpComplexes.SetMemorySelection({memStart, memCount}); - bpDComplexes.SetMemorySelection({memStart, memCount}); + varChars.SetMemorySelection({memStart, memCount}); + varUChars.SetMemorySelection({memStart, memCount}); + varShorts.SetMemorySelection({memStart, memCount}); + varUShorts.SetMemorySelection({memStart, memCount}); + varInts.SetMemorySelection({memStart, memCount}); + varUInts.SetMemorySelection({memStart, memCount}); + varFloats.SetMemorySelection({memStart, memCount}); + varDoubles.SetMemorySelection({memStart, memCount}); + varComplexes.SetMemorySelection({memStart, memCount}); + varDComplexes.SetMemorySelection({memStart, memCount}); - dataManReader.Get(bpChars, myChars.data(), adios2::Mode::Sync); - dataManReader.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - dataManReader.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - dataManReader.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - dataManReader.Get(bpInts, myInts.data(), adios2::Mode::Sync); - dataManReader.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); - dataManReader.Get(bpFloats, myFloats.data(), adios2::Mode::Sync); - dataManReader.Get(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - dataManReader.Get(bpComplexes, myComplexes.data(), - adios2::Mode::Sync); - dataManReader.Get(bpDComplexes, myDComplexes.data(), - adios2::Mode::Sync); + engine.Get(varChars, myChars.data(), adios2::Mode::Sync); + engine.Get(varUChars, myUChars.data(), adios2::Mode::Sync); + engine.Get(varShorts, myShorts.data(), adios2::Mode::Sync); + engine.Get(varUShorts, myUShorts.data(), adios2::Mode::Sync); + engine.Get(varInts, myInts.data(), adios2::Mode::Sync); + engine.Get(varUInts, myUInts.data(), adios2::Mode::Sync); + engine.Get(varFloats, myFloats.data(), adios2::Mode::Sync); + engine.Get(varDoubles, myDoubles.data(), adios2::Mode::Sync); + engine.Get(varComplexes, myComplexes.data(), adios2::Mode::Sync); + engine.Get(varDComplexes, myDComplexes.data(), adios2::Mode::Sync); VerifyData(myChars.data(), currentStep, memStart, memCount, shape); VerifyData(myUChars.data(), currentStep, memStart, memCount, shape); VerifyData(myShorts.data(), currentStep, memStart, memCount, shape); @@ -283,7 +275,7 @@ void DataManReaderP2PMemSelect(const Dims &shape, const Dims &start, shape); VerifyData(myDComplexes.data(), currentStep, memStart, memCount, shape); - dataManReader.EndStep(); + engine.EndStep(); } else if (status == adios2::StepStatus::EndOfStream) { @@ -296,10 +288,10 @@ void DataManReaderP2PMemSelect(const Dims &shape, const Dims &start, } if (received_steps) { - auto attInt = dataManIO.InquireAttribute("AttInt"); + auto attInt = io.InquireAttribute("AttInt"); ASSERT_EQ(110, attInt.Data()[0]); } - dataManReader.Close(); + engine.Close(); print_lines = 0; } diff --git a/testing/adios2/engine/ssc/CMakeLists.txt b/testing/adios2/engine/ssc/CMakeLists.txt index 6c218f930a..23f574ad75 100644 --- a/testing/adios2/engine/ssc/CMakeLists.txt +++ b/testing/adios2/engine/ssc/CMakeLists.txt @@ -5,7 +5,7 @@ include(ADIOSFunctions) -if(ADIOS2_HAVE_MPI) +if(ADIOS2_HAVE_MPI AND NOT MSVC) gtest_add_tests_helper(Base MPI_ONLY Ssc Engine.SSC. "") SetupTestPipeline(Engine.SSC.SscEngineTest.TestSscBase.MPI "" TRUE) @@ -60,13 +60,11 @@ if(ADIOS2_HAVE_MPI) gtest_add_tests_helper(Xgc2Way MPI_ONLY Ssc Engine.SSC. "") SetupTestPipeline(Engine.SSC.SscEngineTest.TestSscXgc2Way.MPI "" TRUE) -if(NOT MSVC) gtest_add_tests_helper(Xgc3Way MPI_ONLY Ssc Engine.SSC. "") SetupTestPipeline(Engine.SSC.SscEngineTest.TestSscXgc3Way.MPI "" TRUE) gtest_add_tests_helper(Xgc3WayMatchedSteps MPI_ONLY Ssc Engine.SSC. "") SetupTestPipeline(Engine.SSC.SscEngineTest.TestSscXgc3WayMatchedSteps.MPI "" TRUE) -endif() gtest_add_tests_helper(VaryingSteps MPI_ONLY Ssc Engine.SSC. "") SetupTestPipeline(Engine.SSC.SscEngineTest.TestSscVaryingSteps.MPI "" TRUE)