3 #----------------------------------------------------------------------
4 # Submit jobs to generate samples for the Wroclaw '09 Neutrino Winter
5 # School generator comparisons.
6 # Script prepared for the RAL/PPD Tier2 batch farm.
9 # perl submit-wro09_winter_school_jobs.pl <options>
12 # --run : Comma separated list of run numbers
13 # --version : GENIE version number
14 # [--production] : production name
15 # [--cycle] : cycle name
19 # perl submit-wro09_winter_school_jobs.pl --production wroclaw09 --cycle 01 --version v2.5.1 --run 1001
20 # perl submit-wro09_winter_school_jobs.pl --production wroclaw09 --cycle 01 --version v2.5.1 --run all
22 # Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
23 # STFC, Rutherford Appleton Lab
24 #----------------------------------------------------------------------
27 #......................................................................
28 # run | nev | init state | energy | processes
29 # nu. | | | (GeV) | enabled
30 #......................................................................
31 # 1000 | 500k | numu + O16 | 0.6 | all
32 # 1001 | 500k | numu + O16 | 1.0 | all
33 # 1002 | 500k | numu + O16 | 5.0 | all
34 # 1100 | 500k | numu + Ar40 | 0.6 | all
35 # 1101 | 500k | numu + Ar40 | 1.0 | all
36 # 1102 | 500k | numu + Ar40 | 5.0 | all
37 # 1200 | 500k | numu + Fe56 | 0.6 | all
38 # 1201 | 500k | numu + Fe56 | 1.0 | all
39 # 1202 | 500k | numu + Fe56 | 5.0 | all
40 # 2000 | 500k | numubar + O16 | 0.6 | all
41 # 2001 | 500k | numubar + O16 | 1.0 | all
42 # 2002 | 500k | numubar + O16 | 5.0 | all
43 # 2100 | 500k | numubar + Ar40 | 0.6 | all
44 # 2101 | 500k | numubar + Ar40 | 1.0 | all
45 # 2102 | 500k | numubar + Ar40 | 5.0 | all
46 # 2200 | 500k | numubar + Fe56 | 0.6 | all
47 # 2201 | 500k | numubar + Fe56 | 1.0 | all
48 # 2202 | 500k | numubar + Fe56 | 5.0 | all
50 #......................................................................
59 if($_ eq '--run') { $runnu = $ARGV[$iarg+1]; }
60 if($_ eq '--version') { $genie_version = $ARGV[$iarg+1]; }
61 if($_ eq '--production') { $production = $ARGV[$iarg+1]; }
62 if($_ eq '--cycle') { $cycle = $ARGV[$iarg+1]; }
63 if($_ eq '--use-valgrind') { $use_valgrind = $ARGV[$iarg+1]; }
66 die("** Aborting [Undefined benchmark runs #. Use the --run option]")
67 unless defined $runnu;
68 die("** Aborting [Undefined GENIE version. Use the --version option]")
69 unless defined $genie_version;
71 $use_valgrind = 0 unless defined $use_valgrind;
72 $production = "wroclaw\_$genie_version" unless defined $production;
73 $cycle = "01" unless defined $cycle;
76 $time_limit = "30:00:00";
77 $topdir = "/opt/ppd/t2k";
78 $genie_inst_dir = "$topdir/GENIE/";
79 $genie_setup = "$genie_inst_dir/$genie_version-setup";
80 $jobs_dir = "$topdir/GENIE/scratch/$production\_$cycle";
81 $xspl_file = "$topdir/GENIE/data/job_inputs/xspl/gxspl-t2k-$genie_version.xml";
127 '1000' => '1000080160',
128 '1001' => '1000080160',
129 '1002' => '1000080160',
130 '1100' => '1000180400',
131 '1101' => '1000180400',
132 '1102' => '1000180400',
133 '1200' => '1000260560',
134 '1201' => '1000260560',
135 '1202' => '1000260560',
136 '2000' => '1000080160',
137 '2001' => '1000080160',
138 '2002' => '1000080160',
139 '2100' => '1000180400',
140 '2101' => '1000180400',
141 '2102' => '1000180400',
142 '2200' => '1000260560',
143 '2201' => '1000260560',
144 '2202' => '1000260560'
189 # make the jobs directory
191 mkpath ($jobs_dir, {verbose => 1, mode=>0777});
193 print "Input runs: $runnu \n";
195 for my $curr_runnu (keys %gevgl_hash) {
196 print "Checking benchmark run: ...... $curr_runnu \n";
198 if($runnu=~m/$curr_runnu/ || $runnu eq "all") {
199 print "** matched -> submitting job \n";
202 # get runnu-dependent info
204 $nev = $nevents_hash {$curr_runnu};
205 $nu = $nupdg_hash {$curr_runnu};
206 $tgt = $tgtpdg_hash {$curr_runnu};
207 $en = $energy_hash {$curr_runnu};
208 $gevgl = $gevgl_hash {$curr_runnu};
210 $batch_script = "$jobs_dir/wro09job-$curr_runnu.pbs";
211 $logfile_evgen = "$jobs_dir/wro09job-$curr_runnu.evgen.log";
212 $logfile_conv = "$jobs_dir/wro09job-$curr_runnu.conv.log";
213 $logfile_pbse = "$jobs_dir/wro09job-$curr_runnu.pbs_e.log";
214 $logfile_pbso = "$jobs_dir/wro09job-$curr_runnu.pbs_o.log";
216 $grep_pipe = "grep -B 20 -A 30 -i \"warn\\|error\\|fatal\"";
217 $valgrind_cmd = "valgrind --tool=memcheck --error-limit=no --leak-check=yes --show-reachable=yes";
218 $evgen_cmd = "gevgen -n $nev -s -e $en -p $nu -t $tgt -r $curr_runnu | grep_pipe &> $logfile_evgen";
219 $conv_cmd = "gntpc -f gst -i gntp.$curr_runnu.ghep.root | grep -B 100 -A 30 -i \"warn\\|error\\|fatal\" &> $logfile_conv";
221 # create the PBS script
223 open(PBS, ">$batch_script") or die("Can not create the PBS batch script");
224 print PBS "#!/bin/bash \n";
225 print PBS "#PBS -l cput=$time_limit \n";
226 print PBS "#PBS -o $logfile_pbso \n";
227 print PBS "#PBS -e $logfile_pbse \n";
228 print PBS "source $genie_setup \n";
229 print PBS "cd $jobs_dir \n";
230 print PBS "export GSPLOAD=$xspl_file \n";
231 print PBS "export GEVGL=$gevgl \n";
232 print PBS "export GSEED=$mcseed \n";
233 print PBS "$evgen_cmd \n";
234 print PBS "$conv_cmd \n";
236 print "EXEC: $evgen_cmd \n";
240 `qsub -q $queue $batch_script`;