G++ standalone: TProof using TChain

Hi everybody,

I am trying to compile and link (g++) a code using Proof (Lite, 4 workers) with a TChain.

As a demonstration example I am using the TSelector(-derivative) from the Hands-on-Tutorial (http://root.cern.ch/drupal/content/processing-proof, ProofFirst.C and ProofFirst.h) and add a check whether the histogram is created (or available) or not:

void ProofFirst::Terminate() { TCanvas *c1 = new TCanvas("c1", "Proof ProofFirst canvas",200,10,400,400); fH1F = dynamic_cast<TH1F *>(fOutput->FindObject("FirstH1F")); if (fH1F) fH1F->Draw(); c1->Update(); // EDIT: if(fH1F) Info("Terminate","ok"); else Info("Terminate","not ok"); }

Now I’ve got 3 scenarios, each using a TChain and loading a TTree from a *.root-File:
[ol]
[li]

// startProof.C: { TChain* chain = new TChain("photonTree"); chain->Add("/path-to/myfile.root"); chain->SetProof(); TProof *p = TProof::Open("lite://"); chain->Process("ProofFirst.C+"); p->Close(); }
I run this via “root -l startProof.C+” and get “Info in ProofFirst::Terminate: ok”.
[/li]
[li] Now compiling with g++

[code]//startProof.cpp:
#include “TChain.h”
#include “TProof.h”
#include “ProofFirst.h”

int main() {
TChain* chain = new TChain(“photonTree”);
chain->Add("/path-to/myfile.root");
chain->SetProof();
TProof *p = TProof::Open(“lite://”);
chain->Process(“ProofFirst.C+”);
gSystem->Exit(0);
return 0;
}[/code]
I compile/link and run this via

$ rootcint -f ProofFirst_dict.C -c ProofFirst.h $ g++ $(root-config --libs --cflags) -lProof -lProofPlayer startProof.cpp ProofFirst.C ProofFirst_dict.C -o startProof $ ./startProof
This works as well.
[/li]
[li] This is the case I am actually interested in. The difference to B) is that I run TChain::Process(void* selector) instead of passing the filename:

[code]//startProof.cpp:
#include “TChain.h”
#include “TProof.h”
#include “ProofFirst.h”

int main() {
TChain* chain = new TChain(“photonTree”);
chain->Add("/path-to/myfile.root");
chain->SetProof();
TProof p = TProof::Open(“lite://”);
ProofFirst
pf = new ProofFirst();
chain->Process(pf);
gSystem->Exit(0);
return 0;
}[/code]
Running this as in B) results in

[code] +++ 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 TProofQueryResult::SetRunning: nwrks: 4
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::InitStats: fraction of remote files 0.000000
Info in ProofFirst::Terminate: not ok |>…| 0.00 %
Lite-0: all output objects have been merged[/code]
So “Info in ProofFirst::Terminate: not ok” says the histogram isn’t there.[/li][/ol]

I tried to figure out for some time now, why this does not work. I think SlaveBegin() is not entered.
Can you help me here? Is proof designed to be able doing this at all?

Thanks in advance,
Johannes

Hello,
Sorry for the late reply.
Is the problem still occuring?
If yes, PROOF is able to process selectors by object for version >= 5.34. And you last case shows that Terminate is called, so it should be the case for your version.
One thing is that SetProof is intended to be called after opening PROOF, because there are initializations done at that level that could be incomplete without a PROOF sessions. I am currently surprised that you get something in cases A and B.
So, I suggest to move the SetProof call after TProof::Open .
Can you also try in a ROOT shell, just to see if there is anything related to the way the compilation/linking is done?

G. Ganis

Hi,

yes, the problem remains.
Right, I am using v5-34-17 (forgot to mention, sorry).

This way

TProof *p = TProof::Open("lite://"); chain->SetProof();I get the same results as before.

If I try this in root:

$ root .L ProofFirst.C TChain* chain = new TChain("photonTree"); chain->Add(rootFile); TProof *p = TProof::Open("lite://"); chain->SetProof(); ProofFirst* pf = new ProofFirst(); chain->Process(pf);I get

[code]Info in TProofLite::SetQueryRunning: starting query: 1
Info in TProofQueryResult::SetRunning: nwrks: 4
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::InitStats: fraction of remote files 0.000000
0.3: caught exception triggered by signal ‘1’ -1
Info in TProofLite::MarkBad:
+++ Message from master at SUSE : marking SUSE:-1 (0.3) as bad
+++ Reason: undefined message in TProof::CollectInputFrom(…)

+++ Message from master at SUSE : marking SUSE:-1 (0.3) as bad
+++ Reason: undefined message in TProof::CollectInputFrom(…)

+++ Most likely your code crashed
+++ Please check the session logs for error messages either using
+++ the ‘Show logs’ button or executing
+++
+++ root [] TProof::Mgr(“SUSE”)->GetSessionLogs()->Display("*")
+++ Message from master at SUSE : marking SUSE:-1 (0.3) as bad
+++ Reason: undefined message in TProof::CollectInputFrom(…)

+++ Most likely your code crashed
+++ Please check the session logs for error messages either using
+++ the ‘Show logs’ button or executing
+++
+++ root [] TProof::Mgr(“SUSE”)->GetSessionLogs()->Display("*")

Error in TPacketizerAdaptive::SplitPerHost: The input list contains no elements
Info in TPacketizerAdaptive::InitStats: fraction of remote files 0.000000
0.0: caught exception triggered by signal ‘1’ -1
Info in TProofLite::MarkBad:
+++ Message from master at SUSE : marking SUSE:-1 (0.0) as bad
+++ Reason: undefined message in TProof::CollectInputFrom(…)

+++ Message from master at SUSE : marking SUSE:-1 (0.0) as bad
+++ Reason: undefined message in TProof::CollectInputFrom(…)

+++ Most likely your code crashed
+++ Please check the session logs for error messages either using
+++ the ‘Show logs’ button or executing
+++
+++ root [] TProof::Mgr(“SUSE”)->GetSessionLogs()->Display("*")

Error in TPacketizerAdaptive::SplitPerHost: The input list contains no elements
Info in TPacketizerAdaptive::InitStats: fraction of remote files 0.000000
0.1: caught exception triggered by signal ‘1’ -1
Info in TProofLite::MarkBad:
+++ Message from master at SUSE : marking SUSE:-1 (0.1) as bad
+++ Reason: undefined message in TProof::CollectInputFrom(…)

+++ Message from master at SUSE : marking SUSE:-1 (0.1) as bad
+++ Reason: undefined message in TProof::CollectInputFrom(…)

+++ Most likely your code crashed
+++ Please check the session logs for error messages either using
+++ the ‘Show logs’ button or executing
+++
+++ root [] TProof::Mgr(“SUSE”)->GetSessionLogs()->Display("*")

Error in TPacketizerAdaptive::SplitPerHost: The input list contains no elements
Info in TPacketizerAdaptive::InitStats: fraction of remote files 0.000000
0.2: caught exception triggered by signal ‘1’ -1
Info in TProofLite::MarkBad:
+++ Message from master at SUSE : marking SUSE:-1 (0.2) as bad
+++ Reason: undefined message in TProof::CollectInputFrom(…)

+++ Message from master at SUSE : marking SUSE:-1 (0.2) as bad
+++ Reason: undefined message in TProof::CollectInputFrom(…)

+++ Most likely your code crashed
+++ Please check the session logs for error messages either using
+++ the ‘Show logs’ button or executing
+++
+++ root [] TProof::Mgr(“SUSE”)->GetSessionLogs()->Display("*")

Error in TPacketizerAdaptive::SplitPerHost: The input list contains no elements
Info in TPacketizerAdaptive::InitStats: fraction of remote files 0.000000
Info in TSelector::Terminate: not ok
Lite-0: all output objects have been merged[/code]

Regards,
Johannes

Hi,

I think the problem comes from the fact that ProofFirst is not known remotely.
Can you try by loading it first:

$ root
TProof *p = TProof::Open("lite://");
p->Load("ProofFirst.C");  // Loads also locally
TChain* chain = new TChain("photonTree");
chain->Add(rootFile);
chain->SetProof();
ProofFirst* pf = new ProofFirst();
chain->Process(pf);

G. Ganis

Hi,

thanks for your answers so far, but this still results in “not ok”.
Also, this would again require the “root”-way of macro loading, but my question is if I can do this in “pure C++”.
If I am comping and linking everything into one executable, everything should be known remotely in my understanding. This of course might be wrong, therefore my question if proof is designed to work this way at all.

Regards,
Johannes

Hi,

The worker processes, 1 per worker, are separated processes which are not the executable that your building as main in standalone. You need to setup the environment of the worker processes and load the required libraries. For that you need to provide the additional code (wrt bare ROOT) as separate library or source files.
If for some reason you cannot do this, then PROOF cannot be used for your problem.

G. Ganis

Ok, that answers my question. Thanks for clarification!

Best regards,
Johannes

Hi,
sorry if I am uploading an old post. Where you able to find a solution to this problem? I am facing an issue that seems exactly as this, i.e. I am using Proof to process a TChain via a TSelector-derived class, and it seems that, on slaves,

SlaveBegin()
Process()
SlaveEnd()

methods are not called

Hi,
no, as stated above, my problem was is not solvable.
If you are trying to compile a standalone application without loading code via root, the cause of your problems will be the same.

Best regards,
Johannes

Hi,
I found an interesting “work-around”. I do not call this a “solution”, since I am not using the method

However, I do not have to compile anything on the workers via AClic. I created a TSelector from the TTree I want to analyze, in Root via TTree->MakeSelector(“name”).

Then, I modified it for my analysis, and compiled it in a shared library (together with its dictionary)

The code I am using in my main program to use this selector is:

//Create the TChain 
TChain *ch=new TChain("TreeName");
ch->Add("MyRootFile.root");

//Open proof
TProof::Open();
gProof->Exec("gSystem->Load(\"libCintex\")");
gProof->Exec("ROOT::Cintex::Cintex::Enable()");
gProof->Exec("gSystem->Load(\"my_path/myLibrary.so\")");

//Process
ch->Process("NameOfMySelectorClass");

This works. I am still NOT able to use the ch->Process(void *selector) method.