From 31f9a87841416fa530a27319a143862ed2bae007 Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Mon, 2 May 2022 15:19:09 -0400 Subject: [PATCH 1/4] finish up polishing tests and examples --- .../datamanReader/helloDataManReader.cpp | 22 +- .../hello/datamanReader/helloDataManReader.py | 20 +- .../datamanWriter/helloDataManWriter.cpp | 22 +- .../hello/datamanWriter/helloDataManWriter.py | 20 +- .../engine/dataman/TestDataMan2DZfp.cpp | 204 +++++++------ .../engine/dataman/TestDataMan3DMemSelect.cpp | 46 ++- .../dataman/TestDataManReaderDoubleBuffer.cpp | 186 ++++++------ .../dataman/TestDataManReaderSingleBuffer.cpp | 186 ++++++------ .../engine/dataman/TestDataManReliable.cpp | 186 ++++++------ .../dataman/TestDataManWriterDoubleBuffer.cpp | 186 ++++++------ .../dataman/TestDataManWriterSingleBuffer.cpp | 186 ++++++------ .../ssc/TestSscMoreWritersThanReaders.cpp | 136 +++++---- .../adios2/engine/ssc/TestSscNoAttributes.cpp | 156 +++++----- .../adios2/engine/ssc/TestSscNoSelection.cpp | 138 +++++---- .../adios2/engine/ssc/TestSscOnlyOneStep.cpp | 184 ++++++------ .../adios2/engine/ssc/TestSscOnlyTwoSteps.cpp | 184 ++++++------ .../engine/ssc/TestSscReaderMultiblock.cpp | 270 +++++++++--------- .../adios2/engine/ssc/TestSscSingleStep.cpp | 163 +++++------ testing/adios2/engine/ssc/TestSscString.cpp | 113 ++++---- testing/adios2/engine/ssc/TestSscStruct.cpp | 171 +++++------ .../adios2/engine/ssc/TestSscSuperLarge.cpp | 163 +++++------ .../adios2/engine/ssc/TestSscUnbalanced.cpp | 164 ++++++----- .../adios2/engine/ssc/TestSscVaryingSteps.cpp | 208 +++++++------- .../engine/ssc/TestSscWriterMultiblock.cpp | 212 +++++++------- .../adios2/engine/ssc/TestSscZeroBlock.cpp | 159 ++++++----- 25 files changed, 1800 insertions(+), 1885 deletions(-) diff --git a/examples/hello/datamanReader/helloDataManReader.cpp b/examples/hello/datamanReader/helloDataManReader.cpp index 2a53c131cf..72f1211236 100644 --- a/examples/hello/datamanReader/helloDataManReader.cpp +++ b/examples/hello/datamanReader/helloDataManReader.cpp @@ -38,14 +38,14 @@ int main(int argc, char *argv[]) // initialize adios2 adios2::ADIOS adios(MPI_COMM_WORLD); - adios2::IO dataManIO = adios.DeclareIO("whatever"); - dataManIO.SetEngine("DataMan"); - dataManIO.SetParameters( + adios2::IO io = adios.DeclareIO("whatever"); + io.SetEngine("DataMan"); + io.SetParameters( {{"IPAddress", "127.0.0.1"}, {"Port", "12306"}, {"Timeout", "5"}}); // open stream - adios2::Engine dataManReader = - dataManIO.Open("HelloDataMan", adios2::Mode::Read); + adios2::Engine engine = + io.Open("HelloDataMan", adios2::Mode::Read); // define variable adios2::Variable floatArrayVar; @@ -54,18 +54,18 @@ int main(int argc, char *argv[]) std::vector floatVector; while (true) { - auto status = dataManReader.BeginStep(); + auto status = engine.BeginStep(); if (status == adios2::StepStatus::OK) { - floatArrayVar = dataManIO.InquireVariable("FloatArray"); + floatArrayVar = io.InquireVariable("FloatArray"); auto shape = floatArrayVar.Shape(); size_t datasize = std::accumulate(shape.begin(), shape.end(), 1, std::multiplies()); floatVector.resize(datasize); - dataManReader.Get(floatArrayVar, floatVector.data(), + engine.Get(floatArrayVar, floatVector.data(), adios2::Mode::Sync); - dataManReader.EndStep(); - PrintData(floatVector, dataManReader.CurrentStep()); + engine.EndStep(); + PrintData(floatVector, engine.CurrentStep()); } else if (status == adios2::StepStatus::EndOfStream) { @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) } // clean up - dataManReader.Close(); + engine.Close(); MPI_Finalize(); return 0; diff --git a/examples/hello/datamanReader/helloDataManReader.py b/examples/hello/datamanReader/helloDataManReader.py index b4747461de..5cda4b4b6a 100644 --- a/examples/hello/datamanReader/helloDataManReader.py +++ b/examples/hello/datamanReader/helloDataManReader.py @@ -17,26 +17,26 @@ size = comm.Get_size() adios = adios2.ADIOS(comm) -dataManIO = adios.DeclareIO("whatever") -dataManIO.SetEngine("DataMan") -dataManIO.SetParameters({"IPAddress": "127.0.0.1", +io = adios.DeclareIO("whatever") +io.SetEngine("DataMan") +io.SetParameters({"IPAddress": "127.0.0.1", "Port": "12306", "Timeout": "5"}) -dataManReader = dataManIO.Open('HelloDataMan', adios2.Mode.Read, comm) +engine = io.Open('HelloDataMan', adios2.Mode.Read, comm) while True: - stepStatus = dataManReader.BeginStep() + stepStatus = engine.BeginStep() if stepStatus == adios2.StepStatus.OK: - var = dataManIO.InquireVariable("FloatArray") + var = io.InquireVariable("FloatArray") shape = var.Shape() floatArray = np.zeros(np.prod(shape), dtype=np.float32) - dataManReader.Get(var, floatArray, adios2.Mode.Sync) - currentStep = dataManReader.CurrentStep() - dataManReader.EndStep() + engine.Get(var, floatArray, adios2.Mode.Sync) + currentStep = engine.CurrentStep() + engine.EndStep() print("Step", currentStep, floatArray) elif stepStatus == adios2.StepStatus.EndOfStream: print("End of stream") break -dataManReader.Close() +engine.Close() diff --git a/examples/hello/datamanWriter/helloDataManWriter.cpp b/examples/hello/datamanWriter/helloDataManWriter.cpp index fb06f0132b..4bd27b215c 100644 --- a/examples/hello/datamanWriter/helloDataManWriter.cpp +++ b/examples/hello/datamanWriter/helloDataManWriter.cpp @@ -62,33 +62,33 @@ int main(int argc, char *argv[]) // initialize adios2 adios2::ADIOS adios(MPI_COMM_WORLD); - adios2::IO dataManIO = adios.DeclareIO("whatever"); - dataManIO.SetEngine("DataMan"); - dataManIO.SetParameters({{"IPAddress", "127.0.0.1"}, + adios2::IO io = adios.DeclareIO("whatever"); + io.SetEngine("DataMan"); + io.SetParameters({{"IPAddress", "127.0.0.1"}, {"Port", "12306"}, {"Timeout", "5"}, {"RendezvousReaderCount", "1"}}); // open stream - adios2::Engine dataManWriter = - dataManIO.Open("HelloDataMan", adios2::Mode::Write); + adios2::Engine engine = + io.Open("HelloDataMan", adios2::Mode::Write); // define variable auto floatArrayVar = - dataManIO.DefineVariable("FloatArray", shape, start, count); + io.DefineVariable("FloatArray", shape, start, count); // write data for (size_t i = 0; i < steps; ++i) { auto floatVector = GenerateData(i); - dataManWriter.BeginStep(); - dataManWriter.Put(floatArrayVar, floatVector.data(), + engine.BeginStep(); + engine.Put(floatArrayVar, floatVector.data(), adios2::Mode::Sync); - PrintData(floatVector, dataManWriter.CurrentStep()); - dataManWriter.EndStep(); + PrintData(floatVector, engine.CurrentStep()); + engine.EndStep(); } - dataManWriter.Close(); + engine.Close(); MPI_Finalize(); return 0; diff --git a/examples/hello/datamanWriter/helloDataManWriter.py b/examples/hello/datamanWriter/helloDataManWriter.py index a8da2c09ae..06be06b177 100644 --- a/examples/hello/datamanWriter/helloDataManWriter.py +++ b/examples/hello/datamanWriter/helloDataManWriter.py @@ -18,7 +18,7 @@ Nx = 10 Ny = 10 -steps = 100000 +steps = 10000 count = [Nx, Ny] start = [rank * Nx, 0] @@ -31,22 +31,22 @@ floatArray[i, j] = (start[0] + i) * shape[1] + (j + start[1]) adios = adios2.ADIOS(comm) -dataManIO = adios.DeclareIO("whatever") -dataManIO.SetEngine("DataMan") -dataManIO.SetParameters({"IPAddress": "127.0.0.1", +io = adios.DeclareIO("whatever") +io.SetEngine("DataMan") +io.SetParameters({"IPAddress": "127.0.0.1", "Port": "12306", "Timeout": "5"}) -var = dataManIO.DefineVariable( +var = io.DefineVariable( "FloatArray", floatArray, shape, start, count, adios2.ConstantDims) -dataManWriter = dataManIO.Open('HelloDataMan', adios2.Mode.Write) +engine = io.Open('HelloDataMan', adios2.Mode.Write) for i in range(steps): floatArray = floatArray + 1 print("Step", i, floatArray) - dataManWriter.BeginStep() - dataManWriter.Put(var, floatArray) - dataManWriter.EndStep() + engine.BeginStep() + engine.Put(var, floatArray) + engine.EndStep() -dataManWriter.Close() +engine.Close() diff --git a/testing/adios2/engine/dataman/TestDataMan2DZfp.cpp b/testing/adios2/engine/dataman/TestDataMan2DZfp.cpp index 2c7aabe668..a5f0f13239 100644 --- a/testing/adios2/engine/dataman/TestDataMan2DZfp.cpp +++ b/testing/adios2/engine/dataman/TestDataMan2DZfp.cpp @@ -104,13 +104,13 @@ 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", "zfp", {{"accuracy", "0.01"}}); - dataManIO.AddOperation("bpDoubles", "zfp", {{"accuracy", "0.1"}}); - dataManIO.AddOperation("bpComplexes", "zfp", {{"accuracy", "0.1"}}); - dataManIO.AddOperation("bpDComplexes", "zfp", {{"accuracy", "0.1"}}); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("DataMan"); + io.SetParameters(engineParams); + io.AddOperation("varFloats", "zfp", {{"accuracy", "0.01"}}); + io.AddOperation("varDoubles", "zfp", {{"accuracy", "0.1"}}); + io.AddOperation("varComplexes", "zfp", {{"accuracy", "0.1"}}); + io.AddOperation("varDComplexes", "zfp", {{"accuracy", "0.1"}}); std::vector myChars(datasize); std::vector myUChars(datasize); std::vector myShorts(datasize); @@ -121,31 +121,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); @@ -156,20 +152,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, @@ -178,10 +173,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()); @@ -199,13 +194,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); @@ -216,62 +211,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); @@ -286,7 +278,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) { @@ -299,11 +291,11 @@ 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]); ASSERT_NE(111, attInt.Data()[0]); } - dataManReader.Close(); + engine.Close(); print_lines = 0; } diff --git a/testing/adios2/engine/dataman/TestDataMan3DMemSelect.cpp b/testing/adios2/engine/dataman/TestDataMan3DMemSelect.cpp index 03a37a5d45..16fe402d57 100644 --- a/testing/adios2/engine/dataman/TestDataMan3DMemSelect.cpp +++ b/testing/adios2/engine/dataman/TestDataMan3DMemSelect.cpp @@ -95,19 +95,18 @@ void DataManWriterP2PMemSelect(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); - auto bpInts = dataManIO.DefineVariable("bpInts", shape, start, count); - adios2::Engine dataManWriter = - dataManIO.Open("stream", adios2::Mode::Write); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("DataMan"); + io.SetParameters(engineParams); + auto varInts = io.DefineVariable("varInts", shape, start, count); + adios2::Engine engine = io.Open("stream", adios2::Mode::Write); for (size_t i = 0; i < steps; ++i) { - dataManWriter.BeginStep(); - dataManWriter.Put(bpInts, writer_data.data(), adios2::Mode::Sync); - dataManWriter.EndStep(); + engine.BeginStep(); + engine.Put(varInts, writer_data.data(), adios2::Mode::Sync); + engine.EndStep(); } - dataManWriter.Close(); + engine.Close(); } void DataManReaderP2PMemSelect(const Dims &shape, const Dims &start, @@ -116,26 +115,25 @@ 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); std::vector myInts = reader_data; while (true) { - adios2::StepStatus status = dataManReader.BeginStep(StepMode::Read, 5); + adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { - const auto &vars = dataManIO.AvailableVariables(); + const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 1); - size_t currentStep = dataManReader.CurrentStep(); - adios2::Variable bpInts = - dataManIO.InquireVariable("bpInts"); - bpInts.SetSelection({start, count}); - bpInts.SetMemorySelection({memStart, memCount}); - dataManReader.Get(bpInts, myInts.data(), adios2::Mode::Sync); + size_t currentStep = engine.CurrentStep(); + adios2::Variable varInts = io.InquireVariable("varInts"); + varInts.SetSelection({start, count}); + varInts.SetMemorySelection({memStart, memCount}); + engine.Get(varInts, myInts.data(), adios2::Mode::Sync); VerifyData(myInts.data(), currentStep, memStart, memCount, shape); - dataManReader.EndStep(); + engine.EndStep(); } else if (status == adios2::StepStatus::EndOfStream) { @@ -146,7 +144,7 @@ void DataManReaderP2PMemSelect(const Dims &shape, const Dims &start, continue; } } - dataManReader.Close(); + engine.Close(); print_lines = 0; } diff --git a/testing/adios2/engine/dataman/TestDataManReaderDoubleBuffer.cpp b/testing/adios2/engine/dataman/TestDataManReaderDoubleBuffer.cpp index b70d15ba8c..57d24e23a9 100644 --- a/testing/adios2/engine/dataman/TestDataManReaderDoubleBuffer.cpp +++ b/testing/adios2/engine/dataman/TestDataManReaderDoubleBuffer.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/TestDataManReaderSingleBuffer.cpp b/testing/adios2/engine/dataman/TestDataManReaderSingleBuffer.cpp index 6f11abaa79..6330ac82bb 100644 --- a/testing/adios2/engine/dataman/TestDataManReaderSingleBuffer.cpp +++ b/testing/adios2/engine/dataman/TestDataManReaderSingleBuffer.cpp @@ -89,9 +89,9 @@ void DataManWriter(const Dims &shape, const Dims &start, const Dims &count, #else adios2::ADIOS adios; #endif - 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); @@ -102,32 +102,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); @@ -138,21 +134,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, @@ -165,10 +160,10 @@ void DataManReader(const Dims &shape, const Dims &start, const Dims &count, #else adios2::ADIOS adios; #endif - 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); @@ -184,60 +179,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); @@ -249,7 +241,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) { @@ -262,11 +254,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/TestDataManReliable.cpp b/testing/adios2/engine/dataman/TestDataManReliable.cpp index c620ab929e..5c95d7c054 100644 --- a/testing/adios2/engine/dataman/TestDataManReliable.cpp +++ b/testing/adios2/engine/dataman/TestDataManReliable.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/TestDataManWriterDoubleBuffer.cpp b/testing/adios2/engine/dataman/TestDataManWriterDoubleBuffer.cpp index b53425e616..0b8f426fa6 100644 --- a/testing/adios2/engine/dataman/TestDataManWriterDoubleBuffer.cpp +++ b/testing/adios2/engine/dataman/TestDataManWriterDoubleBuffer.cpp @@ -94,9 +94,9 @@ void DataManWriter(const Dims &shape, const Dims &start, const Dims &count, #else adios2::ADIOS adios; #endif - 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); @@ -107,32 +107,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); @@ -143,21 +139,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, @@ -170,10 +165,10 @@ void DataManReader(const Dims &shape, const Dims &start, const Dims &count, #else adios2::ADIOS adios; #endif - 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); @@ -189,60 +184,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); @@ -254,7 +246,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) { @@ -267,10 +259,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/TestDataManWriterSingleBuffer.cpp b/testing/adios2/engine/dataman/TestDataManWriterSingleBuffer.cpp index 2f77d85703..ae07968538 100644 --- a/testing/adios2/engine/dataman/TestDataManWriterSingleBuffer.cpp +++ b/testing/adios2/engine/dataman/TestDataManWriterSingleBuffer.cpp @@ -88,9 +88,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); @@ -101,32 +101,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); @@ -137,21 +133,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, @@ -160,10 +155,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); @@ -179,60 +174,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); @@ -244,7 +236,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) { @@ -257,11 +249,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/ssc/TestSscMoreWritersThanReaders.cpp b/testing/adios2/engine/ssc/TestSscMoreWritersThanReaders.cpp index 174bea0646..678502af4b 100644 --- a/testing/adios2/engine/ssc/TestSscMoreWritersThanReaders.cpp +++ b/testing/adios2/engine/ssc/TestSscMoreWritersThanReaders.cpp @@ -29,9 +29,9 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, std::accumulate(count.begin(), count.end(), static_cast(1), std::multiplies()); adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); std::vector myChars(datasize); std::vector myUChars(datasize); std::vector myShorts(datasize); @@ -42,27 +42,24 @@ void Writer(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); - dataManIO.DefineAttribute("AttInt", 110); - adios2::Engine engine = dataManIO.Open(name, 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(name, adios2::Mode::Write); engine.LockWriterDefinitions(); for (size_t i = 0; i < steps; ++i) { @@ -77,16 +74,16 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myDoubles, i, start, count, shape); GenData(myComplexes, i, start, count, shape); GenData(myDComplexes, i, start, count, shape); - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); + 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(); } engine.Close(); @@ -97,10 +94,10 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, const std::string &name) { adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("Test"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); - adios2::Engine engine = dataManIO.Open(name, adios2::Mode::Read); + adios2::IO io = adios.DeclareIO("Test"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); + adios2::Engine engine = io.Open(name, adios2::Mode::Read); engine.LockReaderSelections(); size_t datasize = @@ -122,40 +119,39 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { - const auto &vars = dataManIO.AvailableVariables(); + const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 10); size_t currentStep = engine.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"); - - engine.Get(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Get(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Get(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Get(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Get(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Get(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); + 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"); + + 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, Dims(shape.size(), 0), shape, shape, mpiRank); VerifyData(myUChars.data(), currentStep, Dims(shape.size(), 0), diff --git a/testing/adios2/engine/ssc/TestSscNoAttributes.cpp b/testing/adios2/engine/ssc/TestSscNoAttributes.cpp index 774f1699fa..c1d5f2b7b2 100644 --- a/testing/adios2/engine/ssc/TestSscNoAttributes.cpp +++ b/testing/adios2/engine/ssc/TestSscNoAttributes.cpp @@ -29,9 +29,9 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, std::accumulate(count.begin(), count.end(), static_cast(1), std::multiplies()); adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("staging"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); + adios2::IO io = adios.DeclareIO("staging"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); std::vector myChars(datasize); std::vector myUChars(datasize); std::vector myShorts(datasize); @@ -42,26 +42,23 @@ void Writer(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); - adios2::Engine engine = dataManIO.Open(name, 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); + adios2::Engine engine = io.Open(name, adios2::Mode::Write); engine.LockWriterDefinitions(); for (size_t i = 0; i < steps; ++i) { @@ -76,16 +73,16 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myDoubles, i, start, count, shape); GenData(myComplexes, i, start, count, shape); GenData(myDComplexes, i, start, count, shape); - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); + 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(); } engine.Close(); @@ -96,10 +93,10 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, const std::string &name) { adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("staging"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); - adios2::Engine engine = dataManIO.Open(name, adios2::Mode::Read); + adios2::IO io = adios.DeclareIO("staging"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); + adios2::Engine engine = io.Open(name, adios2::Mode::Read); engine.LockReaderSelections(); size_t datasize = @@ -121,52 +118,51 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { - const auto &vars = dataManIO.AvailableVariables(); + const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 10); size_t currentStep = engine.CurrentStep(); // ASSERT_EQ(i, 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"); - - 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}); - - engine.Get(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Get(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Get(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Get(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Get(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Get(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); + 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"); + + 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); VerifyData(myChars.data(), currentStep, start, count, shape, mpiRank); VerifyData(myUChars.data(), currentStep, start, count, shape, diff --git a/testing/adios2/engine/ssc/TestSscNoSelection.cpp b/testing/adios2/engine/ssc/TestSscNoSelection.cpp index 482da1824b..810c150240 100644 --- a/testing/adios2/engine/ssc/TestSscNoSelection.cpp +++ b/testing/adios2/engine/ssc/TestSscNoSelection.cpp @@ -29,9 +29,9 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, std::accumulate(count.begin(), count.end(), static_cast(1), std::multiplies()); adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); std::vector myChars(datasize); std::vector myUChars(datasize); std::vector myShorts(datasize); @@ -42,27 +42,24 @@ void Writer(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); - dataManIO.DefineAttribute("AttInt", 110); - adios2::Engine engine = dataManIO.Open(name, 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(name, adios2::Mode::Write); engine.LockWriterDefinitions(); for (size_t i = 0; i < steps; ++i) { @@ -77,16 +74,16 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myDoubles, i, start, count, shape); GenData(myComplexes, i, start, count, shape); GenData(myDComplexes, i, start, count, shape); - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); + 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(); } engine.Close(); @@ -97,10 +94,10 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, const std::string &name) { adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("Test"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); - adios2::Engine engine = dataManIO.Open(name, adios2::Mode::Read); + adios2::IO io = adios.DeclareIO("Test"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); + adios2::Engine engine = io.Open(name, adios2::Mode::Read); engine.LockReaderSelections(); size_t datasize = @@ -122,40 +119,39 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { - const auto &vars = dataManIO.AvailableVariables(); + const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 10); size_t currentStep = engine.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"); - - engine.Get(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Get(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Get(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Get(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Get(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Get(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); + 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"); + + 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, Dims(shape.size(), 0), shape, shape, mpiRank); VerifyData(myUChars.data(), currentStep, Dims(shape.size(), 0), @@ -187,7 +183,7 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, } } - auto attInt = dataManIO.InquireAttribute("AttInt"); + auto attInt = io.InquireAttribute("AttInt"); ASSERT_EQ(110, attInt.Data()[0]); engine.Close(); } diff --git a/testing/adios2/engine/ssc/TestSscOnlyOneStep.cpp b/testing/adios2/engine/ssc/TestSscOnlyOneStep.cpp index fc5ad9f096..e5e77e0f10 100644 --- a/testing/adios2/engine/ssc/TestSscOnlyOneStep.cpp +++ b/testing/adios2/engine/ssc/TestSscOnlyOneStep.cpp @@ -29,9 +29,9 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, std::accumulate(count.begin(), count.end(), static_cast(1), std::multiplies()); adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); std::vector myChars(datasize); std::vector myUChars(datasize); std::vector myShorts(datasize); @@ -42,29 +42,26 @@ void Writer(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 scalarInt = dataManIO.DefineVariable("scalarInt"); - auto stringVar = dataManIO.DefineVariable("stringVar"); - dataManIO.DefineAttribute("AttInt", 110); - adios2::Engine engine = dataManIO.Open(name, 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 varIntScalar = io.DefineVariable("varIntScalar"); + auto varString = io.DefineVariable("varString"); + io.DefineAttribute("AttInt", 110); + adios2::Engine engine = io.Open(name, adios2::Mode::Write); engine.LockWriterDefinitions(); for (size_t i = 0; i < steps; ++i) { @@ -79,19 +76,19 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myDoubles, i, start, count, shape); GenData(myComplexes, i, start, count, shape); GenData(myDComplexes, i, start, count, shape); - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); - engine.Put(scalarInt, static_cast(i)); + 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(varIntScalar, static_cast(i)); std::string s = "sample string sample string sample string"; - engine.Put(stringVar, s); + engine.Put(varString, s); engine.EndStep(); } engine.Close(); @@ -102,10 +99,10 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, const std::string &name) { adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("Test"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); - adios2::Engine engine = dataManIO.Open(name, adios2::Mode::Read); + adios2::IO io = adios.DeclareIO("Test"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); + adios2::Engine engine = io.Open(name, adios2::Mode::Read); engine.LockReaderSelections(); size_t datasize = @@ -127,75 +124,74 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { - auto scalarInt = dataManIO.InquireVariable("scalarInt"); + auto varIntScalar = io.InquireVariable("varIntScalar"); auto blocksInfo = - engine.BlocksInfo(scalarInt, engine.CurrentStep()); + engine.BlocksInfo(varIntScalar, engine.CurrentStep()); for (const auto &bi : blocksInfo) { ASSERT_EQ(bi.IsValue, true); ASSERT_EQ(bi.Value, engine.CurrentStep()); - ASSERT_EQ(scalarInt.Min(), engine.CurrentStep()); - ASSERT_EQ(scalarInt.Max(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Min(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Max(), engine.CurrentStep()); } - const auto &vars = dataManIO.AvailableVariables(); + const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 12); size_t currentStep = engine.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 stringVar = - dataManIO.InquireVariable("stringVar"); + 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 varString = + io.InquireVariable("varString"); - 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}); - engine.Get(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Get(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Get(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Get(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Get(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.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); std::string s; - engine.Get(stringVar, s, adios2::Mode::Sync); + engine.Get(varString, s, adios2::Mode::Sync); ASSERT_EQ(s, "sample string sample string sample string"); - ASSERT_EQ(stringVar.Min(), + ASSERT_EQ(varString.Min(), "sample string sample string sample string"); - ASSERT_EQ(stringVar.Max(), + ASSERT_EQ(varString.Max(), "sample string sample string sample string"); int i; - engine.Get(scalarInt, &i, adios2::Mode::Sync); + engine.Get(varIntScalar, &i, adios2::Mode::Sync); ASSERT_EQ(i, currentStep); VerifyData(myChars.data(), currentStep, start, count, shape, @@ -228,7 +224,7 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, break; } } - auto attInt = dataManIO.InquireAttribute("AttInt"); + auto attInt = io.InquireAttribute("AttInt"); ASSERT_EQ(110, attInt.Data()[0]); engine.Close(); } diff --git a/testing/adios2/engine/ssc/TestSscOnlyTwoSteps.cpp b/testing/adios2/engine/ssc/TestSscOnlyTwoSteps.cpp index d9de41d891..e10aaab8b6 100644 --- a/testing/adios2/engine/ssc/TestSscOnlyTwoSteps.cpp +++ b/testing/adios2/engine/ssc/TestSscOnlyTwoSteps.cpp @@ -29,9 +29,9 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, std::accumulate(count.begin(), count.end(), static_cast(1), std::multiplies()); adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); std::vector myChars(datasize); std::vector myUChars(datasize); std::vector myShorts(datasize); @@ -42,29 +42,26 @@ void Writer(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 scalarInt = dataManIO.DefineVariable("scalarInt"); - auto stringVar = dataManIO.DefineVariable("stringVar"); - dataManIO.DefineAttribute("AttInt", 110); - adios2::Engine engine = dataManIO.Open(name, 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 varIntScalar = io.DefineVariable("varIntScalar"); + auto varString = io.DefineVariable("varString"); + io.DefineAttribute("AttInt", 110); + adios2::Engine engine = io.Open(name, adios2::Mode::Write); engine.LockWriterDefinitions(); for (size_t i = 0; i < steps; ++i) { @@ -79,19 +76,19 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myDoubles, i, start, count, shape); GenData(myComplexes, i, start, count, shape); GenData(myDComplexes, i, start, count, shape); - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); - engine.Put(scalarInt, static_cast(i)); + 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(varIntScalar, static_cast(i)); std::string s = "sample string sample string sample string"; - engine.Put(stringVar, s); + engine.Put(varString, s); engine.EndStep(); } engine.Close(); @@ -102,10 +99,10 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, const std::string &name) { adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("Test"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); - adios2::Engine engine = dataManIO.Open(name, adios2::Mode::Read); + adios2::IO io = adios.DeclareIO("Test"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); + adios2::Engine engine = io.Open(name, adios2::Mode::Read); engine.LockReaderSelections(); size_t datasize = @@ -127,75 +124,74 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { - auto scalarInt = dataManIO.InquireVariable("scalarInt"); + auto varIntScalar = io.InquireVariable("varIntScalar"); auto blocksInfo = - engine.BlocksInfo(scalarInt, engine.CurrentStep()); + engine.BlocksInfo(varIntScalar, engine.CurrentStep()); for (const auto &bi : blocksInfo) { ASSERT_EQ(bi.IsValue, true); ASSERT_EQ(bi.Value, engine.CurrentStep()); - ASSERT_EQ(scalarInt.Min(), engine.CurrentStep()); - ASSERT_EQ(scalarInt.Max(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Min(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Max(), engine.CurrentStep()); } - const auto &vars = dataManIO.AvailableVariables(); + const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 12); size_t currentStep = engine.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 stringVar = - dataManIO.InquireVariable("stringVar"); + 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 varString = + io.InquireVariable("varString"); - 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}); - engine.Get(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Get(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Get(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Get(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Get(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.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); std::string s; - engine.Get(stringVar, s, adios2::Mode::Sync); + engine.Get(varString, s, adios2::Mode::Sync); ASSERT_EQ(s, "sample string sample string sample string"); - ASSERT_EQ(stringVar.Min(), + ASSERT_EQ(varString.Min(), "sample string sample string sample string"); - ASSERT_EQ(stringVar.Max(), + ASSERT_EQ(varString.Max(), "sample string sample string sample string"); int i; - engine.Get(scalarInt, &i, adios2::Mode::Sync); + engine.Get(varIntScalar, &i, adios2::Mode::Sync); ASSERT_EQ(i, currentStep); VerifyData(myChars.data(), currentStep, start, count, shape, @@ -228,7 +224,7 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, break; } } - auto attInt = dataManIO.InquireAttribute("AttInt"); + auto attInt = io.InquireAttribute("AttInt"); ASSERT_EQ(110, attInt.Data()[0]); engine.Close(); } diff --git a/testing/adios2/engine/ssc/TestSscReaderMultiblock.cpp b/testing/adios2/engine/ssc/TestSscReaderMultiblock.cpp index 7d727d29f4..a1119fb52f 100644 --- a/testing/adios2/engine/ssc/TestSscReaderMultiblock.cpp +++ b/testing/adios2/engine/ssc/TestSscReaderMultiblock.cpp @@ -29,9 +29,9 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, std::accumulate(count.begin(), count.end(), static_cast(1), std::multiplies()); adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); std::vector myChars(datasize); std::vector myUChars(datasize); std::vector myShorts(datasize); @@ -42,28 +42,25 @@ void Writer(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 scalarInt = dataManIO.DefineVariable("scalarInt"); - dataManIO.DefineAttribute("AttInt", 110); - adios2::Engine engine = dataManIO.Open(name, 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 varIntScalar = io.DefineVariable("varIntScalar"); + io.DefineAttribute("AttInt", 110); + adios2::Engine engine = io.Open(name, adios2::Mode::Write); engine.LockWriterDefinitions(); for (size_t i = 0; i < steps; ++i) { @@ -82,28 +79,28 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myComplexes, i, startTmp, count, shape); GenData(myDComplexes, i, startTmp, count, shape); - bpChars.SetSelection({startTmp, count}); - bpUChars.SetSelection({startTmp, count}); - bpShorts.SetSelection({startTmp, count}); - bpUShorts.SetSelection({startTmp, count}); - bpInts.SetSelection({startTmp, count}); - bpUInts.SetSelection({startTmp, count}); - bpFloats.SetSelection({startTmp, count}); - bpDoubles.SetSelection({startTmp, count}); - bpComplexes.SetSelection({startTmp, count}); - bpDComplexes.SetSelection({startTmp, count}); - - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); - engine.Put(scalarInt, static_cast(i)); + varChars.SetSelection({startTmp, count}); + varUChars.SetSelection({startTmp, count}); + varShorts.SetSelection({startTmp, count}); + varUShorts.SetSelection({startTmp, count}); + varInts.SetSelection({startTmp, count}); + varUInts.SetSelection({startTmp, count}); + varFloats.SetSelection({startTmp, count}); + varDoubles.SetSelection({startTmp, count}); + varComplexes.SetSelection({startTmp, count}); + varDComplexes.SetSelection({startTmp, count}); + + 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(varIntScalar, static_cast(i)); startTmp = {(size_t)mpiRank * 2 + 1, 0}; @@ -118,28 +115,28 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myComplexes, i, startTmp, count, shape); GenData(myDComplexes, i, startTmp, count, shape); - bpChars.SetSelection({startTmp, count}); - bpUChars.SetSelection({startTmp, count}); - bpShorts.SetSelection({startTmp, count}); - bpUShorts.SetSelection({startTmp, count}); - bpInts.SetSelection({startTmp, count}); - bpUInts.SetSelection({startTmp, count}); - bpFloats.SetSelection({startTmp, count}); - bpDoubles.SetSelection({startTmp, count}); - bpComplexes.SetSelection({startTmp, count}); - bpDComplexes.SetSelection({startTmp, count}); - - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); - engine.Put(scalarInt, static_cast(i)); + varChars.SetSelection({startTmp, count}); + varUChars.SetSelection({startTmp, count}); + varShorts.SetSelection({startTmp, count}); + varUShorts.SetSelection({startTmp, count}); + varInts.SetSelection({startTmp, count}); + varUInts.SetSelection({startTmp, count}); + varFloats.SetSelection({startTmp, count}); + varDoubles.SetSelection({startTmp, count}); + varComplexes.SetSelection({startTmp, count}); + varDComplexes.SetSelection({startTmp, count}); + + 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(varIntScalar, static_cast(i)); engine.EndStep(); } @@ -151,10 +148,10 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, const std::string &name) { adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("Test"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); - adios2::Engine engine = dataManIO.Open(name, adios2::Mode::Read); + adios2::IO io = adios.DeclareIO("Test"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); + adios2::Engine engine = io.Open(name, adios2::Mode::Read); engine.LockReaderSelections(); size_t datasize = @@ -176,59 +173,58 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { - const auto &vars = dataManIO.AvailableVariables(); + const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 11); size_t currentStep = engine.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"); - auto scalarInt = dataManIO.InquireVariable("scalarInt"); + 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 varIntScalar = io.InquireVariable("varIntScalar"); int i; - engine.Get(scalarInt, &i, adios2::Mode::Sync); + engine.Get(varIntScalar, &i, adios2::Mode::Sync); ASSERT_EQ(i, currentStep); adios2::Dims startTmp = start; adios2::Dims countTmp = count; startTmp[0] = mpiRank * 2; countTmp[0] = 1; - bpChars.SetSelection({startTmp, countTmp}); - bpUChars.SetSelection({startTmp, countTmp}); - bpShorts.SetSelection({startTmp, countTmp}); - bpUShorts.SetSelection({startTmp, countTmp}); - bpInts.SetSelection({startTmp, countTmp}); - bpUInts.SetSelection({startTmp, countTmp}); - bpFloats.SetSelection({startTmp, countTmp}); - bpDoubles.SetSelection({startTmp, countTmp}); - bpComplexes.SetSelection({startTmp, countTmp}); - bpDComplexes.SetSelection({startTmp, countTmp}); - engine.Get(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Get(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Get(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Get(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Get(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Get(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); + varChars.SetSelection({startTmp, countTmp}); + varUChars.SetSelection({startTmp, countTmp}); + varShorts.SetSelection({startTmp, countTmp}); + varUShorts.SetSelection({startTmp, countTmp}); + varInts.SetSelection({startTmp, countTmp}); + varUInts.SetSelection({startTmp, countTmp}); + varFloats.SetSelection({startTmp, countTmp}); + varDoubles.SetSelection({startTmp, countTmp}); + varComplexes.SetSelection({startTmp, countTmp}); + varDComplexes.SetSelection({startTmp, countTmp}); + 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, startTmp, countTmp, shape, mpiRank); VerifyData(myUChars.data(), currentStep, startTmp, countTmp, shape, @@ -252,26 +248,26 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, startTmp[0] = mpiRank * 2 + 1; countTmp[0] = 1; - bpChars.SetSelection({startTmp, countTmp}); - bpUChars.SetSelection({startTmp, countTmp}); - bpShorts.SetSelection({startTmp, countTmp}); - bpUShorts.SetSelection({startTmp, countTmp}); - bpInts.SetSelection({startTmp, countTmp}); - bpUInts.SetSelection({startTmp, countTmp}); - bpFloats.SetSelection({startTmp, countTmp}); - bpDoubles.SetSelection({startTmp, countTmp}); - bpComplexes.SetSelection({startTmp, countTmp}); - bpDComplexes.SetSelection({startTmp, countTmp}); - engine.Get(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Get(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Get(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Get(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Get(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Get(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); + varChars.SetSelection({startTmp, countTmp}); + varUChars.SetSelection({startTmp, countTmp}); + varShorts.SetSelection({startTmp, countTmp}); + varUShorts.SetSelection({startTmp, countTmp}); + varInts.SetSelection({startTmp, countTmp}); + varUInts.SetSelection({startTmp, countTmp}); + varFloats.SetSelection({startTmp, countTmp}); + varDoubles.SetSelection({startTmp, countTmp}); + varComplexes.SetSelection({startTmp, countTmp}); + varDComplexes.SetSelection({startTmp, countTmp}); + 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, startTmp, countTmp, shape, mpiRank); VerifyData(myUChars.data(), currentStep, startTmp, countTmp, shape, @@ -303,7 +299,7 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, break; } } - auto attInt = dataManIO.InquireAttribute("AttInt"); + auto attInt = io.InquireAttribute("AttInt"); ASSERT_EQ(110, attInt.Data()[0]); engine.Close(); } diff --git a/testing/adios2/engine/ssc/TestSscSingleStep.cpp b/testing/adios2/engine/ssc/TestSscSingleStep.cpp index 6c4fe042a2..0c7cbd528a 100644 --- a/testing/adios2/engine/ssc/TestSscSingleStep.cpp +++ b/testing/adios2/engine/ssc/TestSscSingleStep.cpp @@ -42,24 +42,24 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, std::vector myDoubles(datasize); std::vector> myComplexes(datasize); std::vector> myDComplexes(datasize); - auto bpChars = io.DefineVariable("bpChars", shape, start, count); - auto bpUChars = - io.DefineVariable("bpUChars", shape, start, count); - auto bpShorts = io.DefineVariable("bpShorts", shape, start, count); - auto bpUShorts = - io.DefineVariable("bpUShorts", shape, start, count); - auto bpInts = io.DefineVariable("bpInts", shape, start, count); - auto bpUInts = - io.DefineVariable("bpUInts", shape, start, count); - auto bpFloats = io.DefineVariable("bpFloats", shape, start, count); - auto bpDoubles = - io.DefineVariable("bpDoubles", shape, start, count); - auto bpComplexes = io.DefineVariable>( - "bpComplexes", shape, start, count); - auto bpDComplexes = io.DefineVariable>( - "bpDComplexes", shape, start, count); - auto scalarInt = io.DefineVariable("scalarInt"); - auto stringVar = io.DefineVariable("stringVar"); + 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 varIntScalar = io.DefineVariable("varIntScalar"); + auto varString = io.DefineVariable("varString"); io.DefineAttribute("AttInt", 110); adios2::Engine engine = io.Open(name, adios2::Mode::Write); engine.LockWriterDefinitions(); @@ -76,19 +76,19 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myDoubles, i, start, count, shape); GenData(myComplexes, i, start, count, shape); GenData(myDComplexes, i, start, count, shape); - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); - engine.Put(scalarInt, static_cast(i)); + 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(varIntScalar, static_cast(i)); std::string s = "sample string sample string sample string"; - engine.Put(stringVar, s); + engine.Put(varString, s); engine.EndStep(); } engine.Close(); @@ -128,60 +128,60 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, if (status == adios2::StepStatus::OK) { ++readSteps; - auto scalarInt = io.InquireVariable("scalarInt"); + auto varIntScalar = io.InquireVariable("varIntScalar"); auto blocksInfo = - engine.BlocksInfo(scalarInt, engine.CurrentStep()); + engine.BlocksInfo(varIntScalar, engine.CurrentStep()); for (const auto &bi : blocksInfo) { ASSERT_EQ(bi.IsValue, true); ASSERT_EQ(bi.Value, engine.CurrentStep()); - ASSERT_EQ(scalarInt.Min(), engine.CurrentStep()); - ASSERT_EQ(scalarInt.Max(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Min(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Max(), engine.CurrentStep()); } const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 12); size_t currentStep = engine.CurrentStep(); - adios2::Variable bpChars = - io.InquireVariable("bpChars"); - adios2::Variable bpUChars = - io.InquireVariable("bpUChars"); - adios2::Variable bpShorts = - io.InquireVariable("bpShorts"); - adios2::Variable bpUShorts = - io.InquireVariable("bpUShorts"); - adios2::Variable bpInts = io.InquireVariable("bpInts"); - adios2::Variable bpUInts = - io.InquireVariable("bpUInts"); - adios2::Variable bpFloats = - io.InquireVariable("bpFloats"); - adios2::Variable bpDoubles = - io.InquireVariable("bpDoubles"); - adios2::Variable> bpComplexes = - io.InquireVariable>("bpComplexes"); - adios2::Variable> bpDComplexes = - io.InquireVariable>("bpDComplexes"); - adios2::Variable stringVar = - io.InquireVariable("stringVar"); - - 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}); - - engine.Get(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Get(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); + 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 varString = + io.InquireVariable("varString"); + + 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); VerifyData(myChars.data(), currentStep, start, count, shape, mpiRank); @@ -196,10 +196,11 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, VerifyData(myUInts.data(), currentStep, start, count, shape, mpiRank); - engine.Get(bpFloats, myFloats.data(), adios2::Mode::Deferred); - engine.Get(bpDoubles, myDoubles.data(), adios2::Mode::Deferred); - engine.Get(bpComplexes, myComplexes.data(), adios2::Mode::Deferred); - engine.Get(bpDComplexes, myDComplexes.data(), + engine.Get(varFloats, myFloats.data(), adios2::Mode::Deferred); + engine.Get(varDoubles, myDoubles.data(), adios2::Mode::Deferred); + engine.Get(varComplexes, myComplexes.data(), + adios2::Mode::Deferred); + engine.Get(varDComplexes, myDComplexes.data(), adios2::Mode::Deferred); engine.PerformGets(); @@ -213,16 +214,16 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, mpiRank); std::string s; - engine.Get(stringVar, s); + engine.Get(varString, s); engine.PerformGets(); ASSERT_EQ(s, "sample string sample string sample string"); - ASSERT_EQ(stringVar.Min(), + ASSERT_EQ(varString.Min(), "sample string sample string sample string"); - ASSERT_EQ(stringVar.Max(), + ASSERT_EQ(varString.Max(), "sample string sample string sample string"); int i; - engine.Get(scalarInt, &i); + engine.Get(varIntScalar, &i); engine.PerformGets(); ASSERT_EQ(i, currentStep); engine.EndStep(); diff --git a/testing/adios2/engine/ssc/TestSscString.cpp b/testing/adios2/engine/ssc/TestSscString.cpp index 175cc3d6d9..3d66007d63 100644 --- a/testing/adios2/engine/ssc/TestSscString.cpp +++ b/testing/adios2/engine/ssc/TestSscString.cpp @@ -29,9 +29,9 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, std::accumulate(count.begin(), count.end(), static_cast(1), std::multiplies()); adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); std::vector myChars(datasize); std::vector myUChars(datasize); std::vector myShorts(datasize); @@ -42,29 +42,26 @@ void Writer(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 scalarInt = dataManIO.DefineVariable("scalarInt"); - auto stringVar = dataManIO.DefineVariable("stringVar"); - dataManIO.DefineAttribute("AttInt", 110); - adios2::Engine engine = dataManIO.Open(name, 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 varIntScalar = io.DefineVariable("varIntScalar"); + auto varString = io.DefineVariable("varString"); + io.DefineAttribute("AttInt", 110); + adios2::Engine engine = io.Open(name, adios2::Mode::Write); for (size_t i = 0; i < steps; ++i) { engine.BeginStep(); @@ -78,19 +75,19 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myDoubles, i, start, count, shape); GenData(myComplexes, i, start, count, shape); GenData(myDComplexes, i, start, count, shape); - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); - engine.Put(scalarInt, static_cast(i)); + 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(varIntScalar, static_cast(i)); std::string s = "sample string sample string sample string"; - engine.Put(stringVar, s); + engine.Put(varString, s); engine.EndStep(); } engine.Close(); @@ -101,10 +98,10 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, const std::string &name) { adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("Test"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); - adios2::Engine engine = dataManIO.Open(name, adios2::Mode::Read); + adios2::IO io = adios.DeclareIO("Test"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); + adios2::Engine engine = io.Open(name, adios2::Mode::Read); size_t datasize = std::accumulate(count.begin(), count.end(), static_cast(1), @@ -116,39 +113,39 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { - auto scalarInt = dataManIO.InquireVariable("scalarInt"); + auto varIntScalar = io.InquireVariable("varIntScalar"); auto blocksInfo = - engine.BlocksInfo(scalarInt, engine.CurrentStep()); + engine.BlocksInfo(varIntScalar, engine.CurrentStep()); for (const auto &bi : blocksInfo) { ASSERT_EQ(bi.IsValue, true); ASSERT_EQ(bi.Value, engine.CurrentStep()); - ASSERT_EQ(scalarInt.Min(), engine.CurrentStep()); - ASSERT_EQ(scalarInt.Max(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Min(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Max(), engine.CurrentStep()); } - const auto &vars = dataManIO.AvailableVariables(); + const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 12); size_t currentStep = engine.CurrentStep(); - adios2::Variable bpChars = - dataManIO.InquireVariable("bpChars"); - adios2::Variable stringVar = - dataManIO.InquireVariable("stringVar"); + adios2::Variable varChars = + io.InquireVariable("varChars"); + adios2::Variable varString = + io.InquireVariable("varString"); std::string s; - engine.Get(stringVar, s, adios2::Mode::Sync); + engine.Get(varString, s, adios2::Mode::Sync); ASSERT_EQ(s, "sample string sample string sample string"); - ASSERT_EQ(stringVar.Min(), + ASSERT_EQ(varString.Min(), "sample string sample string sample string"); - ASSERT_EQ(stringVar.Max(), + ASSERT_EQ(varString.Max(), "sample string sample string sample string"); - bpChars.SetSelection({start, count}); + varChars.SetSelection({start, count}); - engine.Get(bpChars, myChars.data(), adios2::Mode::Sync); + engine.Get(varChars, myChars.data(), adios2::Mode::Sync); int i; - engine.Get(scalarInt, &i); + engine.Get(varIntScalar, &i); engine.PerformGets(); ASSERT_EQ(i, currentStep); @@ -164,7 +161,7 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, break; } } - auto attInt = dataManIO.InquireAttribute("AttInt"); + auto attInt = io.InquireAttribute("AttInt"); ASSERT_EQ(110, attInt.Data()[0]); engine.Close(); } diff --git a/testing/adios2/engine/ssc/TestSscStruct.cpp b/testing/adios2/engine/ssc/TestSscStruct.cpp index 5ccfc34f5d..504a3976ef 100644 --- a/testing/adios2/engine/ssc/TestSscStruct.cpp +++ b/testing/adios2/engine/ssc/TestSscStruct.cpp @@ -42,29 +42,29 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, std::vector myDoubles(datasize); std::vector> myComplexes(datasize); std::vector> myDComplexes(datasize); - auto bpChars = io.DefineVariable("bpChars", shape, start, count); - auto bpUChars = - io.DefineVariable("bpUChars", shape, start, count); - auto bpShorts = io.DefineVariable("bpShorts", shape, start, count); - auto bpUShorts = - io.DefineVariable("bpUShorts", shape, start, count); - auto bpInts = io.DefineVariable("bpInts", shape, start, count); - auto bpUInts = - io.DefineVariable("bpUInts", shape, start, count); - auto bpFloats = io.DefineVariable("bpFloats", shape, start, count); - auto bpDoubles = - io.DefineVariable("bpDoubles", shape, start, count); - auto bpComplexes = io.DefineVariable>( - "bpComplexes", shape, start, count); - auto bpDComplexes = io.DefineVariable>( - "bpDComplexes", shape, start, count); - auto scalarInt = io.DefineVariable("scalarInt"); - auto stringVar = io.DefineVariable("stringVar"); + 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 varIntScalar = io.DefineVariable("varIntScalar"); + auto varString = io.DefineVariable("varString"); auto particleDef = adios.DefineStruct("particle"); particleDef.AddItem("a", 0, adios2::DataType::Int8, 1); particleDef.AddItem("b", 4, adios2::DataType::Int32, 4); - auto bpStruct = + auto varStruct = io.DefineStructVariable("particles", particleDef, shape, start, count); struct particle { @@ -97,20 +97,20 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myDoubles, i, start, count, shape); GenData(myComplexes, i, start, count, shape); GenData(myDComplexes, i, start, count, shape); - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); - engine.Put(bpStruct, myParticles.data()); - engine.Put(scalarInt, static_cast(i)); + 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(varStruct, myParticles.data()); + engine.Put(varIntScalar, static_cast(i)); std::string s = "sample string sample string sample string"; - engine.Put(stringVar, s); + engine.Put(varString, s); engine.EndStep(); } engine.Close(); @@ -153,60 +153,60 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { - auto scalarInt = io.InquireVariable("scalarInt"); + auto varIntScalar = io.InquireVariable("varIntScalar"); auto blocksInfo = - engine.BlocksInfo(scalarInt, engine.CurrentStep()); + engine.BlocksInfo(varIntScalar, engine.CurrentStep()); for (const auto &bi : blocksInfo) { ASSERT_EQ(bi.IsValue, true); ASSERT_EQ(bi.Value, engine.CurrentStep()); - ASSERT_EQ(scalarInt.Min(), engine.CurrentStep()); - ASSERT_EQ(scalarInt.Max(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Min(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Max(), engine.CurrentStep()); } const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 12); size_t currentStep = engine.CurrentStep(); - adios2::Variable bpChars = - io.InquireVariable("bpChars"); - adios2::Variable bpUChars = - io.InquireVariable("bpUChars"); - adios2::Variable bpShorts = - io.InquireVariable("bpShorts"); - adios2::Variable bpUShorts = - io.InquireVariable("bpUShorts"); - adios2::Variable bpInts = io.InquireVariable("bpInts"); - adios2::Variable bpUInts = - io.InquireVariable("bpUInts"); - adios2::Variable bpFloats = - io.InquireVariable("bpFloats"); - adios2::Variable bpDoubles = - io.InquireVariable("bpDoubles"); - adios2::Variable> bpComplexes = - io.InquireVariable>("bpComplexes"); - adios2::Variable> bpDComplexes = - io.InquireVariable>("bpDComplexes"); - adios2::Variable stringVar = - io.InquireVariable("stringVar"); + 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 varString = + io.InquireVariable("varString"); - 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}); - engine.Get(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Get(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Get(bpUInts, myUInts.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); VerifyData(myChars.data(), currentStep, start, count, shape, mpiRank); @@ -221,10 +221,11 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, VerifyData(myUInts.data(), currentStep, start, count, shape, mpiRank); - engine.Get(bpFloats, myFloats.data(), adios2::Mode::Deferred); - engine.Get(bpDoubles, myDoubles.data(), adios2::Mode::Deferred); - engine.Get(bpComplexes, myComplexes.data(), adios2::Mode::Deferred); - engine.Get(bpDComplexes, myDComplexes.data(), + engine.Get(varFloats, myFloats.data(), adios2::Mode::Deferred); + engine.Get(varDoubles, myDoubles.data(), adios2::Mode::Deferred); + engine.Get(varComplexes, myComplexes.data(), + adios2::Mode::Deferred); + engine.Get(varDComplexes, myDComplexes.data(), adios2::Mode::Deferred); engine.PerformGets(); @@ -237,22 +238,22 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, VerifyData(myDComplexes.data(), currentStep, start, count, shape, mpiRank); std::string s; - engine.Get(stringVar, s); + engine.Get(varString, s); engine.PerformGets(); ASSERT_EQ(s, "sample string sample string sample string"); - ASSERT_EQ(stringVar.Min(), + ASSERT_EQ(varString.Min(), "sample string sample string sample string"); - ASSERT_EQ(stringVar.Max(), + ASSERT_EQ(varString.Max(), "sample string sample string sample string"); int i; - engine.Get(scalarInt, &i); + engine.Get(varIntScalar, &i); engine.PerformGets(); - auto bpStruct = io.InquireVariable("particles"); - bpStruct.SetSelection({start, count}); - ASSERT_TRUE(bpStruct); - engine.Get(bpStruct, myParticles.data(), adios2::Mode::Sync); + auto varStruct = io.InquireVariable("particles"); + varStruct.SetSelection({start, count}); + ASSERT_TRUE(varStruct); + engine.Get(varStruct, myParticles.data(), adios2::Mode::Sync); for (size_t i = 0; i < datasize; ++i) { ASSERT_EQ(myParticles[i].a, 5); diff --git a/testing/adios2/engine/ssc/TestSscSuperLarge.cpp b/testing/adios2/engine/ssc/TestSscSuperLarge.cpp index 6281ea9701..ab6f5de060 100644 --- a/testing/adios2/engine/ssc/TestSscSuperLarge.cpp +++ b/testing/adios2/engine/ssc/TestSscSuperLarge.cpp @@ -42,24 +42,24 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, std::vector myDoubles(datasize); std::vector> myComplexes(datasize); std::vector> myDComplexes(datasize); - auto bpChars = io.DefineVariable("bpChars", shape, start, count); - auto bpUChars = - io.DefineVariable("bpUChars", shape, start, count); - auto bpShorts = io.DefineVariable("bpShorts", shape, start, count); - auto bpUShorts = - io.DefineVariable("bpUShorts", shape, start, count); - auto bpInts = io.DefineVariable("bpInts", shape, start, count); - auto bpUInts = - io.DefineVariable("bpUInts", shape, start, count); - auto bpFloats = io.DefineVariable("bpFloats", shape, start, count); - auto bpDoubles = - io.DefineVariable("bpDoubles", shape, start, count); - auto bpComplexes = io.DefineVariable>( - "bpComplexes", shape, start, count); - auto bpDComplexes = io.DefineVariable>( - "bpDComplexes", shape, start, count); - auto scalarInt = io.DefineVariable("scalarInt"); - auto stringVar = io.DefineVariable("stringVar"); + 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 varIntScalar = io.DefineVariable("varIntScalar"); + auto varString = io.DefineVariable("varString"); io.DefineAttribute("AttInt", 110); adios2::Engine engine = io.Open(name, adios2::Mode::Write); engine.LockWriterDefinitions(); @@ -76,19 +76,19 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myDoubles, i, start, count, shape); GenData(myComplexes, i, start, count, shape); GenData(myDComplexes, i, start, count, shape); - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); - engine.Put(scalarInt, static_cast(i)); + 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(varIntScalar, static_cast(i)); std::string s = "sample string sample string sample string"; - engine.Put(stringVar, s); + engine.Put(varString, s); engine.EndStep(); } engine.Close(); @@ -125,60 +125,60 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { - auto scalarInt = io.InquireVariable("scalarInt"); + auto varIntScalar = io.InquireVariable("varIntScalar"); auto blocksInfo = - engine.BlocksInfo(scalarInt, engine.CurrentStep()); + engine.BlocksInfo(varIntScalar, engine.CurrentStep()); for (const auto &bi : blocksInfo) { ASSERT_EQ(bi.IsValue, true); ASSERT_EQ(bi.Value, engine.CurrentStep()); - ASSERT_EQ(scalarInt.Min(), engine.CurrentStep()); - ASSERT_EQ(scalarInt.Max(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Min(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Max(), engine.CurrentStep()); } const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 12); size_t currentStep = engine.CurrentStep(); - adios2::Variable bpChars = - io.InquireVariable("bpChars"); - adios2::Variable bpUChars = - io.InquireVariable("bpUChars"); - adios2::Variable bpShorts = - io.InquireVariable("bpShorts"); - adios2::Variable bpUShorts = - io.InquireVariable("bpUShorts"); - adios2::Variable bpInts = io.InquireVariable("bpInts"); - adios2::Variable bpUInts = - io.InquireVariable("bpUInts"); - adios2::Variable bpFloats = - io.InquireVariable("bpFloats"); - adios2::Variable bpDoubles = - io.InquireVariable("bpDoubles"); - adios2::Variable> bpComplexes = - io.InquireVariable>("bpComplexes"); - adios2::Variable> bpDComplexes = - io.InquireVariable>("bpDComplexes"); - adios2::Variable stringVar = - io.InquireVariable("stringVar"); - - 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}); - - engine.Get(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Get(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); + 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 varString = + io.InquireVariable("varString"); + + 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); VerifyData(myChars.data(), currentStep, start, count, shape, mpiRank); @@ -193,10 +193,11 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, VerifyData(myUInts.data(), currentStep, start, count, shape, mpiRank); - engine.Get(bpFloats, myFloats.data(), adios2::Mode::Deferred); - engine.Get(bpDoubles, myDoubles.data(), adios2::Mode::Deferred); - engine.Get(bpComplexes, myComplexes.data(), adios2::Mode::Deferred); - engine.Get(bpDComplexes, myDComplexes.data(), + engine.Get(varFloats, myFloats.data(), adios2::Mode::Deferred); + engine.Get(varDoubles, myDoubles.data(), adios2::Mode::Deferred); + engine.Get(varComplexes, myComplexes.data(), + adios2::Mode::Deferred); + engine.Get(varDComplexes, myDComplexes.data(), adios2::Mode::Deferred); engine.PerformGets(); @@ -210,16 +211,16 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, mpiRank); std::string s; - engine.Get(stringVar, s); + engine.Get(varString, s); engine.PerformGets(); ASSERT_EQ(s, "sample string sample string sample string"); - ASSERT_EQ(stringVar.Min(), + ASSERT_EQ(varString.Min(), "sample string sample string sample string"); - ASSERT_EQ(stringVar.Max(), + ASSERT_EQ(varString.Max(), "sample string sample string sample string"); int i; - engine.Get(scalarInt, &i); + engine.Get(varIntScalar, &i); engine.PerformGets(); ASSERT_EQ(i, currentStep); engine.EndStep(); diff --git a/testing/adios2/engine/ssc/TestSscUnbalanced.cpp b/testing/adios2/engine/ssc/TestSscUnbalanced.cpp index fb4ec7ad3f..cab08904e7 100644 --- a/testing/adios2/engine/ssc/TestSscUnbalanced.cpp +++ b/testing/adios2/engine/ssc/TestSscUnbalanced.cpp @@ -29,9 +29,9 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, std::accumulate(count.begin(), count.end(), static_cast(1), std::multiplies()); adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); std::vector myChars(datasize); std::vector myUChars(datasize); std::vector myShorts(datasize); @@ -42,28 +42,25 @@ void Writer(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 scalarInt = dataManIO.DefineVariable("scalarInt"); - dataManIO.DefineAttribute("AttInt", 110); - adios2::Engine engine = dataManIO.Open(name, 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 varIntScalar = io.DefineVariable("varIntScalar"); + io.DefineAttribute("AttInt", 110); + adios2::Engine engine = io.Open(name, adios2::Mode::Write); engine.LockWriterDefinitions(); for (size_t i = 0; i < steps; ++i) { @@ -78,17 +75,17 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myDoubles, i, start, count, shape); GenData(myComplexes, i, start, count, shape); GenData(myDComplexes, i, start, count, shape); - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); - engine.Put(scalarInt, static_cast(i)); + 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(varIntScalar, static_cast(i)); engine.EndStep(); } engine.Close(); @@ -99,10 +96,10 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, const std::string &name) { adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("Test"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); - adios2::Engine engine = dataManIO.Open(name, adios2::Mode::Read); + adios2::IO io = adios.DeclareIO("Test"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); + adios2::Engine engine = io.Open(name, adios2::Mode::Read); engine.LockReaderSelections(); size_t datasize = @@ -124,54 +121,53 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { - const auto &vars = dataManIO.AvailableVariables(); + const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 11); size_t currentStep = engine.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"); - auto scalarInt = dataManIO.InquireVariable("scalarInt"); + 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 varIntScalar = io.InquireVariable("varIntScalar"); - 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}); - engine.Get(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Get(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Get(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Get(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Get(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.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); int i; - engine.Get(scalarInt, &i, adios2::Mode::Sync); + engine.Get(varIntScalar, &i, adios2::Mode::Sync); ASSERT_EQ(i, currentStep); @@ -205,7 +201,7 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, break; } } - auto attInt = dataManIO.InquireAttribute("AttInt"); + auto attInt = io.InquireAttribute("AttInt"); ASSERT_EQ(110, attInt.Data()[0]); engine.Close(); } diff --git a/testing/adios2/engine/ssc/TestSscVaryingSteps.cpp b/testing/adios2/engine/ssc/TestSscVaryingSteps.cpp index 975fb071f1..cdf076f44a 100644 --- a/testing/adios2/engine/ssc/TestSscVaryingSteps.cpp +++ b/testing/adios2/engine/ssc/TestSscVaryingSteps.cpp @@ -29,9 +29,9 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, std::accumulate(count.begin(), count.end(), static_cast(1), std::multiplies()); adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); std::vector myChars(datasize); std::vector myUChars(datasize); std::vector myShorts(datasize); @@ -42,29 +42,26 @@ void Writer(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 scalarInt = dataManIO.DefineVariable("scalarInt"); - auto stringVar = dataManIO.DefineVariable("stringVar"); - dataManIO.DefineAttribute("AttInt", 110); - adios2::Engine engine = dataManIO.Open(name, 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 varIntScalar = io.DefineVariable("varIntScalar"); + auto varString = io.DefineVariable("varString"); + io.DefineAttribute("AttInt", 110); + adios2::Engine engine = io.Open(name, adios2::Mode::Write); // engine.LockWriterDefinitions(); for (int i = 0; i < static_cast(steps); ++i) { @@ -76,26 +73,26 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, Dims vcount = {10, 2}; Dims vshape = {10, (size_t)mpiSize * 2}; - bpChars.SetShape(vshape); - bpChars.SetSelection({vstart, vcount}); - bpUChars.SetShape(vshape); - bpUChars.SetSelection({vstart, vcount}); - bpShorts.SetShape(vshape); - bpShorts.SetSelection({vstart, vcount}); - bpUShorts.SetShape(vshape); - bpUShorts.SetSelection({vstart, vcount}); - bpInts.SetShape(vshape); - bpInts.SetSelection({vstart, vcount}); - bpUInts.SetShape(vshape); - bpUInts.SetSelection({vstart, vcount}); - bpFloats.SetShape(vshape); - bpFloats.SetSelection({vstart, vcount}); - bpDoubles.SetShape(vshape); - bpDoubles.SetSelection({vstart, vcount}); - bpComplexes.SetShape(vshape); - bpComplexes.SetSelection({vstart, vcount}); - bpDComplexes.SetShape(vshape); - bpDComplexes.SetSelection({vstart, vcount}); + varChars.SetShape(vshape); + varChars.SetSelection({vstart, vcount}); + varUChars.SetShape(vshape); + varUChars.SetSelection({vstart, vcount}); + varShorts.SetShape(vshape); + varShorts.SetSelection({vstart, vcount}); + varUShorts.SetShape(vshape); + varUShorts.SetSelection({vstart, vcount}); + varInts.SetShape(vshape); + varInts.SetSelection({vstart, vcount}); + varUInts.SetShape(vshape); + varUInts.SetSelection({vstart, vcount}); + varFloats.SetShape(vshape); + varFloats.SetSelection({vstart, vcount}); + varDoubles.SetShape(vshape); + varDoubles.SetSelection({vstart, vcount}); + varComplexes.SetShape(vshape); + varComplexes.SetSelection({vstart, vcount}); + varDComplexes.SetShape(vshape); + varDComplexes.SetSelection({vstart, vcount}); GenData(myChars, i, vstart, vcount, vshape); GenData(myUChars, i, vstart, vcount, vshape); @@ -108,19 +105,19 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myComplexes, i, vstart, vcount, vshape); GenData(myDComplexes, i, vstart, vcount, vshape); - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); - engine.Put(scalarInt, i); + 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(varIntScalar, i); std::string s = "sample string sample string sample string"; - engine.Put(stringVar, s); + engine.Put(varString, s); engine.EndStep(); } engine.Close(); @@ -131,10 +128,10 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, const std::string &name) { adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("Test"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); - adios2::Engine engine = dataManIO.Open(name, adios2::Mode::Read); + adios2::IO io = adios.DeclareIO("Test"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); + adios2::Engine engine = io.Open(name, adios2::Mode::Read); // engine.LockReaderSelections(); size_t datasize = @@ -156,45 +153,44 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { - auto scalarInt = dataManIO.InquireVariable("scalarInt"); + auto varIntScalar = io.InquireVariable("varIntScalar"); auto blocksInfo = - engine.BlocksInfo(scalarInt, engine.CurrentStep()); + engine.BlocksInfo(varIntScalar, engine.CurrentStep()); for (const auto &bi : blocksInfo) { ASSERT_EQ(bi.IsValue, true); ASSERT_EQ(bi.Value, engine.CurrentStep()); - ASSERT_EQ(scalarInt.Min(), engine.CurrentStep()); - ASSERT_EQ(scalarInt.Max(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Min(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Max(), engine.CurrentStep()); } - const auto &vars = dataManIO.AvailableVariables(); + const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 12); size_t currentStep = engine.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 stringVar = - dataManIO.InquireVariable("stringVar"); - - auto vshape = bpChars.Shape(); + 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 varString = + io.InquireVariable("varString"); + + auto vshape = varChars.Shape(); myChars.resize(std::accumulate(vshape.begin(), vshape.end(), static_cast(1), std::multiplies())); @@ -226,26 +222,26 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, static_cast(1), std::multiplies())); - engine.Get(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Get(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Get(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Get(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Get(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.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); std::string s; - engine.Get(stringVar, s, adios2::Mode::Sync); + engine.Get(varString, s, adios2::Mode::Sync); ASSERT_EQ(s, "sample string sample string sample string"); - ASSERT_EQ(stringVar.Min(), + ASSERT_EQ(varString.Min(), "sample string sample string sample string"); - ASSERT_EQ(stringVar.Max(), + ASSERT_EQ(varString.Max(), "sample string sample string sample string"); int i; - engine.Get(scalarInt, &i, adios2::Mode::Sync); + engine.Get(varIntScalar, &i, adios2::Mode::Sync); ASSERT_EQ(i, currentStep); VerifyData(myChars.data(), currentStep, {0, 0}, vshape, vshape, @@ -278,7 +274,7 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, break; } } - auto attInt = dataManIO.InquireAttribute("AttInt"); + auto attInt = io.InquireAttribute("AttInt"); ASSERT_EQ(110, attInt.Data()[0]); engine.Close(); } diff --git a/testing/adios2/engine/ssc/TestSscWriterMultiblock.cpp b/testing/adios2/engine/ssc/TestSscWriterMultiblock.cpp index bf5dc6ea4a..3731f51701 100644 --- a/testing/adios2/engine/ssc/TestSscWriterMultiblock.cpp +++ b/testing/adios2/engine/ssc/TestSscWriterMultiblock.cpp @@ -29,9 +29,9 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, std::accumulate(count.begin(), count.end(), static_cast(1), std::multiplies()); adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("WAN"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); + adios2::IO io = adios.DeclareIO("WAN"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); std::vector myChars(datasize); std::vector myUChars(datasize); std::vector myShorts(datasize); @@ -42,28 +42,25 @@ void Writer(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 scalarInt = dataManIO.DefineVariable("scalarInt"); - dataManIO.DefineAttribute("AttInt", 110); - adios2::Engine engine = dataManIO.Open(name, 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 varIntScalar = io.DefineVariable("varIntScalar"); + io.DefineAttribute("AttInt", 110); + adios2::Engine engine = io.Open(name, adios2::Mode::Write); engine.LockWriterDefinitions(); for (size_t i = 0; i < steps; ++i) { @@ -82,28 +79,28 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myComplexes, i, start, count, shape); GenData(myDComplexes, i, start, count, shape); - 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}); - - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); - engine.Put(scalarInt, static_cast(i)); + 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.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(varIntScalar, static_cast(i)); start = {(size_t)mpiRank * 2 + 1, 0}; @@ -118,28 +115,28 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myComplexes, i, start, count, shape); GenData(myDComplexes, i, start, count, shape); - 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}); - - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); - engine.Put(scalarInt, static_cast(i)); + 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.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(varIntScalar, static_cast(i)); engine.EndStep(); } @@ -151,10 +148,10 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, const std::string &name) { adios2::ADIOS adios(mpiComm); - adios2::IO dataManIO = adios.DeclareIO("Test"); - dataManIO.SetEngine("ssc"); - dataManIO.SetParameters(engineParams); - adios2::Engine engine = dataManIO.Open(name, adios2::Mode::Read); + adios2::IO io = adios.DeclareIO("Test"); + io.SetEngine("ssc"); + io.SetParameters(engineParams); + adios2::Engine engine = io.Open(name, adios2::Mode::Read); engine.LockReaderSelections(); size_t datasize = @@ -176,43 +173,42 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { - const auto &vars = dataManIO.AvailableVariables(); + const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 11); size_t currentStep = engine.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"); - auto scalarInt = dataManIO.InquireVariable("scalarInt"); - - engine.Get(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Get(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Get(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Get(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Get(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Get(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Get(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); + 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 varIntScalar = io.InquireVariable("varIntScalar"); + + 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); int i; - engine.Get(scalarInt, &i, adios2::Mode::Sync); + engine.Get(varIntScalar, &i, adios2::Mode::Sync); ASSERT_EQ(i, currentStep); VerifyData(myChars.data(), currentStep, start, shape, shape, @@ -245,7 +241,7 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, break; } } - auto attInt = dataManIO.InquireAttribute("AttInt"); + auto attInt = io.InquireAttribute("AttInt"); ASSERT_EQ(110, attInt.Data()[0]); engine.Close(); } diff --git a/testing/adios2/engine/ssc/TestSscZeroBlock.cpp b/testing/adios2/engine/ssc/TestSscZeroBlock.cpp index 08cd4d89b3..83abe70d6e 100644 --- a/testing/adios2/engine/ssc/TestSscZeroBlock.cpp +++ b/testing/adios2/engine/ssc/TestSscZeroBlock.cpp @@ -42,24 +42,24 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, std::vector myDoubles(datasize); std::vector> myComplexes(datasize); std::vector> myDComplexes(datasize); - auto bpChars = io.DefineVariable("bpChars", shape, start, shape); - auto bpUChars = - io.DefineVariable("bpUChars", shape, start, shape); - auto bpShorts = io.DefineVariable("bpShorts", shape, start, shape); - auto bpUShorts = - io.DefineVariable("bpUShorts", shape, start, shape); - auto bpInts = io.DefineVariable("bpInts", shape, start, shape); - auto bpUInts = - io.DefineVariable("bpUInts", shape, start, shape); - auto bpFloats = io.DefineVariable("bpFloats", shape, start, shape); - auto bpDoubles = - io.DefineVariable("bpDoubles", shape, start, shape); - auto bpComplexes = io.DefineVariable>( - "bpComplexes", shape, start, shape); - auto bpDComplexes = io.DefineVariable>( - "bpDComplexes", shape, start, shape); - auto scalarInt = io.DefineVariable("scalarInt"); - auto stringVar = io.DefineVariable("stringVar"); + auto varChars = io.DefineVariable("varChars", shape, start, shape); + auto varUChars = + io.DefineVariable("varUChars", shape, start, shape); + auto varShorts = io.DefineVariable("varShorts", shape, start, shape); + auto varUShorts = + io.DefineVariable("varUShorts", shape, start, shape); + auto varInts = io.DefineVariable("varInts", shape, start, shape); + auto varUInts = + io.DefineVariable("varUInts", shape, start, shape); + auto varFloats = io.DefineVariable("varFloats", shape, start, shape); + auto varDoubles = + io.DefineVariable("varDoubles", shape, start, shape); + auto varComplexes = io.DefineVariable>( + "varComplexes", shape, start, shape); + auto varDComplexes = io.DefineVariable>( + "varDComplexes", shape, start, shape); + auto varIntScalar = io.DefineVariable("varIntScalar"); + auto varString = io.DefineVariable("varString"); io.DefineAttribute("AttInt", 110); adios2::Engine engine = io.Open(name, adios2::Mode::Write); engine.LockWriterDefinitions(); @@ -78,19 +78,19 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count, GenData(myDoubles, i, start, shape, shape); GenData(myComplexes, i, start, shape, shape); GenData(myDComplexes, i, start, shape, shape); - engine.Put(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Put(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Put(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Put(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Put(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Put(bpUInts, myUInts.data(), adios2::Mode::Sync); - engine.Put(bpFloats, myFloats.data(), adios2::Mode::Sync); - engine.Put(bpDoubles, myDoubles.data(), adios2::Mode::Sync); - engine.Put(bpComplexes, myComplexes.data(), adios2::Mode::Sync); - engine.Put(bpDComplexes, myDComplexes.data(), adios2::Mode::Sync); - engine.Put(scalarInt, static_cast(i)); + 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(varIntScalar, static_cast(i)); std::string s = "sample string sample string sample string"; - engine.Put(stringVar, s); + engine.Put(varString, s); } engine.EndStep(); } @@ -128,60 +128,60 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, adios2::StepStatus status = engine.BeginStep(StepMode::Read, 5); if (status == adios2::StepStatus::OK) { - auto scalarInt = io.InquireVariable("scalarInt"); + auto varIntScalar = io.InquireVariable("varIntScalar"); auto blocksInfo = - engine.BlocksInfo(scalarInt, engine.CurrentStep()); + engine.BlocksInfo(varIntScalar, engine.CurrentStep()); for (const auto &bi : blocksInfo) { ASSERT_EQ(bi.IsValue, true); ASSERT_EQ(bi.Value, engine.CurrentStep()); - ASSERT_EQ(scalarInt.Min(), engine.CurrentStep()); - ASSERT_EQ(scalarInt.Max(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Min(), engine.CurrentStep()); + ASSERT_EQ(varIntScalar.Max(), engine.CurrentStep()); } const auto &vars = io.AvailableVariables(); ASSERT_EQ(vars.size(), 12); size_t currentStep = engine.CurrentStep(); - adios2::Variable bpChars = - io.InquireVariable("bpChars"); - adios2::Variable bpUChars = - io.InquireVariable("bpUChars"); - adios2::Variable bpShorts = - io.InquireVariable("bpShorts"); - adios2::Variable bpUShorts = - io.InquireVariable("bpUShorts"); - adios2::Variable bpInts = io.InquireVariable("bpInts"); - adios2::Variable bpUInts = - io.InquireVariable("bpUInts"); - adios2::Variable bpFloats = - io.InquireVariable("bpFloats"); - adios2::Variable bpDoubles = - io.InquireVariable("bpDoubles"); - adios2::Variable> bpComplexes = - io.InquireVariable>("bpComplexes"); - adios2::Variable> bpDComplexes = - io.InquireVariable>("bpDComplexes"); - adios2::Variable stringVar = - io.InquireVariable("stringVar"); + 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 varString = + io.InquireVariable("varString"); - 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}); - engine.Get(bpChars, myChars.data(), adios2::Mode::Sync); - engine.Get(bpUChars, myUChars.data(), adios2::Mode::Sync); - engine.Get(bpShorts, myShorts.data(), adios2::Mode::Sync); - engine.Get(bpUShorts, myUShorts.data(), adios2::Mode::Sync); - engine.Get(bpInts, myInts.data(), adios2::Mode::Sync); - engine.Get(bpUInts, myUInts.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); VerifyData(myChars.data(), currentStep, start, count, shape, mpiRank); @@ -196,10 +196,11 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, VerifyData(myUInts.data(), currentStep, start, count, shape, mpiRank); - engine.Get(bpFloats, myFloats.data(), adios2::Mode::Deferred); - engine.Get(bpDoubles, myDoubles.data(), adios2::Mode::Deferred); - engine.Get(bpComplexes, myComplexes.data(), adios2::Mode::Deferred); - engine.Get(bpDComplexes, myDComplexes.data(), + engine.Get(varFloats, myFloats.data(), adios2::Mode::Deferred); + engine.Get(varDoubles, myDoubles.data(), adios2::Mode::Deferred); + engine.Get(varComplexes, myComplexes.data(), + adios2::Mode::Deferred); + engine.Get(varDComplexes, myDComplexes.data(), adios2::Mode::Deferred); engine.PerformGets(); @@ -213,16 +214,16 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count, mpiRank); std::string s; - engine.Get(stringVar, s); + engine.Get(varString, s); engine.PerformGets(); ASSERT_EQ(s, "sample string sample string sample string"); - ASSERT_EQ(stringVar.Min(), + ASSERT_EQ(varString.Min(), "sample string sample string sample string"); - ASSERT_EQ(stringVar.Max(), + ASSERT_EQ(varString.Max(), "sample string sample string sample string"); int i; - engine.Get(scalarInt, &i); + engine.Get(varIntScalar, &i); engine.PerformGets(); ASSERT_EQ(i, currentStep); engine.EndStep(); From f98a692c8fd556f76de35eb55ee03402e158c999 Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Mon, 2 May 2022 15:45:23 -0400 Subject: [PATCH 2/4] added examples directory to clang-format list --- examples/hello/datamanReader/helloDataManReader.cpp | 5 ++--- examples/hello/datamanWriter/helloDataManWriter.cpp | 12 +++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/examples/hello/datamanReader/helloDataManReader.cpp b/examples/hello/datamanReader/helloDataManReader.cpp index 72f1211236..bb5ad24699 100644 --- a/examples/hello/datamanReader/helloDataManReader.cpp +++ b/examples/hello/datamanReader/helloDataManReader.cpp @@ -44,8 +44,7 @@ int main(int argc, char *argv[]) {{"IPAddress", "127.0.0.1"}, {"Port", "12306"}, {"Timeout", "5"}}); // open stream - adios2::Engine engine = - io.Open("HelloDataMan", adios2::Mode::Read); + adios2::Engine engine = io.Open("HelloDataMan", adios2::Mode::Read); // define variable adios2::Variable floatArrayVar; @@ -63,7 +62,7 @@ int main(int argc, char *argv[]) std::multiplies()); floatVector.resize(datasize); engine.Get(floatArrayVar, floatVector.data(), - adios2::Mode::Sync); + adios2::Mode::Sync); engine.EndStep(); PrintData(floatVector, engine.CurrentStep()); } diff --git a/examples/hello/datamanWriter/helloDataManWriter.cpp b/examples/hello/datamanWriter/helloDataManWriter.cpp index 4bd27b215c..d116908939 100644 --- a/examples/hello/datamanWriter/helloDataManWriter.cpp +++ b/examples/hello/datamanWriter/helloDataManWriter.cpp @@ -65,13 +65,12 @@ int main(int argc, char *argv[]) adios2::IO io = adios.DeclareIO("whatever"); io.SetEngine("DataMan"); io.SetParameters({{"IPAddress", "127.0.0.1"}, - {"Port", "12306"}, - {"Timeout", "5"}, - {"RendezvousReaderCount", "1"}}); + {"Port", "12306"}, + {"Timeout", "5"}, + {"RendezvousReaderCount", "1"}}); // open stream - adios2::Engine engine = - io.Open("HelloDataMan", adios2::Mode::Write); + adios2::Engine engine = io.Open("HelloDataMan", adios2::Mode::Write); // define variable auto floatArrayVar = @@ -82,8 +81,7 @@ int main(int argc, char *argv[]) { auto floatVector = GenerateData(i); engine.BeginStep(); - engine.Put(floatArrayVar, floatVector.data(), - adios2::Mode::Sync); + engine.Put(floatArrayVar, floatVector.data(), adios2::Mode::Sync); PrintData(floatVector, engine.CurrentStep()); engine.EndStep(); } From ee336a90329bfe7493adbc5bf7855f77a5d810e5 Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Mon, 2 May 2022 15:54:43 -0400 Subject: [PATCH 3/4] fix python format --- examples/hello/datamanReader/helloDataManReader.py | 4 +--- examples/hello/datamanWriter/helloDataManWriter.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/hello/datamanReader/helloDataManReader.py b/examples/hello/datamanReader/helloDataManReader.py index 5cda4b4b6a..6b1dc00668 100644 --- a/examples/hello/datamanReader/helloDataManReader.py +++ b/examples/hello/datamanReader/helloDataManReader.py @@ -19,9 +19,7 @@ adios = adios2.ADIOS(comm) io = adios.DeclareIO("whatever") io.SetEngine("DataMan") -io.SetParameters({"IPAddress": "127.0.0.1", - "Port": "12306", - "Timeout": "5"}) +io.SetParameters({"IPAddress":"127.0.0.1","Port":"12306","Timeout":"5"}) engine = io.Open('HelloDataMan', adios2.Mode.Read, comm) diff --git a/examples/hello/datamanWriter/helloDataManWriter.py b/examples/hello/datamanWriter/helloDataManWriter.py index 06be06b177..6b1dd51009 100644 --- a/examples/hello/datamanWriter/helloDataManWriter.py +++ b/examples/hello/datamanWriter/helloDataManWriter.py @@ -33,9 +33,7 @@ adios = adios2.ADIOS(comm) io = adios.DeclareIO("whatever") io.SetEngine("DataMan") -io.SetParameters({"IPAddress": "127.0.0.1", - "Port": "12306", - "Timeout": "5"}) +io.SetParameters({"IPAddress":"127.0.0.1","Port":"12306","Timeout":"5"}) var = io.DefineVariable( "FloatArray", floatArray, shape, start, count, adios2.ConstantDims) From 1b2754c6eaaa606bef0f675f1ccd1b8d21c3f86c Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Mon, 2 May 2022 15:59:23 -0400 Subject: [PATCH 4/4] more python format --- examples/hello/datamanReader/helloDataManReader.py | 2 +- examples/hello/datamanWriter/helloDataManWriter.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/hello/datamanReader/helloDataManReader.py b/examples/hello/datamanReader/helloDataManReader.py index 6b1dc00668..87248b6a64 100644 --- a/examples/hello/datamanReader/helloDataManReader.py +++ b/examples/hello/datamanReader/helloDataManReader.py @@ -19,7 +19,7 @@ adios = adios2.ADIOS(comm) io = adios.DeclareIO("whatever") io.SetEngine("DataMan") -io.SetParameters({"IPAddress":"127.0.0.1","Port":"12306","Timeout":"5"}) +io.SetParameters({"IPAddress": "127.0.0.1", "Port": "12306", "Timeout": "5"}) engine = io.Open('HelloDataMan', adios2.Mode.Read, comm) diff --git a/examples/hello/datamanWriter/helloDataManWriter.py b/examples/hello/datamanWriter/helloDataManWriter.py index 6b1dd51009..e23774cb38 100644 --- a/examples/hello/datamanWriter/helloDataManWriter.py +++ b/examples/hello/datamanWriter/helloDataManWriter.py @@ -33,7 +33,7 @@ adios = adios2.ADIOS(comm) io = adios.DeclareIO("whatever") io.SetEngine("DataMan") -io.SetParameters({"IPAddress":"127.0.0.1","Port":"12306","Timeout":"5"}) +io.SetParameters({"IPAddress": "127.0.0.1", "Port": "12306", "Timeout": "5"}) var = io.DefineVariable( "FloatArray", floatArray, shape, start, count, adios2.ConstantDims)