ROOT  6.06/09
Reference Guide
TProofBench.h
Go to the documentation of this file.
1 // @(#)root/proofx:$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 #ifndef ROOT_TProofBench
13 #define ROOT_TProofBench
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TProofBench //
18 // //
19 // Steering class for PROOF benchmarks //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #ifndef ROOT_TObject
24 #include "TObject.h"
25 #endif
26 #ifndef ROOT_TProofBenchTypes
27 #include "TProofBenchTypes.h"
28 #endif
29 #ifndef ROOT_TString
30 #include "TString.h"
31 #endif
32 
33 
34 class TF1;
35 class TFile;
36 class TGraphErrors;
37 class TProfile;
38 class TProof;
39 class TProofBenchRunCPU;
41 class TProofBenchDataSet;
42 
43 class TProofBench : public TObject {
44 
45 private:
46  Bool_t fUnlinkOutfile; // Whether to remove empty output files
47 
48 protected:
49 
50  TProof* fProof; // Proof
51  TProof* fProofDS; // Proof to be used for dataset actions
52  TFile *fOutFile; // Output file
53  TString fOutFileName; // Name of the output file
54  Int_t fNtries; // Number of times a measurement is repeated
55  TPBHistType *fHistType; // Type of histograms for CPU runs
56  Int_t fNHist; // Number of histograms to be created in default CPU runs
57  TPBReadType *fReadType; // Type of read (partial, full)
58  TString fDataSet; // Name of the dataset
59  Int_t fNFilesWrk; // Number of files generated files per worker
60  Int_t fNumWrkMax; // Max number of workers (required for dynamic setups)
61  Bool_t fReleaseCache; // Release cache for data reads between runs
62 
63  TString fCPUSel; // Selector to be used for CPU benchmarks
64  TString fCPUPar; // List of par files to be loaded for CPU benchmarks
65  TString fDataSel; // Selector to be used for data benchmarks
66  TString fDataPar; // List of par files to be loaded for data benchmarks
67  TString fDataGenSel; // Selector to be used for generate data for benchmarks
68  TString fDataGenPar; // List of par files to be loaded to generate data for benchmarks
69  TString fSelOption; // Option field for processing the selector
70 
71  TProofBenchRunCPU *fRunCPU; // Instance to run CPU scans
72  TProofBenchRunDataRead *fRunDS; // Instance to run data-read scans
73  TProofBenchDataSet *fDS; // Instance to handle datasets operations
74 
75  Bool_t fDebug; // Debug switch
76 
77  TNamed *fDescription; // Strings describing the cluster for this test (saved in the output file)
78 
79  static TGraphErrors *GetGraph(TDirectory *d, const char *pfn,
80  Int_t &nb, Double_t &xmi, Double_t &xmx,
81  Double_t &ymi, Double_t &ymx, Int_t &kmx, TProfile *&pf);
82 
83  static TF1 *fgFp1; // Simple 1st degree polynomial
84  static TF1 *fgFp1n; // Normalized 1st degree
85  static TF1 *fgFp2; // Simple 2nd degree polynomial
86  static TF1 *fgFp2n; // Normalized 2nd degree
87  static TF1 *fgFp3; // Function with varying Rcpu
88  static TF1 *fgFp3n; // Normalized Function with varying Rcpu
89 
90  static TF1 *fgFio; // Function used for I/O rate fits
91  static TF1 *fgFioV; // Function used for I/O rate fits with non-constant Rcpu
92 
93  static TList *fgGraphs; // List of TGraphErrors created by Draw actions
94 
95  static void AssertFittingFun(Double_t mi, Double_t mx);
96 
97 public:
98 
99  TProofBench(const char *url, const char *outfile = "<default>", const char *proofopt = 0);
100 
101  virtual ~TProofBench();
102 
103  Int_t RunCPU(Long64_t nevents=-1, Int_t start=-1, Int_t stop=-1, Int_t step=-1);
104  Int_t RunCPUx(Long64_t nevents=-1, Int_t start=-1, Int_t stop=-1);
105  Int_t RunDataSet(const char *dset = "BenchDataSet",
106  Int_t start = 1, Int_t stop = -1, Int_t step = 1);
107  Int_t RunDataSetx(const char *dset = "BenchDataSet", Int_t start = 1, Int_t stop = -1);
108 
109  Int_t CopyDataSet(const char *dset, const char *dsetdst, const char *destdir);
110  Int_t MakeDataSet(const char *dset = 0, Long64_t nevt = -1, const char *fnroot = "event",
111  Bool_t regenerate = kFALSE);
112  Int_t ReleaseCache(const char *dset);
113  Int_t RemoveDataSet(const char *dset);
114 
115  void CloseOutFile();
117  Int_t SetOutFile(const char *outfile, Bool_t verbose = kTRUE);
118  const char *GetOutFileName() const { return fOutFileName; }
119  void SetNFilesWrk(Int_t nf = 0) { fNFilesWrk = (nf > 0) ? nf : 4; }
120  void SetNTries(Int_t nt) { if (nt > 0) fNtries = nt; }
121  void SetHistType(TPBHistType *histtype) { fHistType = histtype; }
122  void SetNHist(Int_t nh) { fNHist = nh; }
123  void SetReadType(TPBReadType *readtype) { fReadType = readtype; }
124  void SetReleaseCache(Bool_t on = kTRUE) { fReleaseCache = on; }
125 
126  void SetCPUSel(const char *sel) { fCPUSel = sel; }
127  void SetCPUPar(const char *par) { fCPUPar = par; }
128  void SetDataSel(const char *sel) { fDataSel = sel; }
129  void SetDataPar(const char *par) { fDataPar = par; }
130  void SetDataGenSel(const char *sel) { fDataGenSel = sel; }
131  void SetDataGenPar(const char *par) { fDataGenPar = par; }
132  void SetSelOption(const char *opt) { fSelOption = opt; }
133 
134  void SetProofDS(TProof *p);
135 
136  void SetDebug(Bool_t debug = kTRUE) { fDebug = debug; }
137 
138  Bool_t GetDebug() { return fDebug; }
139 
140  static void DrawCPU(const char *outfile, const char *opt = "std:", Bool_t verbose = kFALSE,
141  Int_t dofit = 0, Int_t n0 = -1, Int_t n1 = -1);
142  static void DrawDataSet(const char *outfile, const char *opt = "std:", const char *type = "mbs", Bool_t verbose = kFALSE,
143  Int_t dofit = 0, Int_t n0 = -1, Int_t n1 = -1);
144  static void GetPerfSpecs(const char *path = ".", Int_t degfit = 1);
145  static void DrawEfficiency(const char *outfile, const char *opt = "", Bool_t verbose = kFALSE);
146 
147  static TList *GetGraphs() { return fgGraphs; }
148 
149  ClassDef(TProofBench, 0) // Steering class for PROOF benchmarks
150 };
151 
152 #endif
virtual ~TProofBench()
Destructor.
double par[1]
Definition: unuranDistr.cxx:38
const char * GetOutFileName() const
Definition: TProofBench.h:118
long long Long64_t
Definition: RtypesCore.h:69
TProofBenchRunCPU * fRunCPU
Definition: TProofBench.h:71
TProofBench(const char *url, const char *outfile="<default>", const char *proofopt=0)
Constructor: check PROOF and load selectors PAR.
TString fDataPar
Definition: TProofBench.h:66
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.
TPBHistType * fHistType
Definition: TProofBench.h:55
Int_t SetOutFile(const char *outfile, Bool_t verbose=kTRUE)
Set the output file Return 0 on success, -1 on error.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:45
static TF1 * fgFioV
Definition: TProofBench.h:91
void SetReadType(TPBReadType *readtype)
Definition: TProofBench.h:123
static void DrawEfficiency(const char *outfile, const char *opt="", Bool_t verbose=kFALSE)
Draw the efficiency plot.
Basic string class.
Definition: TString.h:137
TNamed * fDescription
Definition: TProofBench.h:77
int Int_t
Definition: RtypesCore.h:41
TString fSelOption
Definition: TProofBench.h:69
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
static TList * GetGraphs()
Definition: TProofBench.h:147
TString fCPUSel
Definition: TProofBench.h:63
Profile Historam.
Definition: TProfile.h:34
void SetSelOption(const char *opt)
Definition: TProofBench.h:132
static TF1 * fgFp2n
Definition: TProofBench.h:86
void SetNTries(Int_t nt)
Definition: TProofBench.h:120
void SetCPUSel(const char *sel)
Definition: TProofBench.h:126
TString fDataSel
Definition: TProofBench.h:65
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.
Int_t RemoveDataSet(const char *dset)
Physically remove the dataset 'dset', i.e.
Int_t fNFilesWrk
Definition: TProofBench.h:59
#define ClassDef(name, id)
Definition: Rtypes.h:254
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.
static TF1 * fgFp3n
Definition: TProofBench.h:88
void SetNFilesWrk(Int_t nf=0)
Definition: TProofBench.h:119
void SetNHist(Int_t nh)
Definition: TProofBench.h:122
void SetDebug(Bool_t debug=kTRUE)
Definition: TProofBench.h:136
Bool_t GetDebug()
Definition: TProofBench.h:138
A doubly linked list.
Definition: TList.h:47
Bool_t fUnlinkOutfile
Definition: TProofBench.h:46
void SetHistType(TPBHistType *histtype)
Definition: TProofBench.h:121
static TF1 * fgFp1n
Definition: TProofBench.h:84
bool verbose
static TF1 * fgFp3
Definition: TProofBench.h:87
static void GetPerfSpecs(const char *path=".", Int_t degfit=1)
Get performance specs.
void SetDataGenSel(const char *sel)
Definition: TProofBench.h:130
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...
TFile * fOutFile
Definition: TProofBench.h:52
void SetProofDS(TProof *p)
Set the PROOF instance to be used for dataset operations, like releasing cache ...
static void AssertFittingFun(Double_t mi, Double_t mx)
Make sure that the fitting functions are defined.
TString fDataGenPar
Definition: TProofBench.h:68
TString fDataGenSel
Definition: TProofBench.h:67
Int_t ReleaseCache(const char *dset)
Release memory cache for dataset 'dset' Return 0 on success, -1 on error.
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. ...
double Double_t
Definition: RtypesCore.h:55
void SetCPUPar(const char *par)
Definition: TProofBench.h:127
static TF1 * fgFio
Definition: TProofBench.h:90
Describe directory structure in memory.
Definition: TDirectory.h:41
Int_t fNumWrkMax
Definition: TProofBench.h:60
TString fDataSet
Definition: TProofBench.h:58
int type
Definition: TGX11.cxx:120
Definition: TProof.h:339
static TF1 * fgFp2
Definition: TProofBench.h:85
Bool_t fReleaseCache
Definition: TProofBench.h:61
TString fCPUPar
Definition: TProofBench.h:64
Int_t OpenOutFile(Bool_t wrt=kFALSE, Bool_t verbose=kTRUE)
Set the otuput file Return 0 on success, -1 on error.
void SetDataPar(const char *par)
Definition: TProofBench.h:129
Bool_t fDebug
Definition: TProofBench.h:75
void SetReleaseCache(Bool_t on=kTRUE)
Definition: TProofBench.h:124
Mother of all ROOT objects.
Definition: TObject.h:58
TProofBenchRunDataRead * fRunDS
Definition: TProofBench.h:72
void SetDataGenPar(const char *par)
Definition: TProofBench.h:131
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
bool debug
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
const Bool_t kTRUE
Definition: Rtypes.h:91
TProof * fProofDS
Definition: TProofBench.h:51
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.
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.
void SetDataSel(const char *sel)
Definition: TProofBench.h:128
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.