fix: unnest pht- and dht-related outputs and stats collection in WorkerPostIter and WorkerPostSim

This commit is contained in:
Marco De Lucia 2023-08-11 14:44:26 +02:00
parent 7a10217751
commit 6f20cb897b

View File

@ -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/ChemistryModule.hpp"
#include "poet/DHT_Wrapper.hpp" #include "poet/DHT_Wrapper.hpp"
@ -216,38 +216,38 @@ void poet::ChemistryModule::WorkerPostIter(MPI_Status &prope_status,
uint32_t iteration) { uint32_t iteration) {
MPI_Recv(NULL, 0, MPI_DOUBLE, 0, LOOP_END, this->group_comm, MPI_Recv(NULL, 0, MPI_DOUBLE, 0, LOOP_END, this->group_comm,
MPI_STATUS_IGNORE); MPI_STATUS_IGNORE);
if (this->dht_enabled) { if (this->dht_enabled) {
dht_hits.push_back(dht->getHits()); dht_hits.push_back(dht->getHits());
dht_evictions.push_back(dht->getEvictions()); dht_evictions.push_back(dht->getEvictions());
dht->resetCounter(); dht->resetCounter();
if (this->interp_enabled) {
interp_calls.push_back(interp->getInterpolationCount());
interp->resetCounter();
interp->writePHTStats();
}
if (this->dht_snaps_type == DHT_SNAPS_ITEREND) { if (this->dht_snaps_type == DHT_SNAPS_ITEREND) {
WorkerWriteDHTDump(iteration); 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) { void poet::ChemistryModule::WorkerPostSim(uint32_t iteration) {
if (this->dht_enabled && this->dht_snaps_type == DHT_SNAPS_SIMEND) { if (this->dht_enabled && this->dht_snaps_type == DHT_SNAPS_SIMEND) {
WorkerWriteDHTDump(iteration); WorkerWriteDHTDump(iteration);
if (this->interp_enabled) { }
std::stringstream out; if (this->interp_enabled) {
out << this->dht_file_out_dir << "/iter_" << std::setfill('0') std::stringstream out;
<< std::setw(this->file_pad) << iteration << ".pht"; out << this->dht_file_out_dir << "/iter_" << std::setfill('0')
interp->dumpPHTState(out.str()); << 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() std::cout << "CPP: Worker: Successfully written DHT to file " << out.str()
<< "\n"; << "\n";
} }
void poet::ChemistryModule::WorkerReadDHTDump( void poet::ChemistryModule::WorkerReadDHTDump(
const std::string &dht_input_file) { const std::string &dht_input_file) {
int res = dht->fileToTable((char *)dht_input_file.c_str()); int res = dht->fileToTable((char *)dht_input_file.c_str());