Skip to content

Commit

Permalink
Merge pull request #2822 from JasonRuonanWang/mhs
Browse files Browse the repository at this point in the history
make sure mhs tests use sirius operator
  • Loading branch information
JasonRuonanWang authored Aug 11, 2021
2 parents e263974 + 3b557a5 commit 8335340
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion source/adios2/engine/mhs/MhsReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ MhsReader::MhsReader(IO &io, const std::string &name, const Mode mode,
helper::Comm comm)
: Engine("MhsReader", io, name, mode, std::move(comm))
{
helper::GetParameter(io.m_Parameters, "tiers", m_Tiers);
helper::GetParameter(io.m_Parameters, "Tiers", m_Tiers);
Params params = {{"tiers", std::to_string(m_Tiers)}};
m_Compressor = std::make_shared<compress::CompressSirius>(params);
io.SetEngine("");
Expand Down
21 changes: 6 additions & 15 deletions source/adios2/engine/mhs/MhsWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ MhsWriter::MhsWriter(IO &io, const std::string &name, const Mode mode,
helper::Comm comm)
: Engine("MhsWriter", io, name, mode, std::move(comm))
{
helper::GetParameter(io.m_Parameters, "tiers", m_Tiers);
helper::GetParameter(io.m_Parameters, "Tiers", m_Tiers);
for (const auto &transportParams : io.m_TransportsParameters)
{
auto itVar = transportParams.find("variable");
Expand Down Expand Up @@ -113,21 +113,12 @@ MhsWriter::MhsWriter(IO &io, const std::string &name, const Mode mode,
throw("invalid operator");
}
}
if (m_Tiers > 1)
{
for (int i = 0; i < m_Tiers; ++i)
{
m_SubIOs.emplace_back(
&io.m_ADIOS.DeclareIO("SubIO" + std::to_string(i)));
m_SubEngines.emplace_back(&m_SubIOs.back()->Open(
m_Name + ".tier" + std::to_string(i), adios2::Mode::Write));
}
}
else
for (int i = 0; i < m_Tiers; ++i)
{
m_SubIOs.emplace_back(&io.m_ADIOS.DeclareIO("SubIO"));
m_SubEngines.emplace_back(
&m_SubIOs.back()->Open(m_Name, adios2::Mode::Write));
m_SubIOs.emplace_back(
&io.m_ADIOS.DeclareIO("SubIO" + std::to_string(i)));
m_SubEngines.emplace_back(&m_SubIOs.back()->Open(
m_Name + ".tier" + std::to_string(i), adios2::Mode::Write));
}
}

Expand Down
6 changes: 4 additions & 2 deletions testing/adios2/engine/mhs/TestMhsMultiRank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count,
{
adios2::ADIOS adios(MPI_COMM_WORLD);
adios2::IO io = adios.DeclareIO("ms");
io.SetEngine("mhs");
io.SetParameters(engineParams);
adios2::Engine readerEngine = io.Open(name, adios2::Mode::Read);
size_t datasize = 1;
Expand Down Expand Up @@ -180,6 +181,7 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count,
adios2::IO io = adios.DeclareIO("ms");
io.SetEngine("mhs");
io.SetParameters(engineParams);
io.AddTransport("sirius", {{"variable", "bpFloats"}});
std::vector<char> myChars(datasize);
std::vector<unsigned char> myUChars(datasize);
std::vector<short> myShorts(datasize);
Expand Down Expand Up @@ -250,9 +252,9 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count,
TEST_F(MhsEngineTest, TestMhsMultiRank)
{
std::string filename = "TestMhsMultiRank";
adios2::Params engineParams = {{"Verbose", "0"}};
adios2::Params engineParams = {{"Verbose", "0"}, {"Tiers", "1"}};

size_t rows = 800;
size_t rows = 80;
Dims shape = {rows, 8, 64};
Dims start = {0, 0, 0};
Dims count = {1, 8, 64};
Expand Down
4 changes: 3 additions & 1 deletion testing/adios2/engine/mhs/TestMhsSingleRank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ void Reader(const Dims &shape, const Dims &start, const Dims &count,
adios2::ADIOS adios;
#endif
adios2::IO io = adios.DeclareIO("ms");
io.SetEngine("mhs");
io.SetParameters(engineParams);
adios2::Engine readerEngine = io.Open(name, adios2::Mode::Read);
size_t datasize = 1;
Expand Down Expand Up @@ -186,6 +187,7 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count,
adios2::IO io = adios.DeclareIO("ms");
io.SetEngine("mhs");
io.SetParameters(engineParams);
io.AddTransport("sirius", {{"variable", "bpFloats"}});
std::vector<char> myChars(datasize);
std::vector<unsigned char> myUChars(datasize);
std::vector<short> myShorts(datasize);
Expand Down Expand Up @@ -256,7 +258,7 @@ void Writer(const Dims &shape, const Dims &start, const Dims &count,
TEST_F(MhsEngineTest, TestMhsSingleRank)
{
std::string filename = "TestMhsSingleRank";
adios2::Params engineParams = {{"Verbose", "0"}};
adios2::Params engineParams = {{"Verbose", "0"}, {"Tiers", "1"}};

size_t rows = 1000;
Dims shape = {rows, 1, 128};
Expand Down

0 comments on commit 8335340

Please sign in to comment.