ROOT  6.06/09
Reference Guide
TProofBench.cxx
Go to the documentation of this file.
1 // @(#)root/proof:$Id$
2 // Author: G.Ganis, S.Ryu Feb 2011
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TProofBench //
15 // //
16 // Steering class for PROOF benchmarks //
17 // //
18 //////////////////////////////////////////////////////////////////////////
19 
20 #include "RConfigure.h"
21 
22 #include "TProofBench.h"
23 #include "Getline.h"
24 #include "TProofBenchRunCPU.h"
25 #include "TProofBenchRunDataRead.h"
26 #include "TProofBenchDataSet.h"
27 #include "TProofNodes.h"
28 #include "TClass.h"
29 #include "TFile.h"
30 #include "TFileCollection.h"
31 #include "TFileInfo.h"
32 #include "THashList.h"
33 #include "TKey.h"
34 #include "TObjString.h"
35 #include "TProof.h"
36 #include "TROOT.h"
37 #include "TSortedList.h"
38 #include "TTimeStamp.h"
39 #include "TUrl.h"
40 
41 #include "TCanvas.h"
42 #include "TF1.h"
43 #include "TGraphErrors.h"
44 #include "TH1F.h"
45 #include "TMath.h"
46 #include "TProfile.h"
47 #include "TStyle.h"
48 #include "TLegend.h"
49 #ifdef WIN32
50 #include <io.h>
51 #endif
52 
54 
55 // Functions for fitting
56 
57 TF1 *TProofBench::fgFp1 = 0;
58 TF1 *TProofBench::fgFp1n = 0;
59 TF1 *TProofBench::fgFp2 = 0;
60 TF1 *TProofBench::fgFp2n = 0;
61 TF1 *TProofBench::fgFp3 = 0;
62 TF1 *TProofBench::fgFp3n = 0;
63 TF1 *TProofBench::fgFio = 0;
64 TF1 *TProofBench::fgFioV = 0;
65 static Int_t gFioVn0 = -1; // Number of real cores for fgFioV
66 static Int_t gFioVn1 = -1; // Number of real+hyper cores for fgFioV
67 
68 TList *TProofBench::fgGraphs = new TList;
69 
70 ////////////////////////////////////////////////////////////////////////////////
71 /// Simple polynomial 1st degree
72 
74 {
75  Double_t res = par[0] + par[1] * xx[0];
76  return res;
77 }
78 
79 ////////////////////////////////////////////////////////////////////////////////
80 /// Simple polynomial 2nd degree
81 
83 {
84  Double_t res = par[0] + par[1] * xx[0] + par[2] * xx[0] * xx[0];
85  return res;
86 }
87 
88 ////////////////////////////////////////////////////////////////////////////////
89 /// Normalized 1st degree
90 
92 {
93  Double_t res = par[0] / xx[0] + par[1];
94  return res;
95 }
96 
97 ////////////////////////////////////////////////////////////////////////////////
98 /// Normalized 2nd degree
99 
101 {
102  Double_t res = par[0] / xx[0] + par[1] + par[2] * xx[0];
103  return res;
104 }
105 
106 ////////////////////////////////////////////////////////////////////////////////
107 /// I/O saturated rate function
108 
110 {
111  Double_t sat = par[0] / par[1] * (xx[0] * par[1] / par[2] - 1.);
112  if (xx[0] < par[2] / par[1]) sat = 0.;
113  Double_t res = par[0] * xx[0] / (1. + sat);
114  return res;
115 }
116 
117 ////////////////////////////////////////////////////////////////////////////////
118 /// I/O saturated rate function with varying Rcpu
119 
121 {
122  // par[0] = rio
123  // par[1] = b1
124  // par[2] = b2
125  // par[3] = nc
126  // par[4] = ri
127 
128  Double_t rio = par[0] / par[3] * xx[0];
129  if (xx[0] > par[3]) rio = par[0];
130 
131  Double_t rcpu = par[1] * xx[0];
132  if (xx[0] > gFioVn0) rcpu = par[1]*gFioVn0 + par[2]*(xx[0] - gFioVn0);
133  if (xx[0] > gFioVn1) rcpu = par[1]*gFioVn0 + par[2]*(gFioVn1 - gFioVn0);
134 
135  Double_t res = 1. / (1./par[4] + 1./rio + 1./rcpu);
136 
137  return res;
138 }
139 
140 ////////////////////////////////////////////////////////////////////////////////
141 /// Function with varying Rcpu
142 
144 {
145  // par[0] = offset
146  // par[1] = rate contribution from real cores
147  // par[2] = rate contribution from hyper cores
148 
149  Double_t n = (xx[0] - par[0]);
150  Double_t rcpu = par[1] * n;
151  if (xx[0] > gFioVn0) rcpu = par[1]*gFioVn0 + par[2]*(n - gFioVn0);
152  if (xx[0] > gFioVn1) rcpu = par[1]*gFioVn0 + par[2]*(gFioVn1 - gFioVn0);
153 
154  return rcpu;
155 }
156 
157 ////////////////////////////////////////////////////////////////////////////////
158 /// Function with varying Rcpu normalized
159 
161 {
162  // par[0] = offset
163  // par[1] = rate contribution from real cores
164  // par[2] = rate contribution from hyper cores
165 
166  Double_t n = (xx[0] - par[0]);
167  Double_t rcpu = par[1] * n;
168  if (xx[0] > gFioVn0) rcpu = par[1]*gFioVn0 + par[2]*(n - gFioVn0);
169  if (xx[0] > gFioVn1) rcpu = par[1]*gFioVn0 + par[2]*(gFioVn1 - gFioVn0);
170 
171  return rcpu / xx[0];
172 }
173 
174 ////////////////////////////////////////////////////////////////////////////////
175 /// Constructor: check PROOF and load selectors PAR
176 
177 TProofBench::TProofBench(const char *url, const char *outfile, const char *proofopt)
178  : fUnlinkOutfile(kFALSE), fProofDS(0), fOutFile(0),
179  fNtries(4), fHistType(0), fNHist(16), fReadType(0),
180  fDataSet("BenchDataSet"), fNFilesWrk(2), fReleaseCache(kTRUE),
181  fDataGenSel(kPROOF_BenchSelDataGenDef),
182  fRunCPU(0), fRunDS(0), fDS(0), fDebug(kFALSE), fDescription(0)
183 {
185  if (!url) {
186  Error("TProofBench", "specifying a PROOF master url is mandatory - cannot continue");
187  return;
188  }
189  if (!(fProof = TProof::Open(url, proofopt)) || (fProof && !fProof->IsValid())) {
190  Error("TProofBench", "could not open a valid PROOF session - cannot continue");
191  return;
192  }
193  // Get the size of the cluster
196  // It must be passed as PROOF option 'workers=N' and recorded in the envs vars
197  TNamed *n = (TNamed *) TProof::GetEnvVars()->FindObject("PROOF_NWORKERS");
198  if (!n) {
199  Error("TProofBench", "dynamic mode: you must specify the max number of workers");
200  fProof->Close();
202  return;
203  }
204  TString sn(n->GetTitle());
205  if (sn.IsDigit()) fNumWrkMax = sn.Atoi();
206  if (!sn.IsDigit()) {
207  Error("TProofBench", "dynamic mode: wrong specification of the max number of"
208  " workers ('%s')", n->GetTitle());
209  fProof->Close();
211  return;
212  }
213  }
214  if (fNumWrkMax <= 0) {
215  Error("TProofBench", "wrong max number of workers ('%d')", fNumWrkMax);
216  fProof->Close();
218  return;
219  }
220  // By default we use the same instance for dataset actions
221  fProofDS = fProof;
222  // The object is now valid
224  // Identifying string
225  TUrl u(url);
226  TString host(TString::Format("PROOF at %s", u.GetHost()));
227  if (!strcmp(u.GetProtocol(), "lite")) host.Form("PROOF-Lite on %s", gSystem->HostName());
228  fDescription = new TNamed("PB_description",
229  TString::Format("%s, %d workers", host.Data(), fNumWrkMax).Data());
230  Printf(" Run description: %s", fDescription->GetTitle());
231  // Set output file
232  if (SetOutFile(outfile, kFALSE) != 0)
233  Warning("TProofBench", "problems opening '%s' - ignoring: use SetOutFile to try"
234  " again or with another file", outfile);
235 }
236 
237 ////////////////////////////////////////////////////////////////////////////////
238 /// Destructor
239 
241 {
242  CloseOutFile();
248 }
249 
250 ////////////////////////////////////////////////////////////////////////////////
251 /// Set the otuput file
252 /// Return 0 on success, -1 on error
253 
255 {
256  // Remove any bad file
258 
259  Int_t rc = 0;
260  if (!fOutFile && fOutFileName.Length() > 0) {
261  const char *mode = 0;
262  if (wrt)
263  mode = gSystem->AccessPathName(fOutFileName) ? "RECREATE" : "UPDATE";
264  else
265  mode = "READ";
266  if (!(fOutFile = TFile::Open(fOutFileName, mode)) || (fOutFile && fOutFile->IsZombie())) {
267  if (verbose)
268  Warning("OpenOutFile", "problems opening '%s' - ignoring: use SetOutFile to try"
269  " again or with another file", fOutFileName.Data());
270  rc = -1;
271  }
272  if (fOutFile) {
273  gROOT->GetListOfFiles()->Remove(fOutFile);
274  if (!strcmp(mode, "RECREATE")) {
275  // Save the description string
276  fOutFile->cd();
277  fDescription->Write();
278  }
279  }
280  }
281  return rc;
282 }
283 
284 ////////////////////////////////////////////////////////////////////////////////
285 /// Set the output file
286 /// Return 0 on success, -1 on error
287 
289 {
290  Int_t rc = 0;
291  // Close existing file, if any
292  if (fOutFile) {
293  if (!fOutFile->IsZombie()) fOutFile->Close();
295  }
296 
297  fOutFileName = outfile;
298  if (fOutFileName == "<default>") {
299  // Default output file: proofbench-<master>-<DayMonthYear-hhmm>.root
300  TDatime dat;
301  const char *lite = (fProof->IsLite()) ? "-lite" : "";
302  fOutFileName.Form("proofbench-%s%s-%dw-%d-%.2d%.2d.root",
303  fProof->GetMaster(), lite, fNumWrkMax,
304  dat.GetDate(), dat.GetHour(), dat.GetMinute());
305  Info("SetOutFile", "using default output file: '%s'", fOutFileName.Data());
307  }
308  if (!fOutFileName.IsNull()) {
309  if ((rc = OpenOutFile(kTRUE, kFALSE)) != 0 && verbose)
310  Warning("SetOutFile", "problems opening '%s' - ignoring: use SetOutFile to try"
311  " again or with another file", outfile);
312  }
313  return rc;
314 }
315 
316 ////////////////////////////////////////////////////////////////////////////////
317 /// Close output file
318 
320 {
321  if (SetOutFile(0) != 0)
322  Warning("CloseOutFile", "problems closing '%s'", fOutFileName.Data());
323 }
324 
325 ////////////////////////////////////////////////////////////////////////////////
326 /// Perform the CPU run
327 /// Return 0 on success, -1 on error
328 
329 Int_t TProofBench::RunCPU(Long64_t nevents, Int_t start, Int_t stop, Int_t step)
330 {
331  // Open the file for the results
332  if (OpenOutFile(kTRUE) != 0) {
333  Error("RunCPU", "problems opening '%s' to save the result", fOutFileName.Data());
334  return -1;
335  }
337 
339  TPBHistType *htype = new TPBHistType(TPBHistType::kHist1D); // Owned by the input list
340  fRunCPU = new TProofBenchRunCPU(htype, fNHist, fOutFile);
344  fRunCPU->Run(nevents, start, stop, step, fNtries, fDebug, -1);
345 
346  // Close the file
347  if (SetOutFile(0) != 0)
348  Warning("RunCPU", "problems closing '%s'", fOutFileName.Data());
349 
350  // Done
351  return 0;
352 }
353 
354 ////////////////////////////////////////////////////////////////////////////////
355 /// Perform the CPU run scanning over the number of workers per node
356 /// Return 0 on success, -1 on error
357 
359 {
360  // Open the file for the results
361  if (OpenOutFile(kTRUE) != 0) {
362  Error("RunCPUx", "problems opening '%s' to save the result", fOutFileName.Data());
363  return -1;
364  }
366 
368  TPBHistType *htype = new TPBHistType(TPBHistType::kHist1D); // Owned by the input list
369  fRunCPU = new TProofBenchRunCPU(htype, fNHist, fOutFile);
373  fRunCPU->Run(nevents, start, stop, -2, fNtries, fDebug, -1);
374 
375  // Close the file
376  if (SetOutFile(0) != 0)
377  Warning("RunCPUx", "problems closing '%s'", fOutFileName.Data());
378 
379  // Done
380  return 0;
381 }
382 
383 ////////////////////////////////////////////////////////////////////////////////
384 /// Draw the CPU speedup plot.
385 /// opt = 'typewhat', e.g. 'std:max:'
386 /// type = 'std:' draw standard evt/s plot
387 /// 'stdx:' draw standard evt/s plot, 1 worker per node
388 /// 'norm:' draw normalized plot
389 /// 'normx:' draw normalized plot, 1 worker per node
390 /// what = 'max:' draw max rate
391 /// 'avg:' draw average rate
392 /// 'all:' draw max and average rate on same plot (default)
393 /// dofit = 0 no fit
394 /// 1 fit with the relevant '1st degree related' function
395 /// 2 fit with the relevant '2nd degree related' function
396 /// 3 fit with varying rcpu function
397 /// n0 = for dofit == 3, number of real cores
398 /// n1 = for dofit == 3, number of total cores (real + hyperthreaded)
399 ///
400 
401 void TProofBench::DrawCPU(const char *outfile, const char *opt, Bool_t verbose,
402  Int_t dofit, Int_t n0, Int_t n1)
403 {
404  // Get the TProfile an create the graphs
405  TFile *fout = TFile::Open(outfile, "READ");
406  if (!fout || (fout && fout->IsZombie())) {
407  ::Error("DrawCPU", "could not open file '%s' ...", outfile);
408  return;
409  }
410 
411  // Get description
412  TString description("<not available>");
413  TNamed *nmdesc = (TNamed *) fout->Get("PB_description");
414  if (nmdesc) description = nmdesc->GetTitle();
415 
416  // Parse option
417  TString oo(opt);
418  Bool_t isNorm = (oo.Contains("norm")) ? kTRUE : kFALSE;
419  Bool_t isX = (oo.Contains("stdx:") || oo.Contains("normx:")) ? kTRUE : kFALSE;
420  Bool_t doAvg = kTRUE, doMax = kTRUE;
421  if (oo.Contains("avg:")) doMax = kFALSE;
422  if (oo.Contains("max:")) doAvg = kFALSE;
423 
424  const char *dirn = (isX) ? "RunCPUx" : "RunCPU";
425  TDirectory *d = (TDirectory *) fout->Get(dirn);
426  if (!d) {
427  ::Error("DrawCPU", "could not find directory '%s' ...", dirn);
428  fout->Close();
429  delete fout;
430  return;
431  }
432  d->cd();
433 
434  TString hprofn, hmaxn;
435  const char *lx = (isX) ? "_x" : "";
436  const char *ln = (isNorm) ? "Norm" : "Prof";
437  hprofn.Form("%s%s_CPU_QR_Evts", ln, lx);
438  hmaxn.Form("%s%s_CPU_PS_MaxEvts", ln, lx);
439 
440  Double_t xmin = -1., xmax = -1.;
441  Double_t ami = -1., amx = -1., mmi = -1., mmx = -1.;
442  Int_t kamx = -1, kmmx = -1, nbins = -1;
443  Double_t ymx = -1., ymi = -1.;
444 
445  TProfile *pfav = 0;
446  TGraphErrors *grav = 0;
447  if (doAvg) {
448  if (!(grav = GetGraph(d, hprofn, nbins, xmin, xmax, ami, amx, kamx, pfav))) {
449  ::Error("DrawCPU", "could not find '%s' ...", hprofn.Data());
450  fout->Close();
451  delete fout;
452  return;
453  }
454  ymx = amx;
455  ymi = ami;
456  }
457  TProfile *pfmx = 0;
458  TGraphErrors *grmx = 0;
459  if (doMax) {
460  if (!(grmx = GetGraph(d, hmaxn, nbins, xmin, xmax, mmi, mmx, kmmx, pfmx))) {
461  ::Warning("DrawCPU", "could not find '%s': feature added in 5.34/11", hmaxn.Data());
462  if (!grav) {
463  // Nothing to do if not asked for the average
464  fout->Close();
465  delete fout;
466  return;
467  }
468  doMax = kFALSE;
469  }
470  if (mmx > ymx) ymx = mmx;
471  if ((ymi > 0 && mmi < ymi) || (ymi < 0.)) ymi = mmi;
472  }
473 
474  TProfile *pf = (doMax) ? pfmx : pfav;
475  Int_t kmx = (doMax) ? kmmx : kamx;
476 
477  // Create the canvas
478  TCanvas *cpu = new TCanvas("cpu", "Rate vs wrks",204,69,1050,502);
479  cpu->Range(-3.106332,0.7490716,28.1362,1.249867);
480 
481  TH1F *hgr = new TH1F("Graph-CPU"," CPU speed-up", nbins*4, xmin, xmax);
482  hgr->SetMaximum(ymx + (ymx-ymi)*0.2);
483  hgr->SetMinimum(0);
484  if (isNorm) hgr->SetMaximum(ymx*1.2);
485  hgr->SetDirectory(0);
486  hgr->SetStats(0);
487  hgr->GetXaxis()->SetTitle(pf->GetXaxis()->GetTitle());
488  hgr->GetXaxis()->CenterTitle(true);
489  hgr->GetXaxis()->SetLabelSize(0.05);
490  hgr->GetXaxis()->SetTitleSize(0.06);
491  hgr->GetXaxis()->SetTitleOffset(0.62);
492  hgr->GetYaxis()->SetTitleSize(0.08);
493  hgr->GetYaxis()->SetTitleOffset(0.52);
494  hgr->GetYaxis()->SetTitle("Rate (events/s)");
495 
496  TLegend *leg = 0;
497  if (isNorm) {
498  leg = new TLegend(0.7, 0.8, 0.9, 0.9);
499  } else {
500  leg = new TLegend(0.1, 0.8, 0.3, 0.9);
501  }
502 
503  gStyle->SetOptTitle(0);
504  if (doAvg) {
505  grav->SetFillColor(1);
506  grav->SetLineColor(13);
507  grav->SetMarkerColor(4);
508  grav->SetMarkerStyle(21);
509  grav->SetMarkerSize(1.2);
510  grav->SetHistogram(hgr);
511 
512  if (verbose) grav->Print();
513  grav->Draw("alp");
514  leg->AddEntry(grav, "Average", "P");
515  }
516  if (doMax) {
517  grmx->SetFillColor(1);
518  grmx->SetLineColor(13);
519  grmx->SetMarkerColor(2);
520  grmx->SetMarkerStyle(29);
521  grmx->SetMarkerSize(1.8);
522  grmx->SetHistogram(hgr);
523 
524  if (verbose) grmx->Print();
525  if (doAvg) {
526  grmx->Draw("lpSAME");
527  } else {
528  grmx->Draw("alp");
529  }
530  leg->AddEntry(grmx, "Maximum", "P");
531  }
532  leg->Draw();
533  gPad->Update();
534 
535  if (dofit > 0) {
536  TGraphErrors *gr = (doMax) ? grmx : grav;
537  // Make sure the fitting functions are defined
538  Double_t xmi = 0.9;
539  if (nbins > 5) xmi = 1.5;
540  AssertFittingFun(xmi, nbins + .1);
541 
542  // Starting point for the parameters and fit
543  Double_t normrate = -1.;
544  if (dofit == 1) {
545  if (isNorm) {
546  fgFp1n->SetParameter(0, pf->GetBinContent(1));
548  gr->Fit(fgFp1n);
549  if (verbose) fgFp1n->Print();
550  normrate = fgFp1n->GetParameter(1);
551  } else {
552  fgFp1->SetParameter(0, 0.);
553  fgFp1->SetParameter(1, pf->GetBinContent(1));
554  gr->Fit(fgFp1);
555  if (verbose) fgFp1->Print();
556  normrate = fgFp1->Derivative(1.);
557  }
558  } else if (dofit == 2) {
559  if (isNorm) {
560  fgFp2n->SetParameter(0, pf->GetBinContent(1));
562  fgFp2n->SetParameter(2, 0.);
563  gr->Fit(fgFp2n);
564  if (verbose) fgFp2n->Print();
565  normrate = fgFp2n->GetParameter(1);
566  } else {
567  fgFp2->SetParameter(0, 0.);
568  fgFp2->SetParameter(1, pf->GetBinContent(1));
569  fgFp2->SetParameter(2, 0.);
570  gr->Fit(fgFp2);
571  if (verbose) fgFp2->Print();
572  normrate = fgFp2->Derivative(1.);
573  }
574  } else {
575  // Starting point for the parameters and fit
576  gFioVn0 = (n0 > 0) ? n0 : (Int_t) (nbins + .1)/2.;
577  gFioVn1 = (n1 > 0) ? n1 : (Int_t) (nbins + .1);
578  if (isNorm) {
579  fgFp3n->SetParameter(0, 0.);
580  fgFp3n->SetParameter(1, pf->GetBinContent(1));
582  gr->Fit(fgFp3n);
583  if (verbose) fgFp3n->Print();
584  normrate = pf->GetBinContent(1);
585  } else {
586  fgFp3->SetParameter(0, 0.);
587  fgFp3->SetParameter(1, 0.);
588  fgFp3->SetParameter(2, pf->GetBinContent(1));
589  gr->Fit(fgFp3);
590  if (verbose) fgFp3->Print();
591  normrate = fgFp3->Derivative(1.);
592  }
593  }
594 
595  // Notify the cluster performance parameters
596  if (!isNorm) {
597  printf("* ************************************************************ *\n");
598  printf("* *\r");
599  printf("* Cluster: %s\n", description.Data());
600  printf("* Performance measurement from scalability plot: *\n");
601  printf("* *\r");
602  printf("* rate max: %.3f\tmegaRNGPS (@ %d workers)\n", ymx/1000000, kmx);
603  printf("* *\r");
604  printf("* per-worker rate: %.3f\tmegaRNGPS \n", normrate/1000000);
605  printf("* ************************************************************ *\n");
606  } else {
607  printf("* ************************************************************ *\n");
608  printf("* *\r");
609  printf("* Cluster: %s\n", description.Data());
610  printf("* *\r");
611  printf("* Per-worker rate from normalized plot: %.3f\tmegaRNGPS\n", normrate/1000000);
612  printf("* ************************************************************ *\n");
613  }
614  }
615  // Close the file
616  fout->Close();
617  if (grav) fgGraphs->Add(grav);
618  if (grmx) fgGraphs->Add(grmx);
619 }
620 
621 ////////////////////////////////////////////////////////////////////////////////
622 /// Get from TDirectory 'd' the TProfile named 'pfn' and create the graph.
623 /// Return also the max y in mx.
624 
626  Double_t &xmi, Double_t &xmx,
627  Double_t &ymi, Double_t &ymx, Int_t &kmx, TProfile *&pf)
628 {
629  // Sanity checks
630  if (!d || !pfn || (pfn && strlen(pfn) <= 0)) {
631  ::Error("TProofBench::GetGraph", "directory or name not defined!");
632  return (TGraphErrors *)0;
633  }
634 
635  TList *keylist = d->GetListOfKeys();
636  TKey *key = 0;
637  TIter nxk(keylist);
638  while ((key = (TKey *) nxk())) {
639  if (TString(key->GetName()).BeginsWith(pfn)) {
640  pf = (TProfile *) d->Get(key->GetName());
641  break;
642  }
643  }
644  // Sanity checks
645  if (!pf) {
646  ::Error("TProofBench::GetGraph", "TProfile for '%s' not found in directory '%s'", pfn, d->GetName());
647  return (TGraphErrors *)0;
648  }
649 
650  nb = pf->GetNbinsX();
651  TGraphErrors *gr = new TGraphErrors(nb);
652  gr->SetName(TString::Format("Graph_%s", pfn));
653  Double_t xx, ex, yy, ey;
654  ymi = pf->GetBinContent(1);
655  ymx = ymi;
656  xmi = pf->GetBinCenter(1) - pf->GetBinWidth(1)/2. ;
657  xmx = pf->GetBinCenter(nb) + pf->GetBinWidth(nb)/2. ;
658  kmx = -1;
659  for (Int_t k = 1;k <= nb; k++) {
660  xx = pf->GetBinCenter(k);
661  ex = pf->GetBinWidth(k) * .001;
662  yy = pf->GetBinContent(k);
663  ey = pf->GetBinError(k);
664  if (k == 1) {
665  ymi = yy;
666  ymx = yy;
667  kmx = k;
668  } else {
669  if (yy < ymi) ymi = yy;
670  if (yy > ymx) { ymx = yy; kmx = k; }
671  }
672  gr->SetPoint(k-1, xx, yy);
673  gr->SetPointError(k-1, ex, ey);
674  }
675 
676  // Done
677  return gr;
678 }
679 
680 ////////////////////////////////////////////////////////////////////////////////
681 /// Make sure that the fitting functions are defined
682 
684 {
685  if (!fgFp1) {
686  fgFp1 = new TF1("funp1", funp1, mi, mx, 2);
687  fgFp1->SetParNames("offset", "slope");
688  }
689 
690  if (!fgFp1n) {
691  fgFp1n = new TF1("funp1n", funp1n, mi, mx, 2);
692  fgFp1n->SetParNames("decay", "norm rate");
693  }
694 
695  if (!fgFp2) {
696  fgFp2 = new TF1("funp2", funp2, mi, mx, 3);
697  fgFp2->SetParNames("offset", "slope", "deviation");
698  }
699 
700  if (!fgFp2n) {
701  fgFp2n = new TF1("funp2n", funp2n, mi, mx, 3);
702  fgFp2n->SetParNames("decay", "norm rate", "deviation");
703  }
704 
705  if (!fgFp3) {
706  fgFp3 = new TF1("funcpuv", funcpuv, mi, mx, 3);
707  fgFp3->SetParNames("offset", "slope real", "slope hyper");
708  }
709 
710  if (!fgFp3n) {
711  fgFp3n = new TF1("funcpuvn", funcpuvn, mi, mx, 3);
712  fgFp3n->SetParNames("offset", "slope real", "slope hyper");
713  }
714 
715  if (!fgFio) {
716  fgFio = new TF1("funio", funio, mi, mx, 3);
717  fgFio->SetParNames("R1", "RIO", "TotIO");
718  }
719  if (!fgFioV) {
720  fgFioV = new TF1("funiov", funiov, mi, mx, 5);
721  fgFioV->SetParNames("rio", "b1", "b2", "nc", "ri");
722  }
723 
724 }
725 
726 ////////////////////////////////////////////////////////////////////////////////
727 
728 class fileDesc : public TNamed {
729 public:
730  Long_t fMtime; // Modification time
731  TString fDesc; // Test description string, if any
732  fileDesc(const char *n, const char *o,
733  Long_t t, const char *d) : TNamed(n, o), fMtime(t), fDesc(d) { }
734  Int_t Compare(const TObject *o) const {
735  const fileDesc *fd = static_cast<const fileDesc *>(o);
736  if (!fd || (fd && fd->fMtime == fMtime)) return 0;
737  if (fMtime < fd->fMtime) return -1;
738  return 1;
739  }
740 };
741 
742 ////////////////////////////////////////////////////////////////////////////////
743 /// Get performance specs. Check file 'path', or files in directory 'path'
744 /// (default current directory).
745 /// The degree of the polynomial used for the fit is 'degfit' (default 1).
746 
747 void TProofBench::GetPerfSpecs(const char *path, Int_t degfit)
748 {
749  // Locate the file (ask if many)
750  TString pp(path), fn, oo;
751  if (pp.IsNull()) pp = gSystem->WorkingDirectory();
752  FileStat_t st;
753  if (gSystem->GetPathInfo(pp.Data(), st) != 0) {
754  ::Error("TProofBench::GetPerfSpecs", "path '%s' could not be stat'ed - abort", pp.Data());
755  return;
756  }
757  TSortedList filels;
758  if (R_ISDIR(st.fMode)) {
759  // Scan the directory
760  void *dirp = gSystem->OpenDirectory(pp.Data());
761  if (!dirp) {
762  ::Error("TProofBench::GetPerfSpecs", "directory path '%s' could nto be open - abort", pp.Data());
763  return;
764  }
765  const char *ent = 0;
766  while ((ent = gSystem->GetDirEntry(dirp))) {
767  if (!strcmp(ent, ".") || !strcmp(ent, "..")) continue;
768  fn.Form("%s/%s", pp.Data(), ent);
769  if (gSystem->GetPathInfo(fn.Data(), st) != 0) continue;
770  if (!R_ISREG(st.fMode)) continue;
771  fn += "?filetype=raw";
772  TFile *f = TFile::Open(fn);
773  if (!f) continue;
774  char rr[5] = {0};
775  if (!f->ReadBuffer(rr, 4)) {
776  if (!strncmp(rr, "root", 4)) {
777  SafeDelete(f);
778  fn.ReplaceAll("?filetype=raw", "");
779  if ((f = TFile::Open(fn))) {
780  TString desc("<no decription>");
781  TNamed *nmdesc = (TNamed *) f->Get("PB_description");
782  if (nmdesc) desc = nmdesc->GetTitle();
783  if (f->GetListOfKeys()->FindObject("RunCPU"))
784  filels.Add(new fileDesc(fn, "std:", st.fMtime, desc.Data()));
785  if (f->GetListOfKeys()->FindObject("RunCPUx"))
786  filels.Add(new fileDesc(fn, "stdx:", st.fMtime, desc.Data()));
787  } else {
788  ::Warning("TProofBench::GetPerfSpecs", "problems opening '%s'", fn.Data());
789  }
790  }
791  }
792  SafeDelete(f);
793  }
794  } else if (!R_ISREG(st.fMode)) {
795  ::Error("TProofBench::GetPerfSpecs",
796  "path '%s' not a regular file nor a directory - abort", pp.Data());
797  return;
798  } else {
799  // This is the file
800  fn = pp;
801  // Check it
802  TString emsg;
803  Bool_t isOk = kFALSE;
804  if (gSystem->GetPathInfo(fn.Data(), st) == 0) {
805  fn += "?filetype=raw";
806  TFile *f = TFile::Open(fn);
807  if (f) {
808  char rr[5] = {0};
809  if (!(f->ReadBuffer(rr, 4))) {
810  if (!strncmp(rr, "root", 4)) {
811  fn.ReplaceAll("?filetype=raw", "");
812  if ((f = TFile::Open(fn))) {
813  if (f->GetListOfKeys()->FindObject("RunCPU")) oo = "std:";
814  if (f->GetListOfKeys()->FindObject("RunCPUx")) oo = "stdx:";
815  SafeDelete(f);
816  if (!oo.IsNull()) {
817  isOk = kTRUE;
818  } else {
819  emsg.Form("path '%s' does not contain the relevant dirs - abort", fn.Data());
820  }
821  } else {
822  emsg.Form("path '%s' cannot be open - abort", fn.Data());
823  }
824  } else {
825  emsg.Form("'%s' is not a ROOT file - abort", fn.Data());
826  }
827  } else {
828  emsg.Form("could not read first 4 bytes from '%s' - abort", fn.Data());
829  }
830  SafeDelete(f);
831  } else {
832  emsg.Form("path '%s' cannot be open in raw mode - abort", fn.Data());
833  }
834  } else {
835  emsg.Form("path '%s' cannot be stated - abort", fn.Data());
836  }
837  if (!isOk) {
838  ::Error("TProofBench::GetPerfSpecs", "%s", emsg.Data());
839  return;
840  }
841  }
842 
843  fileDesc *nm = 0;
844  // Ask the user, if more then 1
845  if (filels.GetSize() == 1) {
846  nm = (fileDesc *) filels.First();
847  fn = nm->GetName();
848  oo = nm->GetTitle();
849  } else if (filels.GetSize() > 1) {
850  TIter nxf(&filels);
851  Int_t idx = 0;
852  Printf("Several possible files found:");
853  while ((nm = (fileDesc *) nxf())) {
854  Printf(" %d\t%s\t%s\t%s (file: %s)", idx++, nm->GetTitle(),
855  TTimeStamp(nm->fMtime).AsString("s"), nm->fDesc.Data(), nm->GetName());
856  }
857  TString a(Getline(TString::Format("Make your choice [%d] ", idx-1)));
858  if (a.IsNull() || a[0] == '\n') a.Form("%d", idx-1);
859  idx = a.Atoi();
860  if ((nm = (fileDesc *) filels.At(idx))) {
861  fn = nm->GetName();
862  oo = nm->GetTitle();
863  } else {
864  ::Error("TProofBench::GetPerfSpecs", "chosen index '%d' does not exist - abort", idx);
865  return;
866  }
867  } else {
868  if (fn.IsNull()) {
869  ::Error("TProofBench::GetPerfSpecs",
870  "path '%s' is a directory but no ROOT file found in it - abort", pp.Data());
871  return;
872  }
873  }
874 
875  // Now get the specs
876  TProofBench::DrawCPU(fn.Data(), oo.Data(), kFALSE, degfit);
877 }
878 
879 ////////////////////////////////////////////////////////////////////////////////
880 /// Perform a test using dataset 'dset'
881 /// Return 0 on success, -1 on error
882 /// Open the file for the results
883 
885  Int_t start, Int_t stop, Int_t step)
886 {
887  if (OpenOutFile(kTRUE) != 0) {
888  Error("RunDataSet", "problems opening '%s' to save the result", fOutFileName.Data());
889  return -1;
890  }
892 
893  if (fReleaseCache) ReleaseCache(dset);
895  TPBReadType *readType = fReadType;
896  if (!readType) readType = new TPBReadType(TPBReadType::kReadOpt);
897  fRunDS = new TProofBenchRunDataRead(fDS, readType, fOutFile);
902  fRunDS->Run(dset, start, stop, step, fNtries, fDebug, -1);
903  if (!fReadType) SafeDelete(readType);
904 
905  // Close the file
906  if (SetOutFile(0) != 0)
907  Warning("RunDataSet", "problems closing '%s'", fOutFileName.Data());
908 
909  // Done
910  return 0;
911 }
912 
913 ////////////////////////////////////////////////////////////////////////////////
914 /// Perform a test using dataset 'dset' scanning over the number of workers
915 /// per node.
916 /// Return 0 on success, -1 on error
917 /// Open the file for the results
918 
919 Int_t TProofBench::RunDataSetx(const char *dset, Int_t start, Int_t stop)
920 {
921  if (OpenOutFile(kTRUE) != 0) {
922  Error("RunDataSetx", "problems opening '%s' to save the result", fOutFileName.Data());
923  return -1;
924  }
926 
927  ReleaseCache(dset);
929  TPBReadType *readType = fReadType;
930  if (!readType) readType = new TPBReadType(TPBReadType::kReadOpt);
931  fRunDS = new TProofBenchRunDataRead(fDS, readType, fOutFile);
935  fRunDS->Run(dset, start, stop, -2, fNtries, fDebug, -1);
936  if (!fReadType) SafeDelete(readType);
937 
938  // Close the file
939  if (SetOutFile(0) != 0)
940  Warning("RunDataSetx", "problems closing '%s'", fOutFileName.Data());
941 
942  // Done
943  return 0;
944 }
945 
946 ////////////////////////////////////////////////////////////////////////////////
947 /// Draw the CPU speedup plot.
948 /// opt = 'typewhat', e.g. 'std:max:'
949 /// type = 'std:' draw standard plot
950 /// 'stdx:' draw standard plot, 1 worker per node
951 /// 'norm:' draw normalized plot
952 /// 'normx:' draw normalized plot, 1 worker per node
953 /// what = 'max:' draw max rate
954 /// 'avg:' draw average rate
955 /// 'all:' draw max and average rate on same plot (default)
956 /// type = 'mbs' MB/s scaling plots (default)
957 /// 'evts' Event/s scaling plots
958 /// dofit = 0 no fit
959 /// 1 fit with default 3 parameter saturated I/O formula
960 /// 2 fit with 4 parameter saturated I/O formula (varying Rcpu)
961 /// n0 = for dofit == 2, number of real cores
962 /// n1 = for dofit == 2, number of total cores (real + hyperthreaded)
963 ///
964 
965 void TProofBench::DrawDataSet(const char *outfile,
966  const char *opt, const char *type, Bool_t verbose,
967  Int_t dofit, Int_t n0, Int_t n1)
968 {
969  // Get the TProfile an create the graphs
970  TFile *fout = TFile::Open(outfile, "READ");
971  if (!fout || (fout && fout->IsZombie())) {
972  ::Error("DrawDataSet", "could not open file '%s' ...", outfile);
973  return;
974  }
975 
976  // Get description
977  TString description("<not available>");
978  TNamed *nmdesc = (TNamed *) fout->Get("PB_description");
979  if (nmdesc) description = nmdesc->GetTitle();
980 
981  // Parse option
982  TString oo(opt);
983  Bool_t isNorm = (oo.Contains("norm")) ? kTRUE : kFALSE;
984  Bool_t isX = (oo.Contains("stdx:") || oo.Contains("normx:")) ? kTRUE : kFALSE;
985  Bool_t doAvg = kTRUE, doMax = kTRUE;
986  if (oo.Contains("avg:")) doMax = kFALSE;
987  if (oo.Contains("max:")) doAvg = kFALSE;
988 
989  const char *dirn = (isX) ? "RunDataReadx" : "RunDataRead";
990  TDirectory *d = (TDirectory *) fout->Get(dirn);
991  if (!d) {
992  ::Error("DrawCPU", "could not find directory '%s' ...", dirn);
993  fout->Close();
994  delete fout;
995  return;
996  }
997  d->cd();
998 
999  TString hprofn, hmaxn;
1000  const char *lx = (isX) ? "_x" : "";
1001  const char *ln = (isNorm) ? "Norm" : "Prof";
1002  Bool_t isIO = kTRUE;
1003  if (type && !strcmp(type, "evts")) {
1004  hprofn.Form("%s%s_DataRead_QR_Evts", ln, lx);
1005  hmaxn.Form("%s%s_DataRead_PS_MaxEvts", ln, lx);
1006  isIO = kFALSE;
1007  } else {
1008  hprofn.Form("%s%s_DataRead_QR_IO", ln, lx);
1009  hmaxn.Form("%s%s_DataRead_PS_MaxIO", ln, lx);
1010  }
1011 
1012  Double_t xmin = -1., xmax = -1.;
1013  Double_t ami = -1., amx = -1., mmi = -1., mmx = -1.;
1014  Int_t kamx = -1, kmmx = -1, nbins = -1;
1015  Double_t ymx = -1., ymi = -1.;
1016 
1017  TProfile *pfav = 0;
1018  TGraphErrors *grav = 0;
1019  if (doAvg) {
1020  if (!(grav = GetGraph(d, hprofn, nbins, xmin, xmax, ami, amx, kamx, pfav))) {
1021  ::Error("DrawCPU", "could not find '%s' ...", hprofn.Data());
1022  fout->Close();
1023  delete fout;
1024  return;
1025  }
1026  ymx = amx;
1027  ymi = ami;
1028  }
1029  TProfile *pfmx = 0;
1030  TGraphErrors *grmx = 0;
1031  if (doMax) {
1032  if (!(grmx = GetGraph(d, hmaxn, nbins, xmin, xmax, mmi, mmx, kmmx, pfmx))) {
1033  ::Warning("DrawCPU", "could not find '%s': feature added in 5.34/11", hmaxn.Data());
1034  if (!grav) {
1035  // Nothing to do if not asked for the average
1036  fout->Close();
1037  delete fout;
1038  return;
1039  }
1040  doMax = kFALSE;
1041  }
1042  if (mmx > ymx) ymx = mmx;
1043  if ((ymi > 0 && mmi < ymi) || (ymi < 0.)) ymi = mmi;
1044  }
1045 
1046  TProfile *pf = (doMax) ? pfmx : pfav;
1047  Int_t kmx = (doMax) ? kmmx : kamx;
1048 
1049  // Create the canvas
1050  TCanvas *cpu = new TCanvas("dataset", "Rate vs wrks",204,69,1050,502);
1051  cpu->Range(-3.106332,0.7490716,28.1362,1.249867);
1052 
1053  TH1F *hgr = new TH1F("Graph-DataSet"," Data Read speed-up", nbins*4, xmin, xmax);
1054  hgr->SetMaximum(ymx + (ymx-ymi)*0.2);
1055  hgr->SetMinimum(0);
1056  if (isNorm) hgr->SetMaximum(ymx*1.2);
1057  hgr->SetDirectory(0);
1058  hgr->SetStats(0);
1059  hgr->GetXaxis()->SetTitle(pf->GetXaxis()->GetTitle());
1060  hgr->GetXaxis()->CenterTitle(true);
1061  hgr->GetXaxis()->SetLabelSize(0.05);
1062  hgr->GetXaxis()->SetTitleSize(0.06);
1063  hgr->GetXaxis()->SetTitleOffset(0.62);
1064  hgr->GetYaxis()->SetLabelSize(0.06);
1065  hgr->GetYaxis()->SetTitleSize(0.08);
1066  hgr->GetYaxis()->SetTitleOffset(0.52);
1067  if (isIO) {
1068  hgr->GetYaxis()->SetTitle("Rate (MB/s)");
1069  } else {
1070  hgr->GetYaxis()->SetTitle("Rate (events/s)");
1071  }
1072 
1073  TLegend *leg = 0;
1074  if (isNorm) {
1075  leg = new TLegend(0.7, 0.8, 0.9, 0.9);
1076  } else {
1077  leg = new TLegend(0.1, 0.8, 0.3, 0.9);
1078  }
1079 
1080  if (doAvg) {
1081  grav->SetFillColor(1);
1082  grav->SetLineColor(13);
1083  grav->SetMarkerColor(4);
1084  grav->SetMarkerStyle(21);
1085  grav->SetMarkerSize(1.2);
1086  grav->SetHistogram(hgr);
1087 
1088  if (verbose) grav->Print();
1089  grav->Draw("alp");
1090  leg->AddEntry(grav, "Average", "P");
1091  }
1092  if (doMax) {
1093  grmx->SetFillColor(1);
1094  grmx->SetLineColor(13);
1095  grmx->SetMarkerColor(2);
1096  grmx->SetMarkerStyle(29);
1097  grmx->SetMarkerSize(1.8);
1098  grmx->SetHistogram(hgr);
1099 
1100  if (verbose) grmx->Print();
1101  if (doAvg) {
1102  grmx->Draw("lpSAME");
1103  } else {
1104  grmx->Draw("alp");
1105  }
1106  leg->AddEntry(grmx, "Maximum", "P");
1107  }
1108  leg->Draw();
1109  gPad->Update();
1110 
1111  Double_t normrate = -1.;
1112  if (dofit > 0) {
1113  TGraphErrors *gr = (doMax) ? grmx : grav;
1114  // Make sure the fitting functions are defined
1115  Double_t xmi = 0.9;
1116  if (nbins > 5) xmi = 1.5;
1117  AssertFittingFun(xmi, nbins + .1);
1118 
1119  if (dofit == 1) {
1120  // Starting point for the parameters and fit
1121  fgFio->SetParameter(0, pf->GetBinContent(1));
1122  fgFio->SetParameter(1, pf->GetBinContent(nbins-1));
1123  fgFio->SetParameter(2, pf->GetBinContent(nbins-1));
1124  gr->Fit(fgFio);
1125  if (verbose) fgFio->Print();
1126  normrate = fgFio->Derivative(1.);
1127  } else if (dofit > 1) {
1128  // Starting point for the parameters and fit
1129  gFioVn0 = (n0 > 0) ? n0 : (Int_t) (nbins + .1)/2.;
1130  gFioVn1 = (n1 > 0) ? n1 : (Int_t) (nbins + .1);
1131  fgFioV->SetParameter(0, 20.);
1132  fgFioV->SetParameter(1, pf->GetBinContent(1));
1133  fgFioV->SetParameter(2, pf->GetBinContent(1));
1134  fgFioV->SetParameter(3, 4.);
1135  fgFioV->SetParameter(4, 1000.);
1136 
1137  gr->Fit(fgFioV);
1138  if (verbose) fgFio->Print();
1139  normrate = fgFioV->Derivative(1.);
1140  }
1141  }
1142 
1143  // Notify the cluster performance parameters
1144  if (!isNorm) {
1145  printf("* ************************************************************ *\n");
1146  printf("* *\r");
1147  printf("* Cluster: %s\n", description.Data());
1148  printf("* Performance measurement from scalability plot: *\n");
1149  printf("* *\r");
1150  if (isIO) {
1151  printf("* rate max: %.3f\tMB/s (@ %d workers)\n", ymx, kmx);
1152  printf("* *\r");
1153  printf("* per-worker rate: %.3f\tMB/s \n", normrate);
1154  } else {
1155  printf("* rate max: %.3f\tevts/s (@ %d workers)\n", ymx, kmx);
1156  }
1157  printf("* ************************************************************ *\n");
1158  }
1159  // Close the file
1160  fout->Close();
1161  if (grav) fgGraphs->Add(grav);
1162  if (grmx) fgGraphs->Add(grmx);
1163 }
1164 
1165 ////////////////////////////////////////////////////////////////////////////////
1166 /// Draw the efficiency plot.
1167 /// opt = 'cpu' or 'data' (default the first found)
1168 ///
1169 
1170 void TProofBench::DrawEfficiency(const char *outfile,
1171  const char *opt, Bool_t verbose)
1172 {
1173  // Get the TProfile an create the graphs
1174  TFile *fout = TFile::Open(outfile, "READ");
1175  if (!fout || (fout && fout->IsZombie())) {
1176  ::Error("DrawEfficiency", "could not open file '%s' ...", outfile);
1177  return;
1178  }
1179 
1180  // Get description
1181  TString description("<not available>");
1182  TNamed *nmdesc = (TNamed *) fout->Get("PB_description");
1183  if (nmdesc) description = nmdesc->GetTitle();
1184 
1185  // Parse option
1186  TString oo(opt), ln("CPU");
1187  const char *dirs[4] = { "RunCPU", "RunCPUx", "RunDataRead", "RunDataReadx"};
1188  const char *labs[4] = { "CPU", "CPU", "DataRead", "DataRead"};
1189  Int_t fst = 0, lst = 3;
1190  if (oo == "cpu") {
1191  lst = 0;
1192  } else if (oo == "cpux") {
1193  fst = 1;
1194  lst = 1;
1195  } else if (oo.BeginsWith("data")) {
1196  if (oo.EndsWith("x")) {
1197  fst = 3;
1198  lst = 3;
1199  } else {
1200  fst = 2;
1201  lst = 2;
1202  }
1203  }
1204  const char *dirn = 0;
1205  TDirectory *d = 0;
1206  for (Int_t i = fst; i <= lst; i++) {
1207  if ((d = (TDirectory *) fout->Get(dirs[i]))) {
1208  dirn = dirs[i];
1209  ln = labs[i];
1210  break;
1211  }
1212  }
1213  if (!d && !dirn) {
1214  ::Error("DrawEfficiency", "could not find directory ...");
1215  fout->Close();
1216  delete fout;
1217  return;
1218  }
1219  d->cd();
1220 
1221  TString hprof;
1222  hprof.Form("Prof_%s_CPU_eff", ln.Data());
1223 
1224  Double_t xmin = -1., xmax = -1.;
1225  Int_t kmx = -1, nbins = -1;
1226  Double_t ymx = -1., ymi = -1.;
1227 
1228  TProfile *pf = 0;
1229  TGraphErrors *gr = 0;
1230  if (!(gr = GetGraph(d, hprof, nbins, xmin, xmax, ymi, ymx, kmx, pf))) {
1231  ::Error("DrawEfficiency", "could not find '%s' ...", hprof.Data());
1232  fout->Close();
1233  delete fout;
1234  return;
1235  }
1236 
1237  // Create the canvas
1238  TCanvas *cpu = new TCanvas("efficiency", "efficiency vs wrks",204,69,1050,502);
1239  cpu->Range(-3.106332,0.7490716,28.1362,1.249867);
1240 
1241  TH1F *hgr = new TH1F("Graph-Efficiency","CPU effectiveness", nbins*4, xmin, xmax);
1242  hgr->SetMaximum(1.2);
1243  hgr->SetMinimum(0);
1244  hgr->SetDirectory(0);
1245  hgr->SetStats(0);
1246  hgr->GetXaxis()->SetTitle(pf->GetXaxis()->GetTitle());
1247  hgr->GetXaxis()->CenterTitle(true);
1248  hgr->GetXaxis()->SetLabelSize(0.05);
1249  hgr->GetXaxis()->SetTitleSize(0.06);
1250  hgr->GetXaxis()->SetTitleOffset(0.62);
1251  hgr->GetYaxis()->SetLabelSize(0.06);
1252  hgr->GetYaxis()->SetTitleSize(0.08);
1253  hgr->GetYaxis()->SetTitleOffset(0.52);
1254  hgr->GetYaxis()->SetTitle("CPU effectiveness");
1255 
1256  gr->SetFillColor(1);
1257  gr->SetLineColor(13);
1258  gr->SetMarkerColor(4);
1259  gr->SetMarkerStyle(21);
1260  gr->SetMarkerSize(1.2);
1261  gr->SetHistogram(hgr);
1262 
1263  if (verbose) gr->Print();
1264  gr->Draw("alp");
1265 
1266  // Notify the cluster performance parameters
1267  printf("* ************************************************************ *\n");
1268  printf("* *\r");
1269  printf("* Cluster: %s\n", description.Data());
1270  printf("* CPU effectiveness measurement: *\n");
1271  printf("* *\r");
1272  printf("* effectiveness max: %.3f (@ %d workers)\n", ymx, kmx);
1273  printf("* *\r");
1274  printf("* ************************************************************ *\n");
1275  // Close the file
1276  fout->Close();
1277  if (gr) fgGraphs->Add(gr);
1278 }
1279 
1280 ////////////////////////////////////////////////////////////////////////////////
1281 /// Release memory cache for dataset 'dset'
1282 /// Return 0 on success, -1 on error
1283 
1285 {
1286  // Do it via the dataset handler
1287  if (!fDS) fDS = new TProofBenchDataSet(fProofDS);
1288  return fDS ? fDS->ReleaseCache(dset) : -1;
1289 }
1290 
1291 ////////////////////////////////////////////////////////////////////////////////
1292 /// Physically remove the dataset 'dset', i.e. remove the dataset and the files
1293 /// it describes
1294 /// Return 0 on success, -1 on error
1295 
1297 {
1298  // Do it via the dataset handler
1299  if (!fDS) fDS = new TProofBenchDataSet(fProofDS);
1300  return fDS ? fDS->RemoveFiles(dset) : -1;
1301 }
1302 
1303 ////////////////////////////////////////////////////////////////////////////////
1304 /// Create the largest dataset for the run.
1305 /// Defaults for
1306 /// dataset name, filename root
1307 /// are
1308 /// "BenchDataSet", "event"
1309 /// respectively.
1310 /// These can be changed via dset and fnroot, respectively.
1311 /// The string 'fnroot' defines the location of the files, interpreted as an URL.
1312 /// Examples:
1313 /// fnroot files
1314 /// 'event' <datadir>/event_<ord>_<#>.root
1315 /// '/mss/event' /mss/event_<ord>_<#>.root
1316 /// 'root://srv//mss/event?remote=1'
1317 /// root://srv//mss/event_<ord>_<#>?remote=1.root
1318 /// Default selector is TSelEventGen. Use SetDataGenSel and SetDataGenPar to change it
1319 /// and to pass the list of PARs defining the alternative selector.
1320 /// The argument 'nevt' controls the number of events per file (-1 for the default,
1321 /// which is 30000).
1322 /// Return 0 on success, -1 on error
1323 
1324 Int_t TProofBench::MakeDataSet(const char *dset, Long64_t nevt, const char *fnroot,
1325  Bool_t regenerate)
1326 {
1327  if (dset && strlen(dset) > 0) fDataSet = dset;
1328 
1329  // Load the selector, if needed
1330  if (!TClass::GetClass(fDataGenSel)) {
1331  // Is it the default selector?
1333  // Load the parfile
1334 #ifdef R__HAVE_CONFIG
1335  TString par = TString::Format("%s/%s%s.par", ROOTETCDIR, kPROOF_BenchParDir, kPROOF_BenchDataSelPar);
1336 #else
1337  TString par = TString::Format("$ROOTSYS/etc/%s%s.par", kPROOF_BenchParDir, kPROOF_BenchDataSelPar);
1338 #endif
1339  Info("MakeDataSet", "uploading '%s' ...", par.Data());
1340  if (fProof->UploadPackage(par) != 0) {
1341  Error("MakeDataSet", "problems uploading '%s' - cannot continue", par.Data());
1342  return -1;
1343  }
1344  Info("MakeDataSet", "enabling '%s' ...", kPROOF_BenchDataSelPar);
1346  Error("MakeDataSet", "problems enabling '%s' - cannot continue", kPROOF_BenchDataSelPar);
1347  return -1;
1348  }
1349  } else {
1350  if (fDataGenPar.IsNull()) {
1351  Error("MakeDataSet", "you should load the class '%s' before running the benchmark", fDataGenSel.Data());
1352  return -1;
1353  }
1354  }
1355  // Load additional PAR files, if any or required by the alternative selector
1356  TString par;
1357  Int_t from = 0;
1358  while (fDataGenPar.Tokenize(par, from, ",")) {
1359  Info("MakeDataSet", "Uploading '%s' ...", par.Data());
1360  if (fProof->UploadPackage(par) != 0) {
1361  Error("MakeDataSet", "problems uploading '%s' - cannot continue", par.Data());
1362  return -1;
1363  }
1364  Info("MakeDataSet", "Enabling '%s' ...", par.Data());
1365  if (fProof->EnablePackage(par) != 0) {
1366  Error("MakeDataSet", "problems enabling '%s' - cannot continue", par.Data());
1367  return -1;
1368  }
1369  }
1370  // Check
1371  if (!TClass::GetClass(fDataGenSel)) {
1372  Error("MakeDataSet", "failed to load '%s'", fDataGenSel.Data());
1373  return -1;
1374  }
1375  }
1376 
1377  // For files, 30000 evst each (about 600 MB total) per worker
1378  TString fn, fnr("event");
1379  Bool_t remote = kFALSE;
1380  if (fnroot && strlen(fnroot) > 0) {
1381  TUrl ur(fnroot, kTRUE);
1382  if (!strcmp(ur.GetProtocol(), "file") &&
1384  fnr = fnroot;
1385  } else {
1386  fnr = gSystem->BaseName(ur.GetFile());
1387  // We need to set the basedir
1388  TString bdir(gSystem->DirName(fnroot));
1389  bdir += "/<fn>";
1390  fProof->SetParameter("PROOF_BenchmarkBaseDir", bdir.Data());
1391  // Flag as remote, if so
1392  if (strcmp(ur.GetProtocol(), "file")) remote = kTRUE;
1393  }
1394  }
1395  TProofNodes pn(fProof);
1396  TMap *filesmap = new TMap;
1397  TMap *nodesmap = pn.GetMapOfNodes();
1398  TIter nxnd(nodesmap);
1399  TList *wli = 0;
1400  TObject *obj = 0;
1401  Int_t kf = 1;
1402  while ((obj = nxnd()) != 0) {
1403  if ((wli = dynamic_cast<TList *>(nodesmap->GetValue(obj)))) {
1404  THashList *fli = new THashList;
1405  Int_t nf = wli->GetSize() * fNFilesWrk;
1406  TSlaveInfo *wi = (TSlaveInfo *) wli->First();
1407  while (nf--) {
1408  fn.Form("%s-%s-%d.root", fnr.Data(), wi->GetName(), kf++);
1409  // Add to the node list for generation
1410  fli->Add(new TObjString(fn));
1411  }
1412  filesmap->Add(new TObjString(obj->GetName()), fli);
1413  }
1414  }
1415  filesmap->Print();
1416  // Prepare for file generation ... add map in the input list
1417  filesmap->SetName("PROOF_FilesToProcess");
1418  fProof->AddInput(filesmap);
1419 
1420  // Set parameters for processing
1421  TString oldpack;
1422  if (TProof::GetParameter(fProof->GetInputList(), "PROOF_Packetizer", oldpack) != 0) oldpack = "";
1423  fProof->SetParameter("PROOF_Packetizer", "TPacketizerFile");
1424  Int_t oldnotass = -1;
1425  if (TProof::GetParameter(fProof->GetInputList(), "PROOF_ProcessNotAssigned", oldnotass) != 0) oldnotass = -1;
1426  fProof->SetParameter("PROOF_ProcessNotAssigned", (Int_t)0);
1427 
1428  // Process
1429  Long64_t ne = (nevt > 0) ? nevt : 30000;
1430  fProof->SetParameter("PROOF_BenchmarkNEvents", ne);
1431  fProof->SetParameter("PROOF_BenchmarkRegenerate", Int_t(regenerate));
1433  fProof->DeleteParameters("PROOF_BenchmarkNEvents");
1434  fProof->DeleteParameters("PROOF_BenchmarkRegenerate");
1435  fProof->DeleteParameters("PROOF_BenchmarkBaseDir");
1436 
1437  // Restore parameters
1438  if (!oldpack.IsNull())
1439  fProof->SetParameter("PROOF_Packetizer", oldpack);
1440  else
1441  fProof->DeleteParameters("PROOF_Packetizer");
1442  if (oldnotass != -1)
1443  fProof->SetParameter("PROOF_ProcessNotAssigned", oldnotass);
1444  else
1445  fProof->DeleteParameters("PROOF_ProcessNotAssigned");
1446 
1447  // Cleanup
1448  if (fProof->GetInputList()) fProof->GetInputList()->Remove(filesmap);
1449  filesmap->SetOwner(kTRUE);
1450  delete filesmap;
1451 
1452  // The dataset to be registered in the end with proper port
1453  TFileCollection *fc = new TFileCollection("dum", "dum");
1454 
1455  if (fProof->GetOutputList()) {
1456  fProof->GetOutputList()->Print();
1457  TIter nxout(fProof->GetOutputList());
1458  while ((obj = nxout())) {
1459  TList *fli = dynamic_cast<TList *>(obj);
1460  if (fli && TString(fli->GetName()).BeginsWith("PROOF_FilesGenerated_")) {
1461  TIter nxfg(fli);
1462  TFileInfo *fi = 0;
1463  while ((fi = (TFileInfo *) nxfg()))
1464  fc->Add(fi);
1465  fli->SetOwner(kFALSE);
1466  }
1467  }
1468  // Register the new dataset, overwriting any existing dataset wth the same name
1469  // trusting the existing information
1470  fc->Update();
1471  if (fc->GetNFiles() > 0) {
1472  if (remote) fc->SetBit(TFileCollection::kRemoteCollection);
1473  if (!(fProof->RegisterDataSet(fDataSet, fc, "OT")))
1474  Warning("MakeDataSet", "problems registering '%s'", dset);
1475  } else {
1476  Warning("MakeDataSet", "dataset '%s' is empty!", dset);
1477  }
1478  } else {
1479  Warning("MakeDataSet", "PROOF output list is empty!");
1480  }
1481 
1482  SafeDelete(fc);
1483 
1484  // Get updated information
1485  fc = fProof->GetDataSet(fDataSet);
1486  if (fc) {
1487  fc->Print("F");
1488  } else {
1489  Warning("MakeDataSet", "dataset '%s' was not generated!", fDataSet.Data());
1490  }
1491 
1492  SafeDelete(fc);
1493 
1494  // Done
1495  return 0;
1496 }
1497 
1498 ////////////////////////////////////////////////////////////////////////////////
1499 /// Copy the files of dataset 'dset' to 'destdir' and create a new dataset named 'dsetdst'
1500 /// decribing them.
1501 /// Return 0 on success, -1 on error
1502 
1503 Int_t TProofBench::CopyDataSet(const char *dset, const char *dsetdst, const char *destdir)
1504 {
1505  // Make some checks
1506  if (!fProof) {
1507  Error("CopyDataSet", "no PROOF found - cannot continue");
1508  return -1;
1509  }
1510  if (!dset || (dset && !fProof->ExistsDataSet(dset))) {
1511  Error("CopyDataSet", "dataset '%s' does not exist", dset);
1512  return -1;
1513  }
1514  if (!dsetdst || (dsetdst && fProof->ExistsDataSet(dsetdst))) {
1515  if (isatty(0) != 0 && isatty(1) != 0) {
1516  Printf("Target dataset '%s' exists already:"
1517  " do you want to remove it first?", dsetdst);
1518  const char *a = Getline("[Y,n] ");
1519  Printf("a: %s", a);
1520  if (a[0] == 'Y' || a[0] == 'y' || a[0] == '\n') {
1521  Info("CopyDataSet", "removing dataset '%s' ...", dsetdst);
1522  RemoveDataSet(dsetdst);
1523  } else {
1524  return -1;
1525  }
1526  } else {
1527  Error("CopyDataSet", "destination dataset '%s' does already exist: remove it first", dsetdst);
1528  return -1;
1529  }
1530  }
1531 
1532  // The TFileCollection object for the new dataset
1533  TFileCollection *fc = fProof->GetDataSet(dset);
1534  if (!fc) {
1535  Error("CopyDataSet", "problems retrieving TFileCollection for dataset '%s'", dset);
1536  return -1;
1537  }
1538  TFileCollection *fcn = new TFileCollection(dsetdst, "");
1539  TString fn;
1540  TFileInfo *fi = 0;
1541  TIter nxfi(fc->GetList());
1542  while ((fi = (TFileInfo *) nxfi())) {
1543  fn.Form("%s/%s", destdir, gSystem->BaseName(fi->GetCurrentUrl()->GetFile()));
1544  Info("CopyDataSet", "adding info for file '%s'", fn.Data());
1545  fcn->Add(new TFileInfo(fn));
1546  }
1547  delete fc;
1548 
1549  // Do it via the dataset handler
1550  if (!fDS) fDS = new TProofBenchDataSet(fProofDS);
1551  if (fDS->CopyFiles(dset, destdir) != 0) {
1552  Error("CopyDataSet", "problems copying files of dataset '%s' to dest dir '%s'", dset, destdir);
1553  delete fcn;
1554  return -1;
1555  }
1556 
1557  // Register the new dataset, overwriting any existing dataset wth the same name
1558  // trusting the existing information
1559  Int_t rc = 0;
1560  if (!(fProof->RegisterDataSet(dsetdst, fcn, "OT"))) {
1561  Error("CopyDataSet", "problems registering and verifying '%s'", dsetdst);
1562  rc = -1;
1563  }
1564  delete fcn;
1565 
1566  // Done
1567  return rc;
1568 }
1569 
1570 ////////////////////////////////////////////////////////////////////////////////
1571 /// Set the PROOF instance to be used for dataset operations, like releasing
1572 /// cache ...
1573 /// Use SetProofDS(0) to reset and using the default PROOF
1574 
1576 {
1577  if (pds && !pds->IsValid()) {
1578  Error("SetProofDS", "trying to set an invalid PROOF instance");
1579  return;
1580  }
1581  fProofDS = pds ? pds : fProof;
1582  if (fProofDS) {
1583  SafeDelete(fDS);
1585  }
1586  // Done
1587  return;
1588 }
1589 
const char * GetHost() const
Definition: TUrl.h:76
virtual void SetSelOption(const char *opt)
virtual ~TProofBench()
Destructor.
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0)
Fit this graph with function with name fname.
Definition: TGraph.cxx:1024
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
Definition: TSystem.cxx:928
virtual void SetTitleOffset(Float_t offset=1)
Set distance between the axis and the axis title Offset is a correction factor with respect to the "s...
Definition: TAttAxis.cxx:244
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition: TObject.cxx:823
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition: TSystem.cxx:1265
double par[1]
Definition: unuranDistr.cxx:38
virtual Bool_t IsAbsoluteFileName(const char *dir)
Return true if dir is an absolute pathname.
Definition: TSystem.cxx:945
Long64_t GetNFiles() const
float xmin
Definition: THbookFile.cxx:93
long long Long64_t
Definition: RtypesCore.h:69
TProofBenchRunCPU * fRunCPU
Definition: TProofBench.h:71
virtual void SetMaximum(Double_t maximum=-1111)
Definition: TH1.h:394
This class displays a legend box (TPaveText) containing several legend entries.
Definition: TLegend.h:35
TProofBench(const char *url, const char *outfile="<default>", const char *proofopt=0)
Constructor: check PROOF and load selectors PAR.
virtual void Print(Option_t *chopt="") const
Print graph and errors values.
TString fDataPar
Definition: TProofBench.h:66
virtual Bool_t ExistsDataSet(const char *dataset)
Returns kTRUE if 'dataset' exists, kFALSE otherwise.
Definition: TProof.cxx:11435
Bool_t IsValid() const
Definition: TProof.h:970
Int_t CopyFiles(const char *dset, const char *destdir)
Copy the files of dataset 'dset' to another directory Return 0 on success, -1 on error.
Int_t EnablePackage(const char *package, Bool_t notOnClient=kFALSE, TList *workers=0)
Enable specified package.
Definition: TProof.cxx:8632
Int_t RunCPU(Long64_t nevents=-1, Int_t start=-1, Int_t stop=-1, Int_t step=-1)
Perform the CPU run Return 0 on success, -1 on error.
virtual const char * WorkingDirectory()
Return working directory.
Definition: TSystem.cxx:865
virtual const char * GetName() const
Return name of this collection.
const char * AsString(const Option_t *option="") const
Return the date & time as a string.
Definition: TTimeStamp.cxx:269
virtual Bool_t RegisterDataSet(const char *name, TFileCollection *dataset, const char *optStr="")
Register the 'dataSet' on the cluster under the current user, group and the given 'dataSetName'...
Definition: TProof.cxx:11274
virtual TList * GetListOfKeys() const
Definition: TDirectory.h:155
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
Definition: TDirectory.cxx:727
Ssiz_t Length() const
Definition: TString.h:390
virtual void SetParNames(const char *name0="p0", const char *name1="p1", const char *name2="p2", const char *name3="p3", const char *name4="p4", const char *name5="p5", const char *name6="p6", const char *name7="p7", const char *name8="p8", const char *name9="p9", const char *name10="p10")
Set up to 10 parameter names.
Definition: TF1.cxx:3170
Collectable string class.
Definition: TObjString.h:32
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
Definition: TH1.cxx:8266
This class represents a WWW compatible URL.
Definition: TUrl.h:41
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:635
R__EXTERN TStyle * gStyle
Definition: TStyle.h:423
int GetPathInfo(const char *path, Long_t *id, Long_t *size, Long_t *flags, Long_t *modtime)
Get info about a file: id, size, flags, modification time.
Definition: TSystem.cxx:1363
virtual void SetName(const char *name)
Change (i.e.
Definition: TNamed.cxx:128
virtual TList * GetListOfKeys() const
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
Definition: TLegend.cxx:373
const char * GetProtocol() const
Definition: TUrl.h:73
void SetParameter(const char *par, const char *value)
Set input list parameter.
Definition: TProof.cxx:10389
Int_t SetOutFile(const char *outfile, Bool_t verbose=kTRUE)
Set the output file Return 0 on success, -1 on error.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:892
static const TList * GetEnvVars()
Get environemnt variables.
Definition: TProof.cxx:12318
Double_t funio(Double_t *xx, Double_t *par)
I/O saturated rate function.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:45
virtual Bool_t ReadBuffer(char *buf, Int_t len)
Read a buffer from the file.
Definition: TFile.cxx:1596
virtual TFileCollection * GetDataSet(const char *dataset, const char *optStr="")
Get a list of TFileInfo objects describing the files of the specified dataset.
Definition: TProof.cxx:11504
TList * GetOutputList()
Get list with all object created during processing (see Process()).
Definition: TProof.cxx:10375
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
THist< 1, float > TH1F
Definition: THist.h:315
static TF1 * fgFioV
Definition: TProofBench.h:91
void Add(TObject *obj)
This function may not be used (but we need to provide it since it is a pure virtual in TCollection)...
Definition: TMap.cxx:52
virtual void SetMinimum(Double_t minimum=-1111)
Definition: TH1.h:395
#define gROOT
Definition: TROOT.h:340
static void DrawEfficiency(const char *outfile, const char *opt="", Bool_t verbose=kFALSE)
Draw the efficiency plot.
Bool_t IsZombie() const
Definition: TObject.h:141
Basic string class.
Definition: TString.h:137
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:570
TNamed * fDescription
Definition: TProofBench.h:77
int Int_t
Definition: RtypesCore.h:41
TString fSelOption
Definition: TProofBench.h:69
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
Definition: TSystem.cxx:996
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
const char *const kPROOF_BenchParDir
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:496
int nbins[3]
Long_t fMtime
Definition: TSystem.h:142
TString fCPUSel
Definition: TProofBench.h:63
virtual Int_t GetNbinsX() const
Definition: TH1.h:296
Profile Historam.
Definition: TProfile.h:34
void CenterTitle(Bool_t center=kTRUE)
Center axis title.
Definition: TAxis.h:184
virtual void SetParList(const char *pars)
Double_t funiov(Double_t *xx, Double_t *par)
I/O saturated rate function with varying Rcpu.
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TList.cxx:310
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
Definition: TGraph.cxx:740
Double_t funcpuvn(Double_t *xx, Double_t *par)
Function with varying Rcpu normalized.
Bool_t R_ISREG(Int_t mode)
Definition: TSystem.h:129
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:732
void Run(Long64_t, Int_t, Int_t, Int_t, Int_t, Int_t, Int_t)
void Run(Long64_t nevents, Int_t start, Int_t stop, Int_t step, Int_t ntries, Int_t debug, Int_t draw)
Run benchmark Input parameters nevents: Number of events to run per file.
static TF1 * fgFp2n
Definition: TProofBench.h:86
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:3851
Int_t fMode
Definition: TSystem.h:138
TString fDataSel
Definition: TProofBench.h:65
virtual Double_t GetBinWidth(Int_t bin) const
return bin width for 1D historam Better to use h1.GetXaxis().GetBinWidth(bin)
Definition: TH1.cxx:8492
Int_t RunCPUx(Long64_t nevents=-1, Int_t start=-1, Int_t stop=-1)
Perform the CPU run scanning over the number of workers per node Return 0 on success, -1 on error.
const char * Data() const
Definition: TString.h:349
Int_t RemoveDataSet(const char *dset)
Physically remove the dataset 'dset', i.e.
static struct mg_connection * fc(struct mg_context *ctx)
Definition: civetweb.c:839
Int_t Update(Long64_t avgsize=-1)
Update accumulated information about the elements of the collection (e.g.
virtual const char * GetDirEntry(void *dirp)
Get a directory entry. Returns 0 if no more entries.
Definition: TSystem.cxx:847
#define SafeDelete(p)
Definition: RConfig.h:436
virtual int Unlink(const char *name)
Unlink, i.e. remove, a file.
Definition: TSystem.cxx:1346
Int_t RemoveFiles(const char *dset)
Physically remove the dataset 'dset', i.e.
Int_t fNFilesWrk
Definition: TProofBench.h:59
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
Definition: TString.cxx:2334
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:36
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
static TF1 * fgFp1
Definition: TProofBench.h:83
static void DrawCPU(const char *outfile, const char *opt="std:", Bool_t verbose=kFALSE, Int_t dofit=0, Int_t n0=-1, Int_t n1=-1)
Draw the CPU speedup plot.
const char * GetMaster() const
Definition: TProof.h:936
bool BeginsWith(const std::string &theString, const std::string &theSubstring)
virtual void SetMarkerColor(Color_t mcolor=1)
Definition: TAttMarker.h:51
A sorted doubly linked list.
Definition: TSortedList.h:30
std::vector< std::vector< double > > Data
static Int_t gFioVn0
Definition: TProofBench.cxx:65
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
Definition: TMap.cxx:234
static TF1 * fgFp3n
Definition: TProofBench.h:88
Int_t Atoi() const
Return integer value of string.
Definition: TString.cxx:1964
static TProof * Open(const char *url=0, const char *conffile=0, const char *confdir=0, Int_t loglevel=0)
Start a PROOF session on a specific cluster.
Definition: TProof.cxx:12150
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition: TKey.h:30
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
Int_t ReleaseCache(const char *dset)
Release memory cache for dataset 'dset' Return 0 on success, -1 on error.
Bool_t IsLite() const
Definition: TProof.h:966
TObject * GetParameter(const char *par) const
Get specified parameter.
Definition: TProof.cxx:10485
virtual Int_t Compare(const TObject *obj) const
Compare two TNamed objects.
Definition: TNamed.cxx:74
Double_t funp1(Double_t *xx, Double_t *par)
Simple polynomial 1st degree.
Definition: TProofBench.cxx:73
void SetReleaseCache(Bool_t on=kTRUE)
A doubly linked list.
Definition: TList.h:47
Double_t funp2n(Double_t *xx, Double_t *par)
Normalized 2nd degree.
Bool_t fUnlinkOutfile
Definition: TProofBench.h:46
Int_t UploadPackage(const char *par, EUploadPackageOpt opt=kUntar, TList *workers=0)
Upload a PROOF archive (PAR file).
Definition: TProof.cxx:8898
virtual void SetLineColor(Color_t lcolor)
Definition: TAttLine.h:54
Double_t funcpuv(Double_t *xx, Double_t *par)
Function with varying Rcpu.
virtual Double_t GetBinCenter(Int_t bin) const
return bin center for 1D historam Better to use h1.GetXaxis().GetBinCenter(bin)
Definition: TH1.cxx:8470
static Int_t gFioVn1
Definition: TProofBench.cxx:66
const char *const kPROOF_BenchDataSelPar
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
static TF1 * fgFp1n
Definition: TProofBench.h:84
virtual void SetFillColor(Color_t fcolor)
Definition: TAttFill.h:50
virtual void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Set world coordinate system for the pad.
Definition: TPad.cxx:4627
THashList * GetList()
Int_t Add(TFileInfo *info)
Add TFileInfo to the collection.
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:674
Double_t funp2(Double_t *xx, Double_t *par)
Simple polynomial 2nd degree.
Definition: TProofBench.cxx:82
Int_t GetHour() const
Definition: TDatime.h:71
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2321
bool verbose
static TF1 * fgFp3
Definition: TProofBench.h:87
static void GetPerfSpecs(const char *path=".", Int_t degfit=1)
Get performance specs.
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual void SetMarkerStyle(Style_t mstyle=1)
Definition: TAttMarker.h:53
TAxis * GetYaxis()
Definition: TH1.h:320
const char * GetTitle() const
Returns title of object.
Definition: TAxis.h:133
virtual Long64_t Process(TDSet *dset, const char *selector, Option_t *option="", Long64_t nentries=-1, Long64_t firstentry=0)
Process a data set (TDSet) using the specified selector (.C) file or Tselector object Entry- or event...
Definition: TProof.cxx:5293
float xmax
Definition: THbookFile.cxx:93
TProofBenchDataSet * fDS
Definition: TProofBench.h:73
Int_t RunDataSet(const char *dset="BenchDataSet", Int_t start=1, Int_t stop=-1, Int_t step=1)
Perform a test using dataset 'dset' Return 0 on success, -1 on error Open the file for the results...
Bool_t IsNull() const
Definition: TString.h:387
TFile * fOutFile
Definition: TProofBench.h:52
void SetName(const char *name)
Definition: TCollection.h:116
void SetProofDS(TProof *p)
Set the PROOF instance to be used for dataset operations, like releasing cache ...
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels The size is expressed in per cent of the pad width.
Definition: TAttAxis.cxx:186
static void AssertFittingFun(Double_t mi, Double_t mx)
Make sure that the fitting functions are defined.
virtual void SetMarkerSize(Size_t msize=1)
Definition: TAttMarker.h:54
void AddInput(TObject *obj)
Add objects that might be needed during the processing of the selector (see Process()).
Definition: TProof.cxx:10301
Double_t funp1n(Double_t *xx, Double_t *par)
Normalized 1st degree.
Definition: TProofBench.cxx:91
TGraphErrors * gr
Definition: legend1.C:25
TString fDataGenPar
Definition: TProofBench.h:68
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Definition: TString.cxx:2240
virtual void SetTitleSize(Float_t size=0.04)
Set size of axis title The size is expressed in per cent of the pad width.
Definition: TAttAxis.cxx:254
TString fDataGenSel
Definition: TProofBench.h:67
#define Printf
Definition: TGeoToOCC.h:18
virtual Double_t GetBinError(Int_t bin) const
Return bin error of a Profile histogram.
Definition: TProfile.cxx:860
Int_t ReleaseCache(const char *dset)
Release memory cache for dataset 'dset' Return 0 on success, -1 on error.
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
Int_t RunDataSetx(const char *dset="BenchDataSet", Int_t start=1, Int_t stop=-1)
Perform a test using dataset 'dset' scanning over the number of workers per node. ...
virtual Double_t GetBinContent(Int_t bin) const
Return bin content of a Profile histogram.
Definition: TProfile.cxx:795
long Long_t
Definition: RtypesCore.h:50
virtual Double_t Derivative(Double_t x, Double_t *params=0, Double_t epsilon=0.001) const
Returns the first derivative of the function at point x, computed by Richardson's extrapolation metho...
Definition: TF1.cxx:852
The Canvas class.
Definition: TCanvas.h:48
TList * GetInputList()
Get input list.
Definition: TProof.cxx:10320
void Close(Option_t *option="")
Close all open slave servers.
Definition: TProof.cxx:1792
virtual Int_t GetSize() const
Definition: TCollection.h:95
Int_t GetMinute() const
Definition: TDatime.h:72
#define ClassImp(name)
Definition: Rtypes.h:279
double f(double x)
void DeleteParameters(const char *wildcard)
Delete the input list parameters specified by a wildcard (e.g.
Definition: TProof.cxx:10500
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:415
double Double_t
Definition: RtypesCore.h:55
virtual const char * HostName()
Return the system's host name.
Definition: TSystem.cxx:307
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
Definition: TLegend.cxx:280
static TF1 * fgFio
Definition: TProofBench.h:90
Bool_t UseDynamicStartup() const
Definition: TProof.h:954
Describe directory structure in memory.
Definition: TDirectory.h:41
Int_t fNumWrkMax
Definition: TProofBench.h:60
virtual void Print(Option_t *option="") const
Print TNamed name and title.
Definition: TF1.cxx:2623
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
Definition: TMap.h:44
TString fDataSet
Definition: TProofBench.h:58
int type
Definition: TGX11.cxx:120
leg
Definition: legend1.C:34
const char *const kPROOF_BenchSelDataGenDef
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
The TTimeStamp encapsulates seconds and ns since EPOCH.
Definition: TTimeStamp.h:76
Definition: TProof.h:339
Double_t ey[n]
Definition: legend1.C:17
static TF1 * fgFp2
Definition: TProofBench.h:85
Bool_t fReleaseCache
Definition: TProofBench.h:61
TMap * GetMapOfNodes() const
Definition: TProofNodes.h:55
TString fCPUPar
Definition: TProofBench.h:64
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2881
Int_t OpenOutFile(Bool_t wrt=kFALSE, Bool_t verbose=kTRUE)
Set the otuput file Return 0 on success, -1 on error.
const char * GetName() const
Returns name of object.
Definition: TProof.h:254
Bool_t fDebug
Definition: TProofBench.h:75
virtual Double_t GetParameter(Int_t ipar) const
Definition: TF1.h:359
Mother of all ROOT objects.
Definition: TObject.h:58
void Print(Option_t *option="") const
Prints the contents of the TFileCollection.
virtual TObject * First() const
Return the first object in the list. Returns 0 when list is empty.
Definition: TList.cxx:556
TProofBenchRunDataRead * fRunDS
Definition: TProofBench.h:72
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Definition: TGraph.cxx:2127
TUrl * GetCurrentUrl() const
Return the current url.
Definition: TFileInfo.cxx:246
Bool_t R_ISDIR(Int_t mode)
Definition: TSystem.h:126
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
Definition: TDirectory.cxx:433
virtual void Add(TObject *obj)
Definition: TList.h:81
Class that contains a list of TFileInfo's and accumulated meta data information about its entries...
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:567
1-Dim function class
Definition: TF1.h:149
Int_t fNtries
Definition: TProofBench.h:54
Int_t fNHist
Definition: TProofBench.h:56
void CloseOutFile()
Close output file.
TString fOutFileName
Definition: TProofBench.h:53
static TList * fgGraphs
Definition: TProofBench.h:93
A TGraphErrors is a TGraph with error bars.
Definition: TGraphErrors.h:28
void SetOptTitle(Int_t tit=1)
Definition: TStyle.h:330
#define gPad
Definition: TVirtualPad.h:288
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
Definition: TSystem.cxx:830
virtual void SetHistogram(TH1F *h)
Definition: TGraph.h:177
Int_t CopyDataSet(const char *dset, const char *dsetdst, const char *destdir)
Copy the files of dataset 'dset' to 'destdir' and create a new dataset named 'dsetdst' decribing them...
TPBReadType * fReadType
Definition: TProofBench.h:57
Class describing a generic file including meta information.
Definition: TFileInfo.h:50
void ResetBit(UInt_t f)
Definition: TObject.h:172
virtual void SetParameter(Int_t param, Double_t value)
Definition: TF1.h:431
Int_t GetDate() const
Return date in form of 19971224 (i.e. 24/12/1997)
Definition: TDatime.cxx:245
void Add(TObject *obj)
virtual void SetPointError(Double_t ex, Double_t ey)
Set ex and ey values for point pointed by the mouse.
const Bool_t kTRUE
Definition: Rtypes.h:91
TProof * fProofDS
Definition: TProofBench.h:51
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
Definition: TNamed.cxx:152
TObject * obj
Int_t GetParallel() const
Returns number of slaves active in parallel mode.
Definition: TProof.cxx:2299
Double_t ex[n]
Definition: legend1.C:17
const Int_t n
Definition: legend1.C:16
Int_t MakeDataSet(const char *dset=0, Long64_t nevt=-1, const char *fnroot="event", Bool_t regenerate=kFALSE)
Create the largest dataset for the run.
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
Definition: TH1.cxx:8320
const char * GetFile() const
Definition: TUrl.h:78
TAxis * GetXaxis()
Definition: TH1.h:319
TProof * fProof
Definition: TProofBench.h:50
static TGraphErrors * GetGraph(TDirectory *d, const char *pfn, Int_t &nb, Double_t &xmi, Double_t &xmx, Double_t &ymi, Double_t &ymx, Int_t &kmx, TProfile *&pf)
Get from TDirectory 'd' the TProfile named 'pfn' and create the graph.
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition: TDatime.h:39
virtual void Close(Option_t *option="")
Close a file.
Definition: TFile.cxx:898
static void DrawDataSet(const char *outfile, const char *opt="std:", const char *type="mbs", Bool_t verbose=kFALSE, Int_t dofit=0, Int_t n0=-1, Int_t n1=-1)
Draw the CPU speedup plot.
virtual void SetSelName(const char *sel)
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:904