Minimizing with multiple processors

EDITED
After much searching I found how to compile Minuit2 to take advantage of multiple processors during derivative calculations (using OpenMP). However, the implementation crashes once it reaches the derivatives. Here is my error:

Minimizing Minuit2Minimizer: Minimize with max iterations 10000000 edmval 0.001 strategy 1 Info in <Minuit2>: VariableMetricBuilder: no improvement in line search *** glibc detected *** /home/root/bin/root.exe: double free or corruption (fasttop): 0x00007fdb50023020 *** Error in <TBranch::GetBasket>: File: data/analysis/trees.root at byte:745179065486758755, branch:Score, entry:5797, badread=0, nerrors=2, basketnumber=0 Error in <TBranch::GetBasket>: File: data/analysis/trees.root at byte:745179065486758755, branch:Score, entry:5797, badread=0, nerrors=1, basketnumber=0

This is strange because the tree file appears fine. I think it’s because the threads are all trying to read from the tree at the same time; there is a TTree->GetEntry() line in the derivative function. Is there a way around this? Do I need to look into OpenMP’s locking/unlocking mechanism? Thanks!

Hi,

Yes, you need to use the OPENMP or TThread locking mechanism while reading the file and the tree as they are not yet thread safe. A few months ago I faced exactly the same problem. You can look at my solution in the following post.


https://root-forum.cern.ch/t/openmp-tfile-problem/11799/1

Cheers,
Tarak.