Slow Multi-thread Integrals

I’ve found that while multi-threading on Ubuntu TF1::IntegralOneDim integration slows down multi-job processes to a single thread speed. Looking further, it seems this is only true when using gsl integrators. I believe this may be due to the gsl workspace being shared between threads and creating a race condition? (I can’t post a link to stack exchange thread)

I don’t know if there is a workaround for gsl but I wanted to post for posterity that switching the default integrator to Gauss or GaussLegendre worked for me (TF1::IntegralOneDim has good documentation):

#include <Math/IntegratorOptions.h>
ROOT::Math::IntegratorOneDimOptions::SetDefaultIntegrator("Gauss");

ROOT Version: 6.24/02
Platform: Ubuntu 20.04.3
Compiler: g++ 9.3.0


Hi,

Thank you for your post. Do you have an example code showing this problem ? In principle, if you create integrator object in different threads, as it is done if TF1::Integral is called in separate threads, the GSL integrator workspace should not be shared.
If you post your example code, I can investigate this issue

Best regards

Lorenzo