bug fix for unbalanced cpu loads

This commit is contained in:
2024-09-04 10:59:16 +02:00
parent 3d3eff1bca
commit 9e50d8bdcf
+19 -1
View File
@@ -98,7 +98,25 @@ void Simulation::start() {
int leftover_events = events_this_cpu;
int num_cpu_syncs = 0;
while (leftover_events > 0) {
bool empty_loop = false;
if(total_simulated_events % MpiCommunication::mpiSize() != 0) {
if((events_this_cpu % event_stride == 0) &&
(total_simulated_events % MpiCommunication::mpiSize()
<= MpiCommunication::mpiRank())) {
DEBUG_LEVEL_3("empty loop");
empty_loop = true;
}
}
while (leftover_events > 0 || empty_loop) {
// special case of unbalanced cpu load, with a part of the cpus having one cycle
// that has no events, while the rest of the cpus have a single event (questionable if needed)
if(leftover_events == 0 && empty_loop) {
DEBUG_LEVEL_3("empty loop looped");
empty_loop = false;
}
int events_of_cylcle = eventsOfCycle(event_stride, leftover_events);
SIM_INFO("Leftover events on first cpu: " +
std::to_string(leftover_events));