From 7b1365fa294330d0cfdbb8682417387108035558 Mon Sep 17 00:00:00 2001 From: Kai Germaschewski Date: Fri, 15 Mar 2019 16:40:36 -0400 Subject: [PATCH] add more tests, two of which fail --- .../adios2/interface/TestADIOSInterface.cpp | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/testing/adios2/interface/TestADIOSInterface.cpp b/testing/adios2/interface/TestADIOSInterface.cpp index 2c8472d9a7..49c23c26af 100644 --- a/testing/adios2/interface/TestADIOSInterface.cpp +++ b/testing/adios2/interface/TestADIOSInterface.cpp @@ -223,6 +223,99 @@ TEST_F(ADIOS2_CXX11_API_IO, MultiBlockPutDS) engine.Close(); } +TEST_F(ADIOS2_CXX11_API_IO, MultiBlockPutZeroCopySync) +{ + using T = double; + using Box = MyDataView::Box; + using Block = MyDataView::Block; + const size_t Nx = 10; + const adios2::Dims shape = {size * Nx}; + std::vector selections = { + {{rank * Nx}, {Nx / 2}}, {{rank * Nx + Nx / 2}, {Nx / 2}}, + }; + + adios2::Engine engine = io.Open("multi0_sync.bp", adios2::Mode::Write); + adios2::Variable var = io.DefineVariable("var", shape); + + MyDataView myData(selections); + for (int b = 0; b < myData.nBlocks(); ++b) + { + var.SetSelection(myData.selection(b)); + auto span = engine.Put(var); + myData.place(b, span.data()); + } + + for (int b = 0; b < myData.nBlocks(); ++b) + { + PopulateBlock(myData, b); + //engine.Put(var, &myData[b][0], adios2::Mode::Sync); + } + engine.Close(); +} + +TEST_F(ADIOS2_CXX11_API_IO, MultiBlockPutZeroCopySync2) +{ + using T = double; + using Box = MyDataView::Box; + using Block = MyDataView::Block; + const size_t Nx = 10; + const adios2::Dims shape = {size * Nx}; + std::vector selections = { + {{rank * Nx}, {Nx / 2}}, {{rank * Nx + Nx / 2}, {Nx / 2}}, + }; + + io.SetParameter("MaxBufferSize", "50"); + adios2::Engine engine = io.Open("multi0_sync2.bp", adios2::Mode::Write); + adios2::Variable var = io.DefineVariable("var", shape); + + MyDataView myData(selections); + for (int b = 0; b < myData.nBlocks(); ++b) + { + var.SetSelection(myData.selection(b)); + auto span = engine.Put(var); + myData.place(b, span.data()); + } + + for (int b = 0; b < myData.nBlocks(); ++b) + { + PopulateBlock(myData, b); + //engine.Put(var, &myData[b][0], adios2::Mode::Sync); + } + engine.Close(); +} + +TEST_F(ADIOS2_CXX11_API_IO, MultiBlockPutZeroCopySync3) +{ + using T = double; + using Box = MyDataView::Box; + using Block = MyDataView::Block; + const size_t Nx = 10; + const adios2::Dims shape = {size * Nx}; + std::vector selections = { + {{rank * Nx}, {Nx / 2}}, {{rank * Nx + Nx / 2}, {Nx / 2}}, + }; + + adios2::Engine engine = io.Open("multi0_sync3.bp", adios2::Mode::Write); + adios2::Variable var = io.DefineVariable("var", shape); + + MyDataView myData(selections); + for (int b = 0; b < 1; ++b) + { + var.SetSelection(myData.selection(b)); + auto span = engine.Put(var); + myData.place(b, span.data()); + } + + for (int b = 0; b < 1; ++b) + { + PopulateBlock(myData, b); + //engine.Put(var, &myData[b][0], adios2::Mode::Sync); + } + + engine.Put(var, std::vector{5., 6., 7., 8., 9.}.data(), adios2::Mode::Sync); + engine.Close(); +} + int main(int argc, char **argv) { #ifdef ADIOS2_HAVE_MPI