Proof and gcc/g++ do not speed up the execution

Hello. I am trying to use PROOF-lite in a compiled code. I wrote a short test program and compiled it with

and not in the cint. I open a proof-lite session by TProof::Open("") and make some analysis on the chain, at the same time watching the processes info (by top/htop). I only see the name of my program (say, “main”), no root/proof activity, and it only works at one core.

If I do the same in a cint/ACLiC mode, by

root main.cxx[+]then I get a bit more output from the proof, but also I see many proofserv processes, and these use all the 4 cores with 100% load. I think it does not depend on root version, since I tried 5.22, 5.24, 5.26b and 5.28. Any advice? Is it some kind of a bug? Is it possible to use proof for speed-up in a compiled program?

P.S. I want to use g++, since don’t really want to convert my code to the one that can be used by ACLiC.

Then you are not using PROOF.

Where is the problem? PROOF is designed to use your cores …
Note that if your task is just reading data your HDD will probably not be able to feed 4 cores, and you will probably get a speed up of 2 at the best.

I do not understand this question and comment. Please elaborate.
Anyhow, if you want to get speed-up you need to compile at least your selector. Code that cannot be used in ACLiC means that is not full C/C++ compliant. Never a good idea.

Perhaps you should explain a bit more what you are doing in your code.

G. Ganis

Sorry for the long post below, I tried to explain everything I did in details.
OK. Here is the CINT version of the code:

// main.cxx
#include "TChain.h"
#include "TProof.h"

#include <iostream>
using namespace std;


int main()
{
  TProof *p = TProof::Open("");
  TChain *ch1 = new TChain("fTree");
  ch1->Add("data.root");
  cout<<"Found "<<ch1->GetEntries()<<" entries"<<endl;
  ch1->SetProof();

  ch1->Process("MySel.C+");
}

In the test data file data.root(see attached) I have three branches that I read in the selector. Please note that there are only 1000 entries inside. So, if I run this script with the CINT:[code]
[volynets@pclg-23]:~/Work/tests/root/proof/simple_tree$ root
root [0] .x main.cxx
+++ Starting PROOF-Lite with 4 workers +++
Opening connections to workers: OK (4 workers)
Setting up worker servers: OK (4 workers)
PROOF set to parallel mode (4 workers)

Info in TProofLite::SetQueryRunning: starting query: 1
Info in TUnixSystem::ACLiC: creating shared library /home/pclg-23/volynets/Work/tests/root/proof/simple_tree/./MySel_C.so
Looking up for exact location of files: OK (1 files)
Looking up for exact location of files: OK (1 files)
Info in TPacketizerAdaptive::TPacketizerAdaptive: Setting max number of workers per node to 4
Validating files: OK (1 files)
Info in TPacketizerAdaptive::TPacketizerAdaptive: fraction of remote files 1.000000
(int)0: merging output objects … / (-4 workers still sending)
root [1]
[/code]
It opens the Proof query process (with a very nice speed-o-meter), and seems to use all the 4 cores.

Then I try the second way: to compile the same code, with some modifications:

// main.C
#include "MySel.h"   // Here is my selector, created with TChain::MakeSelector("MySel");

#include "TProof.h"
#include "TChain.h"

#include <iostream>
using namespace std;

int main()
{
  TProof::Open("");
  TChain *ch1 = new TChain("fTree");
  ch1->Add("data.root");
  cout<<"Found "<<ch1->GetEntries()<<" entries"<<endl;
  ch1->SetProof();

  MySel* s = new MySel; // Here I use the selector object
  ch1->GetTree()->Process(s); // Here I use GetTree as I get "Warning in <TProofChain::Process>: not implemented"
}

compile with

g++ `root-config --libs --cflags` -lProof -lProofPlayer main.C MySel.C -o main

and run:

[volynets@pclg-23]:~/Work/tests/root/proof/simple_tree$ ./main
 +++ Starting PROOF-Lite with 4 workers +++
Opening connections to workers: OK (4 workers)
Setting up worker servers: OK (4 workers)
PROOF set to parallel mode (4 workers)
Found 1000 entries

This is it. No proof as you said. I need to use this way if possible. What am I doing wrong?

I not only read from disk but make the analysis with my real program, which takes longer time than reading.

I compile both as I said. Did not understand about the ACLiC mode.

I need to use the second way by compiling the entire program. The question is whether I can do this with proof.

Thank you!
data.root (26.5 KB)
MySel.h (2.61 KB)
MySel.C (3.18 KB)

Hi,

You are forcing single core processing by calling Process on the TTree:

  MySel* s = new MySel; // Here I use the selector object
  ch1->GetTree()->Process(s); // Here I use GetTree as I get "Warning in <TProofChain::Process>: not implemented"

You should do it as in the first case (what you refer as ‘cint’):

ch1->Process("MySel.C+");

Is there any reason why you want to pass directly the selector object?
Support for that is planned but it should not be a show-stopper.

G. Ganis

Thank you very much. Now I understand a bit more. Also:

I want to pass/retrieve some parameters and variables (say, of integer type) to/from the selector object. Can I do this when using
ch1->Process(“MySel.C+”)?
Probably It is better to use root classes in the selector and retrieve the objects from fObject->FindObject()?

Hi,

Currently you have to use the input list to pass parameters (available in the TSelector object via it fInput member; use TProof::AddInput for that) and to retrieve the results via the output list.

Note that, even if we add the possibility to process directly the selector object, it will be always advised to retrieve parameters/results/variables via the output list. Each worker will get a copy of the initial selector object to start with, so, while the input (passed) parameters are well defined, the output is not (you have to tell the system how to ‘merge’ the various copies back).

G. Ganis

Thank you very much. Now it is more or less clear for me how proof works. I’ll try what you suggested.

hello evry body
i want to creat my histogramme by profile but i don t know how!!
i use this commande : h.Draw(“prof”);but no thing
you can help me !!!

[quote=“abdellahkadaoui”]hello evry body
i want to creat my histogramme by profile but i don t know how!!
i use this commande : h.Draw(“prof”);but no thing
you can help me !!![/quote]

This is not the right place for these requests. Please repost to ‘ROOT support’.
Thanks.