Enabled time measurement

This commit is contained in:
rastogi 2025-10-30 16:38:06 +01:00
parent 37c6227580
commit 3fb6ca5209
6 changed files with 17 additions and 50 deletions

Binary file not shown.

View File

@ -410,8 +410,6 @@ protected:
ChemBCast(&type, 1, MPI_INT);
}
void PropagateControlLogic(int type, int flag);
double simtime = 0.;
double idle_t = 0.;
double seq_t = 0.;

View File

@ -232,37 +232,6 @@ inline void printProgressbar(int count_pkgs, int n_wp, int barWidth = 70) {
/* end visual progress */
}
void poet::ChemistryModule::PropagateControlLogic(int type, int flag) {
/*
PropagateFunctionType(type);
static int master_bcast_seq = 0;
int tmp = flag ? 1 : 0;
std::cerr << "[MASTER BCAST " << master_bcast_seq << "] ftype=" << type
<< " flag=" << tmp << std::endl
<< std::flush;
master_bcast_seq++;
ChemBCast(&tmp, 1, MPI_INT);
switch (type) {
case CHEM_CTRL_ENABLE:
this->control_enabled = (tmp == 1);
break;
case CHEM_WARMUP_PHASE:
this->warmup_enabled = (tmp == 1);
break;
case CHEM_DHT_ENABLE:
this->dht_enabled = (tmp == 1);
break;
case CHEM_IP_ENABLE:
this->interp_enabled = (tmp == 1);
break;
default:
break;
}
*/
}
inline void poet::ChemistryModule::MasterSendPkgs(
worker_list_t &w_list, workpointer_t &work_pointer,
workpointer_t &sur_pointer, int &pkg_to_send, int &count_pkgs,

View File

@ -465,7 +465,7 @@ static Rcpp::List RunMasterLoop(RInsidePOET &R, RuntimeParameters &params,
profiling["simtime"] = dSimTime;
profiling["chemistry"] = chem_profiling;
profiling["diffusion"] = diffusion_profiling;
//profiling["ctrl_logic"] = ctrl_profiling;
profiling["control_loop"] = ctrl_profiling;
chem.MasterLoopBreak();

View File

@ -3,9 +3,9 @@
#include <doctest/doctest.h>
#include <vector>
#include <Chemistry/ChemistryModule.hpp>
#include <Control/ControlModule.hpp>
TEST_CASE("Stats calculation")
TEST_CASE("Metrics calculation")
{
std::vector<double> real =
{
@ -27,15 +27,15 @@ TEST_CASE("Stats calculation")
2.8, 0.02, 0.7, 0.5
};
poet::ChemistryModule::error_stats stats(6, 5);
poet::ChemistryModule::computeStats(real, pred, /*size_per_prop*/ 4, /*species_count*/ 6, stats);
poet::ControlModule::metricsHistory metrics(6, 5);
poet::ControlModule::computeSpeciesErrorMetrics(real, pred, /*size_per_prop*/ 4);
SUBCASE("Non-zero values")
{
// species 1 is ID, should stay 0
CHECK_EQ(stats.mape[0], 0);
CHECK_EQ(stats.rrsme[0], 0);
CHECK_EQ(metrics.mape[0], 0);
CHECK_EQ(metrics.rrsme[0], 0);
/*
mape species 2
@ -49,8 +49,8 @@ TEST_CASE("Stats calculation")
rrsme = sqrt(1.02040816/4) = 0.50507627
*/
CHECK_EQ(stats.mape[1], doctest::Approx(28.5714286).epsilon(1e-6));
CHECK_EQ(stats.rrsme[1], doctest::Approx(0.50507627).epsilon(1e-6));
CHECK_EQ(metrics.mape[1], doctest::Approx(28.5714286).epsilon(1e-6));
CHECK_EQ(metrics.rrsme[1], doctest::Approx(0.50507627).epsilon(1e-6));
}
SUBCASE("Zero-denominator case")
@ -65,8 +65,8 @@ TEST_CASE("Stats calculation")
rrsme = 1
*/
CHECK_EQ(stats.mape[2], 100.0);
CHECK_EQ(stats.rrsme[2], 1.0);
CHECK_EQ(metrics.mape[2], 100.0);
CHECK_EQ(metrics.rrsme[2], 1.0);
}
SUBCASE("True and predicted values are zero")
@ -81,8 +81,8 @@ TEST_CASE("Stats calculation")
rrsme = 0.0
*/
CHECK_EQ(stats.mape[3], 0.0);
CHECK_EQ(stats.rrsme[3], 0.0);
CHECK_EQ(metrics.mape[3], 0.0);
CHECK_EQ(metrics.rrsme[3], 0.0);
}
SUBCASE("Negative values")
@ -97,8 +97,8 @@ TEST_CASE("Stats calculation")
rrsme = sqrt(13.6989796 / 4) = 1.85060663
*/
CHECK_EQ(stats.mape[4], doctest::Approx(183.92857143).epsilon(1e-6));
CHECK_EQ(stats.rrsme[4], doctest::Approx(1.85060663).epsilon(1e-6));
CHECK_EQ(metrics.mape[4], doctest::Approx(183.92857143).epsilon(1e-6));
CHECK_EQ(metrics.rrsme[4], doctest::Approx(1.85060663).epsilon(1e-6));
}
SUBCASE("Large differences")
@ -113,7 +113,7 @@ TEST_CASE("Stats calculation")
rrsme = sqrt(2,12262382 / 4) = 0.72846136
*/
CHECK_EQ(stats.mape[5], doctest::Approx(62.102492).epsilon(1e-6));
CHECK_EQ(stats.rrsme[5], doctest::Approx(0.72846136).epsilon(1e-6));
CHECK_EQ(metrics.mape[5], doctest::Approx(62.102492).epsilon(1e-6));
CHECK_EQ(metrics.rrsme[5], doctest::Approx(0.72846136).epsilon(1e-6));
}
}