We have a fairly complex simulation, which at one point uses CVODE to solve a system of coupled differential equations. To initialize the system, we make a one-time use of TF1 and BrentRootFinder to find the starting (zero) state.
It appears that the TF1 construtor is extraordinarily, and variably, slow. On both a CentOS7 compute node (64 GB, 32 cores) and my MacBook Pro (dual core), the one line
TF1 f1("Function", Tdot, 0., 6., 12);
takes anywhere from 14 to 96 seconds. Since Tdot is a compiled global function, this doesn’t make a lot of sense to me. Is there something we could/should do to speed it up?
We use the same function in our (non-ROOT) ODE solver code, and it is not slow to evaluate. Does gSystem->Load("libHist") typically need to be done in a compiled executable?
Additional followup: I commented out all of the body of the Tdot function above, so it consists entirely of:
double Tdot(double* x, double* par) {
return 0;
}
Recompiling and running again, it took 48 seconds to run the TF1 constructor. Clearly, the content of the function (as I expected) has no bearing on the slowness. As I’ve noted, we do not see this behaviour with any other ROOT stuff that we use (histograms, TTrees, etc.). It is exclusively the TF1 constructor that impacts our jobs.
Yes. The original problem is part of our SuperCDMS simulation, which is based on Geant4 and uses ROOT (with mutexes) for I/O. The demo I attached above is also compiled with a very simple Make file:
Thanks. Then we need some sort of trace - callgrind, strace -t, or similar tools. Please also let me know what time says for the simple reproducer: I bet it’s not CPU time.
Just a disclaimer: the questions above were ruling out common causes. I totally believe that this is an issue with ROOT, it’s just that we have never seen this before, we have no other similar reports, and I cannot reproduce it with the example you sent. So we need to dissect your case.
Okay. I’m gone for a week starting today, but we do need to get this sorted out. It’s turned out to be a significant (albeit not the most significant) portion of initialization for one class of our simulation jobs.
Ugh. So MacOS doesn’t have strace, but it has dtrace with a dtruss wrapper to act like strace. But the Mac “system integrity protection” won’t forward DYLD_LIBRARY_PATH to any kind of child process, so dtruss can’t launch the demonstrator.