Commit 38d719a6 authored by Sonja Happ's avatar Sonja Happ

add counters for forward sweep and backward sweep loops to rank results

parent 07639a4e
......@@ -68,7 +68,10 @@ public:
/*counting number of FBS sweeps in model*/
void reset_number_of_fbs_sweeps();
void reset_loop_counters();
void increment_number_of_fbs_sweeps();
void add_to_forward_loop_counter(unsigned int n);
void add_to_backward_loop_counter(unsigned int n);
unsigned int get_number_of_fbs_sweeps();
/*logging time values*/
......@@ -111,6 +114,8 @@ public:
unsigned int number_of_fbs_sweeps; //!< counting the number of forward-backward sweeps
//!< in each iteration
unsigned int forward_loop_counter; //!< counting number of iterations through forward sweep loop
unsigned int backward_loop_counter; //!< counting number of iterations through backward sweep loop
private:
......
......@@ -120,6 +120,7 @@ Model::Model(std::string &propsFile, int argc, char** argv, boost::mpi::communic
forward_backward_sweep_finished=false;
backward_sweep_finished=false;
forward_sweep_finished=false;
IO->reset_loop_counters();
//create villas config with disabled villas node (used in all agents that never contain a villas node)
villas_config_node_disabled = new villas_node_config();
......@@ -1498,6 +1499,7 @@ void Model::forward_backward_sweep() {
repast::ScheduleRunner &runner = repast::RepastProcess::instance()->getScheduleRunner();
IO->reset_number_of_fbs_sweeps();
IO->reset_loop_counters();
while (!forward_backward_sweep_finished) {
IO->log_info("####### number of loops: " + std::to_string(IO->get_number_of_fbs_sweeps()+1) + "#######");
......@@ -1626,6 +1628,7 @@ void Model::do_backward_sweep() {
IO->flush_log();
}
IO->add_to_backward_loop_counter(counter);
IO->log_info("backward sweep took " + std::to_string(counter) + " iterations.");
backward_sweep_finished=false;
IO->stop_time_measurement(IO->tm_backward_sweep);
......@@ -1701,6 +1704,7 @@ void Model::do_forward_sweep() {
IO->flush_log();
}
IO->add_to_forward_loop_counter(counter);
IO->log_info("forward sweep took " + std::to_string(counter) + " iterations.");
forward_sweep_finished = false;
IO->stop_time_measurement(IO->tm_forward_sweep);
......
......@@ -359,7 +359,9 @@ void ModelIO::log_results_for_tick() {
"," + std::to_string(tm_df->get_duration() / 1000000.0)+
"," + std::to_string(tm_bcast_FBS->get_duration() / 1000000.0)+
"," + std::to_string(tm_bcast_forward_sweep->get_duration() / 1000000.0)+
"," + std::to_string(tm_bcast_backward_sweep->get_duration() / 1000000.0)
"," + std::to_string(tm_bcast_backward_sweep->get_duration() / 1000000.0)+
"," + std::to_string(backward_loop_counter)+
"," + std::to_string(forward_loop_counter)
);
......@@ -499,7 +501,9 @@ void ModelIO::set_result_file_header() {
"DF behavior [s]," <<
"MPI bcast FBS [s]," <<
"MPI bcast forward sweep [s]," <<
"MPI bcast backward sweep [s]" <<
"MPI bcast backward sweep [s]," <<
"Forward loop counter," <<
"Backward loop counter" <<
std::endl;
......@@ -987,10 +991,23 @@ void ModelIO::reset_number_of_fbs_sweeps() {
number_of_fbs_sweeps = 0;
}
void ModelIO::reset_loop_counters() {
backward_loop_counter = 0;
forward_loop_counter = 0;
}
void ModelIO::increment_number_of_fbs_sweeps() {
number_of_fbs_sweeps++;
}
void ModelIO::add_to_forward_loop_counter(unsigned int n) {
forward_loop_counter += n;
}
void ModelIO::add_to_backward_loop_counter(unsigned int n) {
backward_loop_counter += n;
}
unsigned int ModelIO::get_number_of_fbs_sweeps() {
return number_of_fbs_sweeps;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment