Multicore TGraph(TF1)

Hi, I have a complicated numerical TF1 function which I wish to evaluate many times to form a TGraph. In PyROOT I am using the syntax:

f = ROOT.TF1('f',f_python(),A,B,N) [f.SetParameter(i,param[i]) for i in range(N)] fgraph = ROOT.TGraph(f)
which evaluates the function fNpx times (default 100).

The function is very slow to compute, and I am wondering if ROOT knows to use the 4 cores in my computer to calculate the data points 4x faster.

So, does ROOT know that data points in a TGraph can be calculated independently? If not, is there a simple way to enable this?



calling a python function this way through a TF1 is costing way more than the 4x you hope to gain from using multicore … (This is expected to be better in the Cling world, and much better in the PyPy/cppyy world, but there are just too many layers in the dispatch back and forth in the CINT world).

TGraph can take an array of values as well, so is it an option to calculate the array of values fully in Python, then pass it to the TGraph? If so, you can use the Python “multiprocessing” module to trivially parallelize the code.