Hi everyone. This is my first post on the forum (and I hope my search for an answer was thorough enough).
I am doing a summer internship using the Metropolis-Hastings algorithm to fit a multivariable distribution. At this point we’re running a test to make a linear fit.
I am trying to characterize the convergence off the method with a TH2D with the y error and the proposal width for the parameters.
At one point the code would take about 2.75 hours to run, and I thought I could parallelize the fors in my program with openMP, but apperently it’s not yet supported for interpreted macros:
My question is if there is any way of parellelizing my for loops while maintaining the interpreted macro structure.
You can call compiled C/C++ functions from inside of ROOT interpreted macros.
So, you can “encapsulate” all time consuming parts into some C/C++ functions and compile them (into one or more shared libraries -> you can simply use ACLiC, built-in in ROOT, to precompile your source code).
Then the interpreted macro could be used to “steer” the execution of your compiled functions.
Hi Pepe. Thank you for the reply! I’m sorry I took so long to come back to this thread.
I’m telling root to compile the macro with:
root -l TestCode.C+
And I get the following output:
Info in TUnixSystem::ACLiC: creating shared library /home/Some/Thing/./TestCode_C.so
/home/Some/Thing/TestCode_C_ACLiC_dict.o: In function TestCode()': TestCode_C_ACLiC_dict.cxx:(.text+0x9eb7): undefined reference toomp_set_num_threads’
collect2: error: ld returned 1 exit status
Error in : Compilation failed!
ACLIC doesn’t seem to know omp_set_num_threads, but shouldn’t it be in the omp.h file? (I coppied the omp.h to my directory so ACLIC could find it)
Wouldn’t I run into the same problem if I compiled my for loops out of the macro with ACLIC and then linked it? Should I use gcc to compile them and then link the librarys? Is there a way to preserve the ‘root -l TestCode.C+’ line?