Enabled time measurement

This commit is contained in:
rastogi 2025-10-30 16:38:06 +01:00
parent 4ac8914175
commit e479f666af
8 changed files with 29 additions and 62 deletions

View File

@ -115,18 +115,18 @@ setup <- list(
Chemistry = chemistry_setup # Parameters related to the chemistry process Chemistry = chemistry_setup # Parameters related to the chemistry process
) )
iterations <- 100 iterations <- 5000
dt <- 200 dt <- 200
checkpoint_interval <- 20 checkpoint_interval <- 100
control_interval <- 20 control_interval <- 100
mape_threshold <- rep(3.5e-3, 13) mape_threshold <- rep(3.5e-3, 13)
#out_save <- seq(50, iterations, by = 50) out_save <- seq(1000, iterations, by = 1000)
list( list(
timesteps = rep(dt, iterations), timesteps = rep(dt, iterations),
store_result = FALSE, store_result = TRUE,
#out_save = out_save, out_save = out_save,
checkpoint_interval = checkpoint_interval, checkpoint_interval = checkpoint_interval,
control_interval = control_interval, control_interval = control_interval,
mape_threshold = mape_threshold mape_threshold = mape_threshold

View File

@ -1,10 +1,10 @@
#!/bin/bash #!/bin/bash
#SBATCH --job-name=dolo #SBATCH --job-name=dolo_5000
#SBATCH --output=dolo_%j.out #SBATCH --output=dolo_5000_%j.out
#SBATCH --error=dolo_%j.err #SBATCH --error=dolo_5000_%j.err
#SBATCH --partition=long #SBATCH --partition=long
#SBATCH --nodes=4 #SBATCH --nodes=6
#SBATCH --ntasks=96 #SBATCH --ntasks=144
#SBATCH --ntasks-per-node=24 #SBATCH --ntasks-per-node=24
#SBATCH --exclusive #SBATCH --exclusive
#SBATCH --time=12:00:00 #SBATCH --time=12:00:00
@ -14,5 +14,5 @@ source /etc/profile.d/modules.sh
module purge module purge
module load cmake gcc openmpi module load cmake gcc openmpi
mpirun -n 96 ./poet --interp dolo_fgcs_3.R dolo_fgcs_3.qs2 dolo mpirun -n 144 ./poet --interp dolo_fgcs_3.R dolo_fgcs_3.qs2 dolo_5000
#mpirun -n 96 ./poet --interp barite_fgcs_2.R barite_fgcs_2.qs2 bar_warmup #mpirun -n 96 ./poet --interp barite_fgcs_2.R barite_fgcs_2.qs2 bar_warmup

Binary file not shown.

View File

@ -410,8 +410,6 @@ protected:
ChemBCast(&type, 1, MPI_INT); ChemBCast(&type, 1, MPI_INT);
} }
void PropagateControlLogic(int type, int flag);
double simtime = 0.; double simtime = 0.;
double idle_t = 0.; double idle_t = 0.;
double seq_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 */ /* 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( inline void poet::ChemistryModule::MasterSendPkgs(
worker_list_t &w_list, workpointer_t &work_pointer, worker_list_t &w_list, workpointer_t &work_pointer,
workpointer_t &sur_pointer, int &pkg_to_send, int &count_pkgs, 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["simtime"] = dSimTime;
profiling["chemistry"] = chem_profiling; profiling["chemistry"] = chem_profiling;
profiling["diffusion"] = diffusion_profiling; profiling["diffusion"] = diffusion_profiling;
//profiling["ctrl_logic"] = ctrl_profiling; profiling["control_loop"] = ctrl_profiling;
chem.MasterLoopBreak(); chem.MasterLoopBreak();

View File

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