submit-wro09_winter_school_jobs.pl
Go to the documentation of this file.
1 #!/usr/bin/perl
2 
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.
7 #
8 # Syntax:
9 # perl submit-wro09_winter_school_jobs.pl <options>
10 #
11 # Options:
12 # --run : Comma separated list of run numbers
13 # --version : GENIE version number
14 # [--production] : production name
15 # [--cycle] : cycle name
16 # [--use-valgrind] :
17 #
18 # Examples:
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
21 #
22 # Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
23 # STFC, Rutherford Appleton Lab
24 #----------------------------------------------------------------------
25 #
26 # SAMPLES:
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
49 #
50 #......................................................................
51 #
52 
53 use File::Path;
54 
55 # inputs
56 #
57 $iarg=0;
58 foreach (@ARGV) {
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]; }
64  $iarg++;
65 }
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;
70 
71 $use_valgrind = 0 unless defined $use_valgrind;
72 $production = "wroclaw\_$genie_version" unless defined $production;
73 $cycle = "01" unless defined $cycle;
74 
75 $queue = "prod";
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";
82 $mcseed = 210921029;
83 
84 %nevents_hash = (
85  '1000' => '500000',
86  '1001' => '500000',
87  '1002' => '100000',
88  '1100' => '500000',
89  '1101' => '500000',
90  '1102' => '100000',
91  '1200' => '500000',
92  '1201' => '500000',
93  '1202' => '100000',
94  '2000' => '500000',
95  '2001' => '500000',
96  '2002' => '100000',
97  '2100' => '500000',
98  '2101' => '500000',
99  '2102' => '100000',
100  '2200' => '500000',
101  '2201' => '500000',
102  '2202' => '100000'
103 );
104 
105 %nupdg_hash = (
106  '1000' => '14',
107  '1001' => '14',
108  '1002' => '14',
109  '1100' => '14',
110  '1101' => '14',
111  '1102' => '14',
112  '1200' => '14',
113  '1201' => '14',
114  '1202' => '14',
115  '2000' => '-14',
116  '2001' => '-14',
117  '2002' => '-14',
118  '2100' => '-14',
119  '2101' => '-14',
120  '2102' => '-14',
121  '2200' => '-14',
122  '2201' => '-14',
123  '2202' => '-14'
124 );
125 
126 %tgtpdg_hash = (
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'
145 );
146 
147 %energy_hash = (
148  '1000' => '0.6',
149  '1001' => '1.0',
150  '1002' => '5.0',
151  '1100' => '0.6',
152  '1101' => '1.0',
153  '1102' => '5.0',
154  '1200' => '0.6',
155  '1201' => '1.0',
156  '1202' => '5.0',
157  '2000' => '0.6',
158  '2001' => '1.0',
159  '2002' => '5.0',
160  '2100' => '0.6',
161  '2101' => '1.0',
162  '2102' => '5.0',
163  '2200' => '0.6',
164  '2201' => '1.0',
165  '2202' => '5.0'
166 );
167 
168 %gevgl_hash = (
169  '1000' => 'Default',
170  '1001' => 'Default',
171  '1002' => 'Default',
172  '1100' => 'Default',
173  '1101' => 'Default',
174  '1102' => 'Default',
175  '1200' => 'Default',
176  '1201' => 'Default',
177  '1202' => 'Default',
178  '2000' => 'Default',
179  '2001' => 'Default',
180  '2002' => 'Default',
181  '2100' => 'Default',
182  '2101' => 'Default',
183  '2102' => 'Default',
184  '2200' => 'Default',
185  '2201' => 'Default',
186  '2202' => 'Default'
187 );
188 
189 # make the jobs directory
190 #
191 mkpath ($jobs_dir, {verbose => 1, mode=>0777});
192 
193 print "Input runs: $runnu \n";
194 
195 for my $curr_runnu (keys %gevgl_hash) {
196  print "Checking benchmark run: ...... $curr_runnu \n";
197 
198  if($runnu=~m/$curr_runnu/ || $runnu eq "all") {
199  print "** matched -> submitting job \n";
200 
201  #
202  # get runnu-dependent info
203  #
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};
209 
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";
215 
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";
220 
221  # create the PBS script
222  #
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";
235 
236  print "EXEC: $evgen_cmd \n";
237 
238  # submit job
239  #
240  `qsub -q $queue $batch_script`;
241  }
242 }