From 95c289f20ae67ed084007a54ca80bb53bc9e4f91 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Sat, 14 Jan 2023 10:05:52 +0100 Subject: [PATCH] mv loop up --- Sim/Simulation/ISimulation.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sim/Simulation/ISimulation.cpp b/Sim/Simulation/ISimulation.cpp index 49115069729..6458fef212e 100644 --- a/Sim/Simulation/ISimulation.cpp +++ b/Sim/Simulation/ISimulation.cpp @@ -220,7 +220,8 @@ void ISimulation::runSingleSimulation(const ReSample& re_sample, size_t batch_st if (n_threads == 1) { // Run computation in current thread. try { - runComputation(re_sample, batch_start, batch_size); + for (size_t i = 0; i < batch_size; ++i) + runComputation(re_sample, batch_start + i, 1); } catch (const std::exception& ex) { throw std::runtime_error(std::string("Unexpected error in simulation:\n") + ex.what()); } @@ -238,7 +239,8 @@ void ISimulation::runSingleSimulation(const ReSample& re_sample, size_t batch_st threads.emplace_back(new std::thread( [this, &re_sample, &failure_messages, &mutex, thread_start, thread_size]() { try { - runComputation(re_sample, thread_start, thread_size); + for (size_t i = 0; i < thread_size; ++i) + runComputation(re_sample, thread_start + i, 1); } catch (const std::exception& ex) { mutex.lock(); failure_messages.push_back(ex.what()); -- GitLab