Minimize() and pthreads

Hello.

I have a bunch of minimizations to do, so my plan was to start up some pthreads and let them do the minimizations… Everything works with one thread.
Unfortunately, I am getting a Segmentation violation for more then one thread somewhere in minimizer->Minimize().

The threads share the data, but each of them works only on a small subset.

Is there something wrong with my approach? Is it possible to use the ROOT’s minimizer (Minuit) like this?

NOTE: I discovered that to create a minimizer (ROOT::Math::factory::CreateMinimizer) the call has to be mutexed.

Using the latest stable ROOT on linuxx8664gcc.

Thanks. :confused:

Hi,
which minimizer are you using ? TMinuit is not thread safe and it will not work. You should try using Minuit2. If you have separate minimizer instance for each thread, you should also have separate function objects.
I have been using Minuit2 with multiple threads (using OpenMP) where each thread computes a different function derivative.

Best Regards

Lorenzo

Hi and thanks.
Yes I have separate functions for each minimizer and I am using the “old” Minuit, so I will try the new one and share the results… :smiley:

Hi.

Minuit2 works beautifully with pThreads.

Thanks. :smiley: