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