Hi all,
I’ve been using RDataFrame in python/PyROOT to run over the CMS NanoAOD format with multi-threading enabled. From basic benchmarks I’ve done, it seems the gain of adding more threads diminishes exponentially (not a huge surprise) so I’ve found it’s most optimal on a 16 thread CPU to run four separate “jobs” with four threads each.
It’s obviously a little annoying to be watching four separate terminals while waiting to queue up the next set to process by hand. So I was hoping to instead use the python multiprocessing library to do this job instead.
What I’m wondering about is how the multiprocessing and ROOT multi-threading interact. My understanding is that each Process
will use one thread of the CPU and if I use Pool
, then I can tell it how many process/threads I would like to use at a time.
So say I have the setup above of four jobs at a time with four threads each. Should I do ROOT. EnableImplicitMT(16) to make all 16 threads available to root? Or ROOT. EnableImplicitMT(4) so that each process only uses four threads at a time?
From trying both and just watching htop, it seems doing ROOT. EnableImplicitMT(4) only uses four total threads even though I submit multiple Process
es and so I think when I do ROOT. EnableImplicitMT(16), the separate Process
es are all sharing the 16 threads.
Does anyone have experience with this or know the back end of ROOT and multiprocessing to have a guess of what’s going on? Is there a way to set the number of threads in ROOT per Process
rather than per parent script?
Thanks!
Lucas