From 6f20cb897bc9ec6f3190e618dbe5033504381317 Mon Sep 17 00:00:00 2001 From: Marco De Lucia Date: Fri, 11 Aug 2023 14:44:26 +0200 Subject: [PATCH] fix: unnest pht- and dht-related outputs and stats collection in WorkerPostIter and WorkerPostSim --- src/ChemistryModule/WorkerFunctions.cpp | 45 +++++++++++++------------ 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/ChemistryModule/WorkerFunctions.cpp b/src/ChemistryModule/WorkerFunctions.cpp index eb9df84a2..a46030f79 100644 --- a/src/ChemistryModule/WorkerFunctions.cpp +++ b/src/ChemistryModule/WorkerFunctions.cpp @@ -1,4 +1,4 @@ -// Time-stamp: "Last modified 2023-08-10 12:14:24 mluebke" +// Time-stamp: "Last modified 2023-08-11 14:07:03 delucia" #include "poet/ChemistryModule.hpp" #include "poet/DHT_Wrapper.hpp" @@ -216,38 +216,38 @@ void poet::ChemistryModule::WorkerPostIter(MPI_Status &prope_status, uint32_t iteration) { MPI_Recv(NULL, 0, MPI_DOUBLE, 0, LOOP_END, this->group_comm, MPI_STATUS_IGNORE); + if (this->dht_enabled) { dht_hits.push_back(dht->getHits()); dht_evictions.push_back(dht->getEvictions()); - dht->resetCounter(); - - if (this->interp_enabled) { - interp_calls.push_back(interp->getInterpolationCount()); - interp->resetCounter(); - interp->writePHTStats(); - } - + dht->resetCounter(); + if (this->dht_snaps_type == DHT_SNAPS_ITEREND) { WorkerWriteDHTDump(iteration); - - if (this->interp_enabled) { - std::stringstream out; - out << this->dht_file_out_dir << "/iter_" << std::setfill('0') - << std::setw(this->file_pad) << iteration << ".pht"; - interp->dumpPHTState(out.str()); - } } } + + if (this->interp_enabled) { + std::stringstream out; + interp_calls.push_back(interp->getInterpolationCount()); + interp->resetCounter(); + interp->writePHTStats(); + out << this->dht_file_out_dir << "/iter_" << std::setfill('0') + << std::setw(this->file_pad) << iteration << ".pht"; + interp->dumpPHTState(out.str()); + } } + + void poet::ChemistryModule::WorkerPostSim(uint32_t iteration) { if (this->dht_enabled && this->dht_snaps_type == DHT_SNAPS_SIMEND) { WorkerWriteDHTDump(iteration); - if (this->interp_enabled) { - std::stringstream out; - out << this->dht_file_out_dir << "/iter_" << std::setfill('0') - << std::setw(this->file_pad) << iteration << ".pht"; - interp->dumpPHTState(out.str()); - } + } + if (this->interp_enabled) { + std::stringstream out; + out << this->dht_file_out_dir << "/iter_" << std::setfill('0') + << std::setw(this->file_pad) << iteration << ".pht"; + interp->dumpPHTState(out.str()); } } @@ -263,6 +263,7 @@ void poet::ChemistryModule::WorkerWriteDHTDump(uint32_t iteration) { std::cout << "CPP: Worker: Successfully written DHT to file " << out.str() << "\n"; } + void poet::ChemistryModule::WorkerReadDHTDump( const std::string &dht_input_file) { int res = dht->fileToTable((char *)dht_input_file.c_str());