32 TString STAGE[
NSTAGE] = {
"FULL",
"INIT",
"STRAIN",
"CSTRAIN",
"COHERENCE",
"SUPERCLUSTER",
"LIKELIHOOD"};
36 TB.
checkFile(gSystem->Getenv(
"CWB_ROOTLOGON_FILE"));
37 TB.
checkFile(gSystem->Getenv(
"CWB_PARAMETERS_FILE"));
38 TB.
checkFile(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
41 TString cwb_jstage_name =
"FULL";
42 TString cwb_fstage_name =
"FULL";
46 double cwb_bench_min = -1;
47 double cwb_bench_max = -1;
48 int cwb_bench_res = -1;
49 int cwb_bench_factor= -1;
51 if(cwb_bench_opts!=
"") {
57 cwb_fstage_name = option;
58 cwb_fstage_name.ToUpper();
60 for(
int i=0;
i<
NSTAGE;
i++)
if(cwb_fstage_name==STAGE[
i]) bstage=
true;
62 cout <<
"cwb_condor_benchmark.C : fstage " 63 << cwb_fstage_name.Data() <<
" not correct" << endl;
64 cout <<
"select : " << endl;
65 for(
int i=0;i<
NSTAGE;i++) cout << STAGE[i] << endl;
72 cwb_jstage_name = option;
73 cwb_jstage_name.ToUpper();
75 for(
int i=0;
i<
NSTAGE;
i++)
if(cwb_jstage_name==STAGE[
i]) bstage=
true;
77 cout <<
"cwb_condor_benchmark.C : jstage " 78 << cwb_jstage_name.Data() <<
" not correct" << endl;
79 cout <<
"select : " << endl;
80 for(
int i=0;i<
NSTAGE;i++) cout << STAGE[i] << endl;
86 if(option!=
"") cwb_bench_res = option.Atoi();
89 if(option!=
"") cwb_bench_factor = option.Atoi();
93 cwb_bench_name=option;
94 cwb_bench_name.ToUpper();
95 if((cwb_bench_name!=
"MEM") && (cwb_bench_name!=
"JET") &&
96 (cwb_bench_name!=
"JFS") && (cwb_bench_name!=
"SET") &&
97 (cwb_bench_name!=
"PSIZE") && (cwb_bench_name!=
"CSIZE") &&
98 (cwb_bench_name!=
"THR") && (cwb_bench_name!=
"GT")) {
99 cout <<
"cwb_condor_benchmark.C : Error - " 100 <<
"currently only JET/MEM/JFS/SET/THR/PSIZE/CSIZE/GT is implemented" << endl;
104 if((cwb_bench_res>=0) &&
105 (cwb_bench_name!=
"THR")&&(cwb_bench_name!=
"PSIZE")&&(cwb_bench_name!=
"CSIZE")) {
106 cout <<
"cwb_condor_benchmark.C : Error - " 107 <<
"'--res' parm must declared only with bench=THR/PSIZE/CSIZE" << endl;
110 if(((cwb_bench_name==
"THR") &&(cwb_bench_res<0)) ||
111 ((cwb_bench_name==
"PSIZE")&&(cwb_bench_res<0)) ||
112 ((cwb_bench_name==
"CSIZE")&&(cwb_bench_res<0))) {
113 cout <<
"cwb_condor_benchmark.C : Error - " 114 <<
"when bench=THR/PSIZE/CSIZE the '--res' parm must be > 0" << endl;
117 if(((cwb_bench_name==
"THR") &&(cwb_jstage_name!=
"COHERENCE")) ||
118 ((cwb_bench_name==
"PSIZE")&&(cwb_jstage_name!=
"COHERENCE")) ||
119 ((cwb_bench_name==
"GT") &&(cwb_jstage_name!=
"COHERENCE")) ||
120 ((cwb_bench_name==
"CSIZE")&&(cwb_jstage_name!=
"COHERENCE"))) {
121 cout <<
"cwb_condor_benchmark.C : Error - " 122 <<
"bench=THR/PSIZE/CSIZE/GT is available only in COHERENCE stage" << endl;
128 cwb_plot_type=option;
129 cwb_plot_type.ToUpper();
130 if((cwb_plot_type!=
"HIST")&&(cwb_plot_type!=
"GRAPH")&&(cwb_plot_type!=
"HIST2")) {
131 cout <<
"cwb_condor_benchmark.C : currently only HIST/GRAPH/HIST2 is implemented" << endl;
138 cwb_plot_save=option;
139 if(option.EndsWith(
".png")) {
141 if(option.Contains(
"/")) {
142 option.Remove(option.Last(
'/'));
150 if(option!=
"") cwb_bench_min = option.Atof();
153 if(option!=
"") cwb_bench_max = option.Atof();
154 if(cwb_bench_min==0) cwb_bench_min=-1;
155 if(cwb_bench_max==0) cwb_bench_max=-1;
156 if(cwb_bench_min>0 && cwb_bench_max>0 && cwb_bench_min>=cwb_bench_max) {
157 cout <<
"cwb_condor_benchmark.C : Error min must be < max " << endl;
164 if(cwb_bench_name==
"JET") uns =
true;
165 if(cwb_bench_name==
"SET") uns =
true;
166 if(cwb_bench_name==
"JFS") uns =
true;
167 if(cwb_bench_name==
"MEM") uns =
true;
177 if(cwb_bench_name==
"SET") cwb_bench_name =
"JET";}
180 if(cwb_fstage_name==
"INIT") fstage =
"init_";
181 if(cwb_fstage_name==
"STRAIN") fstage =
"strain_";
182 if(cwb_fstage_name==
"CSTRAIN") fstage =
"cstrain_";
183 if(cwb_fstage_name==
"COHERENCE") fstage =
"coherence_";
184 if(cwb_fstage_name==
"SUPERCLUSTER") fstage =
"supercluster_";
185 if(cwb_fstage_name==
"LIKELIHOOD") fstage =
"wave_";
186 if(cwb_fstage_name==
"FULL") fstage =
"wave_";
197 int estat = gSystem->GetPathInfo(condor_dag_file,&
id,&size,&
flags,&mt);
201 cout << endl <<
"cwb_condor_benchmark.C : error - dag file not exist !!!" 202 << endl << condor_dag_file << endl << endl;
203 if (!
online) gSystem->Exit(1);
207 for(
int i=0;i<ncondor_jobs;i++) if(jobList[i]>max_jobid) max_jobid=jobList[
i];
214 if(factor<0)
sprintf(sfactor,
"_n%g_",
fabs(factor));
215 if(factor==0)
sprintf(sfactor,
"_z%g_",factor);
216 if(factor>0)
sprintf(sfactor,
"_p%g_",factor);
220 sprintf(sfactor,
"_%i_",ioffset);
221 }
else sprintf(sfactor,
"_%g_",factor);
227 cout <<
"Starting reading output directory ..." << endl;
230 int nfile = fileList.size();
231 float*
jobId =
new float[nfile];
232 float* istat =
new float[nfile];
233 for(
int n=0;
n<nfile;
n++) {jobId[
n]=
n;istat[
n]=0;}
234 for(
int n=0;
n<nfile;
n++) {
237 if (
n%100==0) cout <<
"cwb_condor benchmark - " <<
n <<
"/" << fileList.size() <<
" files" << endl;
240 cwb_bench_res,cwb_bench_factor,cwb_bench_name);
247 if(cwb_plot_save!=
"") gROOT->SetBatch(
true);
249 canvas =
new TCanvas(
"cwb_condor_benchmark",
"LVC experiment", 300,40, 800, 600);
251 canvas->ToggleEventStatus();
254 canvas->SetFillColor(kWhite);
256 gStyle->SetTitleH(0.050);
257 gStyle->SetTitleW(0.98);
258 gStyle->SetTitleY(0.98);
259 gStyle->SetTitleFont(72);
261 gStyle->SetTitleFillColor(kWhite);
262 gStyle->SetNumberContours(256);
263 gStyle->SetMarkerStyle(7);
264 gStyle->SetMarkerSize(2);
265 gStyle->SetPalette(1,0);
267 if((cwb_bench_name==
"JET")||(cwb_bench_name==
"SET")) {
268 for(
int n=0;
n<nfile;
n++) istat[
n]/=3600.;
270 if(cwb_bench_name==
"JFS") {
271 for(
int n=0;
n<nfile;
n++) istat[
n]/=(1024.*1024.);
273 if((cwb_bench_name==
"THR")&&(cwb_bench_max<=0)) {
274 for(
int n=0;n<nfile;n++) if(istat[n]>50) istat[
n]=50;
278 double istat_min=100000;
280 for(
int n=0;
n<nfile;
n++) {
281 if(istat[
n]>0 && istat[
n]<istat_min) istat_min=istat[
n];
282 if(istat[
n]>0 && istat[
n]>istat_max) istat_max=istat[
n];
284 if(cwb_bench_max>0) istat_max=cwb_bench_max;
289 if(cwb_bench_name==
"SET") ptitle=
"SET - Elapsed Time in Stage "+cwb_jstage_name;
290 if(cwb_bench_name==
"JET") ptitle=
"JET - Job Elapsed Time at the end of Stage "+cwb_jstage_name;
291 if(cwb_bench_name==
"JFS") ptitle=
"JFS - Job File Size at the end of Stage "+cwb_jstage_name;
292 if(cwb_bench_name==
"MEM") ptitle=
"MEM - Virtual Memory used at the end of Stage "+cwb_jstage_name;
293 if(cwb_bench_name==
"THR") {ptitle=cwb_jstage_name+
" - Threshold @ ResolutionID : ";
294 ptitle+=cwb_bench_res;ptitle+=
" & FactorID : ";
295 ptitle+=cwb_bench_factor;}
296 if(cwb_bench_name==
"GT") {ptitle=cwb_jstage_name+
" - Gating Time @ FactorID : ";
297 ptitle+=cwb_bench_factor;}
298 if(cwb_bench_name==
"PSIZE") {ptitle=cwb_jstage_name+
" - Number of pixels per lag @ ResolutionID : ";
299 ptitle+=cwb_bench_res;ptitle+=
" & FactorID : ";
300 ptitle+=cwb_bench_factor;}
301 if(cwb_bench_name==
"CSIZE") {ptitle=cwb_jstage_name+
" - Number of clusters per lag @ ResolutionID : ";
302 ptitle+=cwb_bench_res;ptitle+=
" & FactorID : ";
303 ptitle+=cwb_bench_factor;}
305 if(cwb_bench_name==
"SET") ytitle=
"hour";
306 if(cwb_bench_name==
"JET") ytitle=
"hour";
307 if(cwb_bench_name==
"JFS") ytitle=
"MB";
308 if(cwb_bench_name==
"MEM") ytitle=
"MB";
309 if(cwb_bench_name==
"THR") ytitle=
"energy";
310 if(cwb_bench_name==
"GT") ytitle=
"sec";
311 if(cwb_bench_name==
"PSIZE") ytitle=
"count";
312 if(cwb_bench_name==
"CSIZE") ytitle=
"count";
314 char ofile_name[1024]=
"";
315 if(cwb_plot_save!=
"") {
316 if(cwb_plot_save.EndsWith(
".png")) {
317 sprintf(ofile_name,
"%s",cwb_plot_save.Data());
320 if(cwb_bench_res>=0) {extraLabel+=
"_RESID_";extraLabel+=cwb_bench_res;}
321 if(cwb_bench_factor>=0) {extraLabel+=
"_FACTORID_";extraLabel+=cwb_bench_factor;}
323 sprintf(ofile_name,
"%s/benchmark_%s_%s_%s_%s%s.png",cwb_plot_save.Data(),
data_label,
324 cwb_bench_name.Data(),cwb_jstage_name.Data(),cwb_plot_type.Data(),extraLabel.Data());
328 if(cwb_plot_type==
"GRAPH") {
330 float*
x =
new float[max_jobid+1];
331 float*
y =
new float[max_jobid+1];
332 for(
int n=0;
n<=max_jobid;
n++) {x[
n]=
n;y[
n]=0;}
333 for(
int n=0;
n<nfile;
n++) {
334 if(istat[
n]>0) y[
int(jobId[
n])]=istat[
n];
337 for(
int n=0;
n<=max_jobid;
n++) {
338 if(cwb_bench_name==
"GT") {x[
N]=x[
n];y[
N]=y[
n];N++;}
339 else if(y[
n]>0) {x[
N]=x[
n];y[
N]=y[
n];N++;}
342 gplot =
new TGraph(N,x,y);
343 gplot->SetName(
"benchmark");
344 gplot->SetTitle(
"graph");
345 gplot->SetLineColor(kRed);
346 gplot->SetMarkerColor(kRed);
348 gplot->GetHistogram()->SetXTitle(
"Job id");
349 gplot->GetHistogram()->SetYTitle(ytitle);
350 gplot->SetTitle(ptitle);
351 if(cwb_plot_save!=
"") {
352 cout <<
"cwb_condor_benchmark.C : dump -> " << ofile_name << endl;
353 canvas->Print(ofile_name);
358 if(cwb_plot_type==
"HIST") {
359 if((cwb_bench_name==
"THR")||(cwb_bench_name==
"PSIZE")||(cwb_bench_name==
"CSIZE")||(cwb_bench_name==
"GT")) {
363 hplot =
new TH1F(
"benchmark",
"hist",100,istat_min,istat_max);
364 for(
int n=0;
n<nfile;
n++) {
365 if(cwb_bench_name==
"GT")
hplot->Fill(istat[
n]);
366 else if(istat[n]>0)
hplot->Fill(istat[n]);
369 hplot->SetXTitle(ytitle);
370 hplot->SetYTitle(
"#counts");
371 hplot->SetTitle(ptitle);
372 hplot->SetLineColor(kRed);
373 hplot->SetFillColor(kRed);
374 hplot->GetYaxis()->SetTitleOffset(1.3);
375 if(cwb_plot_save!=
"") {
376 cout <<
"cwb_condor_benchmark.C : dump -> " << ofile_name << endl;
377 canvas->Print(ofile_name);
382 if(cwb_plot_type==
"HIST2") {
384 int NX = sqrt(max_jobid); NX=NX-NX%10;
if(NX==0) NX=max_jobid;
385 int NY = max_jobid/NX;
if(max_jobid%NX) NY+=1;
387 h2plot =
new TH2F(
"benchmark",
"hist2",NX,0,NX,NY,0,NX*NY);
388 for(
int n=0;
n<nfile;
n++) {
389 int job = jobId[
n]-1;
393 if(cwb_bench_max>0)
if(istat[
n]>cwb_bench_max) z=cwb_bench_max;
395 if(istat[
n])
h2plot->Fill(nx,ny,z);
399 char h2title[256];
sprintf(h2title,
" : condor jobs = %d/%d",nfile,ncondor_jobs);
400 h2plot->SetTitle(ptitle+h2title);
403 h2plot->SetYTitle(
"job#");
404 h2plot->SetZTitle(ytitle);
405 h2plot->SetLineColor(kRed);
406 h2plot->SetFillColor(kRed);
407 h2plot->GetYaxis()->SetTitleOffset(1.3);
408 h2plot->GetZaxis()->SetTitleOffset(0.5);
409 h2plot->GetZaxis()->SetRangeUser(0,
int(istat_max)+1);
411 h2plot->GetYaxis()->CenterTitle(
true);
412 h2plot->GetZaxis()->CenterTitle(
true);
413 if(cwb_plot_save!=
"") {
414 cout <<
"cwb_condor_benchmark.C : dump -> " << ofile_name << endl;
415 canvas->Print(ofile_name);
void cwb_condor_benchmark()
char condor_dag_file[1024]
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<< "\ layers : "<< nLAYERS<< "\ dF(hz) : "<< dF<< "\ 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 full_condor_dir[1024]
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)