PROOF with g++


It’s a naive question maybe but I would like to know if it is possible to compile my TSelector code with g++ and run on PROOF. Is there any example of this?


Dear Akira,

I am not sure to understand your question: to run a compiled selector you just follow the usual ROOT convention, i.e. adding a ‘+’ or ‘++’ to the selector string, e.g.

root[] TProof *p = TProof::Open("master");
root[] p->Process("MySelector.C",1000);    // interpreted selector
root[] p->Process("MySelector.C+",1000);    // compiled selector

Is this what you meant?
If not, could you say a bit more about what you would like to do?

Gerri Ganis

…and if your really wish to use g++ on command line before, simply load the .so file in ROOT and run the selector.

Note that you must load the library on every worker, so use something like gProof->Exec(".L /path/to/your/")


Thanks for reply. The compilation in ROOT seems not to be highly optimized. I tend to get a speed increase of one or two order of magnitude if I compile with g++ compared to compiling with ACLiC. If g++ compiled library can be readily executed with something like: gProof->Exec(".L /path/to/your/") then that answers my question. Has this been demonstrated? Somehow I had an impression that only library compiled with ACLiC could be loaded but probably I was mislead.



Note that the default compilation option for ACliC are those use to compile your ROOT binary (so you may not have compiled ROOT in optimized mode).

Also you can force ACLiC to compile in the code in optimized mode:root [] .L myscript.C+O
You can also change the default optimization flagsgSystem->SetFlagsOpt(" -O3 ");

[quote]Somehow I had an impression that only library compiled with ACLiC could be loaded but probably I was mislead.[/quote]Actually you can load any library, however you need to make sure that they are available on all the slave node (either via shared file system or via an upload of a PAR file).


Hi Philippe

It’s a good news for me that I can load any library regardless of the compiler. But let me ask a little more detail about ACLiC; it seems suspicious that optimization option is not turned on by default. Could you comment on the drawbacks if any? Right now I’m taking some benchmarks and my (very simple) analysis runs at 50 Hz reading in TTree. When I compile this with default ACLiC, it speeds up to 330 Hz but this increase seems small. On the other hand, I have a g++ compiled one which runs qt 16,000Hz doing the same thing (in terms of analysis, but it is actually written withing a bigger framework so there might be something happening outside of my knowledge). How do you see these numbers? Do you think this is something I’d expect or maybe my CINT analysis is not optimized? My input tree does have a lot of branches (few hundred) so I’m wondering if I have to be more careful.


Hi Akira,

Are you actually using the exact same source code for your ACLiC and g++ benchmark? Are you sure that the ROOT version you are using has been compiled with optimization on? Did you try the .L script.cxx+O ? Do you know which compilation option are using in your g++ compilation? Note that if you do:root [] gDebug = 7; root [] .L script.cxx++ you will see the compilation option used by ACLiC.


PS. If the gDebug result in too many messages from the plugin manager. Do the following:

root [] .L script.cxx+ root [] gDebug = 7; root [] .L script.cxx++O

I’m not using exactly the same code between ACLiC and g++ codes. The analysis is the same but g++ one is wrapped in a framework (which takes care of event loop, configuration etc). I talked to the author of the framework and indeed it turns out that I had to do branch->GetEntry(), rather than tree->GetEntry() because the latter will initiate loading of the whole tree. Fixing this, I see a result faster than g++ (again, g++ one is more complex). With optimization, I get 1.5 times increase in speed.

Thanks a lot for help.