Skip to content

Commit 036e2ff

Browse files
committed
o2sim_parallel: correct stack filtering, add timing information
This is providing one more step to be consistent with the serial and parallel version of the simulation. Up until now, the parallel version did not call important hooks on the stack object after each event. Also adding some total timing information to both o2sim and o2sim_parallel for better systematic comparison.
1 parent 490681b commit 036e2ff

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

Steer/include/Steer/O2MCApplication.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,20 @@ class O2MCApplication : public FairMCApplication
4444
/** Define actions at the end of event */
4545
void FinishEvent() override
4646
{
47+
// update the stack
48+
fStack->FillTrackArray();
49+
fStack->UpdateTrackIndex(fActiveDetectors);
50+
4751
// This special finish event version does not fill the output tree of FairRootManager
4852
// but forwards the data to the HitMerger
4953
SendData();
5054

5155
// call end of event on active detectors
5256
for (auto det : listActiveDetectors) {
57+
det->FinishEvent();
5358
det->EndOfEvent();
5459
}
60+
fStack->Reset();
5561
}
5662

5763
/** Define actions at the end of run */

run/o2sim.cxx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@
1010

1111
#include "../macro/o2sim.C"
1212
#include <SimConfig/SimConfig.h>
13+
#include <TStopwatch.h>
14+
#include <FairLogger.h>
1315

1416
int main(int argc, char* argv[])
1517
{
18+
TStopwatch timer;
19+
timer.Start();
1620
auto& conf = o2::conf::SimConfig::Instance();
1721
if (!conf.resetFromArguments(argc, argv)) {
1822
return 1;
@@ -21,6 +25,9 @@ int main(int argc, char* argv[])
2125
// call o2sim "macro"
2226
o2sim(false);
2327

28+
// print total time
29+
LOG(INFO) << "Simulation process took " << timer.RealTime() << " s";
30+
2431
// We do this instead of return 0
2532
// for the reason that we see lots of problems
2633
// with TROOTs atexit mechanism often triggering double-free or delete symptoms.

run/o2sim_parallel.cxx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include <vector>
2222
#include <thread>
2323
#include <signal.h>
24+
#include "TStopwatch.h"
25+
#include "FairLogger.h"
2426

2527
const char* serverlogname = "serverlog";
2628
const char* workerlogname = "workerlog";
@@ -30,6 +32,8 @@ const char* mergerlogname = "mergerlog";
3032
// for parallel simulation
3133
int main(int argc, char* argv[])
3234
{
35+
TStopwatch timer;
36+
timer.Start();
3337
std::string rootpath(getenv("O2_ROOT"));
3438
std::string installpath = rootpath + "/bin";
3539

@@ -151,7 +155,9 @@ int main(int argc, char* argv[])
151155
// wait just blocks and waits until any child returns; make sure that we wait until merger is here
152156
while ((cpid = wait(&status)) != mergerpid) {
153157
}
154-
std::cout << "Merger process " << mergerpid << " returned\n";
158+
// This marks the actual end of the computation (since results are available)
159+
LOG(INFO) << "Merger process " << mergerpid << " returned";
160+
LOG(INFO) << "Simulation process took " << timer.RealTime() << " s";
155161

156162
// make sure the rest shuts down
157163
for (auto p : childpids) {

0 commit comments

Comments
 (0)