3 #----------------------------------------------------------------------------------------------------------------
4 # Submit jobs for calculating GENIE x-section splines for all the nuclear targets in T2K
7 # shell% perl submit_t2k_xsec_calc_jobs.pl <options>
10 # --version : GENIE version number
11 # [--arch] : <SL4.x86_32, SL5.x86_64, SL6.x86_64, ...>, default: SL6.x86_64
12 # [--production] : default: <version>
13 # [--cycle] : default: 01
14 # [--use-valgrind] : default: off
15 # [--batch-system] : <PBS, LSF, slurm, HTCondor, HTCondor_PBS, none>, default: PBS
16 # [--queue] : default: prod.
17 # [--softw-topdir] : top level dir for softw installations, default: /opt/ppd/t2k/softw/GENIE/generator
18 # [--jobs-topdir] : top level dir for job files, default: /opt/ppd/t2k/softw/GENIE/scratch
21 # Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
22 # University of Liverpool & STFC Rutherford Appleton Laboratory
25 # Copyright (c) 2003-2020, The GENIE Collaboration
26 # For the full text of the license visit http://copyright.genie-mc.org
27 #----------------------------------------------------------------------------------------------------------------
35 if($_ eq '--version') { $genie_version = $ARGV[$iarg+1]; }
36 if($_ eq '--arch') { $arch = $ARGV[$iarg+1]; }
37 if($_ eq '--production') { $production = $ARGV[$iarg+1]; }
38 if($_ eq '--cycle') { $cycle = $ARGV[$iarg+1]; }
39 if($_ eq '--use-valgrind') { $use_valgrind = $ARGV[$iarg+1]; }
40 if($_ eq '--batch-system') { $batch_system = $ARGV[$iarg+1]; }
41 if($_ eq '--queue') { $queue = $ARGV[$iarg+1]; }
42 if($_ eq '--softw-topdir') { $softw_topdir = $ARGV[$iarg+1]; }
43 if($_ eq '--jobs-topdir') { $jobs_topdir = $ARGV[$iarg+1]; }
46 die("** Aborting [Undefined GENIE version. Use the --version option]")
47 unless defined $genie_version;
49 $use_valgrind = 0 unless defined $use_valgrind;
50 $arch = "SL6.x86_64" unless defined $arch;
51 $production = "$genie_version" unless defined $production;
52 $cycle = "01" unless defined $cycle;
53 $batch_system = "PBS" unless defined $batch_system;
54 $queue = "prod" unless defined $queue;
55 $softw_topdir = "/opt/ppd/t2k/softw/GENIE/generator" unless defined $softw_topdir;
56 $jobs_topdir = "/opt/ppd/t2k/softw/GENIE/scratch" unless defined $jobs_topdir;
58 $genie_setup = "$softw_topdir/builds/$arch/$genie_version-setup";
59 $freenucsplines = "$softw_topdir/data/job_inputs/xspl/gxspl-vN-$genie_version.xml";
60 $jobs_dir = "$jobs_topdir/xsec\_t2k-$production\_$cycle/";
63 $neutrinos = "12,-12,14,-14";
66 'B10' => '1000050100',
67 'B11' => '1000050110',
68 'C12' => '1000060120',
69 'C13' => '1000060130',
70 'N14' => '1000070140',
71 'N15' => '1000070150',
72 'O16' => '1000080160',
73 'O17' => '1000080170',
74 'O18' => '1000080180',
75 'F19' => '1000090190',
76 'Na23' => '1000110230',
77 'Al27' => '1000130270',
78 'Si28' => '1000140280',
79 'Si29' => '1000140290',
80 'Si30' => '1000140300',
81 'Cl35' => '1000170350',
82 'Cl37' => '1000170370',
83 'Ar36' => '1000180360',
84 'Ar38' => '1000180380',
85 'Ar40' => '1000180400',
86 'Ti46' => '1000220460',
87 'Ti47' => '1000220470',
88 'Ti48' => '1000220480',
89 'Ti49' => '1000220490',
90 'Ti50' => '1000220500',
91 'Fe54' => '1000260540',
92 'Fe56' => '1000260560',
93 'Fe57' => '1000260570',
94 'Fe58' => '1000260580',
95 'Co59' => '1000270590',
96 'Cu63' => '1000290630',
97 'Cu65' => '1000290650',
98 'Zn64' => '1000300640',
99 'Zn66' => '1000300660',
100 'Zn67' => '1000300670',
101 'Zn68' => '1000300680',
102 'Zn70' => '1000300700',
103 'Pb204' => '1000822040',
104 'Pb206' => '1000822060',
105 'Pb207' => '1000822070',
106 'Pb208' => '1000822080' );
109 # make the jobs directory
111 mkpath ($jobs_dir, {verbose => 1, mode=>0777});
114 # loop over nuclear targets & submit jobs
116 while( my ($tgt_name, $tgt_code) = each %targets ) {
118 $filename_template = "$jobs_dir/job_$tgt_name";
119 $grep_pipe = "grep -B 100 -A 30 -i \"warn\\|error\\|fatal\"";
120 $cmd = "gmkspl -p $neutrinos -t $tgt_code -n $nkots -e $emax --input-cross-sections $freenucsplines --output-cross-sections gxspl_$tgt_name.xml | $grep_pipe &> $filename_template.mkspl.log";
121 print "@@ exec: $cmd \n";
128 if($batch_system eq 'PBS' || $batch_system eq 'HTCondor_PBS') {
129 $batch_script = "$filename_template.pbs";
130 open(PBS, ">$batch_script") or die("Can not create the PBS batch script");
131 print PBS "#!/bin/bash \n";
132 print PBS "#PBS -N $tgt_name \n";
133 print PBS "#PBS -o $filename_template.pbsout.log \n";
134 print PBS "#PBS -e $filename_template.pbserr.log \n";
135 print PBS "source $genie_setup \n";
136 print PBS "cd $jobs_dir \n";
139 $job_submission_command = "qsub";
140 if($batch_system eq 'HTCondor_PBS') {
141 $job_submission_command = "condor_qsub";
143 `$job_submission_command -q $queue $batch_script`;
147 if($batch_system eq 'LSF') {
148 $batch_script = "$filename_template.sh";
149 open(LSF, ">$batch_script") or die("Can not create the LSF batch script");
150 print LSF "#!/bin/bash \n";
151 print LSF "#BSUB-j $tgt_name \n";
152 print LSF "#BSUB-q $queue \n";
153 print LSF "#BSUB-o $filename_template.pbsout.log \n";
154 print LSF "#BSUB-e $filename_template.pbserr.log \n";
155 print LSF "source $genie_setup \n";
156 print LSF "cd $jobs_dir \n";
159 `bsub < $batch_script`;