14 TString STAGE[
NSTAGE] = {
"FULL",
"INIT",
"STRAIN",
"CSTRAIN",
"COHERENCE",
"SUPERCLUSTER",
"LIKELIHOOD"};
18 TB.
checkFile(gSystem->Getenv(
"CWB_ROOTLOGON_FILE"));
19 TB.
checkFile(gSystem->Getenv(
"CWB_PARAMETERS_FILE"));
20 TB.
checkFile(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
23 TString cwb_jstage_name =
"FULL";
24 TString cwb_fstage_name =
"FULL";
28 double cwb_bench_min = -1;
29 double cwb_bench_max = -1;
30 int cwb_bench_res = -1;
31 int cwb_bench_factor= -1;
33 if(cwb_bench_opts!=
"") {
39 cwb_fstage_name = option;
40 cwb_fstage_name.ToUpper();
42 for(
int i=0;
i<
NSTAGE;
i++)
if(cwb_fstage_name==STAGE[
i]) bstage=
true;
44 cout <<
"cwb_condor_benchmark.C : fstage "
45 << cwb_fstage_name.Data() <<
" not correct" << endl;
46 cout <<
"select : " << endl;
47 for(
int i=0;i<
NSTAGE;i++) cout << STAGE[i] << endl;
54 cwb_jstage_name = option;
55 cwb_jstage_name.ToUpper();
57 for(
int i=0;
i<
NSTAGE;
i++)
if(cwb_jstage_name==STAGE[
i]) bstage=
true;
59 cout <<
"cwb_condor_benchmark.C : jstage "
60 << cwb_jstage_name.Data() <<
" not correct" << endl;
61 cout <<
"select : " << endl;
62 for(
int i=0;i<
NSTAGE;i++) cout << STAGE[i] << endl;
68 if(option!=
"") cwb_bench_res = option.Atoi();
71 if(option!=
"") cwb_bench_factor = option.Atoi();
75 cwb_bench_name=option;
76 cwb_bench_name.ToUpper();
77 if((cwb_bench_name!=
"MEM") && (cwb_bench_name!=
"JET") &&
78 (cwb_bench_name!=
"JFS") && (cwb_bench_name!=
"SET") &&
79 (cwb_bench_name!=
"PSIZE") && (cwb_bench_name!=
"CSIZE") &&
80 (cwb_bench_name!=
"THR") && (cwb_bench_name!=
"GT")) {
81 cout <<
"cwb_condor_benchmark.C : Error - "
82 <<
"currently only JET/MEM/JFS/SET/THR/PSIZE/CSIZE/GT is implemented" << endl;
86 if((cwb_bench_res>=0) &&
87 (cwb_bench_name!=
"THR")&&(cwb_bench_name!=
"PSIZE")&&(cwb_bench_name!=
"CSIZE")) {
88 cout <<
"cwb_condor_benchmark.C : Error - "
89 <<
"'--res' parm must declared only with bench=THR/PSIZE/CSIZE" << endl;
92 if(((cwb_bench_name==
"THR") &&(cwb_bench_res<0)) ||
93 ((cwb_bench_name==
"PSIZE")&&(cwb_bench_res<0)) ||
94 ((cwb_bench_name==
"CSIZE")&&(cwb_bench_res<0))) {
95 cout <<
"cwb_condor_benchmark.C : Error - "
96 <<
"when bench=THR/PSIZE/CSIZE the '--res' parm must be > 0" << endl;
99 if(((cwb_bench_name==
"THR") &&(cwb_jstage_name!=
"COHERENCE")) ||
100 ((cwb_bench_name==
"PSIZE")&&(cwb_jstage_name!=
"COHERENCE")) ||
101 ((cwb_bench_name==
"GT") &&(cwb_jstage_name!=
"COHERENCE")) ||
102 ((cwb_bench_name==
"CSIZE")&&(cwb_jstage_name!=
"COHERENCE"))) {
103 cout <<
"cwb_condor_benchmark.C : Error - "
104 <<
"bench=THR/PSIZE/CSIZE/GT is available only in COHERENCE stage" << endl;
110 cwb_plot_type=option;
111 cwb_plot_type.ToUpper();
112 if((cwb_plot_type!=
"HIST")&&(cwb_plot_type!=
"GRAPH")&&(cwb_plot_type!=
"HIST2")) {
113 cout <<
"cwb_condor_benchmark.C : currently only HIST/GRAPH/HIST2 is implemented" << endl;
120 cwb_plot_save=option;
121 if(option.EndsWith(
".png")) {
123 if(option.Contains(
"/")) {
124 option.Remove(option.Last(
'/'));
132 if(option!=
"") cwb_bench_min = option.Atof();
135 if(option!=
"") cwb_bench_max = option.Atof();
136 if(cwb_bench_min==0) cwb_bench_min=-1;
137 if(cwb_bench_max==0) cwb_bench_max=-1;
138 if(cwb_bench_min>0 && cwb_bench_max>0 && cwb_bench_min>=cwb_bench_max) {
139 cout <<
"cwb_condor_benchmark.C : Error min must be < max " << endl;
146 if(cwb_bench_name==
"JET") uns =
true;
147 if(cwb_bench_name==
"SET") uns =
true;
148 if(cwb_bench_name==
"JFS") uns =
true;
149 if(cwb_bench_name==
"MEM") uns =
true;
159 if(cwb_bench_name==
"SET") cwb_bench_name =
"JET";}
162 if(cwb_fstage_name==
"INIT") fstage =
"init_";
163 if(cwb_fstage_name==
"STRAIN") fstage =
"strain_";
164 if(cwb_fstage_name==
"CSTRAIN") fstage =
"cstrain_";
165 if(cwb_fstage_name==
"COHERENCE") fstage =
"coherence_";
166 if(cwb_fstage_name==
"SUPERCLUSTER") fstage =
"supercluster_";
167 if(cwb_fstage_name==
"LIKELIHOOD") fstage =
"wave_";
168 if(cwb_fstage_name==
"FULL") fstage =
"wave_";
179 int estat = gSystem->GetPathInfo(condor_dag_file,&
id,&size,&
flags,&mt);
183 cout << endl <<
"cwb_condor_benchmark.C : error - dag file not exist !!!"
184 << endl << condor_dag_file << endl << endl;
185 if (!
online) gSystem->Exit(1);
187 int ncondor_jobs = jobList.size();
189 for(
int i=0;i<ncondor_jobs;i++) if(jobList[i]>max_jobid) max_jobid=jobList[
i];
196 if(factor<0)
sprintf(sfactor,
"_n%g_",
fabs(factor));
197 if(factor==0)
sprintf(sfactor,
"_z%g_",factor);
198 if(factor>0)
sprintf(sfactor,
"_p%g_",factor);
202 sprintf(sfactor,
"_%i_",ioffset);
203 }
else sprintf(sfactor,
"_%g_",factor);
209 cout <<
"Starting reading output directory ..." << endl;
212 int nfile = fileList.size();
213 float*
jobId =
new float[nfile];
214 float* istat =
new float[nfile];
215 for(
int n=0;
n<nfile;
n++) {jobId[
n]=
n;istat[
n]=0;}
216 for(
int n=0;
n<nfile;
n++) {
219 if (
n%100==0) cout <<
"cwb_condor benchmark - " <<
n <<
"/" << fileList.size() <<
" files" << endl;
222 cwb_bench_res,cwb_bench_factor,cwb_bench_name);
229 if(cwb_plot_save!=
"") gROOT->SetBatch(
true);
231 canvas =
new TCanvas(
"cwb_condor_benchmark",
"LVC experiment", 300,40, 800, 600);
233 canvas->ToggleEventStatus();
236 canvas->SetFillColor(kWhite);
238 gStyle->SetTitleH(0.050);
239 gStyle->SetTitleW(0.98);
240 gStyle->SetTitleY(0.98);
241 gStyle->SetTitleFont(72);
243 gStyle->SetTitleFillColor(kWhite);
244 gStyle->SetNumberContours(256);
245 gStyle->SetMarkerStyle(7);
246 gStyle->SetMarkerSize(2);
247 gStyle->SetPalette(1,0);
249 if((cwb_bench_name==
"JET")||(cwb_bench_name==
"SET")) {
250 for(
int n=0;
n<nfile;
n++) istat[
n]/=3600.;
252 if(cwb_bench_name==
"JFS") {
253 for(
int n=0;
n<nfile;
n++) istat[
n]/=(1024.*1024.);
255 if((cwb_bench_name==
"THR")&&(cwb_bench_max<=0)) {
256 for(
int n=0;n<nfile;n++) if(istat[n]>50) istat[
n]=50;
260 double istat_min=100000;
262 for(
int n=0;
n<nfile;
n++) {
263 if(istat[
n]>0 && istat[
n]<istat_min) istat_min=istat[
n];
264 if(istat[
n]>0 && istat[
n]>istat_max) istat_max=istat[
n];
266 if(cwb_bench_max>0) istat_max=cwb_bench_max;
271 if(cwb_bench_name==
"SET") ptitle=
"SET - Elapsed Time in Stage "+cwb_jstage_name;
272 if(cwb_bench_name==
"JET") ptitle=
"JET - Job Elapsed Time at the end of Stage "+cwb_jstage_name;
273 if(cwb_bench_name==
"JFS") ptitle=
"JFS - Job File Size at the end of Stage "+cwb_jstage_name;
274 if(cwb_bench_name==
"MEM") ptitle=
"MEM - Virtual Memory used at the end of Stage "+cwb_jstage_name;
275 if(cwb_bench_name==
"THR") {ptitle=cwb_jstage_name+
" - Threshold @ ResolutionID : ";
276 ptitle+=cwb_bench_res;ptitle+=
" & FactorID : ";
277 ptitle+=cwb_bench_factor;}
278 if(cwb_bench_name==
"GT") {ptitle=cwb_jstage_name+
" - Gating Time @ FactorID : ";
279 ptitle+=cwb_bench_factor;}
280 if(cwb_bench_name==
"PSIZE") {ptitle=cwb_jstage_name+
" - Number of pixels per lag @ ResolutionID : ";
281 ptitle+=cwb_bench_res;ptitle+=
" & FactorID : ";
282 ptitle+=cwb_bench_factor;}
283 if(cwb_bench_name==
"CSIZE") {ptitle=cwb_jstage_name+
" - Number of clusters per lag @ ResolutionID : ";
284 ptitle+=cwb_bench_res;ptitle+=
" & FactorID : ";
285 ptitle+=cwb_bench_factor;}
287 if(cwb_bench_name==
"SET") ytitle=
"hour";
288 if(cwb_bench_name==
"JET") ytitle=
"hour";
289 if(cwb_bench_name==
"JFS") ytitle=
"MB";
290 if(cwb_bench_name==
"MEM") ytitle=
"MB";
291 if(cwb_bench_name==
"THR") ytitle=
"energy";
292 if(cwb_bench_name==
"GT") ytitle=
"sec";
293 if(cwb_bench_name==
"PSIZE") ytitle=
"count";
294 if(cwb_bench_name==
"CSIZE") ytitle=
"count";
296 char ofile_name[1024]=
"";
297 if(cwb_plot_save!=
"") {
298 if(cwb_plot_save.EndsWith(
".png")) {
299 sprintf(ofile_name,
"%s",cwb_plot_save.Data());
302 if(cwb_bench_res>=0) {extraLabel+=
"_RESID_";extraLabel+=cwb_bench_res;}
303 if(cwb_bench_factor>=0) {extraLabel+=
"_FACTORID_";extraLabel+=cwb_bench_factor;}
305 sprintf(ofile_name,
"%s/benchmark_%s_%s_%s_%s%s.png",cwb_plot_save.Data(),
data_label,
306 cwb_bench_name.Data(),cwb_jstage_name.Data(),cwb_plot_type.Data(),extraLabel.Data());
310 if(cwb_plot_type==
"GRAPH") {
312 float*
x =
new float[max_jobid+1];
313 float*
y =
new float[max_jobid+1];
314 for(
int n=0;
n<=max_jobid;
n++) {x[
n]=
n;y[
n]=0;}
315 for(
int n=0;
n<nfile;
n++) {
316 if(istat[
n]>0) y[
int(jobId[
n])]=istat[
n];
319 for(
int n=0;
n<=max_jobid;
n++) {
320 if(cwb_bench_name==
"GT") {x[
N]=x[
n];y[
N]=y[
n];N++;}
321 else if(y[
n]>0) {x[
N]=x[
n];y[
N]=y[
n];N++;}
324 gplot =
new TGraph(N,x,y);
325 gplot->SetName(
"benchmark");
326 gplot->SetTitle(
"graph");
327 gplot->SetLineColor(kRed);
328 gplot->SetMarkerColor(kRed);
330 gplot->GetHistogram()->SetXTitle(
"Job id");
331 gplot->GetHistogram()->SetYTitle(ytitle);
332 gplot->SetTitle(ptitle);
333 if(cwb_plot_save!=
"") {
334 cout <<
"cwb_condor_benchmark.C : dump -> " << ofile_name << endl;
335 canvas->Print(ofile_name);
340 if(cwb_plot_type==
"HIST") {
341 if((cwb_bench_name==
"THR")||(cwb_bench_name==
"PSIZE")||(cwb_bench_name==
"CSIZE")||(cwb_bench_name==
"GT")) {
345 hplot =
new TH1F(
"benchmark",
"hist",100,istat_min,istat_max);
346 for(
int n=0;
n<nfile;
n++) {
347 if(cwb_bench_name==
"GT")
hplot->Fill(istat[
n]);
348 else if(istat[n]>0)
hplot->Fill(istat[n]);
351 hplot->SetXTitle(ytitle);
352 hplot->SetYTitle(
"#counts");
353 hplot->SetTitle(ptitle);
354 hplot->SetLineColor(kRed);
355 hplot->SetFillColor(kRed);
356 hplot->GetYaxis()->SetTitleOffset(1.3);
357 if(cwb_plot_save!=
"") {
358 cout <<
"cwb_condor_benchmark.C : dump -> " << ofile_name << endl;
359 canvas->Print(ofile_name);
364 if(cwb_plot_type==
"HIST2") {
366 int NX = sqrt(max_jobid); NX=NX-NX%10;
if(NX==0) NX=max_jobid;
367 int NY = max_jobid/NX;
if(max_jobid%NX) NY+=1;
369 h2plot =
new TH2F(
"benchmark",
"hist2",NX,0,NX,NY,0,NX*NY);
370 for(
int n=0;
n<nfile;
n++) {
371 int job = jobId[
n]-1;
375 if(cwb_bench_max>0)
if(istat[
n]>cwb_bench_max) z=cwb_bench_max;
377 if(istat[
n])
h2plot->Fill(nx,ny,z);
381 char h2title[256];
sprintf(h2title,
" : condor jobs = %d/%d",nfile,ncondor_jobs);
382 h2plot->SetTitle(ptitle+h2title);
385 h2plot->SetYTitle(
"job#");
386 h2plot->SetZTitle(ytitle);
387 h2plot->SetLineColor(kRed);
388 h2plot->SetFillColor(kRed);
389 h2plot->GetYaxis()->SetTitleOffset(1.3);
390 h2plot->GetZaxis()->SetTitleOffset(0.5);
391 h2plot->GetZaxis()->SetRangeUser(0,
int(istat_max)+1);
393 h2plot->GetYaxis()->CenterTitle(
true);
394 h2plot->GetZaxis()->CenterTitle(
true);
395 if(cwb_plot_save!=
"") {
396 cout <<
"cwb_condor_benchmark.C : dump -> " << ofile_name << endl;
397 canvas->Print(ofile_name);
void cwb_condor_benchmark()
cout<< endl;cout<< "ts size = "<< ts.size()<< " ts rate = "<< ts.rate()<< endl;tf.Forward(ts, wdm);int levels=tf.getLevel();cout<< "tf size = "<< tf.size()<< endl;double dF=tf.resolution();double dT=1./(2 *dF);cout<< "rate(hz) : "<< RATE<< "\t layers : "<< nLAYERS<< "\t dF(hz) : "<< dF<< "\t dT(ms) : "<< dT *1000.<< endl;int itime=TIME_PIXEL_INDEX;int ifreq=FREQ_PIXEL_INDEX;int index=(levels+1)*itime+ifreq;double time=itime *dT;double freq=(ifreq >0)?ifreq *dF:dF/4;cout<< endl;cout<< "PIXEL TIME = "<< time<< " sec "<< endl;cout<< "PIXEL FREQ = "<< freq<< " Hz "<< endl;cout<< endl;wavearray< double > x
char condor_dag_file[256]
cout<< "Starting reading output directory ..."<< endl;vector< TString > fileList
double fabs(const Complex &x)
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
char full_condor_dir[512]