Generating toy RooDataSet using mutithread

Dear experts,
I’m trying to modify the mt304_fillHistos.C in the tutorial to generate a large toy RooDataSet and fill the variables into a histogram. But I get *** Break *** segmentation violation errors. The script I’m using is
mt304_fillHistos.C (3.4 KB)
It works fine if I set nWorkers = 1U but has a problem when nWorkers = 8U is used. Anything wrong? Thanks!

Hello,

I am not entirely sure we support this kind of generation from multiple threads. I am sure @jonas can suggest a way to accelerate the task involving roofit.

Cheers,
D

Hello!

Importing from ROOT files to RooWorkspace is not thread safe. You need to put a lock around it to force serial execution:

      static std::mutex io_mutex;
      {
          std::lock_guard<std::mutex> lk(io_mutex);
          w1.import("tttxxx.root:w0:model",RooFit::RenameAllVariables(tt.c_str()),RooFit::RenameAllNodes(tt.c_str()));
      }

Of course this only makes sense it it’s not the performance bottleneck.

You could also consider rewriting your code such that the workspace is simply recreated by each thread on the fly, if it’s not too complicated. Then you don’t have to use IO.

I hope that helps!

Cheers,
Jonas

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.