submit-nuint09_jobs.pl
Go to the documentation of this file.
1 #!/usr/bin/perl
2 
3 #-----------------------------------------------------------------------
4 # Submit jobs to generate requested samples for the NuINT09 `Confronting
5 # theory, models & data' session organized by S.Dytman and S.Boyd.
6 # Script prepared for the RAL/PPD Tier2 batch farm.
7 #
8 # Syntax:
9 # perl submit-nuint09_jobs.pl <options>
10 #
11 # Options:
12 # --run : Comma separated list of run numbers
13 # --version : GENIE version number
14 # [--nsubruns] : number of subruns per run
15 # [--arch] : <SL4_32bit, SL5_64bit>, default: SL5_64bit
16 # [--production] : production name, default: nuint09_<version>
17 # [--cycle] : cycle in current production, default: 01
18 # [--use-valgrind] : default: off
19 # [--queue] : default: prod
20 # [--softw-topdir] : default: /opt/ppd/t2k/GENIE
21 #
22 # Examples:
23 # perl submit-nuint09_jobs.pl --production nuint09 --cycle 01 --version v2.5.1 --run 1001 --nsubruns 5
24 # perl submit-nuint09_jobs.pl --production nuint09 --cycle 01 --version v2.5.1 --run all --nsubruns 5
25 #
26 # Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
27 # STFC, Rutherford Appleton Lab
28 #----------------------------------------------------------------------
29 #
30 # SAMPLES:
31 #......................................................................
32 # run number | init state | energy | processes
33 # | | (GeV) | enabled
34 # (xx=subrun_id) |
35 #......................................................................
36 #
37 # 1001xx | numu + C12 | 0.5 | COH-CC
38 # 1002xx | numu + C12 | 1.0 | COH-CC
39 # 1003xx | numu + C12 | 1.5 | COH-CC
40 # 1011xx | numu + C12 | 0.5 | COH-NC
41 # 1012xx | numu + C12 | 1.0 | COH-NC
42 # 1013xx | numu + C12 | 1.5 | COH-NC
43 # 2001xx | numu + C12 | 0.5 | QEL-CC
44 # 2002xx | numu + C12 | 1.0 | QEL-CC
45 # 3002xx | numu + C12 | 1.0 | RES-CC
46 # 3003xx | numu + C12 | 1.5 | RES-CC
47 # 9001xx | numu + C12 | 0.5 | CC (all)
48 # 9002xx | numu + C12 | 1.0 | CC (all)
49 # 9003xx | numu + C12 | 1.5 | CC (all)
50 # 9099xx | numu + C12 | 0.1-30. | CC (all)
51 #
52 # 1101xx | numu + O16 | 0.5 | COH-CC
53 # 1102xx | numu + O16 | 1.0 | COH-CC
54 # 1103xx | numu + O16 | 1.5 | COH-CC
55 # 1111xx | numu + O16 | 0.5 | COH-NC
56 # 1112xx | numu + O16 | 1.0 | COH-NC
57 # 1113xx | numu + O16 | 1.5 | COH-NC
58 # 2101xx | numu + O16 | 0.5 | QEL-CC
59 # 2102xx | numu + O16 | 1.0 | QEL-CC
60 # 3102xx | numu + O16 | 1.0 | RES-CC
61 # 3103xx | numu + O16 | 1.5 | RES-CC
62 # 9101xx | numu + O16 | 0.5 | CC (all)
63 # 9102xx | numu + O16 | 1.0 | CC (all)
64 # 9103xx | numu + O16 | 1.5 | CC (all)
65 # 9199xx | numu + O16 | 0.1-30. | CC (all)
66 #
67 # 1201xx | numu + Fe56 | 0.5 | COH-CC
68 # 1202xx | numu + Fe56 | 1.0 | COH-CC
69 # 1203xx | numu + Fe56 | 1.5 | COH-CC
70 # 1211xx | numu + Fe56 | 0.5 | COH-NC
71 # 1212xx | numu + Fe56 | 1.0 | COH-NC
72 # 1213xx | numu + Fe56 | 1.5 | COH-NC
73 # 2201xx | numu + Fe56 | 0.5 | QEL-CC
74 # 2202xx | numu + Fe56 | 1.0 | QEL-CC
75 # 3202xx | numu + Fe56 | 1.0 | RES-CC
76 # 3203xx | numu + Fe56 | 1.5 | RES-CC
77 # 9201xx | numu + Fe56 | 0.5 | CC (all)
78 # 9202xx | numu + Fe56 | 1.0 | CC (all)
79 # 9203xx | numu + Fe56 | 1.5 | CC (all)
80 # 9299xx | numu + Fe56 | 0.1-30 | CC (all)
81 #......................................................................
82 #
83 # run number key: IJKKxx, where
84 #
85 # I : Enabled processes
86 # 1: COHCC,
87 # 2: QELCC,
88 # 3: RESCC,
89 # 9: ALLCC
90 # J : Initial state
91 # 0: nu_mu+C12,
92 # 1: nu_mu+O16,
93 # 2: nu_mu+Fe56
94 # KK : Energy
95 # 01: 0.5 GeV,
96 # 02: 1.0 GeV,
97 # 03: 1.5 GeV,
98 # 99: 0.1 - 30 GeV with 1/E flux
99 # xx : Run id
100 # 01-99, 100k events each
101 #......................................................................
102 #
103 
104 use File::Path;
105 
106 # inputs
107 #
108 $iarg=0;
109 foreach (@ARGV) {
110  if($_ eq '--run') { $runnu = $ARGV[$iarg+1]; }
111  if($_ eq '--nsubruns') { $nsubruns = $ARGV[$iarg+1]; }
112  if($_ eq '--version') { $genie_version = $ARGV[$iarg+1]; }
113  if($_ eq '--arch') { $arch = $ARGV[$iarg+1]; }
114  if($_ eq '--production') { $production = $ARGV[$iarg+1]; }
115  if($_ eq '--cycle') { $cycle = $ARGV[$iarg+1]; }
116  if($_ eq '--use-valgrind') { $use_valgrind = $ARGV[$iarg+1]; }
117  if($_ eq '--queue') { $queue = $ARGV[$iarg+1]; }
118  if($_ eq '--softw-topdir') { $softw_topdir = $ARGV[$iarg+1]; }
119  $iarg++;
120 }
121 die("** Aborting [Undefined benchmark runs #. Use the --run option]")
122 unless defined $runnu;
123 die("** Aborting [Undefined GENIE version. Use the --version option]")
124 unless defined $genie_version;
125 
126 $nsubruns = 1 unless defined $nsubruns;
127 $use_valgrind = 0 unless defined $use_valgrind;
128 $arch = "SL5_64bit" unless defined $arch;
129 $production = "nuint09\_$genie_version" unless defined $production;
130 $cycle = "01" unless defined $cycle;
131 $queue = "prod" unless defined $queue;
132 $softw_topdir = "/opt/ppd/t2k/GENIE" unless defined $softw_topdir;
133 $time_limit = "60:00:00";
134 $genie_setup = "$softw_topdir/builds/$arch/$genie_version-setup";
135 $jobs_dir = "$softw_topdir/scratch/$production\_$cycle";
136 $xspl_file = "$softw_topdir/data/job_inputs/xspl/gxspl-t2k-$genie_version.xml";
137 $mcseed = 210921029;
138 $nev_per_subrun = 100000;
139 
140 %nupdg_hash = (
141  '1001' => '14',
142  '1002' => '14',
143  '1003' => '14',
144  '1011' => '14',
145  '1012' => '14',
146  '1013' => '14',
147  '2001' => '14',
148  '2002' => '14',
149  '3002' => '14',
150  '3003' => '14',
151  '9001' => '14',
152  '9002' => '14',
153  '9003' => '14',
154  '9099' => '14',
155  '1101' => '14',
156  '1102' => '14',
157  '1103' => '14',
158  '1111' => '14',
159  '1112' => '14',
160  '1113' => '14',
161  '2101' => '14',
162  '2102' => '14',
163  '3102' => '14',
164  '3103' => '14',
165  '9101' => '14',
166  '9102' => '14',
167  '9103' => '14',
168  '9199' => '14',
169  '1201' => '14',
170  '1202' => '14',
171  '1203' => '14',
172  '1211' => '14',
173  '1212' => '14',
174  '1213' => '14',
175  '2201' => '14',
176  '2202' => '14',
177  '3202' => '14',
178  '3203' => '14',
179  '9201' => '14',
180  '9202' => '14',
181  '9203' => '14',
182  '9299' => '14'
183 );
184 
185 %tgtpdg_hash = (
186  '1001' => '1000060120',
187  '1002' => '1000060120',
188  '1003' => '1000060120',
189  '1011' => '1000060120',
190  '1012' => '1000060120',
191  '1013' => '1000060120',
192  '2001' => '1000060120',
193  '2002' => '1000060120',
194  '3002' => '1000060120',
195  '3003' => '1000060120',
196  '9001' => '1000060120',
197  '9002' => '1000060120',
198  '9003' => '1000060120',
199  '9099' => '1000060120',
200  '1101' => '1000080160',
201  '1102' => '1000080160',
202  '1103' => '1000080160',
203  '1111' => '1000080160',
204  '1112' => '1000080160',
205  '1113' => '1000080160',
206  '2101' => '1000080160',
207  '2102' => '1000080160',
208  '3102' => '1000080160',
209  '3103' => '1000080160',
210  '9101' => '1000080160',
211  '9102' => '1000080160',
212  '9103' => '1000080160',
213  '9199' => '1000080160',
214  '1201' => '1000260560',
215  '1202' => '1000260560',
216  '1203' => '1000260560',
217  '1211' => '1000260560',
218  '1212' => '1000260560',
219  '1213' => '1000260560',
220  '2201' => '1000260560',
221  '2202' => '1000260560',
222  '3202' => '1000260560',
223  '3203' => '1000260560',
224  '9201' => '1000260560',
225  '9202' => '1000260560',
226  '9203' => '1000260560',
227  '9299' => '1000260560'
228 );
229 
230 %energy_hash = (
231  '1001' => '0.5',
232  '1002' => '1.0',
233  '1003' => '1.5',
234  '1011' => '0.5',
235  '1012' => '1.0',
236  '1013' => '1.5',
237  '2001' => '0.5',
238  '2002' => '1.0',
239  '3002' => '1.0',
240  '3003' => '1.5',
241  '9001' => '0.5',
242  '9002' => '1.0',
243  '9003' => '1.5',
244  '9099' => '0.1,30.0',
245  '1101' => '0.5',
246  '1102' => '1.0',
247  '1103' => '1.5',
248  '1111' => '0.5',
249  '1112' => '1.0',
250  '1113' => '1.5',
251  '2101' => '0.5',
252  '2102' => '1.0',
253  '3102' => '1.0',
254  '3103' => '1.5',
255  '9101' => '0.5',
256  '9102' => '1.0',
257  '9103' => '1.5',
258  '9199' => '0.1,30.0',
259  '1201' => '0.5',
260  '1202' => '1.0',
261  '1203' => '1.5',
262  '1211' => '0.5',
263  '1212' => '1.0',
264  '1213' => '1.5',
265  '2201' => '0.5',
266  '2202' => '1.0',
267  '3202' => '1.0',
268  '3203' => '1.5',
269  '9201' => '0.5',
270  '9202' => '1.0',
271  '9203' => '1.5',
272  '9203' => '0.1,30.0'
273 );
274 
275 %gevgl_hash = (
276  '1001' => 'COH-CC',
277  '1002' => 'COH-CC',
278  '1003' => 'COH-CC',
279  '1011' => 'COH-NC',
280  '1012' => 'COH-NC',
281  '1013' => 'COH-NC',
282  '2001' => 'QEL-CC',
283  '2002' => 'QEL-CC',
284  '3002' => 'RES-CC',
285  '3003' => 'RES-CC',
286  '9001' => 'CC',
287  '9002' => 'CC',
288  '9003' => 'CC',
289  '9099' => 'CC',
290  '1101' => 'COH-CC',
291  '1102' => 'COH-CC',
292  '1103' => 'COH-CC',
293  '1111' => 'COH-NC',
294  '1112' => 'COH-NC',
295  '1113' => 'COH-NC',
296  '2101' => 'QEL-CC',
297  '2102' => 'QEL-CC',
298  '3102' => 'RES-CC',
299  '3103' => 'RES-CC',
300  '9101' => 'CC',
301  '9102' => 'CC',
302  '9103' => 'CC',
303  '9199' => 'CC',
304  '1201' => 'COH-CC',
305  '1202' => 'COH-CC',
306  '1203' => 'COH-CC',
307  '1211' => 'COH-NC',
308  '1212' => 'COH-NC',
309  '1213' => 'COH-NC',
310  '2201' => 'QEL-CC',
311  '2202' => 'QEL-CC',
312  '3202' => 'RES-CC',
313  '3203' => 'RES-CC',
314  '9201' => 'CC',
315  '9202' => 'CC',
316  '9203' => 'CC',
317  '9299' => 'CC'
318 );
319 
320 %fluxopt_hash = (
321  '1001' => '',
322  '1002' => '',
323  '1003' => '',
324  '1011' => '',
325  '1012' => '',
326  '1013' => '',
327  '2001' => '',
328  '2002' => '',
329  '3002' => '',
330  '3003' => '',
331  '9001' => '',
332  '9002' => '',
333  '9003' => '',
334  '9099' => '-f "1/x"',
335  '1101' => '',
336  '1102' => '',
337  '1103' => '',
338  '1111' => '',
339  '1112' => '',
340  '1113' => '',
341  '2101' => '',
342  '2102' => '',
343  '3102' => '',
344  '3103' => '',
345  '9101' => '',
346  '9102' => '',
347  '9103' => '',
348  '9199' => '-f "1/x"',
349  '1201' => '',
350  '1202' => '',
351  '1203' => '',
352  '1211' => '',
353  '1212' => '',
354  '1213' => '',
355  '2201' => '',
356  '2202' => '',
357  '3202' => '',
358  '3203' => '',
359  '9201' => '',
360  '9202' => '',
361  '9203' => '',
362  '9299' => '-f "1/x"'
363 );
364 
365 # make the jobs directory
366 #
367 mkpath ($jobs_dir, {verbose => 1, mode=>0777});
368 
369 print "Input runs: $runnu \n";
370 
371 for my $curr_runnu (keys %gevgl_hash) {
372  #print "Checking benchmark run: ...... $curr_runnu \n";
373 
374  if($runnu=~m/$curr_runnu/ || $runnu eq "all") {
375  print "** submitting run: $curr_runnu \n";
376 
377  #
378  # get runnu-dependent info
379  #
380  $nu = $nupdg_hash {$curr_runnu};
381  $tgt = $tgtpdg_hash {$curr_runnu};
382  $en = $energy_hash {$curr_runnu};
383  $gevgl = $gevgl_hash {$curr_runnu};
384  $fluxopt = $fluxopt_hash {$curr_runnu};
385 
386  #
387  # submit subruns
388  #
389  for($isubrun = 0; $isubrun < $nsubruns; $isubrun++) {
390 
391  $curr_subrunnu = 100 * $curr_runnu + $isubrun;
392 
393  $batch_script = "$jobs_dir/nuint09job-$curr_subrunnu.pbs";
394  $logfile_evgen = "$jobs_dir/nuint09job-$curr_subrunnu.evgen.log";
395  $logfile_conv = "$jobs_dir/nuint09job-$curr_subrunnu.conv.log";
396  $logfile_pbse = "$jobs_dir/nuint09job-$curr_subrunnu.pbs_e.log";
397  $logfile_pbso = "$jobs_dir/nuint09job-$curr_subrunnu.pbs_o.log";
398 
399  $curr_seed = $mcseed + $isubrun;
400  $grep_pipe = "grep -B 20 -A 30 -i \"warn\\|error\\|fatal\"";
401  $valgrind_cmd = "valgrind --tool=memcheck --error-limit=no --leak-check=yes --show-reachable=yes";
402  $evgen_cmd = "gevgen -n $nev_per_subrun -s -e $en -p $nu -t $tgt -r $curr_subrunnu $fluxopt | grep_pipe &> $logfile_evgen";
403  $conv_cmd = "gntpc -f gst -i gntp.$curr_subrunnu.ghep.root | grep -B 100 -A 30 -i \"warn\\|error\\|fatal\" &> $logfile_conv";
404 
405  # create the PBS script
406  #
407  open(PBS, ">$batch_script") or die("Can not create the PBS batch script");
408  print PBS "#!/bin/bash \n";
409  print PBS "#PBS -l cput=$time_limit \n";
410  print PBS "#PBS -o $logfile_pbso \n";
411  print PBS "#PBS -e $logfile_pbse \n";
412  print PBS "source $genie_setup \n";
413  print PBS "cd $jobs_dir \n";
414  print PBS "export GSPLOAD=$xspl_file \n";
415  print PBS "export GEVGL=$gevgl \n";
416  print PBS "export GSEED=$curr_seed \n";
417  print PBS "$evgen_cmd \n";
418  print PBS "$conv_cmd \n";
419 
420  print "EXEC: $evgen_cmd \n";
421 
422  #
423  # submit job
424  #
425  `qsub -q $queue $batch_script`;
426 
427  } #subruns
428 
429  }
430 }