Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TProofBenchRunCPU.cxx
Go to the documentation of this file.
1// @(#)root/proof:$Id$
2// Author: Sangsu Ryu 22/06/2010
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/** \class TProofBenchRunCPU
13\ingroup proofbench
14
15CPU-intensive PROOF benchmark test generates events and fill 1, 2, or 3-D histograms.
16No I/O activity is involved.
17
18*/
19
20#include "RConfigure.h"
21
22#include "TProofBenchRunCPU.h"
23#include "TProofNodes.h"
24#include "TProofPerfAnalysis.h"
25#include "TFileCollection.h"
26#include "TFileInfo.h"
27#include "TProof.h"
28#include "TString.h"
29#include "Riostream.h"
30#include "TMap.h"
31#include "TEnv.h"
32#include "TTree.h"
33#include "TLeaf.h"
34#include "TCanvas.h"
35#include "TROOT.h"
36#include "TH2.h"
37#include "TF1.h"
38#include "TProfile.h"
39#include "TLegend.h"
40#include "TKey.h"
41#include "TRegexp.h"
42#include "TPerfStats.h"
43#include "TQueryResult.h"
44#include "TMath.h"
45#include "TStyle.h"
46#include "TGraphErrors.h"
47
49
50////////////////////////////////////////////////////////////////////////////////
51/// Default constructor
52
54 TDirectory* dirproofbench, TProof* proof,
55 TProofNodes* nodes, Long64_t nevents, Int_t ntries,
56 Int_t start, Int_t stop, Int_t step, Int_t draw,
57 Int_t debug)
59 fHistType(histtype), fNHists(nhists),
60 fNEvents(nevents), fNTries(ntries), fStart(start), fStop(stop),
61 fStep(step), fDraw(draw), fDebug(debug), fDirProofBench(dirproofbench),
62 fNodes(nodes), fListPerfPlots(0),
67{
69 Error("TProofBenchRunCPU", "problems validating PROOF session or enabling selector PAR");
70 return;
71 }
72
73 fName = "CPU";
74
75 if (!fNodes) fNodes = new TProofNodes(fProof);
76
77 if (stop == -1) fStop = fNodes->GetNWorkersCluster();
78
80
81 gEnv->SetValue("Proof.StatsTrace",1);
82 gStyle->SetOptStat(0);
83}
84
85////////////////////////////////////////////////////////////////////////////////
86/// Destructor
87
98
99////////////////////////////////////////////////////////////////////////////////
100/// Build histograms, profiles and graphs needed for this run
101
103{
104 TObject *o = 0;
105 Int_t quotient = (stop - start) / step;
106 Int_t ndiv = quotient + 1;
107 Double_t ns_min = start - step/2.;
108 Double_t ns_max = quotient*step + start + step/2.;
109
110 fProfLegend = new TLegend(0.1, 0.8, 0.3, 0.9);
111 fNormLegend = new TLegend(0.7, 0.8, 0.9, 0.9);
112
113 TString axtitle("Active Workers"), namelab(GetName()), sellab(GetSelName());
114 if (nx) {
115 axtitle = "Active Workers/Node";
116 namelab.Form("x_%s", GetName());
117 }
119 sellab.Form("%s_%s", GetSelName(), GetNameStem().Data());
120
121 TString name, title;
122
123 // Book perfstat profile (max evts)
124 name.Form("Prof_%s_PS_MaxEvts_%s", namelab.Data(), sellab.Data());
125 title.Form("Profile %s PerfStat Event - %s", namelab.Data(), sellab.Data());
126 fProfile_perfstat_evtmax = new TProfile(name, title, ndiv, ns_min, ns_max);
128 fProfile_perfstat_evtmax->GetYaxis()->SetTitle("Events/sec");
129 fProfile_perfstat_evtmax->GetXaxis()->SetTitle(axtitle);
130 fProfile_perfstat_evtmax->SetMarkerStyle(23);
131 fProfile_perfstat_evtmax->SetMarkerColor(2);
132 if ((o = fListPerfPlots->FindObject(name))) {
133 fListPerfPlots->Remove(o);
134 delete o;
135 }
137 fProfLegend->AddEntry(fProfile_perfstat_evtmax, "Maximum");
138
139 // Book perfstat profile
140 name.Form("Prof_%s_PS_Evts_%s", namelab.Data(), sellab.Data());
141 title.Form("Profile %s PerfStat Event - %s", namelab.Data(), sellab.Data());
142 fProfile_perfstat_event = new TProfile(name, title, ndiv, ns_min, ns_max);
144 fProfile_perfstat_event->GetYaxis()->SetTitle("Events/sec");
145 fProfile_perfstat_event->GetXaxis()->SetTitle(axtitle);
146 fProfile_perfstat_event->SetMarkerStyle(21);
147 if ((o = fListPerfPlots->FindObject(name))) {
148 fListPerfPlots->Remove(o);
149 delete o;
150 }
152 fProfLegend->AddEntry(fProfile_perfstat_event, "Average");
153
154 // Book perfstat histogram
155 name.Form("Hist_%s_PS_Evts_%s", namelab.Data(), sellab.Data());
156 title.Form("Histogram %s PerfStat Event - %s", namelab.Data(), sellab.Data());
157 fHist_perfstat_event = new TH2D(name, title, ndiv, ns_min, ns_max, 100, 0, 0);
159 fHist_perfstat_event->GetYaxis()->SetTitle("Events/sec");
160 fHist_perfstat_event->GetXaxis()->SetTitle(axtitle);
161 fHist_perfstat_event->SetMarkerStyle(7);
162 if ((o = fListPerfPlots->FindObject(name))) {
163 fListPerfPlots->Remove(o);
164 delete o;
165 }
167
168 // Book normalized perfstat profile (max evts)
169 name.Form("Norm_%s_PS_MaxEvts_%s", namelab.Data(), sellab.Data());
170 title.Form("Profile %s Normalized PerfStat Event - %s", namelab.Data(), sellab.Data());
171 fNorm_perfstat_evtmax = new TProfile(name, title, ndiv, ns_min, ns_max);
173 fNorm_perfstat_evtmax->GetYaxis()->SetTitle("Events/sec");
174 fNorm_perfstat_evtmax->GetXaxis()->SetTitle(axtitle);
175 fNorm_perfstat_evtmax->SetMarkerStyle(23);
176 fNorm_perfstat_evtmax->SetMarkerColor(2);
177 if ((o = fListPerfPlots->FindObject(name))) {
178 fListPerfPlots->Remove(o);
179 delete o;
180 }
182 fNormLegend->AddEntry(fNorm_perfstat_evtmax, "Maximum");
183
184 // Book queryresult profile
185 name.Form("Prof_%s_QR_Evts_%s", namelab.Data(), sellab.Data());
186 title.Form("Profile %s QueryResult Event - %s", namelab.Data(), sellab.Data());
187 fProfile_queryresult_event = new TProfile(name, title, ndiv, ns_min, ns_max);
189 fProfile_queryresult_event->GetYaxis()->SetTitle("Events/sec");
190 fProfile_queryresult_event->GetXaxis()->SetTitle(axtitle);
191 fProfile_queryresult_event->SetMarkerStyle(22);
192 if ((o = fListPerfPlots->FindObject(name))) {
193 fListPerfPlots->Remove(o);
194 delete o;
195 }
197
198 // Book normalized queryresult profile
199 name.Form("Norm_%s_QR_Evts_%s", namelab.Data(), sellab.Data());
200 title.Form("Profile %s Normalized QueryResult Event - %s", namelab.Data(), sellab.Data());
201 fNorm_queryresult_event = new TProfile(name, title, ndiv, ns_min, ns_max);
203 fNorm_queryresult_event->GetYaxis()->SetTitle("Events/sec");
204 fNorm_queryresult_event->GetXaxis()->SetTitle(axtitle);
205 fNorm_queryresult_event->SetMarkerStyle(22);
206 if ((o = fListPerfPlots->FindObject(name))) {
207 fListPerfPlots->Remove(o);
208 delete o;
209 }
211 fNormLegend->AddEntry(fNorm_queryresult_event, "Average");
212
213 // Book CPU efficiency profile
214 name.Form("Prof_%s_CPU_eff_%s", namelab.Data(), sellab.Data());
215 title.Form("Profile %s CPU efficiency - %s", namelab.Data(), sellab.Data());
216 fProfile_cpu_eff = new TProfile(name, title, ndiv, ns_min, ns_max);
217 fProfile_cpu_eff->SetDirectory(fDirProofBench);
218 fProfile_cpu_eff->GetYaxis()->SetTitle("Efficiency");
219 fProfile_cpu_eff->GetXaxis()->SetTitle(axtitle);
220 fProfile_cpu_eff->SetMarkerStyle(22);
221 if ((o = fListPerfPlots->FindObject(name))) {
222 fListPerfPlots->Remove(o);
223 delete o;
224 }
226}
227
228////////////////////////////////////////////////////////////////////////////////
229/// Run benchmark
230/// Input parameters
231/// nevents: Number of events to run per file. When it is -1, use data member fNEvents.
232/// start: Start scan with 'start' workers. When it is -1, use data member fStart.
233/// When 0, the same number of workers are activated on all nodes.
234/// stop: Stop scan at 'stop' workers. When it is -1 , use data member fStop.
235/// step: Scan every 'step' workers. When it is -1, use data member fStep.
236/// ntries: Number of repetitions. When it is -1, use data member fNTries.
237/// debug: debug switch. When it is -1, use data member fDebug.
238/// draw: draw switch. When it is -1, use data member fDraw.
239/// Returns
240/// Nothing
241
242void TProofBenchRunCPU::Run(Long64_t nevents, Int_t start, Int_t stop,
243 Int_t step, Int_t ntries, Int_t debug, Int_t draw)
244{
245 if (!fProof){
246 Error("Run", "Proof not set");
247 return;
248 }
249
250 nevents = (nevents == -1) ? fNEvents : nevents;
251 start = (start == -1) ? fStart : start;
252 stop = (stop == -1) ? fStop : stop;
253 step = (step == -1) ? fStep : step;
254 ntries = (ntries == -1) ? fNTries : ntries;
255 debug = (debug == -1) ? fDebug : debug;
256 draw = (draw == -1) ? fDraw : draw;
257
258 Bool_t nx = kFALSE;
259 if (step == -2){
260 nx = kTRUE;
261 start = fStart;
262 step = 1;
263 }
264
265 if (nx){
266 Int_t minnworkersanode = fNodes->GetMinWrksPerNode();
267 if (stop > minnworkersanode) stop = minnworkersanode;
268 }
269
270 // Load the selector, if needed
272 // Is it the default selector?
274 // Load the parfile
276 Info("Run", "Uploading '%s' ...", par.Data());
277 if (fProof->UploadPackage(par) != 0) {
278 Error("Run", "problems uploading '%s' - cannot continue", par.Data());
279 return;
280 }
281 Info("Run", "Enabling '%s' ...", kPROOF_BenchCPUSelPar);
282 if (fProof->EnablePackage(kPROOF_BenchCPUSelPar) != 0) {
283 Error("Run", "problems enabling '%s' - cannot continue", kPROOF_BenchCPUSelPar);
284 return;
285 }
286 } else {
287 if (fParList.IsNull()) {
288 Error("Run", "you should load the class '%s' before running the benchmark", fSelName.Data());
289 return;
290 } else {
291 TString par;
292 Int_t from = 0;
293 while (fParList.Tokenize(par, from, ",")) {
294 Info("Run", "Uploading '%s' ...", par.Data());
295 if (fProof->UploadPackage(par) != 0) {
296 Error("Run", "problems uploading '%s' - cannot continue", par.Data());
297 return;
298 }
299 Info("Run", "Enabling '%s' ...", par.Data());
300 if (fProof->EnablePackage(par) != 0) {
301 Error("Run", "problems enabling '%s' - cannot continue", par.Data());
302 return;
303 }
304 }
305 }
306 }
307 // Check
309 Error("Run", "failed to load '%s'", fSelName.Data());
310 return;
311 }
312 }
313
314 // Build histograms, profiles and graphs needed for this run
315 BuildHistos(start, stop, step, nx);
316
317 // Get pad
318 if (!fCanvas) fCanvas = new TCanvas("Canvas");
319 // Cleanup up the canvas
320 fCanvas->Clear();
321
322 // Divide the canvas as many as the number of profiles in the list
323 fCanvas->Divide(2,1);
324
325 TString perfstats_name = "PROOF_PerfStats";
326
328
329 if (nx){
330 Info("Run", "Running CPU-bound tests; %d ~ %d active worker(s)/node,"
331 " every %d worker(s)/node.", start, stop, step);
332 } else {
333 Info("Run", "Running CPU-bound tests; %d ~ %d active worker(s),"
334 " every %d worker(s).", start, stop, step);
335 }
336
337 Int_t npad = 1; //pad number
338
339 Int_t nnodes = fNodes->GetNNodes(); // Number of machines
340 Int_t ncores = fNodes->GetNCores(); // Number of cores
341
342 Double_t ymi = -1., ymx = -1., emx = -1.;
343 for (Int_t nactive = start; nactive <= stop; nactive += step) {
344
345 // For CPU effectiveness (ok for lite; should do it properly for standard clusters)
346 Int_t ncoren = (nactive < ncores) ? nactive : ncores;
347
348 // Actvate the wanted workers
349 Int_t nw = -1;
350 if (nx) {
351 TString workers;
352 workers.Form("%dx", nactive);
353 nw = fNodes->ActivateWorkers(workers);
354 } else {
355 nw = fNodes->ActivateWorkers(nactive);
356 }
357 if (nw < 0){
358 Error("Run", "could not activate the requested number of"
359 " workers/node on the cluster; skipping the test point"
360 " (%d workers/node)", nactive);
361 continue;
362 }
363
364 for (Int_t j = 0; j < ntries; j++) {
365
366 if (nx){
367 Info("Run", "Running CPU-bound tests with %d active worker(s)/node;"
368 " trial %d/%d", nactive, j + 1, ntries);
369 } else {
370 Info("Run", "Running CPU-bound tests with %d active worker(s);"
371 " trial %d/%d", nactive, j + 1, ntries);
372 }
373
374 Int_t nevents_all=0;
375 if (nx){
376 nevents_all=nevents*nactive*nnodes;
377 } else {
378 nevents_all=nevents*nactive;
379 }
380
381 // Process
382 fProof->Process(fSelName, nevents_all, fSelOption);
383
384 TList *l = fProof->GetOutputList();
385
386 // Save perfstats
387 TTree *t = 0;
388 if (l) t = dynamic_cast<TTree*>(l->FindObject(perfstats_name.Data()));
389 if (t) {
390
391 //FillPerfStatPerfPlots(t, profile_perfstat_event, nactive);
392 FillPerfStatPerfPlots(t, nactive);
393
394 TProofPerfAnalysis pfa(t);
395 Double_t pf_eventrate = pfa.GetEvtRateAvgMax();
396// if (pf_eventrate > emx) emx = pf_eventrate;
397 fProfile_perfstat_evtmax->Fill(nactive, pf_eventrate);
398 fCanvas->cd(npad);
399 fProfile_perfstat_evtmax->SetMaximum(emx*1.6);
400 fProfile_perfstat_evtmax->SetMinimum(0.);
401 fProfile_perfstat_evtmax->Draw("L");
402 fProfLegend->Draw();
403 gPad->Update();
404 // The normalised histos
405 // Use the first bin to set the Y range for the histo
406 Double_t nert = nx ? pf_eventrate/nactive/nnodes : pf_eventrate/nactive;
407 fNorm_perfstat_evtmax->Fill(nactive, nert);
408 Double_t y1 = fNorm_perfstat_evtmax->GetBinContent(1);
409 Double_t e1 = fNorm_perfstat_evtmax->GetBinError(1);
410 Double_t dy = 5 * e1;
411 if (dy / y1 < 0.2) dy = y1 * 0.2;
412 if (dy > y1) dy = y1*.999999;
413 if (ymi < 0.) ymi = y1 - dy;
414 if (fNorm_perfstat_evtmax->GetBinContent(nactive) < ymi)
415 ymi = fNorm_perfstat_evtmax->GetBinContent(nactive) / 2.;
416 if (ymx < 0.) ymx = y1 + dy;
417 if (fNorm_perfstat_evtmax->GetBinContent(nactive) > ymx)
418 ymx = fNorm_perfstat_evtmax->GetBinContent(nactive) * 1.5;
419 fNorm_perfstat_evtmax->SetMaximum(ymx);
420 fNorm_perfstat_evtmax->SetMinimum(ymi);
421 fCanvas->cd(npad + 1);
422 fNorm_perfstat_evtmax->Draw("L");
423 fNormLegend->Draw();
424 gPad->Update();
425
426 // Build up new name
427 TString newname = TString::Format("%s_%s_%dwrks%dthtry", t->GetName(), GetName(), nactive, j);
428 t->SetName(newname);
429
430 if (debug && fDirProofBench->IsWritable()){
431 TDirectory *curdir = gDirectory;
432 TString dirn = nx ? "RunCPUx" : "RunCPU";
433 if (!fDirProofBench->GetDirectory(dirn))
434 fDirProofBench->mkdir(dirn, "RunCPU results");
435 if (fDirProofBench->cd(dirn)) {
437 t->Write();
438 l->Remove(t);
439 } else {
440 Warning("Run", "cannot cd to subdirectory '%s' to store the results!", dirn.Data());
441 }
442 curdir->cd();
443 }
444
445 } else {
446 if (l)
447 Warning("Run", "%s: tree not found", perfstats_name.Data());
448 else
449 Error("Run", "PROOF output list is empty!");
450 }
451
452 // Performance measures from TQueryResult
453
454 const char *drawopt = t ? "LSAME" : "L";
455 TQueryResult *queryresult = fProof->GetQueryResult();
456 if (queryresult) {
457 queryresult->Print("F");
458 TDatime qr_start = queryresult->GetStartTime();
459 TDatime qr_end = queryresult->GetEndTime();
460 Float_t qr_proc = queryresult->GetProcTime();
461
462 Long64_t qr_entries = queryresult->GetEntries();
463
464 // Calculate event rate
465 Double_t qr_eventrate = qr_entries / Double_t(qr_proc);
466 if (qr_eventrate > emx) emx = qr_eventrate;
467
468 // Calculate and fill CPU efficiency
469 Float_t qr_cpu_eff = -1.;
470 if (qr_proc > 0.) {
471 qr_cpu_eff = queryresult->GetUsedCPU() / ncoren / qr_proc ;
472 fProfile_cpu_eff->Fill(nactive, qr_cpu_eff);
473 Printf("cpu_eff: %f", qr_cpu_eff);
474 }
475
476 // Fill and draw
477 fProfile_queryresult_event->Fill(nactive, qr_eventrate);
478 fCanvas->cd(npad);
479 fProfile_queryresult_event->Draw(drawopt);
480 fProfLegend->Draw();
481 gPad->Update();
482 // The normalised histo
483 Double_t nert = nx ? qr_eventrate/nactive/nnodes : qr_eventrate/nactive;
484 fNorm_queryresult_event->Fill(nactive, nert);
485 // Use the first bin to set the Y range for the histo
486 Double_t y1 = fNorm_queryresult_event->GetBinContent(1);
487 Double_t e1 = fNorm_queryresult_event->GetBinError(1);
488 Double_t dy = 5 * e1;
489 if (dy / y1 < 0.2) dy = y1 * 0.2;
490 if (dy > y1) dy = y1*.999999;
491 if (ymi < 0.) ymi = y1 - dy;
492 if (fNorm_queryresult_event->GetBinContent(nactive) < ymi)
493 ymi = fNorm_queryresult_event->GetBinContent(nactive) / 2.;
494 if (ymx < 0.) ymx = y1 + dy;
495 if (fNorm_queryresult_event->GetBinContent(nactive) > ymx)
496 ymx = fNorm_queryresult_event->GetBinContent(nactive) * 1.5;
497 fNorm_queryresult_event->SetMaximum(ymx);
498// fNorm_queryresult_event->SetMinimum(ymi);
499 fNorm_queryresult_event->SetMinimum(0.);
500 fCanvas->cd(npad+1);
501 fNorm_queryresult_event->Draw(drawopt);
502 fNormLegend->Draw();
503 } else {
504 Warning("Run", "TQueryResult not found!");
505 }
506 gPad->Update();
507
508 } // for iterations
509 } // for number of workers
510
511 // Make the result persistent
512 fCanvas->cd(npad);
513 fProfile_queryresult_event->SetMaximum(1.6*emx);
514 fProfile_queryresult_event->DrawCopy("L");
515 fProfile_perfstat_evtmax->DrawCopy("LSAME");
516 fProfLegend->Draw();
517 fCanvas->cd(npad + 1);
518 fNorm_queryresult_event->DrawCopy("L");
519 fNorm_perfstat_evtmax->DrawCopy("LSAME");
520 fNormLegend->Draw();
521 gPad->Update();
522
523 //save performance profiles to file
524 if (fDirProofBench && fDirProofBench->IsWritable()){
525 TDirectory *curdir = gDirectory;
526 TString dirn = nx ? "RunCPUx" : "RunCPU";
527 if (!fDirProofBench->GetDirectory(dirn))
528 fDirProofBench->mkdir(dirn, "RunCPU results");
529 if (fDirProofBench->cd(dirn)) {
530 fListPerfPlots->Write(0, kOverwrite);
531 fListPerfPlots->SetOwner(kFALSE);
532 fListPerfPlots->Clear();
533 } else {
534 Warning("Run", "cannot cd to subdirectory '%s' to store the results!", dirn.Data());
535 }
536 curdir->cd();
537 }
538}
539
540////////////////////////////////////////////////////////////////////////////////
541
543{
544 // Fill performance profiles using tree 't'(PROOF_PerfStats).
545 // Input parameters
546 // t: Proof output tree (PROOF_PerfStat) containing performance statistics.
547 // profile: Profile to be filled up with information from tree 't'.
548 // nactive: Number of active workers processed the query.
549 // Return
550 // Nothing
551
552 // find perfstat profile
554 Error("FillPerfStatPerfPlots", "no perfstat profile found");
555 return;
556 }
557
558 // find perfstat histogram
560 Error("FillPerfStatPerfPlots", "no perfstat histogram found");
561 return;
562 }
563
564 // extract timing information
565 TPerfEvent pe;
566 TPerfEvent* pep = &pe;
567 t->SetBranchAddress("PerfEvents",&pep);
568 Long64_t entries = t->GetEntries();
569
570 Double_t event_rate_packet = 0;
571
572 for (Long64_t k=0; k<entries; k++) {
573
574 t->GetEntry(k);
575
576 // Skip information from workers
577 if (pe.fEvtNode.Contains(".")) continue;
578
580 if (pe.fProcTime != 0.0) {
581 event_rate_packet = pe.fEventsProcessed / pe.fProcTime;
582 fHist_perfstat_event->Fill(Double_t(nactive), event_rate_packet);
583 }
584 }
585 }
586
587 return;
588}
589
590////////////////////////////////////////////////////////////////////////////////
591/// Show settings
592
594{
595 Printf("+++ TProofBenchRunCPU +++++++++++++++++++++++++++++++++++++++++");
596 Printf("Name = %s", fName.Data());
597 if (fProof) fProof->Print(option);
598 Printf("fHistType = k%s", GetNameStem().Data());
599 Printf("fNHists = %d", fNHists);
600 Printf("fNEvents = %lld", fNEvents);
601 Printf("fNTries = %d", fNTries);
602 Printf("fStart = %d", fStart);
603 Printf("fStop = %d", fStop);
604 Printf("fStep = %d", fStep);
605 Printf("fDraw = %d", fDraw);
606 Printf("fDebug = %d", fDebug);
607 if (fDirProofBench)
608 Printf("fDirProofBench = %s", fDirProofBench->GetPath());
609 if (fNodes) fNodes->Print(option);
611 if (fCanvas)
612 Printf("Performance Canvas: Name = %s Title = %s",
613 fCanvas->GetName(), fCanvas->GetTitle());
614 Printf("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
615}
616
617////////////////////////////////////////////////////////////////////////////////
618/// Draw Performance plots
619
621{
622 // Get canvas
623 if (!fCanvas) fCanvas = new TCanvas("Canvas");
624
625 fCanvas->Clear();
626
627 // Divide the canvas as many as the number of profiles in the list
628 Int_t nprofiles = fListPerfPlots->GetSize();
629 if (nprofiles <= 2){
630 fCanvas->Divide(1,nprofiles);
631 } else {
632 Int_t nside = (Int_t)TMath::Sqrt((Float_t)nprofiles);
633 nside = (nside*nside<nprofiles)?nside+1:nside;
634 fCanvas->Divide(nside,nside);
635 }
636
637 Int_t npad=1;
639 TProfile* profile=0;
640 while ((profile=(TProfile*)(nxt()))){
641 fCanvas->cd(npad++);
642 profile->Draw();
643 gPad->Update();
644 }
645 return;
646}
647
648////////////////////////////////////////////////////////////////////////////////
649/// Set histogram type
650
652{
653 fHistType = histtype;
654 fName.Form("%sCPU", GetNameStem().Data());
655}
656
657////////////////////////////////////////////////////////////////////////////////
658/// Get name for this run
659
661{
662 TString namestem("+++undef+++");
663 if (fHistType) {
664 switch (fHistType->GetType()) {
666 namestem = "Hist1D";
667 break;
669 namestem = "Hist2D";
670 break;
672 namestem = "Hist3D";
673 break;
675 namestem = "HistAll";
676 break;
677 default:
678 break;
679 }
680 }
681 return namestem;
682}
683
684////////////////////////////////////////////////////////////////////////////////
685/// Set parameters
686
688{
689 if (!fProof) {
690 Error("SetParameters", "proof not set; Doing nothing");
691 return 1;
692 }
693
695 fProof->AddInput(fHistType);
696 fProof->SetParameter("PROOF_BenchmarkNHists", fNHists);
697 fProof->SetParameter("PROOF_BenchmarkDraw", Int_t(fDraw));
698 return 0;
699}
700
701////////////////////////////////////////////////////////////////////////////////
702/// Delete parameters set for this run
703
705{
706 if (!fProof){
707 Error("DeleteParameters", "proof not set; Doing nothing");
708 return 1;
709 }
710 if (fProof->GetInputList()) {
711 TObject *type = fProof->GetInputList()->FindObject("PROOF_Benchmark_HistType");
712 if (type) fProof->GetInputList()->Remove(type);
713 }
714 fProof->DeleteParameters("PROOF_BenchmarkNHists");
715 fProof->DeleteParameters("PROOF_BenchmarkDraw");
716 return 0;
717}
718
#define SafeDelete(p)
Definition RConfig.hxx:517
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
long long Long64_t
Definition RtypesCore.h:80
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
#define gDirectory
Definition TDirectory.h:384
R__EXTERN TEnv * gEnv
Definition TEnv.h:170
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char y1
char name[80]
Definition TGX11.cxx:110
const char *const kPROOF_BenchCPUSelPar
const char *const kPROOF_BenchSelCPUDef
const char *const kPROOF_BenchParDir
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
Definition TString.cxx:2503
R__EXTERN TStyle * gStyle
Definition TStyle.h:433
#define gPad
The Canvas class.
Definition TCanvas.h:23
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:2969
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition TDatime.h:37
Describe directory structure in memory.
Definition TDirectory.h:45
virtual Bool_t cd()
Change current directory to "this" directory.
void Draw(Option_t *option="") override
Draw this histogram with options.
Definition TH1.cxx:3066
2-D histogram with a double per channel (see TH1 documentation)
Definition TH2.h:357
This class displays a legend box (TPaveText) containing several legend entries.
Definition TLegend.h:23
A doubly linked list.
Definition TList.h:38
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:196
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:973
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:987
@ kOverwrite
overwrite existing object with same name
Definition TObject.h:92
TObject()
TObject constructor.
Definition TObject.h:251
@ kInvalidObject
if object ctor succeeded but object should not be used
Definition TObject.h:72
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition TObject.cxx:961
TString fEvtNode
Definition TPerfStats.h:42
TVirtualPerfStats::EEventType fType
Definition TPerfStats.h:44
Double_t fProcTime
Definition TPerfStats.h:54
Long64_t fEventsProcessed
Definition TPerfStats.h:50
Profile Histogram.
Definition TProfile.h:32
CPU-intensive PROOF benchmark test generates events and fill 1, 2, or 3-D histograms.
TString GetNameStem() const
Get name for this run.
void FillPerfStatPerfPlots(TTree *t, Int_t nactive)
TDirectory * fDirProofBench
Int_t DeleteParameters()
Delete parameters set for this run.
const char * GetName() const override
Returns name of object.
Int_t SetParameters()
Set parameters.
TProfile * fProfile_queryresult_event
void BuildHistos(Int_t start, Int_t stop, Int_t step, Bool_t nx)
Build histograms, profiles and graphs needed for this run.
TProfile * fNorm_queryresult_event
TProfile * fProfile_perfstat_evtmax
~TProofBenchRunCPU() override
Destructor.
TProfile * fNorm_perfstat_evtmax
TProfile * fProfile_cpu_eff
void DrawPerfPlots()
Draw Performance plots.
void Print(Option_t *option="") const override
Show settings.
TPBHistType * fHistType
TProfile * fProfile_perfstat_event
void Run(Long64_t nevents, Int_t start, Int_t stop, Int_t step, Int_t ntries, Int_t debug, Int_t draw) override
Run benchmark Input parameters nevents: Number of events to run per file.
void SetHistType(TPBHistType *histtype)
Set histogram type.
TProofBenchRunCPU(TPBHistType *histtype=0, Int_t nhists=16, TDirectory *dirproofbench=0, TProof *proof=0, TProofNodes *nodes=0, Long64_t nevents=1000000, Int_t ntries=2, Int_t start=1, Int_t stop=-1, Int_t step=1, Int_t draw=0, Int_t debug=0)
Default constructor.
TProofBenchRun(TProof *proof=0, const char *sel=0)
Constructor: check PROOF and load selectors PAR.
virtual const char * GetSelName()
PROOF worker node information.
Definition TProofNodes.h:28
Set of tools to analyse the performance tree.
Double_t GetEvtRateAvgMax() const
This class controls a Parallel ROOT Facility, PROOF, cluster.
Definition TProof.h:316
A container class for query results.
Long64_t GetEntries() const
TDatime GetEndTime() const
TDatime GetStartTime() const
Float_t GetProcTime() const
void Print(Option_t *opt="") const override
Print query content. Use opt = "F" for a full listing.
Float_t GetUsedCPU() const
static const TString & GetEtcDir()
Get the sysconfig directory in the installation. Static utility function.
Definition TROOT.cxx:3080
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
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:2378
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2356
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:632
A TTree represents a columnar dataset.
Definition TTree.h:79
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
Definition TTree.cxx:5638
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=nullptr)
Change branch address, dealing with clone trees properly.
Definition TTree.cxx:8380
virtual void SetDirectory(TDirectory *dir)
Change the tree's directory.
Definition TTree.cxx:8956
virtual Long64_t GetEntries() const
Definition TTree.h:466
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) override
Write this object to the current directory.
Definition TTree.cxx:9743
void SetName(const char *name) override
Change the name of this tree.
Definition TTree.cxx:9195
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:662
TLine l
Definition textangle.C:4