diff --git a/src/scripts/production/batch/README b/src/scripts/production/batch/README index ba05f8835..eec16f033 100644 --- a/src/scripts/production/batch/README +++ b/src/scripts/production/batch/README @@ -1,4 +1,4 @@ - These scripts are used primarily at the RAL/PPD Tier2 batch farm. + These scripts are used primarily at the Liverpool and RAL/PPD Tier2 batch farm. To recycle the scripts at another batch farm, build the following directory structure: @@ -7,17 +7,13 @@ | | | |-- builds/ | | - | |--------- SL6.x86_64 + | |--------- el7.x86_64/ | | | | | |------- directory ( is of type v2.4.4, v2.6.0 etc / multiple versions can exist) | | |------- -setup script (script to fully setup the environment for a specific version of GENIE) | | - | |--------- SL5.x86_64 - | | | - | | |------- .... - | | |------- .... | | - | |--------- / + | |--------- / | | |--- comparisons diff --git a/src/scripts/production/batch/Configuration/copy_dir.pl b/src/scripts/production/batch/rmv/Configuration/copy_dir.pl similarity index 100% rename from src/scripts/production/batch/Configuration/copy_dir.pl rename to src/scripts/production/batch/rmv/Configuration/copy_dir.pl diff --git a/src/scripts/production/batch/xsec_splines/group_spline.pl b/src/scripts/production/batch/rmv/group_spline.pl similarity index 100% rename from src/scripts/production/batch/xsec_splines/group_spline.pl rename to src/scripts/production/batch/rmv/group_spline.pl diff --git a/src/scripts/production/batch/htcondor_exec.sh b/src/scripts/production/batch/rmv/htcondor_exec.sh similarity index 100% rename from src/scripts/production/batch/htcondor_exec.sh rename to src/scripts/production/batch/rmv/htcondor_exec.sh diff --git a/src/scripts/production/batch/xsec_splines/vA_spline_generator.pl b/src/scripts/production/batch/rmv/vA_spline_generator.pl similarity index 100% rename from src/scripts/production/batch/xsec_splines/vA_spline_generator.pl rename to src/scripts/production/batch/rmv/vA_spline_generator.pl diff --git a/src/scripts/production/batch/xsec_splines/vN_spline_generator.pl b/src/scripts/production/batch/rmv/vN_spline_generator.pl similarity index 100% rename from src/scripts/production/batch/xsec_splines/vN_spline_generator.pl rename to src/scripts/production/batch/rmv/vN_spline_generator.pl diff --git a/src/scripts/production/batch/xsec_splines/genie_test.list b/src/scripts/production/batch/spline_lists/genie_test.list similarity index 53% rename from src/scripts/production/batch/xsec_splines/genie_test.list rename to src/scripts/production/batch/spline_lists/genie_test.list index 252a55650..79c4c493c 100644 --- a/src/scripts/production/batch/xsec_splines/genie_test.list +++ b/src/scripts/production/batch/spline_lists/genie_test.list @@ -1,26 +1,26 @@ # -# Specify the set of initial states used for the GENIE MC validation runs so that all necessary -# cross-section splines can be build. Specify the energy range and the number of knots. +# Specify the set of initial states used for the standard GENIE tests # # maximum energy (GeV) -150 +100 # number of knots (logaritmically spaced from threshold to maximum energy) -1000 +100 # list of neutrino PDG codes 12 # nue -12 # nuebar 14 # numu -14 # numubar + 16 # nutau +-16 # nutaubar # list of target PDG codes +1000010020 # H2 1000060120 # C12 1000080160 # O16 -1000100200 # Ne20 -1000130270 # Al27 -1000140300 # Si30 1000180380 # Ar38 1000260560 # Fe56 +1000822080 # Pb208 diff --git a/src/scripts/production/batch/spline_lists/hermes.list b/src/scripts/production/batch/spline_lists/hermes.list new file mode 100644 index 000000000..c3c71f806 --- /dev/null +++ b/src/scripts/production/batch/spline_lists/hermes.list @@ -0,0 +1,22 @@ +# +# Specify all possible initial states requiored for the comparisons to HERMES data +# so that all necessary cross-section splines can be build. +# + +# maximum energy (GeV) +50 + +# number of knots (logaritmically spaced from threshold to maximum energy) +100 + +# list of neutrino PDG codes + 11 # e- +-11 # e+ + +# list of target PDG codes +1000010020 # H2 +1000020040 # He4 +1000070140 # N14 +1000100200 # Ne20 +1000360840 # Kr84 +1000541320 # Xe132 diff --git a/src/scripts/production/batch/xsec_splines/km3net.list b/src/scripts/production/batch/spline_lists/km3net.list similarity index 100% rename from src/scripts/production/batch/xsec_splines/km3net.list rename to src/scripts/production/batch/spline_lists/km3net.list diff --git a/src/scripts/production/batch/xsec_splines/t2k.list b/src/scripts/production/batch/spline_lists/t2k.list similarity index 99% rename from src/scripts/production/batch/xsec_splines/t2k.list rename to src/scripts/production/batch/spline_lists/t2k.list index 44ad95740..a8492d853 100644 --- a/src/scripts/production/batch/xsec_splines/t2k.list +++ b/src/scripts/production/batch/spline_lists/t2k.list @@ -7,7 +7,7 @@ 50 # number of knots (logaritmically spaced from threshold to maximum energy) -400 +100 # list of neutrino PDG codes 12 # nue diff --git a/src/scripts/production/batch/submit.pl b/src/scripts/production/batch/submit.pl deleted file mode 100644 index 472c2216d..000000000 --- a/src/scripts/production/batch/submit.pl +++ /dev/null @@ -1,109 +0,0 @@ -#------------------------------------------------------------------------------------------- -# A script to submit a single job so as to avoid the manual creation of batch script files. -# -# Syntax: -# % perl submit.pl -# -# Options: -# --cmd : Command(s) to execute -# --version : GENIE version number -# [--job-name] : default: tmp-(random_number) -# [--arch] : , default: SL6.x86_64 -# [--production] : default: routine_validation -# [--cycle] : default: 01 -# [--batch-system] : , default: PBS -# [--queue] : default: prod -# [--softw-topdir] : top level dir for softw installations, default: /opt/ppd/t2k/softw/GENIE/ -# [--jobs-topdir] : top level dir for job files, default: /opt/ppd/t2k/softw/scratch/GENIE/ -# -# Example: -# % perl submit.pl -# --cmd 'gevgen -p 14 -t 1000260560 -e 1 --cross-sections /some/path/xsec.xml \ -# --seed 1989298 --r 100; mv gntp.100.ghep.root /some/other/path/' \ -# --version v2.8.0 \ -# --job-name numuFe100 -# -# Author: -# Costas Andreopoulos -# University of Liverpool -# -# Copyright: -# Copyright (c) 2003-2025, The GENIE Collaboration -# For the full text of the license visit http://copyright.genie-mc.org -#------------------------------------------------------------------------------------------- - -#!/usr/bin/perl - -use File::Path; - -$iarg=0; -foreach (@ARGV) { - if($_ eq '--cmd') { $cmd = $ARGV[$iarg+1]; } - if($_ eq '--version') { $genie_version = $ARGV[$iarg+1]; } - if($_ eq '--job-name') { $name = $ARGV[$iarg+1]; } - if($_ eq '--arch') { $arch = $ARGV[$iarg+1]; } - if($_ eq '--production') { $production = $ARGV[$iarg+1]; } - if($_ eq '--cycle') { $cycle = $ARGV[$iarg+1]; } - if($_ eq '--batch-system') { $batch_system = $ARGV[$iarg+1]; } - if($_ eq '--queue') { $queue = $ARGV[$iarg+1]; } - if($_ eq '--softw-topdir') { $softw_topdir = $ARGV[$iarg+1]; } - if($_ eq '--jobs-topdir') { $jobs_topdir = $ARGV[$iarg+1]; } - $iarg++; -} -die("** Aborting [Undefined GENIE command. Use the --cmd option]") -unless defined $cmd; -die("** Aborting [Undefined GENIE version. Use the --version option]") -unless defined $genie_version; - -$random_num = int (rand(999999999)); - -$name = "tmp-$random_num" unless defined $name; -$arch = "SL6.x86_64" unless defined $arch; -$production = "routine_validation" unless defined $production; -$cycle = "01" unless defined $cycle; -$batch_system = "PBS" unless defined $batch_system; -$queue = "prod" unless defined $queue; -$softw_topdir = "/opt/ppd/t2k/softw/GENIE" unless defined $softw_topdir; -$jobs_topdir = "/opt/ppd/t2k/scratch/GENIE/" unless defined $jobs_topdir; -$genie_setup = "$softw_topdir/generator/builds/$arch/$genie_version-setup"; -$job_dir = "$jobs_topdir/$genie_version-$production\_$cycle-$name"; - -# make the job directory -# -mkpath ($job_dir, {verbose => 1, mode=>0777}); - - -# submit job -# - -# PBS case -if($batch_system eq 'PBS') { - $batch_script = "$job_dir/$name.pbs"; - open(PBS, ">$batch_script") or die("Can not create the PBS batch script"); - print PBS "#!/bin/bash \n"; - print PBS "#PBS -N $name \n"; - print PBS "#PBS -o $job_dir/$name.pbsout.log \n"; - print PBS "#PBS -e $job_dir/$name.pbserr.log \n"; - print PBS "source $genie_setup \n"; - print PBS "cd $job_dir \n"; - print PBS "$cmd \n"; - close(PBS); - `qsub -q $queue $batch_script`; -} #PBS - -# LSF case -if($batch_system eq 'LSF') { - $batch_script = "$job_dir/$name.sh"; - open(LSF, ">$batch_script") or die("Can not create the LSF batch script"); - print LSF "#!/bin/bash \n"; - print PBS "#BSUB-j $name \n"; - print LSF "#BSUB-q $queue \n"; - print LSF "#BSUB-o $job_dir/$name.lsfout.log \n"; - print LSF "#BSUB-e $job_dir/$name.lsferr.log \n"; - print LSF "source $genie_setup \n"; - print LSF "cd $job_dir \n"; - print LSF "$cmd \n"; - `bsub < $batch_script`; -} #LSF - - diff --git a/src/scripts/production/batch/bulk_submit.pl b/src/scripts/production/batch/submit_bulk.pl similarity index 52% rename from src/scripts/production/batch/bulk_submit.pl rename to src/scripts/production/batch/submit_bulk.pl index 94b3ec9a1..c1c9555cf 100644 --- a/src/scripts/production/batch/bulk_submit.pl +++ b/src/scripts/production/batch/submit_bulk.pl @@ -2,34 +2,44 @@ # A script to bulk submit other scripts... # # Syntax: -# % perl bulk-submit.pl +# % perl submit_bulk.pl # # Options: -# --cmd : Actual script to execute *including* all fixed arguments -# --arg : "Running" argument -# --min : "Running" argument : minimum value -# --max : "Running" argument : maximum value +# --cmd : Actual script to execute *including* all fixed arguments +# --arg : "Running" argument +# --min : "Running" argument : minimum value +# --max : "Running" argument : maximum value # # Example 1: -# To submit 100 nd280 MC jobs (processing flux files 100-200) using GENIE v2.6.0, type: -# % perl bulk-submit.pl \ -# --cmd 'perl submit-evg_nd280.pl --version v2.6.0' \ +# +# To submit 100 T2K/ND280 MC jobs (processing flux files 100-200) using GENIE v3.06.0, +# type: +# +# % perl submit_bulk.pl \ +# --cmd 'perl submit_mc_jobs_prod_t2k_nd280.pl --gen-version v3.06.00' \ # --arg '--flux-run' \ # --min 100 \ # --max 200 -# See submit-evg_nd280.pl for more nd280 MC job options. +# See submit_mc_jobs_prod_t2k_nd280.pl for more ND280 MC job options. # # Example 2: -# To submit 100 standard `\nu_e signal' SuperK MC jobs using GENIE v2.6.0, type: +# +# To submit 100 standard `\nu_e signal' T2K/SuperK MC jobs using GENIE v3.06.00, +# type: # % perl bulk-submit.pl \ -# --cmd 'perl submit-evg_sk_fhst.pl --neutrino nuesig --version v2.6.0' \ +# --cmd 'perl submit_mc_jobs_prod_t2k_superk_fhst.pl --neutrino nuesig --gen-version v3.06.00' \ # --arg '--run' \ # --min 1 \ # --max 100 -# See submit-evg_sk_fhst.pl for more SuperK MC job options. +# See submit_mc_jobs_prod_t2k_superk_fhst.pl for more SuperK MC job options. +# +# Author: +# Costas Andreopoulos +# University of Liverpool # -# Costas Andreopoulos -# STFC, Rutherford Appleton Lab +# Copyright: +# Copyright (c) 2003-2025, The GENIE Collaboration +# For the full text of the license visit http://copyright.genie-mc.org #------------------------------------------------------------------------------------------- #!/usr/bin/perl diff --git a/src/scripts/production/batch/submit_eA_hadron_attenuation_validation_mc_jobs.pl b/src/scripts/production/batch/submit_eA_hadron_attenuation_validation_mc_jobs.pl deleted file mode 100644 index c00be5fe1..000000000 --- a/src/scripts/production/batch/submit_eA_hadron_attenuation_validation_mc_jobs.pl +++ /dev/null @@ -1,256 +0,0 @@ -#!/usr/bin/perl - -#----------------------------------------------------------------------------------------------------------- -# Submit jobs to generate data needed for validating GENIE's hadronization + intranuclear transport model -# (with emphasis on the modeling of medium effects to the hadronization) in a set of comparisons against -# the CLAS and HERMES nuclear attenuation data. -# -# Syntax: -# perl submit-vld_hadroatten.pl -# -# Options: -# --version : GENIE version number -# --run : runs to submit (eg --run 101102 / --run 101102,154002 / -run all) -# [--model-enum] : physics model enumeration, default: 0 -# [--nsubruns] : number of subruns per run, default: 1 -# [--offset] : subrun offset (for augmenting existing sample), default: 0 -# [--arch] : , default: SL6.x86_64 -# [--production] : production name, default: -# [--cycle] : cycle in current production, default: 01 -# [--use-valgrind] : default: off -# [--batch-system] : , default: PBS -# [--queue] : default: prod -# [--softw-topdir] : top level dir for softw installations, default: /opt/ppd/t2k/softw/GENIE/ -# [--jobs-topdir] : top level dir for job files, default: /opt/ppd/t2k/softw/scratch/GENIE/ -# -# EVENT SAMPLES: -# -# Run number key: ITTJJMxxx -# I : probe (1:e-, 2:e+) -# TT : nuclear target (01:H1, 02:D2, 03:He4, 06:C12, 07:N14, 08:O16, 10:Ne20, 26:Fe56, 36:Kr83, 54:Xe131) -# JJ : flux setting (01: 12.0 GeV [HERMES], 02: 27.6 GeV [HERMES]) -# M : model enumeration -# xxx : sub-run ID, 000-999, 50k events each -# -#................................................................................... -# run number | init state | energy | event gen. | flux -# | | (GeV) | list | -#................................................................................... -# -# 10202Mxxx | e- + D2 | 27.6 | EM | monoenergetic -# 10302Mxxx | e- + He4 | 27.6 | EM | monoenergetic -# 10702Mxxx | e- + N14 | 27.6 | EM | monoenergetic -# 11002Mxxx | e- + Ne20 | 27.6 | EM | monoenergetic -# 13602Mxxx | e- + Kr83 | 27.6 | EM | monoenergetic -# 15402Mxxx | e- + Xe131 | 27.6 | EM | monoenergetic -# -#................................................................................... -# -# Author: -# Costas Andreopoulos -# University of Liverpool -# -# Copyright: -# Copyright (c) 2003-2025, The GENIE Collaboration -# For the full text of the license visit http://copyright.genie-mc.org -#----------------------------------------------------------------------------------------------------------- -# - -use File::Path; - -# inputs -# -$iarg=0; -foreach (@ARGV) { - if($_ eq '--version') { $genie_version = $ARGV[$iarg+1]; } - if($_ eq '--run') { $runnu = $ARGV[$iarg+1]; } - if($_ eq '--model-enum') { $model_enum = $ARGV[$iarg+1]; } - if($_ eq '--nsubruns') { $nsubruns = $ARGV[$iarg+1]; } - if($_ eq '--offset') { $offset = $ARGV[$iarg+1]; } - if($_ eq '--arch') { $arch = $ARGV[$iarg+1]; } - if($_ eq '--production') { $production = $ARGV[$iarg+1]; } - if($_ eq '--cycle') { $cycle = $ARGV[$iarg+1]; } - if($_ eq '--use-valgrind') { $use_valgrind = $ARGV[$iarg+1]; } - if($_ eq '--batch-system') { $batch_system = $ARGV[$iarg+1]; } - if($_ eq '--queue') { $queue = $ARGV[$iarg+1]; } - if($_ eq '--softw-topdir') { $softw_topdir = $ARGV[$iarg+1]; } - if($_ eq '--jobs-topdir') { $jobs_topdir = $ARGV[$iarg+1]; } - $iarg++; -} -die("** Aborting [Undefined GENIE version. Use the --version option]") -unless defined $genie_version; -die("** Aborting [You need to specify which runs to submit. Use the --run option]") -unless defined $runnu; - -$model_enum = "0" unless defined $model_enum; -$nsubruns = 1 unless defined $nsubruns; -$offset = 0 unless defined $offset; -$use_valgrind = 0 unless defined $use_valgrind; -$arch = "SL5_64bit" unless defined $arch; -$production = "$genie_version" unless defined $production; -$cycle = "01" unless defined $cycle; -$batch_system = "PBS" unless defined $batch_system; -$queue = "prod" unless defined $queue; -$softw_topdir = "/opt/ppd/t2k/softw/GENIE" unless defined $softw_topdir; -$jobs_topdir = "/opt/ppd/t2k/scratch/GENIE/" unless defined $jobs_topdir; -$time_limit = "60:00:00"; -$genie_setup = "$softw_topdir/generator/builds/$arch/$genie_version-setup"; -$jobs_dir = "$jobs_topdir/vld\_hadroatten-$production\_$cycle"; -$xspl_file = "$softw_topdir/data/job_inputs/xspl/gxspl-eA-$genie_version.xml"; -$mcseed = 210921029; -$nev_per_subrun = 50000; - -# inputs for event generation jobs -%evg_pdg_hash = ( - '10202' => '11', - '10302' => '11', - '10702' => '11', - '11002' => '11', - '13602' => '11', - '15402' => '11' -); -%evg_tgtpdg_hash = ( - '10202' => '1000010020', - '10302' => '1000020040', - '10702' => '1000070140', - '11002' => '1000100200', - '13602' => '1000360830', - '15402' => '1000541310' -); -%evg_energy_hash = ( - '10202' => '27.6', - '10302' => '27.6', - '10702' => '27.6', - '11002' => '27.6', - '13602' => '27.6', - '15402' => '27.6' -); -%evg_gevgl_hash = ( - '10202' => 'EM', - '10302' => 'EM', - '10702' => 'EM', - '11002' => 'EM', - '13602' => 'EM', - '15402' => 'EM' -); -%evg_fluxopt_hash = ( - '10202' => '', - '10302' => '', - '10702' => '', - '11002' => '', - '13602' => '', - '15402' => '' -); - -# make the jobs directory -# -mkpath ($jobs_dir, {verbose => 1, mode=>0777}); - -# -# submit event generation jobs -# - -# run loop -for my $curr_runnu (keys %evg_gevgl_hash) { - - # check whether to commit current run - if($runnu=~m/$curr_runnu/ || $runnu eq "all") { - - print "** submitting event generation run: $curr_runnu \n"; - - # - # get runnu-dependent info - # - $probe = $evg_pdg_hash {$curr_runnu}; - $tgt = $evg_tgtpdg_hash {$curr_runnu}; - $en = $evg_energy_hash {$curr_runnu}; - $gevgl = $evg_gevgl_hash {$curr_runnu}; - $fluxopt = $evg_fluxopt_hash {$curr_runnu}; - - # submit subruns - for($isubrun = 0; $isubrun < $nsubruns; $isubrun++) { - - # Run number key: ITTJJMxxx - $curr_subrunnu = 10000 * $curr_runnu + 1000 * $model_enum + $isubrun + $offset; - $curr_seed = $mcseed + $isubrun + $offset; - $fntemplate = "$jobs_dir/hadroatten-$curr_subrunnu"; -# $grep_pipe = "grep -B 20 -A 30 -i \"warn\\|error\\|fatal\""; - $grep_pipe = "grep -B 20 -A 30 -i fatal"; - $valgrind_cmd = "valgrind --tool=memcheck --error-limit=no --leak-check=yes --show-reachable=yes"; - $evgen_opt = "-n $nev_per_subrun -e $en -p $probe -t $tgt $fluxopt -r $curr_subrunnu --seed $curr_seed --cross-sections $xspl_file --event-generator-list $gevgl"; - $evgen_cmd = "gevgen $evgen_opt | $grep_pipe &> $fntemplate.evgen.log"; - $conv_cmd = "gntpc -f gst -i gntp.$curr_subrunnu.ghep.root"; - - print "@@ exec: $evgen_cmd \n"; - - # - # submit - # - - # PBS case - if($batch_system eq 'PBS') { - $batch_script = "$fntemplate.pbs"; - open(PBS, ">$batch_script") or die("Can not create the PBS batch script"); - print PBS "#!/bin/bash \n"; - print PBS "#PBS -N hadroatten-$curr_subrunnu \n"; - print PBS "#PBS -l cput=$time_limit \n"; - print PBS "#PBS -o $fntemplate.pbsout.log \n"; - print PBS "#PBS -e $fntemplate.pbserr.log \n"; - print PBS "source $genie_setup \n"; - print PBS "cd $jobs_dir \n"; - print PBS "$evgen_cmd \n"; - print PBS "$conv_cmd \n"; - close(PBS); - `qsub -q $queue $batch_script`; - } #PBS - - # LSF case - if($batch_system eq 'LSF') { - $batch_script = "$fntemplate.sh"; - open(LSF, ">$batch_script") or die("Can not create the LSF batch script"); - print LSF "#!/bin/bash \n"; - print LSF "#BSUB-j hadroatten-$curr_subrunnu \n"; - print LSF "#BSUB-q $queue \n"; - print LSF "#BSUB-c $time_limit \n"; - print LSF "#BSUB-o $fntemplate.lsfout.log \n"; - print LSF "#BSUB-e $fntemplate.lsferr.log \n"; - print LSF "source $genie_setup \n"; - print LSF "cd $jobs_dir \n"; - print LSF "$evgen_cmd \n"; - print LSF "$conv_cmd \n"; - close(LSF); - `qsub < $batch_script`; - } #LSF - - # slurm case - if($batch_system eq 'slurm') { - my $time_lim = `sinfo -h -p batch -o %l`; - my ($days, $hours, $remainder) = $time_lim =~ /([0]+)-([0-9]+):(.*)/; - my $newhours = $days * 24 + $hours; - my $new_time_lim = "$newhours:$remainder"; - $time_limit = $new_time_lim lt $time_limit ? $new_time_lim : $time_limit; - $batch_script = "$fntemplate.sh"; - open(SLURM, ">$batch_script") or die("Can not create the slurm batch script"); - print SLURM "#!/bin/bash \n"; - print SLURM "#SBATCH-p $queue \n"; - print SLURM "#SBATCH-o $fntemplate.lsfout.log \n"; - print SLURM "#SBATCH-e $fntemplate.lsferr.log \n"; - print SLURM "#SBATCH-t $time_limit \n"; - print SLURM "source $genie_setup \n"; - print SLURM "cd $jobs_dir \n"; - print SLURM "$evgen_cmd \n"; - print SLURM "$conv_cmd \n"; - close(SLURM); - `sbatch --job-name=hadroatten-$curr_subrunnu $batch_script`; - } #slurm - - # no batch system, run jobs interactively - if($batch_system eq 'none') { - system("source $genie_setup; cd $jobs_dir; $evgen_cmd; $conv_cmd"); - } # interactive mode - - - } # loop over subruns - } #checking whether to submit current run -} # loop over runs - diff --git a/src/scripts/production/batch/submit_eA_xsec_calc_jobs.pl b/src/scripts/production/batch/submit_eA_xsec_calc_jobs.pl deleted file mode 100644 index 58e53ecaa..000000000 --- a/src/scripts/production/batch/submit_eA_xsec_calc_jobs.pl +++ /dev/null @@ -1,159 +0,0 @@ -#!/usr/bin/perl - -#---------------------------------------------------------------------- -# Submit jobs for calculating GENIE eA cross section splines to be used -# with GENIE's validation programs comparing GENIE against electron -# scattering data. -# -# Syntax: -# shell% perl submit_eA_xsec_calc_jobs.pl -# -# Options: -# --version : GENIE version number -# [--arch] : , default: SL6.x86_64 -# [--production] : default: -# [--cycle] : default: 01 -# [--use-valgrind] : default: off -# [--batch-system] : , default: PBS -# [--queue] : default: prod -# [--softw-topdir] : top level dir for softw installations, default: /opt/ppd/t2k/softw/GENIE/ -# [--jobs-topdir] : top level dir for job files, default: /opt/ppd/t2k/scratch/GENIE/ -# -# Author: -# Costas Andreopoulos -# University of Liverpool -# -# Copyright: -# Copyright (c) 2003-2025, The GENIE Collaboration -# For the full text of the license visit http://copyright.genie-mc.org -#---------------------------------------------------------------------- - -use File::Path; - -# inputs -# -$iarg=0; -foreach (@ARGV) { - if($_ eq '--version') { $genie_version = $ARGV[$iarg+1]; } - if($_ eq '--arch') { $arch = $ARGV[$iarg+1]; } - if($_ eq '--production') { $production = $ARGV[$iarg+1]; } - if($_ eq '--cycle') { $cycle = $ARGV[$iarg+1]; } - if($_ eq '--use-valgrind') { $use_valgrind = $ARGV[$iarg+1]; } - if($_ eq '--batch-system') { $batch_system = $ARGV[$iarg+1]; } - if($_ eq '--queue') { $queue = $ARGV[$iarg+1]; } - if($_ eq '--softw-topdir') { $softw_topdir = $ARGV[$iarg+1]; } - if($_ eq '--jobs-topdir') { $jobs_topdir = $ARGV[$iarg+1]; } - $iarg++; -} -die("** Aborting [Undefined GENIE version. Use the --version option]") -unless defined $genie_version; - -$use_valgrind = 0 unless defined $use_valgrind; -$arch = "SL6.x86_64" unless defined $arch; -$production = "$genie_version" unless defined $production; -$cycle = "01" unless defined $cycle; -$batch_system = "PBS" unless defined $batch_system; -$queue = "prod" unless defined $queue; -$softw_topdir = "/opt/ppd/t2k/softw/GENIE" unless defined $softw_topdir; -$jobs_topdir = "/opt/ppd/t2k/scratch/GENIE/" unless defined $jobs_topdir; -$genie_setup = "$softw_topdir/generator/builds/$arch/$genie_version-setup"; -$jobs_dir = "$jobs_topdir/xsec\_eA-$production\_$cycle/"; -$time_limit = "60:00:00"; - -$nkots = 200; -$emax = 35; -$probes = "11"; -%targets = ( - 'H1' => '1000010020', - 'H2' => '1000010020', - 'H3' => '1000010030', - 'He3' => '1000020030', - 'He4' => '1000020040', - 'C12' => '1000060120', - 'N14' => '1000070140', - 'O16' => '1000080160', - 'Ne20' => '1000100200', - 'Al27' => '1000130270', - 'Ca40' => '1000200400', - 'Ca48' => '1000200480', - 'Fe56' => '1000260560', - 'Kr83' => '1000360830', - 'Xe131' => '1000541310', - 'Au197' => '1000791970', - 'Pb208' => '1000822080', - 'U238' => '1000922380' ); - -# make the jobs directory -# -mkpath ($jobs_dir, {verbose => 1, mode=>0777}); - -# -# loop over nuclear targets & submit jobs -# -while( my ($tgt_name, $tgt_code) = each %targets ) { - - $fntemplate = "$jobs_dir/job_$tgt_name"; - $grep_pipe = "grep -B 100 -A 30 -i \"warn\\|error\\|fatal\""; - $gmkspl_opt = "-p $probes -t $tgt_code -n $nkots -e $emax -o gxspl_emode_$tgt_name.xml --event-generator-list EM"; - $gmkspl_cmd = "gmkspl $gmkspl_opt | $grep_pipe &> $fntemplate.mkspl.log"; - print "@@ exec: $gmkspl_cmd \n"; - - # PBS case - if($batch_system eq 'PBS') { - $batch_script = "$fntemplate.pbs"; - open(PBS, ">$batch_script") or die("Can not create the PBS batch script"); - print PBS "#!/bin/bash \n"; - print PBS "#PBS -N $tgt_name \n"; - print PBS "#PBS -o $fntemplate.pbsout.log \n"; - print PBS "#PBS -e $fntemplate.pbserr.log \n"; - print PBS "source $genie_setup \n"; - print PBS "cd $jobs_dir \n"; - print PBS "$gmkspl_cmd \n"; - close(PBS); - `qsub -q $queue $batch_script`; - } #PBS - - # LSF case - if($batch_system eq 'LSF') { - $batch_script = "$fntemplate.sh"; - open(LSF, ">$batch_script") or die("Can not create the LSF batch script"); - print LSF "#!/bin/bash \n"; - print LSF "#BSUB-j $tgt_name \n"; - print LSF "#BSUB-q $queue \n"; - print LSF "#BSUB-o $fntemplate.lsfout.log \n"; - print LSF "#BSUB-e $fntemplate.lsferr.log \n"; - print LSF "source $genie_setup \n"; - print LSF "cd $jobs_dir \n"; - print LSF "$gmkspl_cmd \n"; - close(LSF); - `bsub < $batch_script`; - } #LSF - - # slurm case - if($batch_system eq 'slurm') { - my $time_lim = `sinfo -h -p batch -o %l`; - my ($days, $hours, $remainder) = $time_lim =~ /([0]+)-([0-9]+):(.*)/; - my $newhours = $days * 24 + $hours; - my $new_time_lim = "$newhours:$remainder"; - $time_limit = $new_time_lim lt $time_limit ? $new_time_lim : $time_limit; - $batch_script = "$fntemplate.sh"; - open(SLURM, ">$batch_script") or die("Can not create the SLURM batch script"); - print SLURM "#!/bin/bash \n"; - print SLURM "#SBATCH-p $queue \n"; - print SLURM "#SBATCH-o $fntemplate.lsfout.log \n"; - print SLURM "#SBATCH-e $fntemplate.lsferr.log \n"; - print SLURM "#SBATCH-t $time_limit \n"; - print SLURM "source $genie_setup \n"; - print SLURM "cd $jobs_dir \n"; - print SLURM "$gmkspl_cmd \n"; - close(SLURM); - `sbatch --job-name=$tgt_name $batch_script`; - } #slurm - - # no batch system, run jobs interactively - if($batch_system eq 'none') { - system("source $genie_setup; cd $jobs_dir; $gmkspl_cmd"); - } # interactive mode - -} - diff --git a/src/scripts/production/batch/submit_inline.pl b/src/scripts/production/batch/submit_inline.pl new file mode 100644 index 000000000..596c698a0 --- /dev/null +++ b/src/scripts/production/batch/submit_inline.pl @@ -0,0 +1,131 @@ +#-------------------------------------------------------------------------------------------------- +# A helper script to submit a single job with all commands specified directly on the command line, +# avoiding the need to manually create a separate batch script for one-off or ad hoc tasks. +# +# Syntax: +# % perl submit_inline.pl +# +# Options: +# --cmd : Command(s) to execute +# --gen-version : GENIE generator version number +# [--job-name] : default: tmp-(random_number) +# [--arch] : , default: el7.x86_64 +# [--production] : default: prod +# [--cycle] : default: 01 +# [--batch-system] : , default: Slurm +# [--queue] : default: compute +# [--time-limit] : default: 10:00:00 +# [--softw-topdir] : top level dir for softw installations, default: /opt/ppd/t2k/softw/GENIE/ +# [--job-topdir] : top level dir for job files, default: /opt/ppd/t2k/softw/scratch/GENIE/ +# +# Example: +# % perl submit_inline.pl +# --cmd 'gevgen -p 14 -t 1000260560 -e 1 --cross-sections /some/path/xsec.xml \ +# --seed 1989298 --r 100; mv gntp.100.ghep.root /some/other/path/' \ +# --gen-version v3.6.0 \ +# --job-name numuFe100 +# +# Author: +# Costas Andreopoulos +# University of Liverpool +# +# Copyright: +# Copyright (c) 2003-2025, The GENIE Collaboration +# For the full text of the license visit http://copyright.genie-mc.org +#-------------------------------------------------------------------------------------------------- + +#!/usr/bin/perl + +use File::Path; + +$iarg=0; +foreach (@ARGV) { + if($_ eq '--cmd') { $cmd = $ARGV[$iarg+1]; } + if($_ eq '--gen-version') { $gen_version = $ARGV[$iarg+1]; } + if($_ eq '--job-name') { $job_name = $ARGV[$iarg+1]; } + if($_ eq '--arch') { $arch = $ARGV[$iarg+1]; } + if($_ eq '--production') { $production = $ARGV[$iarg+1]; } + if($_ eq '--cycle') { $cycle = $ARGV[$iarg+1]; } + if($_ eq '--batch-system') { $batch_system = $ARGV[$iarg+1]; } + if($_ eq '--queue') { $queue = $ARGV[$iarg+1]; } + if($_ eq '--time-limit') { $time_limit = $ARGV[$iarg+1]; } + if($_ eq '--softw-topdir') { $softw_topdir = $ARGV[$iarg+1]; } + if($_ eq '--job-topdir') { $job_topdir = $ARGV[$iarg+1]; } + $iarg++; +} +die("** Aborting [Undefined GENIE command. Use the --cmd option]") +unless defined $cmd; +die("** Aborting [Undefined GENIE version. Use the --gen-version option]") +unless defined $gen_version; + +$random_num = int (rand(999999999)); + +$arch = "el7.x86_64" unless defined $arch; +$production = "prod" unless defined $production; +$cycle = "01" unless defined $cycle; +$batch_system = "Slurm" unless defined $batch_system; +$queue = "compute" unless defined $queue; +$time_limit = "10:00:00" unless defined $time_limit; +$softw_topdir = "/user/costasa/projects/GENIE/softw/" unless defined $softw_topdir; +$job_topdir = "/scratch/costasa/GENIE/" unless defined $job_topdir; +$job_name = "tmp-$random_num" unless defined $job_name; +$job_dir = "$job_topdir/$production\_$cycle-$gen_version-$job_name"; +$gen_setup_script = "$softw_topdir/generator/builds/$arch/$gen_version-setup.sh"; +$filename_basepath = "$job_dir/$jobname"; + +# make the job directory +mkpath ($job_dir, {verbose => 1, mode=>0777}); + +# submit job +# ----------------------- + +# Slurm case +if($batch_system eq 'Slurm') { + $batch_script = "$filename_basepath.sh"; + open(SLURM, ">$batch_script") or die("Can not create the SLURM batch script"); + print SLURM "#!/bin/bash \n"; + print SLURM "#SBATCH-p $queue \n"; + print SLURM "#SBATCH-J $job_name \n"; + print SLURM "#SBATCH-N 1 \n"; + print SLURM "#SBATCH-c 1 \n"; + print SLURM "#SBATCH-o $filename_basepath.slurmout.log \n"; + print SLURM "#SBATCH-e $filename_basepath.slurmerr.log \n"; + print SLURM "#SBATCH-t $time_limit \n"; + print SLURM "source $gen_setup_script \n"; + print SLURM "cd $job_dir \n"; + print SLURM "$gmkspl_cmd \n"; + close(SLURM); + `sbatch $batch_script`; +} #slurm + +# PBS case +if($batch_system eq 'PBS') { + $batch_script = "$filename_basepath.pbs"; + open(PBS, ">$batch_script") or die("Can not create the PBS batch script"); + print PBS "#!/bin/bash \n"; + print PBS "#PBS -N $job_name \n"; + print PBS "#PBS -o $filename_basepath.pbsout.log \n"; + print PBS "#PBS -e $filename_basepath.pbserr.log \n"; + print PBS "source $gen_setup_script \n"; + print PBS "cd $job_dir \n"; + print PBS "$cmd \n"; + close(PBS); + `qsub -q $queue $batch_script`; +} #PBS + +# LSF case +if($batch_system eq 'LSF') { + $batch_script = "$filename_basepath.sh"; + open(LSF, ">$batch_script") or die("Can not create the LSF batch script"); + print LSF "#!/bin/bash \n"; + print PBS "#BSUB-j $job_name \n"; + print LSF "#BSUB-q $queue \n"; + print LSF "#BSUB-o $filename_basepath.lsfout.log \n"; + print LSF "#BSUB-e $filename_basepath.lsferr.log \n"; + print LSF "source $gen_setup_script \n"; + print LSF "cd $job_dir \n"; + print LSF "$cmd \n"; + `bsub < $batch_script`; +} #LSF + + diff --git a/src/scripts/production/batch/submit_mc_jobs_comparisons_hadron_attenuation_eA.pl b/src/scripts/production/batch/submit_mc_jobs_comparisons_hadron_attenuation_eA.pl new file mode 100644 index 000000000..8aff50ddb --- /dev/null +++ b/src/scripts/production/batch/submit_mc_jobs_comparisons_hadron_attenuation_eA.pl @@ -0,0 +1,263 @@ +#!/usr/bin/perl + +#----------------------------------------------------------------------------------------------------------- +# Submit jobs to generate data needed for validating GENIE's hadronization + intranuclear transport model +# (with emphasis on the modeling of medium effects to the hadronization) in a set of comparisons against +# the CLAS and HERMES nuclear attenuation data. +# +# Syntax: +# perl submit_mc_jobs_comparisons_hadron_attenuation_eA.pl +# +# Options: +# --run : runs to submit (eg --run 101102 / --run 101102,154002 / -run all) +# --gen-version : GENIE version number +# --tune : GENIE physics tune +# --cross-sections : GENIE cross-sections file +# [--nsubruns] : number of subruns per run, default: 1 +# [--offset] : subrun offset (for augmenting existing sample), default: 0 +# [--arch] : , default: el7.x86_64 +# [--production] : production name, default: prod +# [--cycle] : cycle in current production, default: 01 +# [--use-valgrind] : default: off +# [--batch-system] : , default: Slurm +# [--queue] : default: compute +# [--softw-topdir] : top level dir for softw installations, default: /user/costasa/projects/GENIE/softw/ +# [--jobs-topdir] : top level dir for job files, default: /scratch/costasa/GENIE/ +# +# EVENT SAMPLES: +# +# Run number key: ITTJJxxx +# I : probe (1:e-, 2:e+) +# TT : nuclear target (01:H1, 02:D2, 03:He4, 06:C12, 07:N14, 08:O16, 10:Ne20, 26:Fe56, 36:Kr83, 54:Xe131) +# JJ : flux setting (01: 12.0 GeV [HERMES], 02: 27.6 GeV [HERMES]) +# xxx : sub-run ID, 000-999, 100k events each +# +#................................................................................... +# run number | init state | energy | event gen. | flux +# | | (GeV) | list | +#................................................................................... +# 10202xxx | e- + D2 | 27.6 | EM | monoenergetic +# 10302xxx | e- + He4 | 27.6 | EM | monoenergetic +# 10702xxx | e- + N14 | 27.6 | EM | monoenergetic +# 11002xxx | e- + Ne20 | 27.6 | EM | monoenergetic +# 13602xxx | e- + Kr84 | 27.6 | EM | monoenergetic +# 15402xxx | e- + Xe132 | 27.6 | EM | monoenergetic +# +# +# Author: +# Costas Andreopoulos +# University of Liverpool +# +# Copyright: +# Copyright (c) 2003-2025, The GENIE Collaboration +# For the full text of the license visit http://copyright.genie-mc.org +#----------------------------------------------------------------------------------------------------------- +# + +use File::Path; + +# inputs +# +$iarg=0; +foreach (@ARGV) { + if($_ eq '--run') { $runnu = $ARGV[$iarg+1]; } + if($_ eq '--gen-version') { $gen_version = $ARGV[$iarg+1]; } + if($_ eq '--tune') { $tune = $ARGV[$iarg+1]; } + if($_ eq '--cross-sections') { $cross_sections = $ARGV[$iarg+1]; } + if($_ eq '--model-enum') { $model_enum = $ARGV[$iarg+1]; } + if($_ eq '--nsubruns') { $nsubruns = $ARGV[$iarg+1]; } + if($_ eq '--offset') { $offset = $ARGV[$iarg+1]; } + if($_ eq '--arch') { $arch = $ARGV[$iarg+1]; } + if($_ eq '--production') { $production = $ARGV[$iarg+1]; } + if($_ eq '--cycle') { $cycle = $ARGV[$iarg+1]; } + if($_ eq '--use-valgrind') { $use_valgrind = $ARGV[$iarg+1]; } + if($_ eq '--batch-system') { $batch_system = $ARGV[$iarg+1]; } + if($_ eq '--queue') { $queue = $ARGV[$iarg+1]; } + if($_ eq '--softw-topdir') { $softw_topdir = $ARGV[$iarg+1]; } + if($_ eq '--jobs-topdir') { $jobs_topdir = $ARGV[$iarg+1]; } + $iarg++; +} +die("** Aborting [You need to specify which runs to submit. Use the --run option]") +unless defined $runnu; +die("** Aborting [Undefined GENIE Generator version. Use the --gen-version option]") +unless defined $gen_version; +die("** Aborting [Undefined GENIE physics tune. Use the --tune option]") +unless defined $tune; +die("** Aborting [Undefined GENIE cross-sections file. Use the --cross-section option]") +unless defined $cross_sections; +die("** Aborting [GENIE cross-sections file can not be found at $cross_sections]") +unless -e $cross_sections; + +$nsubruns = 1 unless defined $nsubruns; +$offset = 0 unless defined $offset; +$use_valgrind = 0 unless defined $use_valgrind; +$arch = "el7.x86_64" unless defined $arch; +$production = "prod" unless defined $production; +$cycle = "01" unless defined $cycle; +$batch_system = "Slurm" unless defined $batch_system; +$queue = "compute" unless defined $queue; +$softw_topdir = "/user/costasa/projects/GENIE/softw/" unless defined $softw_topdir; +$jobs_topdir = "/scratch/costasa/GENIE/" unless defined $jobs_topdir; +$time_limit = "10:00:00"; +$gen_setup_script = "$softw_topdir/generator/builds/$arch/$gen_version-setup.sh"; +$jobs_dir = "$jobs_topdir/$production\_$cycle-$gen_version-$tune-hadroatten\_e"; +$mcseed = 210921029; +$nev_per_subrun = 100000; + +# inputs for event generation jobs +%evg_pdg_hash = ( + '10202' => '11', + '10302' => '11', + '10702' => '11', + '11002' => '11', + '13602' => '11', + '15402' => '11' +); +%evg_tgtpdg_hash = ( + '10202' => '1000010020', + '10302' => '1000020040', + '10702' => '1000070140', + '11002' => '1000100200', + '13602' => '1000360840', + '15402' => '1000541320' +); +%evg_energy_hash = ( + '10202' => '27.6', + '10302' => '27.6', + '10702' => '27.6', + '11002' => '27.6', + '13602' => '27.6', + '15402' => '27.6' +); +%evg_gevgl_hash = ( + '10202' => 'EM', + '10302' => 'EM', + '10702' => 'EM', + '11002' => 'EM', + '13602' => 'EM', + '15402' => 'EM' +); +%evg_fluxopt_hash = ( + '10202' => '', + '10302' => '', + '10702' => '', + '11002' => '', + '13602' => '', + '15402' => '' +); + +# make the jobs directory +# +mkpath ($jobs_dir, {verbose => 1, mode=>0777}); + +# +# submit event generation jobs +# + +# run loop +for my $curr_runnu (keys %evg_gevgl_hash) { + + # check whether to commit current run + if($runnu=~m/$curr_runnu/ || $runnu eq "all") { + + print "** submitting event generation run: $curr_runnu \n"; + + # Get info that depends on the run number + # ------------------------------------------------------------- + + $probe = $evg_pdg_hash {$curr_runnu}; + $tgt = $evg_tgtpdg_hash {$curr_runnu}; + $en = $evg_energy_hash {$curr_runnu}; + $gevgl = $evg_gevgl_hash {$curr_runnu}; + $fluxopt = $evg_fluxopt_hash {$curr_runnu}; + + # loop over subruns + for($isubrun = 0; $isubrun < $nsubruns; $isubrun++) { + + # Get info that depends on the run and subrun numbers + # ------------------------------------------------------------- + # Run number key: ITTJJxxx + $curr_subrunnu = 1000 * $curr_runnu + $isubrun + $offset; + $curr_seed = $mcseed + $isubrun + $offset; + $job_name = "hadroatten\_e-$curr_subrunnu"; + $filename_basepath = "$jobs_dir/$job_name"; + + # Form commands to run + # ------------------------------------------------------------- +# $grep_pipe = "grep -B 20 -A 30 -i \"warn\\|error\\|fatal\""; + $grep_pipe = "grep -B 20 -A 30 -i fatal"; + $valgrind_cmd = "valgrind --tool=memcheck --error-limit=no --leak-check=yes --show-reachable=yes"; + $evgen_opt = "-n $nev_per_subrun -e $en -p $probe -t $tgt $fluxopt --tune $tune -r $curr_subrunnu --seed $curr_seed --cross-sections $cross_sections --event-generator-list $gevgl"; + $evgen_cmd = "gevgen $evgen_opt | $grep_pipe &> $fntemplate.evgen.log"; + $conv_cmd = "gntpc -f gst -i gntp.$curr_subrunnu.ghep.root"; + + print "@@ exec: $evgen_cmd \n"; + + # Submit jobs + # ------------------------------------------------------------- + + # Slurm case + if($batch_system eq 'slurm') { + $batch_script = "$filename_basepath.sh"; + open(SLURM, ">$batch_script") or die("Can not create the slurm batch script"); + print SLURM "#!/bin/bash \n"; + print SLURM "#SBATCH-p $queue \n"; + print SLURM "#SBATCH-J $job_name \n"; + print SLURM "#SBATCH-N 1 \n"; + print SLURM "#SBATCH-c 1 \n"; + print SLURM "#SBATCH-o $filename_basepath.slurmout.log \n"; + print SLURM "#SBATCH-e $filename_basepath.slurmerr.log \n"; + print SLURM "#SBATCH-t $time_limit \n"; + print SLURM "source $gen_setup_script \n"; + print SLURM "cd $jobs_dir \n"; + print SLURM "$evgen_cmd \n"; + print SLURM "$conv_cmd \n"; + close(SLURM); + `sbatch $batch_script`; + } #Slurm + + # PBS case + if($batch_system eq 'PBS') { + $batch_script = "$filename_basepath.pbs"; + open(PBS, ">$batch_script") or die("Can not create the PBS batch script"); + print PBS "#!/bin/bash \n"; + print PBS "#PBS -N $job_name \n"; + print PBS "#PBS -l cput=$time_limit \n"; + print PBS "#PBS -o $filename_basepath.pbsout.log \n"; + print PBS "#PBS -e $filename_basepath.pbserr.log \n"; + print PBS "source $gen_setup_script \n"; + print PBS "cd $jobs_dir \n"; + print PBS "$evgen_cmd \n"; + print PBS "$conv_cmd \n"; + close(PBS); + `qsub -q $queue $batch_script`; + } #PBS + + # LSF case + if($batch_system eq 'LSF') { + $batch_script = "$filename_basepath.sh"; + open(LSF, ">$batch_script") or die("Can not create the LSF batch script"); + print LSF "#!/bin/bash \n"; + print LSF "#BSUB-j $job_name \n"; + print LSF "#BSUB-q $queue \n"; + print LSF "#BSUB-c $time_limit \n"; + print LSF "#BSUB-o $filename_basepath.lsfout.log \n"; + print LSF "#BSUB-e $filename_basepath.lsferr.log \n"; + print LSF "source $gen_setup_script \n"; + print LSF "cd $jobs_dir \n"; + print LSF "$evgen_cmd \n"; + print LSF "$conv_cmd \n"; + close(LSF); + `qsub < $batch_script`; + } #LSF + + # no batch system, run jobs interactively + if($batch_system eq 'none') { + system("source $gen_setup_script; cd $jobs_dir; $evgen_cmd; $conv_cmd"); + } # interactive mode + + + } # loop over subruns + } #checking whether to submit current run +} # loop over runs + diff --git a/src/scripts/production/batch/submit_hadronization_validation_mc_jobs.pl b/src/scripts/production/batch/submit_mc_jobs_comparisons_hadronization_nu.pl similarity index 100% rename from src/scripts/production/batch/submit_hadronization_validation_mc_jobs.pl rename to src/scripts/production/batch/submit_mc_jobs_comparisons_hadronization_nu.pl diff --git a/src/scripts/production/batch/submit_eA_xsec_validation_mc_jobs.pl b/src/scripts/production/batch/submit_mc_jobs_comparisons_xsec_eeprime.pl similarity index 100% rename from src/scripts/production/batch/submit_eA_xsec_validation_mc_jobs.pl rename to src/scripts/production/batch/submit_mc_jobs_comparisons_xsec_eeprime.pl diff --git a/src/scripts/production/batch/submit_intranuke_validation_mc_jobs.pl b/src/scripts/production/batch/submit_mc_jobs_comparisons_xsec_hA.pl similarity index 100% rename from src/scripts/production/batch/submit_intranuke_validation_mc_jobs.pl rename to src/scripts/production/batch/submit_mc_jobs_comparisons_xsec_hA.pl diff --git a/src/scripts/production/batch/submit_neutrino_xsec_validation_mc_jobs.pl b/src/scripts/production/batch/submit_mc_jobs_comparisons_xsec_legacy_nu.pl similarity index 100% rename from src/scripts/production/batch/submit_neutrino_xsec_validation_mc_jobs.pl rename to src/scripts/production/batch/submit_mc_jobs_comparisons_xsec_legacy_nu.pl diff --git a/src/scripts/production/batch/submit_miniboone_validation_mc_jobs.pl b/src/scripts/production/batch/submit_mc_jobs_comparisons_xsec_miniboone.pl similarity index 100% rename from src/scripts/production/batch/submit_miniboone_validation_mc_jobs.pl rename to src/scripts/production/batch/submit_mc_jobs_comparisons_xsec_miniboone.pl diff --git a/src/scripts/production/batch/submit_t2k_validation_mc_jobs.pl b/src/scripts/production/batch/submit_mc_jobs_comparisons_xsec_t2k.pl similarity index 100% rename from src/scripts/production/batch/submit_t2k_validation_mc_jobs.pl rename to src/scripts/production/batch/submit_mc_jobs_comparisons_xsec_t2k.pl diff --git a/src/scripts/production/batch/submit_t2k_nd280_mc_jobs.pl b/src/scripts/production/batch/submit_mc_jobs_prod_t2k_nd280.pl similarity index 100% rename from src/scripts/production/batch/submit_t2k_nd280_mc_jobs.pl rename to src/scripts/production/batch/submit_mc_jobs_prod_t2k_nd280.pl diff --git a/src/scripts/production/batch/submit_t2k_superk_fhst_mc_jobs.pl b/src/scripts/production/batch/submit_mc_jobs_prod_t2k_superk_fhst.pl similarity index 100% rename from src/scripts/production/batch/submit_t2k_superk_fhst_mc_jobs.pl rename to src/scripts/production/batch/submit_mc_jobs_prod_t2k_superk_fhst.pl diff --git a/src/scripts/production/batch/submit_t2k_superk_fntp_mc_jobs.pl b/src/scripts/production/batch/submit_mc_jobs_prod_t2k_superk_fntp.pl similarity index 100% rename from src/scripts/production/batch/submit_t2k_superk_fntp_mc_jobs.pl rename to src/scripts/production/batch/submit_mc_jobs_prod_t2k_superk_fntp.pl diff --git a/src/scripts/production/batch/submit_standard_neutrino_mc_test_jobs.pl b/src/scripts/production/batch/submit_mc_jobs_standard_checks.pl similarity index 100% rename from src/scripts/production/batch/submit_standard_neutrino_mc_test_jobs.pl rename to src/scripts/production/batch/submit_mc_jobs_standard_checks.pl diff --git a/src/scripts/production/batch/submit_vA_xsec_calc_jobs.pl b/src/scripts/production/batch/submit_vA_xsec_calc_jobs.pl deleted file mode 100644 index 3fad3b69b..000000000 --- a/src/scripts/production/batch/submit_vA_xsec_calc_jobs.pl +++ /dev/null @@ -1,218 +0,0 @@ -#!/usr/bin/perl - -#---------------------------------------------------------------------------------------------------------------- -# Submit jobs for calculating GENIE x-section splines for all nuclear targets and at the energy range required -# for generating the GENIE release validation samples. Note that other scripts are available for generating -# x-section splines for the larger array of targets found in detector geometry descriptions of given expts. -# If needed, use the GENIE gspladd utility to merge the job outputs. -# -# Syntax: -# shell% perl submit_vA_xsec_calc_jobs.pl -# -# Options: -# --version : GENIE version number -# --config-file : Text file which specifies the list of initial states -# [--arch] : , default: SL6.x86_64 -# [--production] : default: routine_validation -# [--cycle] : default: 01 -# [--use-valgrind] : default: off -# [--batch-system] : , default: PBS -# [--queue] : default: prod -# [--softw-topdir] : top level dir for softw installations, default: /opt/ppd/t2k/softw/GENIE/ -# [--jobs-topdir] : top level dir for job files, default: /opt/ppd/t2k/scratch/GENIE/ -# -# Author: -# Costas Andreopoulos -# University of Liverpool -# -# Copyright: -# Copyright (c) 2003-2025, The GENIE Collaboration -# For the full text of the license visit http://copyright.genie-mc.org -#---------------------------------------------------------------------------------------------------------------- - -use File::Path; -use File::Basename; - -# inputs -# -$iarg=0; -foreach (@ARGV) { - if($_ eq '--version') { $genie_version = $ARGV[$iarg+1]; } - if($_ eq '--config-file') { $config_file = $ARGV[$iarg+1]; } - if($_ eq '--arch') { $arch = $ARGV[$iarg+1]; } - if($_ eq '--production') { $production = $ARGV[$iarg+1]; } - if($_ eq '--cycle') { $cycle = $ARGV[$iarg+1]; } - if($_ eq '--use-valgrind') { $use_valgrind = $ARGV[$iarg+1]; } - if($_ eq '--batch-system') { $batch_system = $ARGV[$iarg+1]; } - if($_ eq '--queue') { $queue = $ARGV[$iarg+1]; } - if($_ eq '--softw-topdir') { $softw_topdir = $ARGV[$iarg+1]; } - if($_ eq '--jobs-topdir') { $jobs_topdir = $ARGV[$iarg+1]; } - $iarg++; -} -die("** Aborting [Undefined GENIE version. Use the --version option]") -unless defined $genie_version; -die("** Aborting [Undefined configuration file. Use the --config-file option. See examples in ?]") -unless defined $config_file; - -$use_valgrind = 0 unless defined $use_valgrind; -$arch = "SL6.x86_64" unless defined $arch; -$production = "routine_validation" unless defined $production; -$cycle = "01" unless defined $cycle; -$batch_system = "PBS" unless defined $batch_system; -$queue = "prod" unless defined $queue; -$softw_topdir = "/opt/ppd/t2k/softw/GENIE/" unless defined $softw_topdir; -$jobs_topdir = "/opt/ppd/t2k/scratch/GENIE/" unless defined $jobs_topdir; -$time_limit = "60:00:00"; - -$genie_setup = "$softw_topdir/generator/builds/$arch/$genie_version-setup"; -$freenucsplines = "$softw_topdir/data/job_inputs/xspl/gxspl-vN-$genie_version.xml"; -$config = basename($config_file,".list"); -$jobs_dir = "$jobs_topdir/$genie_version-$production\_$cycle-xsec\_vA\_$config"; - -$nknots = 0; -$emax = 0; -@neutrinos = (); -@targets = (); - -open (CONFIG, $config_file); -$i=0; -while() -{ - chomp; - # skip comment lines starting with # and empty lines that don't contain any number - if( substr($_,0,1) ne '#' && m/[0-9]/ ) - { - s/ //g; # rm empty spaces from $_ - #print "line = $_\n" ; - $value = ""; - $idx = index($_,"#"); - if($idx == -1) { $value = $_; } - else { $value = substr($_,0,$idx); } - - if ($i==0) { $emax = $value; } - elsif ($i==1) { $nknots = $value; } - else { - if( $value == 12 || $value == 14 || $value == 16 || - $value == -12 || $value == -14 || $value == -16 ) - { - push(@neutrinos, $value); - } - else - { - push(@targets, $value); - } - } - $i++; - } -} -close(CONFIG); - -# make the jobs directory -# -mkpath ($jobs_dir, {verbose => 1, mode=>0777}); - -$nu_codes = ""; -$i=0; -foreach (@neutrinos) -{ - s/ //g; # rm empty spaces from $_ - if($i == 0) { $nu_codes = $_; } - else { $nu_codes = $nu_codes . ",$_"; } - $i++; -} - -# -# loop over nuclear targets & submit jobs -# -foreach(@targets) -{ - s/ //g; # rm empty spaces from $_ - $tgt_code = $_; - $jobname = "vAxscalc-$tgt_code"; - $filename_template = "$jobs_dir/$jobname"; - $grep_pipe = "grep -B 100 -A 30 -i \"warn\\|error\\|fatal\""; - $gmkspl_opt = "-p $nu_codes -t $_ -n $nknots -e $emax --input-cross-sections $freenucsplines --output-cross-sections gxspl_$tgt_code.xml"; - $gmkspl_cmd = "gmkspl $gmkspl_opt | $grep_pipe &> $filename_template.mkspl.log"; - print "@@ exec: $gmkspl_cmd \n"; - - # - # submit - # - - # PBS case - if($batch_system eq 'PBS' || $batch_system eq 'HTCondor_PBS') { - $batch_script = "$filename_template.pbs"; - open(PBS, ">$batch_script") or die("Can not create the PBS batch script"); - print PBS "#!/bin/bash \n"; - print PBS "#PBS -N $jobname \n"; - print PBS "#PBS -o $filename_template.pbsout.log \n"; - print PBS "#PBS -e $filename_template.pbserr.log \n"; - print PBS "source $genie_setup \n"; - print PBS "cd $jobs_dir \n"; - print PBS "$gmkspl_cmd \n"; - close(PBS); - $job_submission_command = "qsub"; - if($batch_system eq 'HTCondor_PBS') { - $job_submission_command = "condor_qsub"; - } - `$job_submission_command -q $queue $batch_script`; - } #PBS - - # LSF case - if($batch_system eq 'LSF') { - $batch_script = "$filename_template.sh"; - open(LSF, ">$batch_script") or die("Can not create the LSF batch script"); - print LSF "#!/bin/bash \n"; - print LSF "#BSUB-j $jobname \n"; - print LSF "#BSUB-o $filename_template.lsfout.log \n"; - print LSF "#BSUB-e $filename_template.lsferr.log \n"; - print LSF "source $genie_setup \n"; - print LSF "cd $jobs_dir \n"; - print LSF "$gmkspl_cmd \n"; - close(LSF); - `bsub < $batch_script`; - } #LSF - - # HTCondor - if($batch_system eq 'HTCondor') { - $batch_script = "$filename_template.htc"; - open(HTC, ">$batch_script") or die("Can not create the Condor submit description file: $batch_script"); - print HTC "Universe = vanilla \n"; - print HTC "Executable = $softw_topdir/generator/builds/$arch/$genie_version/src/scripts/production/batch/htcondor_exec.sh \n"; - print HTC "Arguments = $genie_setup $jobs_dir $gmkspl_cmd \n"; - print HTC "Log = $filename_template.log \n"; - print HTC "Output = $filename_template.out \n"; - print HTC "Error = $filename_template.err \n"; - print HTC "Request_memory = 2 GB \n"; - print HTC "Queue \n"; - close(HTC); - `condor_submit $batch_script`; - } #HTCondor - - # slurm case - if($batch_system eq 'slurm') { - my $time_lim = `sinfo -h -p batch -o %l`; - my ($days, $hours, $remainder) = $time_lim =~ /([0]+)-([0-9]+):(.*)/; - my $newhours = $days * 24 + $hours; - my $new_time_lim = "$newhours:$remainder"; - $time_limit = $new_time_lim lt $time_limit ? $new_time_lim : $time_limit; - $batch_script = "$filename_template.sh"; - open(SLURM, ">$batch_script") or die("Can not create the SLURM batch script"); - print SLURM "#!/bin/bash \n"; - print SLURM "#SBATCH-p $queue \n"; - print SLURM "#SBATCH-o $filename_template.lsfout.log \n"; - print SLURM "#SBATCH-e $filename_template.lsferr.log \n"; - print SLURM "#SBATCH-t $time_limit \n"; - print SLURM "source $genie_setup \n"; - print SLURM "cd $jobs_dir \n"; - print SLURM "$gmkspl_cmd \n"; - close(SLURM); - `sbatch --job-name=$jobname $batch_script`; - } #slurm - - # run interactively - if($batch_system eq 'none') { - system("source $genie_setup; cd $jobs_dir; $gmkspl_cmd"); - } -} - diff --git a/src/scripts/production/batch/submit_vN_xsec_calc_jobs.pl b/src/scripts/production/batch/submit_vN_xsec_calc_jobs.pl deleted file mode 100644 index 8d57fa1b5..000000000 --- a/src/scripts/production/batch/submit_vN_xsec_calc_jobs.pl +++ /dev/null @@ -1,295 +0,0 @@ -#!/usr/bin/perl - -#---------------------------------------------------------------------------------------------------------------- -# Submit jobs for calculating GENIE free-nucleon cross-section splines which can then be re-used for calculating -# nuclear cross-sections. If needed, use the GENIE gspladd utility to merge the job outputs. -# -# Syntax: -# shell% perl submit_vN_xsec_calc_jobs.pl -# -# Options: -# --version : genie version number -# --xsplset : set of splines to generate -# [--arch] : , default: SL6.x86_64 -# [--production] : default: routine_validation -# [--cycle] : default: 01 -# [--use-valgrind] : default: off -# [--batch-system] : , default: PBS -# [--queue] : default: prod -# [--softw-topdir] : top level dir for softw installations, default: /opt/ppd/t2k/softw/GENIE/ -# [--jobs-topdir] : top level dir for job files, default: /opt/ppd/t2k/softw/scratch/GENIE/ -# -# Examples: -# shell% perl submit_vN_xsec_calc_jobs.pl --version v2.6.0 --xsplset chm -# shell% perl submit_vN_xsec_calc_jobs.pl --version v2.6.0 --xsplset chm,nue,qel -# shell% perl submit_vN_xsec_calc_jobs.pl --version v2.6.0 --xsplset all -# -# Author: -# Costas Andreopoulos -# University of Liverpool -# -# Copyright: -# Copyright (c) 2003-2025, The GENIE Collaboration -# For the full text of the license visit http://copyright.genie-mc.org -#------------------------------------------------------------------------------------------------------------- - -use File::Path; - -# inputs -# -$iarg=0; -foreach (@ARGV) { - if($_ eq '--version') { $genie_version = $ARGV[$iarg+1]; } - if($_ eq '--xsplset') { $xsplset = $ARGV[$iarg+1]; } - if($_ eq '--arch') { $arch = $ARGV[$iarg+1]; } - if($_ eq '--production') { $production = $ARGV[$iarg+1]; } - if($_ eq '--cycle') { $cycle = $ARGV[$iarg+1]; } - if($_ eq '--use-valgrind') { $use_valgrind = $ARGV[$iarg+1]; } - if($_ eq '--batch-system') { $batch_system = $ARGV[$iarg+1]; } - if($_ eq '--queue') { $queue = $ARGV[$iarg+1]; } - if($_ eq '--softw-topdir') { $softw_topdir = $ARGV[$iarg+1]; } - if($_ eq '--jobs-topdir') { $jobs_topdir = $ARGV[$iarg+1]; } - $iarg++; -} -die("** Aborting [Undefined set of cross section splines #. Use the --xsplset option]") -unless defined $xsplset; -die("** Aborting [Undefined GENIE version. Use the --version option]") -unless defined $genie_version; - -$use_valgrind = 0 unless defined $use_valgrind; -$arch = "SL6.x86_64" unless defined $arch; -$production = "routine_validation" unless defined $production; -$cycle = "01" unless defined $cycle; -$batch_system = "PBS" unless defined $batch_system; -$queue = "prod" unless defined $queue; -$softw_topdir = "/opt/ppd/t2k/softw/GENIE/" unless defined $softw_topdir; -$jobs_topdir = "/opt/ppd/t2k/scratch/GENIE/" unless defined $jobs_topdir; -$genie_setup = "$softw_topdir/generator/builds/$arch/$genie_version-setup"; -$jobs_dir = "$jobs_topdir/$genie_version-$production\_$cycle-xsec\_vN/"; -$time_limit = "60:00:00"; - -$nkots = 500; -$emax = 500; - -%NUPDG = ( 'chm' => '12,-12,14,-14,16,-16', - 'nue' => '12,-12,14,-14,16,-16', - 'qel' => '12,-12,14,-14,16,-16', - 'dis_ebar_cc' => '-12', - 'dis_ebar_nc' => '-12', - 'dis_e_cc' => '12', - 'dis_e_nc' => '12', - 'dis_mubar_cc' => '-14', - 'dis_mubar_nc' => '-14', - 'dis_mu_cc' => '14', - 'dis_mu_nc' => '14', - 'dis_taubar_cc' => '-16', - 'dis_taubar_nc' => '-16', - 'dis_tau_cc' => '16', - 'dis_tau_nc' => '16', - 'res_ebar_cc' => '-12', - 'res_ebar_nc' => '-12', - 'res_e_cc' => '12', - 'res_e_nc' => '12', - 'res_mubar_cc' => '-14', - 'res_mubar_nc' => '-14', - 'res_mu_cc' => '14', - 'res_mu_nc' => '14', - 'res_taubar_cc' => '-16', - 'res_taubar_nc' => '-16', - 'res_tau_cc' => '16', - 'res_tau_nc' => '16' ); - -%TGTPDG = ( 'chm' => '1000010010,1000000010', - 'nue' => '1000010010,1000000010', - 'qel' => '1000010010,1000000010', - 'dis_ebar_cc' => '1000010010,1000000010', - 'dis_ebar_nc' => '1000010010,1000000010', - 'dis_e_cc' => '1000010010,1000000010', - 'dis_e_nc' => '1000010010,1000000010', - 'dis_mubar_cc' => '1000010010,1000000010', - 'dis_mubar_nc' => '1000010010,1000000010', - 'dis_mu_cc' => '1000010010,1000000010', - 'dis_mu_nc' => '1000010010,1000000010', - 'dis_taubar_cc' => '1000010010,1000000010', - 'dis_taubar_nc' => '1000010010,1000000010', - 'dis_tau_cc' => '1000010010,1000000010', - 'dis_tau_nc' => '1000010010,1000000010', - 'res_ebar_cc' => '1000010010,1000000010', - 'res_ebar_nc' => '1000010010,1000000010', - 'res_e_cc' => '1000010010,1000000010', - 'res_e_nc' => '1000010010,1000000010', - 'res_mubar_cc' => '1000010010,1000000010', - 'res_mubar_nc' => '1000010010,1000000010', - 'res_mu_cc' => '1000010010,1000000010', - 'res_mu_nc' => '1000010010,1000000010', - 'res_taubar_cc' => '1000010010,1000000010', - 'res_taubar_nc' => '1000010010,1000000010', - 'res_tau_cc' => '1000010010,1000000010', - 'res_tau_nc' => '1000010010,1000000010' ); - -%GEVGL = ( 'chm' => 'Charm', - 'nue' => 'NuE', - 'qel' => 'QE', - 'dis_ebar_cc' => 'CCDIS', - 'dis_ebar_nc' => 'NCDIS', - 'dis_e_cc' => 'CCDIS', - 'dis_e_nc' => 'NCDIS', - 'dis_mubar_cc' => 'CCDIS', - 'dis_mubar_nc' => 'NCDIS', - 'dis_mu_cc' => 'CCDIS', - 'dis_mu_nc' => 'NCDIS', - 'dis_taubar_cc' => 'CCDIS', - 'dis_taubar_nc' => 'NCDIS', - 'dis_tau_cc' => 'CCDIS', - 'dis_tau_nc' => 'NCDIS', - 'res_ebar_cc' => 'CCRES', - 'res_ebar_nc' => 'NCRES', - 'res_e_cc' => 'CCRES', - 'res_e_nc' => 'NCRES', - 'res_mubar_cc' => 'CCRES', - 'res_mubar_nc' => 'NCRES', - 'res_mu_cc' => 'CCRES', - 'res_mu_nc' => 'NCRES', - 'res_taubar_cc' => 'CCRES', - 'res_taubar_nc' => 'NCRES', - 'res_tau_cc' => 'CCRES', - 'res_tau_nc' => 'NCRES' ); - -%OUTXML = ( 'chm' => 'pgxspl-chm.xml', - 'nue' => 'pgxspl-nue.xml', - 'qel' => 'pgxspl-qel.xml', - 'dis_ebar_cc' => 'pgxspl-dis_ebar_cc.xml', - 'dis_ebar_nc' => 'pgxspl-dis_ebar_nc.xml', - 'dis_e_cc' => 'pgxspl-dis_e_cc.xml', - 'dis_e_nc' => 'pgxspl-dis_e_nc.xml', - 'dis_mubar_cc' => 'pgxspl-dis_mubar_cc.xml', - 'dis_mubar_nc' => 'pgxspl-dis_mubar_nc.xml', - 'dis_mu_cc' => 'pgxspl-dis_mu_cc.xml', - 'dis_mu_nc' => 'pgxspl-dis_mu_nc.xml', - 'dis_taubar_cc' => 'pgxspl-dis_taubar_cc.xml', - 'dis_taubar_nc' => 'pgxspl-dis_taubar_nc.xml', - 'dis_tau_cc' => 'pgxspl-dis_tau_cc.xml', - 'dis_tau_nc' => 'pgxspl-dis_tau_nc.xml', - 'res_ebar_cc' => 'pgxspl-res_ebar_cc.xml', - 'res_ebar_nc' => 'pgxspl-res_ebar_nc.xml', - 'res_e_cc' => 'pgxspl-res_e_cc.xml', - 'res_e_nc' => 'pgxspl-res_e_nc.xml', - 'res_mubar_cc' => 'pgxspl-res_mubar_cc.xml', - 'res_mubar_nc' => 'pgxspl-res_mubar_nc.xml', - 'res_mu_cc' => 'pgxspl-res_mu_cc.xml', - 'res_mu_nc' => 'pgxspl-res_mu_nc.xml', - 'res_taubar_cc' => 'pgxspl-res_taubar_cc.xml', - 'res_taubar_nc' => 'pgxspl-res_taubar_nc.xml', - 'res_tau_cc' => 'pgxspl-res_tau_cc.xml', - 'res_tau_nc' => 'pgxspl-res_tau_nc.xml' ); - -# make the jobs directory -# -print "@@ Creating job directory: $jobs_dir \n"; -mkpath ($jobs_dir, {verbose => 1, mode=>0777}); - -for my $curr_xsplset (keys %OUTXML) { - if($xsplset=~m/$curr_xsplset/ || $xsplset eq "all") { - - # - # get runnu-dependent info - # - $nu = $NUPDG {$curr_xsplset}; - $tgt = $TGTPDG {$curr_xsplset}; - $gevgl = $GEVGL {$curr_xsplset}; - $outxml = $OUTXML {$curr_xsplset}; - - $jobname = "vNxscalc-$curr_xsplset"; - $filename_template = "$jobs_dir/$jobname"; - - $grep_pipe = "grep -B 100 -A 30 -i \"warn\\|error\\|fatal\""; - $valgrind_cmd = "valgrind --tool=memcheck --error-limit=no --leak-check=yes --show-reachable=yes"; - $gmkspl_opt = "-p $nu -t $tgt -n $nkots -e $emax -o $outxml --event-generator-list $gevgl"; - $gmkspl_cmd = "gmkspl $gmkspl_opt"; - - print "@@ exec: $gmkspl_cmd \n"; - - # - # submit - # - - # PBS case - if($batch_system eq 'PBS' || $batch_system eq 'HTCondor_PBS') { - $batch_script = "$filename_template.pbs"; - open(PBS, ">$batch_script") or die("Can not create the PBS batch script"); - print PBS "#!/bin/bash \n"; - print PBS "#PBS -N $jobname \n"; - print PBS "#PBS -o $filename_template.pbsout.log \n"; - print PBS "#PBS -e $filename_template.pbserr.log \n"; - print PBS "source $genie_setup \n"; - print PBS "cd $jobs_dir \n"; - print PBS "$gmkspl_cmd | $grep_pipe &> $filename_template.mkspl.log \n"; - close(PBS); - $job_submission_command = "qsub"; - if($batch_system eq 'HTCondor_PBS') { - $job_submission_command = "condor_qsub"; - } - `$job_submission_command -q $queue $batch_script`; - } #PBS / #HTCondor_PBS - - # LSF case - if($batch_system eq 'LSF') { - $batch_script = "$filename_template.sh"; - open(LSF, ">$batch_script") or die("Can not create the LSF batch script"); - print LSF "#!/bin/bash \n"; - print PBS "#BSUB-j $jobname \n"; - print LSF "#BSUB-q $queue \n"; - print LSF "#BSUB-o $filename_template.lsfout.log \n"; - print LSF "#BSUB-e $filename_template.lsferr.log \n"; - print LSF "source $genie_setup \n"; - print LSF "cd $jobs_dir \n"; - print LSF "$gmkspl_cmd | $grep_pipe &> $filename_template.mkspl.log \n"; - close(LSF); - `bsub < $batch_script`; - } #LSF - - # HTCondor - if($batch_system eq 'HTCondor') { - $batch_script = "$filename_template.htc"; - open(HTC, ">$batch_script") or die("Can not create the Condor submit description file: $batch_script"); - print HTC "Universe = vanilla \n"; - print HTC "Executable = $softw_topdir/generator/builds/$arch/$genie_version/src/scripts/production/batch/htcondor_exec.sh \n"; - print HTC "Arguments = $genie_setup $jobs_dir $gmkspl_cmd \n"; - print HTC "Log = $filename_template.log \n"; - print HTC "Output = $filename_template.out \n"; - print HTC "Error = $filename_template.err \n"; - print HTC "Request_memory = 2 GB \n"; - print HTC "Queue \n"; - close(HTC); - `condor_submit $batch_script`; - } #HTCondor - - # slurm case - if($batch_system eq 'slurm') { - my $time_lim = `sinfo -h -p batch -o %l`; - my ($days, $hours, $remainder) = $time_lim =~ /([0]+)-([0-9]+):(.*)/; - my $newhours = $days * 24 + $hours; - my $new_time_lim = "$newhours:$remainder"; - $time_limit = $new_time_lim lt $time_limit ? $new_time_lim : $time_limit; - $batch_script = "$filename_template.sh"; - open(SLURM, ">$batch_script") or die("Can not create the slurm batch script"); - print SLURM "#!/bin/bash \n"; - print SLURM "#SBATCH-p $queue \n"; - print SLURM "#SBATCH-o $filename_template.slurmout.log \n"; - print SLURM "#SBATCH-e $filename_template.slurmerr.log \n"; - print SLURM "#SBATCH-t $time_limit \n"; - print SLURM "source $genie_setup \n"; - print SLURM "cd $jobs_dir \n"; - print SLURM "$gmkspl_cmd | $grep_pipe &> $filename_template.mkspl.log \n"; - close(SLURM); - `sbatch --job-name=$jobname $batch_script`; - } #slurm - - # no batch system, run jobs interactively - if($batch_system eq 'none') { - system("source $genie_setup; cd $jobs_dir; $gmkspl_cmd"); - } # interactive mode - - - } -} diff --git a/src/scripts/production/batch/submit_xsec_calc_jobs_eA.pl b/src/scripts/production/batch/submit_xsec_calc_jobs_eA.pl new file mode 100644 index 000000000..b655361ba --- /dev/null +++ b/src/scripts/production/batch/submit_xsec_calc_jobs_eA.pl @@ -0,0 +1,214 @@ +#!/usr/bin/perl + +#---------------------------------------------------------------------------------------------------------------- +# Submit jobs for calculating the specified GENIE nuclear cross-section splines. +# The GENIE gspladd utility can be used to merge the job outputs. +# +# Syntax: +# shell% perl submit_xsec_calc_jobs_eA.pl +# +# Options: +# --gen-version : GENIE generator version number +# --tune : GENIE physics tune +# --spline-list : Text file listing the nuclear cross-section splines to be generated. +# [--input-splines] : Input free-nucleon splines that can speed-up the calculation of nuclear splines +# [--arch] : , default: el7.x86_64 +# [--production] : default: prod +# [--cycle] : default: 01 +# [--use-valgrind] : default: off +# [--batch-system] : , default: Slurm +# [--queue] : default: compute +# [--time-limit] : default: 10:00:00 +# [--softw-topdir] : top level dir for softw installations, default: /user/costasa/projects/GENIE/softw/ +# [--jobs-topdir] : top level dir for job files, default: /scratch/costasa/GENIE/ +# +# Examples: +# % perl submit_xsec_calc_jobs_eA.pl --gen-version v3.06.00 \ +# --tune G18_10a_02_11b --spline-list ./spline_lists/hermes.list +# +# Author: +# Costas Andreopoulos +# University of Liverpool +# +# Copyright: +# Copyright (c) 2003-2025, The GENIE Collaboration +# For the full text of the license visit http://copyright.genie-mc.org +#---------------------------------------------------------------------------------------------------------------- + +use File::Path; +use File::Basename; + +# inputs +# +$iarg=0; +foreach (@ARGV) { + if($_ eq '--gen-version') { $gen_version = $ARGV[$iarg+1]; } + if($_ eq '--tune') { $tune = $ARGV[$iarg+1]; } + if($_ eq '--spline-list') { $spline_list = $ARGV[$iarg+1]; } + if($_ eq '--input-splines') { $input_splines = $ARGV[$iarg+1]; } + if($_ eq '--arch') { $arch = $ARGV[$iarg+1]; } + if($_ eq '--production') { $production = $ARGV[$iarg+1]; } + if($_ eq '--cycle') { $cycle = $ARGV[$iarg+1]; } + if($_ eq '--use-valgrind') { $use_valgrind = $ARGV[$iarg+1]; } + if($_ eq '--batch-system') { $batch_system = $ARGV[$iarg+1]; } + if($_ eq '--queue') { $queue = $ARGV[$iarg+1]; } + if($_ eq '--time-limit') { $time_limit = $ARGV[$iarg+1]; } + if($_ eq '--softw-topdir') { $softw_topdir = $ARGV[$iarg+1]; } + if($_ eq '--jobs-topdir') { $jobs_topdir = $ARGV[$iarg+1]; } + $iarg++; +} +die("** Aborting [Undefined spline list. Use the --spline-list option. See examples in ?]") +unless defined $spline_list; +die("** Aborting [Undefined GENIE Generator version. Use the --gen-version option]") +unless defined $gen_version; +die("** Aborting [Undefined GENIE physics tune. Use the --tune option]") +unless defined $tune; + +$use_valgrind = 0 unless defined $use_valgrind; +$arch = "el7.x86_64" unless defined $arch; +$production = "prod" unless defined $production; +$cycle = "01" unless defined $cycle; +$batch_system = "Slurm" unless defined $batch_system; +$queue = "compute" unless defined $queue; +$time_limit = "10:00:00" unless defined $time_limit; +$softw_topdir = "/user/costasa/projects/GENIE/softw/" unless defined $softw_topdir; +$jobs_topdir = "/scratch/costasa/GENIE/" unless defined $jobs_topdir; +$input_splines = "" unless defined $input_splines; +$gen_setup_script = "$softw_topdir/generator/builds/$arch/$gen_version-setup.sh"; +$splines_name = basename($spline_list,".list"); +$jobs_dir = "$jobs_topdir/$production\_$cycle-$gen_version-$tune-xsec\_eA\_$splines_name"; + +$nknots = 0; +$emax = 0; +@probes = (); +@targets = (); + +open (REQUIRED_SPLINES, $spline_list); +$i=0; +while() +{ + chomp; + # skip comment lines starting with # and empty lines that don't contain any number + if( substr($_,0,1) ne '#' && m/[0-9]/ ) + { + s/ //g; # rm empty spaces from $_ + #print "line = $_\n" ; + $value = ""; + $idx = index($_,"#"); + if($idx == -1) { $value = $_; } + else { $value = substr($_,0,$idx); } + + if ($i==0) { $emax = $value; } + elsif ($i==1) { $nknots = $value; } + else { + if($value == 11 || $value == -11) + { + push(@probes, $value); + } + else + { + push(@targets, $value); + } + } + $i++; + } +} +close(REQUIRED_SPLINES); + +# make the jobs directory +# +mkpath ($jobs_dir, {verbose => 1, mode=>0777}); + +$probe_codes = ""; +$i=0; +foreach (@probes) +{ + s/ //g; # rm empty spaces from $_ + if($i == 0) { $probe_codes = $_; } + else { $probe_codes = $probe_codes . ",$_"; } + $i++; +} + +# +# loop over nuclear targets & submit jobs +# +foreach(@targets) +{ + s/ //g; # rm empty spaces from $_ + $tgt_code = $_; + $job_name = "XSeA-$tgt_code"; + $filename_basepath = "$jobs_dir/$job_name"; + + $grep_pipe = "grep -B 100 -A 30 -i \"warn\\|error\\|fatal\""; + $gmkspl_opt = "-p $probe_codes -t $_ -n $nknots -e $emax --tune $tune --event-generator-list EM"; + $gmkspl_opt = "$gmkspl_opt --output-cross-sections gxspl_$tgt_code.xml"; + $gmkspl_opt = "$gmkspl_opt --input-cross-sections $input_splines" if -e $input_splines; + #$gmkspl_cmd = "gmkspl $gmkspl_opt | $grep_pipe &> $filename_basepath.mkspl.log"; + $gmkspl_cmd = "gmkspl $gmkspl_opt &> $filename_basepath.mkspl.log"; + + print "@@ exec: $gmkspl_cmd \n"; + + # Submit jobs + # ------------------------------------------------------------- + + # Slurm case + if($batch_system eq 'Slurm') { + ##my $time_lim = `sinfo -h -p batch -o %l`; + ##my ($days, $hours, $remainder) = $time_lim =~ /([0]+)-([0-9]+):(.*)/; + ##my $newhours = $days * 24 + $hours; + ##my $new_time_lim = "$newhours:$remainder"; + ##$time_limit = $new_time_lim lt $time_limit ? $new_time_lim : $time_limit; + $batch_script = "$filename_basepath.sh"; + open(SLURM, ">$batch_script") or die("Can not create the SLURM batch script"); + print SLURM "#!/bin/bash \n"; + print SLURM "#SBATCH-p $queue \n"; + print SLURM "#SBATCH-J $job_name \n"; + print SLURM "#SBATCH-N 1 \n"; + print SLURM "#SBATCH-c 1 \n"; + print SLURM "#SBATCH-o $filename_basepath.slurmout.log \n"; + print SLURM "#SBATCH-e $filename_basepath.slurmerr.log \n"; + print SLURM "#SBATCH-t $time_limit \n"; + print SLURM "source $gen_setup_script \n"; + print SLURM "cd $jobs_dir \n"; + print SLURM "$gmkspl_cmd \n"; + close(SLURM); + `sbatch --job-name=$job_name $batch_script`; + } #slurm + + # PBS case + if($batch_system eq 'PBS') { + $batch_script = "$filename_basepath.pbs"; + open(PBS, ">$batch_script") or die("Can not create the PBS batch script"); + print PBS "#!/bin/bash \n"; + print PBS "#PBS -N $job_name \n"; + print PBS "#PBS -o $filename_basepath.pbsout.log \n"; + print PBS "#PBS -e $filename_basepath.pbserr.log \n"; + print PBS "source $gen_setup_script \n"; + print PBS "cd $jobs_dir \n"; + print PBS "$gmkspl_cmd \n"; + close(PBS); + $job_submission_command = "qsub"; + `$job_submission_command -q $queue $batch_script`; + } #PBS + + # LSF case + if($batch_system eq 'LSF') { + $batch_script = "$filename_basepath.sh"; + open(LSF, ">$batch_script") or die("Can not create the LSF batch script"); + print LSF "#!/bin/bash \n"; + print LSF "#BSUB-j $job_name \n"; + print LSF "#BSUB-o $filename_basepath.lsfout.log \n"; + print LSF "#BSUB-e $filename_basepath.lsferr.log \n"; + print LSF "source $gen_setup_script \n"; + print LSF "cd $jobs_dir \n"; + print LSF "$gmkspl_cmd \n"; + close(LSF); + `bsub < $batch_script`; + } #LSF + + # run interactively + if($batch_system eq 'none') { + system("source $gen_setup_script; cd $jobs_dir; $gmkspl_cmd"); + } +} + diff --git a/src/scripts/production/batch/submit_xsec_calc_jobs_eN.pl b/src/scripts/production/batch/submit_xsec_calc_jobs_eN.pl new file mode 100644 index 000000000..5f750d8b9 --- /dev/null +++ b/src/scripts/production/batch/submit_xsec_calc_jobs_eN.pl @@ -0,0 +1,227 @@ +#!/usr/bin/perl + +#---------------------------------------------------------------------------------------------------------------- +# Submit jobs for calculating GENIE free-nucleon cross-sections used for constructing cross-section splines. +# Generate data for all or specified processes, and split the task amongst several worker nodes. +# The GENIE gspladd utility can be used to merge the job outputs. +# +# Syntax: +# shell% perl submit_xsec_calc_jobs_eN.pl +# +# Options: +# --gen-version : GENIE generator version number +# --tune : GENIE physics tune +# --xsec-spline-set : set of cross-section splines to generate +# [--arch] : , default: el7.x86_64 +# [--production] : default: prod +# [--cycle] : default: 01 +# [--use-valgrind] : default: off +# [--batch-system] : , default: Slurm +# [--queue] : default: compute +# [--softw-topdir] : top level dir for softw installations, default: /user/costasa/projects/GENIE/softw/ +# [--jobs-topdir] : top level dir for job files, default: /scratch/costasa/GENIE/ +# +# Examples: +# % perl submit_xsec_calc_jobs_eN.pl --gen-version v3.06.00 --tune G18_10a_02_11b --xsec-spline-set dis_eminusp,dis_eminusn +# % perl submit_xsec_calc_jobs_eN.pl --gen-version v3.06.00 --tune G18_10a_02_11b --xsec-spline-set all +# +# Author: +# Costas Andreopoulos +# University of Liverpool +# +# Copyright: +# Copyright (c) 2003-2025, The GENIE Collaboration +# For the full text of the license visit http://copyright.genie-mc.org +#------------------------------------------------------------------------------------------------------------- + +use File::Path; + +# inputs +# +$iarg=0; +foreach (@ARGV) { + if($_ eq '--gen-version') { $gen_version = $ARGV[$iarg+1]; } + if($_ eq '--tune') { $tune = $ARGV[$iarg+1]; } + if($_ eq '--xsec-spline-set') { $xsplset = $ARGV[$iarg+1]; } + if($_ eq '--arch') { $arch = $ARGV[$iarg+1]; } + if($_ eq '--production') { $production = $ARGV[$iarg+1]; } + if($_ eq '--cycle') { $cycle = $ARGV[$iarg+1]; } + if($_ eq '--use-valgrind') { $use_valgrind = $ARGV[$iarg+1]; } + if($_ eq '--batch-system') { $batch_system = $ARGV[$iarg+1]; } + if($_ eq '--queue') { $queue = $ARGV[$iarg+1]; } + if($_ eq '--time-limit') { $time_limit = $ARGV[$iarg+1]; } + if($_ eq '--softw-topdir') { $softw_topdir = $ARGV[$iarg+1]; } + if($_ eq '--jobs-topdir') { $jobs_topdir = $ARGV[$iarg+1]; } + $iarg++; +} +die("** Aborting [Undefined set of cross section splines #. Use the --xsplset option]") +unless defined $xsplset; +die("** Aborting [Undefined GENIE Generator version. Use the --gen-version option]") +unless defined $gen_version; +die("** Aborting [Undefined GENIE physics tune. Use the --tune option]") +unless defined $tune; + +$use_valgrind = 0 unless defined $use_valgrind; +$arch = "el7.x86_64" unless defined $arch; +$production = "prod" unless defined $production; +$cycle = "01" unless defined $cycle; +$batch_system = "Slurm" unless defined $batch_system; +$queue = "compute" unless defined $queue; +$time_limit = "10:00:00" unless defined $time_limit; +$softw_topdir = "/user/costasa/projects/GENIE/softw/" unless defined $softw_topdir; +$jobs_topdir = "/scratch/costasa/GENIE/" unless defined $jobs_topdir; +$gen_setup_script = "$softw_topdir/generator/builds/$arch/$gen-version-setup.sh"; +$jobs_dir = "$jobs_topdir/$production\_$cycle-$gen_version-$tune-XSeN/"; +$time_limit = "10:00:00"; + +$nkots = 100; +$emax = 100; + +%EPDG = ( + 'qel_eminusp' => '11' , + 'qel_eminusn' => '11' , + 'qel_eplusp' => '-11' , + 'qel_eplusn' => '-11' , + 'res_eminusp' => '11' , + 'res_eminusn' => '11' , + 'res_eplusp' => '-11' , + 'res_eplusn' => '-11' , + 'dis_eminusp' => '11' , + 'dis_eminusn' => '11' , + 'dis_eplusp' => '-11' , + 'dis_eplusn' => '-11' +); + +%TGTPDG = ( + 'qel_eminusp' => '1000010010' , + 'qel_eminusn' => '1000000010' , + 'qel_eplusp' => '1000010010' , + 'qel_eplusn' => '1000000010' , + 'res_eminusp' => '1000010010' , + 'res_eminusn' => '1000000010' , + 'res_eplusp' => '1000010010' , + 'res_eplusn' => '1000000010' , + 'dis_eminusp' => '1000010010' , + 'dis_eminusn' => '1000000010' , + 'dis_eplusp' => '1000010010' , + 'dis_eplusn' => '1000000010' +); + +%GEVGL = ( + 'qel_eminusp' => 'EMQE' , + 'qel_eminusn' => 'EMQE' , + 'qel_eplusp' => 'EMQE' , + 'qel_eplusn' => 'EMQE' , + 'res_eminusp' => 'EMRES' , + 'res_eminusn' => 'EMRES' , + 'res_eplusp' => 'EMRES' , + 'res_eplusn' => 'EMRES' , + 'dis_eminusp' => 'EMDIS' , + 'dis_eminusn' => 'EMDIS' , + 'dis_eplusp' => 'EMDIS' , + 'dis_eplusn' => 'EMDIS' +); + +%OUTXML = ( + 'qel_eminusp' => 'partial-xspl-e-p-qel.xml' , + 'qel_eminusn' => 'partial-xspl-e-n-qel.xml' , + 'qel_eplusp' => 'partial-xspl-e+p-qel.xml' , + 'qel_eplusn' => 'partial-xspl-e+n-qel.xml' , + 'res_eminusp' => 'partial-xspl-e-p-res.xml' , + 'res_eminusn' => 'partial-xspl-e-n-res.xml' , + 'res_eplusp' => 'partial-xspl-e+p-res.xml' , + 'res_eplusn' => 'partial-xspl-e+n-res.xml' , + 'dis_eminusp' => 'partial-xspl-e-p-dis.xml' , + 'dis_eminusn' => 'partial-xspl-e-n-dis.xml' , + 'dis_eplusp' => 'partial-xspl-e+p-dis.xml' , + 'dis_eplusn' => 'partial-xspl-e+n-dis.xml' +); + +# make the jobs directory +# +print "@@ Creating job directory: $jobs_dir \n"; +mkpath ($jobs_dir, {verbose => 1, mode=>0777}); + +for my $curr_xsplset (keys %OUTXML) { + if($xsplset=~m/$curr_xsplset/ || $xsplset eq "all") { + + # Get runnu-dependent info + # ------------------------------------------------------------- + + $probe = $EPDG {$curr_xsplset}; + $tgt = $TGTPDG {$curr_xsplset}; + $gevgl = $GEVGL {$curr_xsplset}; + $outxml = $OUTXML {$curr_xsplset}; + + $job_name = "XSeN-$curr_xsplset"; + $filename_basepath = "$jobs_dir/$job_name"; + + $grep_pipe = "grep -B 100 -A 30 -i \"warn\\|error\\|fatal\""; + $valgrind_cmd = "valgrind --tool=memcheck --error-limit=no --leak-check=yes --show-reachable=yes"; + $gmkspl_opt = "-p $probe -t $tgt -n $nkots -e $emax -o $outxml --event-generator-list $gevgl --tune $tune"; + $gmkspl_cmd = "gmkspl $gmkspl_opt"; + + print "@@ exec: $gmkspl_cmd \n"; + + # Submit jobs + # ------------------------------------------------------------- + + # Slurm case + if($batch_system eq 'Slurm') { + $batch_script = "$filename_basepath.sh"; + open(SLURM, ">$batch_script") or die("Can not create the Slurm batch script"); + print SLURM "#!/bin/bash \n"; + print SLURM "#SBATCH-p $queue \n"; + print SLURM "#SBATCH-J $job_name \n"; + print SLURM "#SBATCH-N 1 \n"; + print SLURM "#SBATCH-c 1 \n"; + print SLURM "#SBATCH-o $filename_basepath.slurmout.log \n"; + print SLURM "#SBATCH-e $filename_basepath.slurmerr.log \n"; + print SLURM "#SBATCH-t $time_limit \n"; + print SLURM "source $gen_setup_script \n"; + print SLURM "cd $jobs_dir \n"; + print SLURM "$gmkspl_cmd | $grep_pipe &> $filename_basepath.mkspl.log \n"; + close(SLURM); + `sbatch $batch_script`; + } #Slurm + + # PBS case + if($batch_system eq 'PBS') { + $batch_script = "$filename_basepath.pbs"; + open(PBS, ">$batch_script") or die("Can not create the PBS batch script"); + print PBS "#!/bin/bash \n"; + print PBS "#PBS -N $job_name \n"; + print PBS "#PBS -o $filename_basepath.pbsout.log \n"; + print PBS "#PBS -e $filename_basepath.pbserr.log \n"; + print PBS "source $gen_setup_script \n"; + print PBS "cd $jobs_dir \n"; + print PBS "$gmkspl_cmd | $grep_pipe &> $filename_basepath.mkspl.log \n"; + close(PBS); + $job_submission_command = "qsub"; + `$job_submission_command -q $queue $batch_script`; + } #PBS + + # LSF case + if($batch_system eq 'LSF') { + $batch_script = "$filename_basepath.sh"; + open(LSF, ">$batch_script") or die("Can not create the LSF batch script"); + print LSF "#!/bin/bash \n"; + print PBS "#BSUB-j $job_name \n"; + print LSF "#BSUB-q $queue \n"; + print LSF "#BSUB-o $filename_basepath.lsfout.log \n"; + print LSF "#BSUB-e $filename_basepath.lsferr.log \n"; + print LSF "source $gen_setup_script \n"; + print LSF "cd $jobs_dir \n"; + print LSF "$gmkspl_cmd | $grep_pipe &> $filename_basepath.mkspl.log \n"; + close(LSF); + `bsub < $batch_script`; + } #LSF + + # no batch system, run jobs interactively + if($batch_system eq 'none') { + system("source $gen_setup_script $gen_version; cd $jobs_dir; $gmkspl_cmd"); + } # interactive mode + + + } +} diff --git a/src/scripts/production/batch/submit_xsec_calc_jobs_vA.pl b/src/scripts/production/batch/submit_xsec_calc_jobs_vA.pl new file mode 100644 index 000000000..aa46ede41 --- /dev/null +++ b/src/scripts/production/batch/submit_xsec_calc_jobs_vA.pl @@ -0,0 +1,218 @@ +#!/usr/bin/perl + +#---------------------------------------------------------------------------------------------------------------- +# Submit jobs for calculating the specified GENIE nuclear cross-section splines. +# The GENIE gspladd utility can be used to merge the job outputs. +# +# Syntax: +# shell% perl submit_xsec_calc_jobs_vA.pl +# +# Options: +# --gen-version : GENIE generator version number +# --tune : GENIE physics tune +# --spline-list : Text file listing the nuclear cross-section splines to be generated. +# [--input-splines] : Input free-nucleon splines that can speed-up the calculation of nuclear splines +# [--arch] : , default: el7.x86_64 +# [--production] : default: prod +# [--cycle] : default: 01 +# [--use-valgrind] : default: off +# [--batch-system] : , default: Slurm +# [--queue] : default: compute +# [--time-limit] : default: 10:00:00 +# [--softw-topdir] : top level dir for softw installations, default: /user/costasa/projects/GENIE/softw/ +# [--jobs-topdir] : top level dir for job files, default: /scratch/costasa/GENIE/ +# +# Examples: +# % perl submit_xsec_calc_jobs_vA.pl --gen-version v3.06.00 \ +# --tune G18_10a_02_11b --spline-list ./spline_lists/t2k.list +# +# Author: +# Costas Andreopoulos +# University of Liverpool +# +# Copyright: +# Copyright (c) 2003-2025, The GENIE Collaboration +# For the full text of the license visit http://copyright.genie-mc.org +#---------------------------------------------------------------------------------------------------------------- + +use File::Path; +use File::Basename; + +# inputs +# +$iarg=0; +foreach (@ARGV) { + if($_ eq '--gen-version') { $gen_version = $ARGV[$iarg+1]; } + if($_ eq '--tune') { $tune = $ARGV[$iarg+1]; } + if($_ eq '--spline-list') { $spline_list = $ARGV[$iarg+1]; } + if($_ eq '--input-splines') { $input_splines = $ARGV[$iarg+1]; } + if($_ eq '--arch') { $arch = $ARGV[$iarg+1]; } + if($_ eq '--production') { $production = $ARGV[$iarg+1]; } + if($_ eq '--cycle') { $cycle = $ARGV[$iarg+1]; } + if($_ eq '--use-valgrind') { $use_valgrind = $ARGV[$iarg+1]; } + if($_ eq '--batch-system') { $batch_system = $ARGV[$iarg+1]; } + if($_ eq '--queue') { $queue = $ARGV[$iarg+1]; } + if($_ eq '--time-limit') { $time_limit = $ARGV[$iarg+1]; } + if($_ eq '--softw-topdir') { $softw_topdir = $ARGV[$iarg+1]; } + if($_ eq '--jobs-topdir') { $jobs_topdir = $ARGV[$iarg+1]; } + $iarg++; +} +die("** Aborting [Undefined spline list. Use the --spline-list option. See examples in ?]") +unless defined $spline_list; +die("** Aborting [Undefined GENIE Generator version. Use the --gen-version option]") +unless defined $gen_version; +die("** Aborting [Undefined GENIE physics tune. Use the --tune option]") +unless defined $tune; + +$use_valgrind = 0 unless defined $use_valgrind; +$arch = "el7.x86_64" unless defined $arch; +$production = "prod" unless defined $production; +$cycle = "01" unless defined $cycle; +$batch_system = "Slurm" unless defined $batch_system; +$queue = "compute" unless defined $queue; +$time_limit = "24:00:00" unless defined $time_limit; +$softw_topdir = "/user/costasa/projects/GENIE/softw/" unless defined $softw_topdir; +$jobs_topdir = "/scratch/costasa/GENIE/" unless defined $jobs_topdir; +$input_splines = "" unless defined $input_splines; +$gen_setup_script = "$softw_topdir/generator/builds/$arch/$gen_version-setup.sh"; +$splines_name = basename($spline_list,".list"); +$jobs_dir = "$jobs_topdir/$production\_$cycle-$gen_version-$tune-xsec\_vA\_$splines_name"; + +$nknots = 0; +$emax = 0; +@neutrinos = (); +@targets = (); + +@processes = ("CC","NC","NuE"); # Can split for finely to fit within time limits +#@processes = ("all"); # This disables job splitting based on process type + +open (REQUIRED_SPLINES, $spline_list); +$i=0; +while() +{ + chomp; + # skip comment lines starting with # and empty lines that don't contain any number + if( substr($_,0,1) ne '#' && m/[0-9]/ ) + { + s/ //g; # rm empty spaces from $_ + $value = ""; + $idx = index($_,"#"); + if($idx == -1) { $value = $_; } + else { $value = substr($_,0,$idx); } + + if ($i==0) { $emax = $value; } + elsif ($i==1) { $nknots = $value; } + else { + if( $value == 12 || $value == 14 || $value == 16 || + $value == -12 || $value == -14 || $value == -16 ) + { + push(@neutrinos, $value); + } + else + { + push(@targets, $value); + } + } + $i++; + } +} +close(REQUIRED_SPLINES); + +print "Probes: @neutrinos\n"; +print "Targets: @targets\n"; +print "Processes: @processes\n"; + +# make the jobs directory +# +mkpath ($jobs_dir, {verbose => 1, mode=>0777}); + +# +# Loop over neutrinos and nuclear targets & submit a separate job for each combination. +# For each initial state, can subdivide jobs further based on the process type +# +foreach my $nu_code (@neutrinos) +{ + foreach my $tgt_code (@targets) + { + foreach my $proc_type (@processes) + { + $job_name = "XSvA_$nu_code\_$tgt_code\_$proc_type"; + $filename_basepath = "$jobs_dir/$job_name"; + + $grep_pipe = "grep -B 100 -A 30 -i \"warn\\|error\\|fatal\""; + $gmkspl_opt = "-p $nu_code -t $tgt_code -n $nknots -e $emax --tune $tune"; + $gmkspl_opt = "$gmkspl_opt --event-generator-list $proc_type" if $proc_type ne "all"; + $gmkspl_opt = "$gmkspl_opt --output-cross-sections gxspl_$tgt_code.xml"; + $gmkspl_opt = "$gmkspl_opt --input-cross-sections $input_splines" if -e $input_splines; + #$gmkspl_cmd = "gmkspl $gmkspl_opt | $grep_pipe &> $filename_basepath.mkspl.log"; + $gmkspl_cmd = "gmkspl $gmkspl_opt &> $filename_basepath.mkspl.log"; + + print "@@ exec: $gmkspl_cmd \n"; + + # Submit jobs + # ------------------------------------------------------------- + + # Slurm case + if($batch_system eq 'Slurm') { + ##my $time_lim = `sinfo -h -p batch -o %l`; + ##my ($days, $hours, $remainder) = $time_lim =~ /([0]+)-([0-9]+):(.*)/; + ##my $newhours = $days * 24 + $hours; + ##my $new_time_lim = "$newhours:$remainder"; + ##$time_limit = $new_time_lim lt $time_limit ? $new_time_lim : $time_limit; + $batch_script = "$filename_basepath.sh"; + open(SLURM, ">$batch_script") or die("Can not create the SLURM batch script"); + print SLURM "#!/bin/bash \n"; + print SLURM "#SBATCH-p $queue \n"; + print SLURM "#SBATCH-J $job_name \n"; + print SLURM "#SBATCH-N 1 \n"; + print SLURM "#SBATCH-c 1 \n"; + print SLURM "#SBATCH-o $filename_basepath.slurmout.log \n"; + print SLURM "#SBATCH-e $filename_basepath.slurmerr.log \n"; + print SLURM "#SBATCH-t $time_limit \n"; + print SLURM "source $gen_setup_script \n"; + print SLURM "cd $jobs_dir \n"; + print SLURM "$gmkspl_cmd \n"; + close(SLURM); + `sbatch $batch_script`; + } #Slurm + + # PBS case + if($batch_system eq 'PBS') { + $batch_script = "$filename_basepath.pbs"; + open(PBS, ">$batch_script") or die("Can not create the PBS batch script"); + print PBS "#!/bin/bash \n"; + print PBS "#PBS -N $job_name \n"; + print PBS "#PBS -o $filename_basepath.pbsout.log \n"; + print PBS "#PBS -e $filename_basepath.pbserr.log \n"; + print PBS "source $gen_setup_script \n"; + print PBS "cd $jobs_dir \n"; + print PBS "$gmkspl_cmd \n"; + close(PBS); + $job_submission_command = "qsub"; + `$job_submission_command -q $queue $batch_script`; + } #PBS + + # LSF case + if($batch_system eq 'LSF') { + $batch_script = "$filename_basepath.sh"; + open(LSF, ">$batch_script") or die("Can not create the LSF batch script"); + print LSF "#!/bin/bash \n"; + print LSF "#BSUB-j $job_name \n"; + print LSF "#BSUB-o $filename_basepath.lsfout.log \n"; + print LSF "#BSUB-e $filename_basepath.lsferr.log \n"; + print LSF "source $gen_setup_script \n"; + print LSF "cd $jobs_dir \n"; + print LSF "$gmkspl_cmd \n"; + close(LSF); + `bsub < $batch_script`; + } #LSF + + # run interactively + if($batch_system eq 'none') { + system("source $gen_setup_script; cd $jobs_dir; $gmkspl_cmd"); + } + + } # process + } # targets +} # neutrinos + diff --git a/src/scripts/production/batch/submit_xsec_calc_jobs_vN.pl b/src/scripts/production/batch/submit_xsec_calc_jobs_vN.pl new file mode 100644 index 000000000..4f1f81cb8 --- /dev/null +++ b/src/scripts/production/batch/submit_xsec_calc_jobs_vN.pl @@ -0,0 +1,289 @@ +#!/usr/bin/perl + +#---------------------------------------------------------------------------------------------------------------- +# Submit jobs for calculating GENIE free-nucleon cross-sections used for constructing cross-section splines. +# Generate data for all or specified processes, and split the task amongst several worker nodes. +# The GENIE gspladd utility can be used to merge the job outputs. +# +# Syntax: +# shell% perl submit_xsec_calc_jobs_vN.pl +# +# Options: +# --gen-version : GENIE generator version number +# --tune : GENIE physics tune +# --xsec-spline-set : set of cross-section splines to generate +# [--arch] : , default: el7.x86_64 +# [--production] : default: prod +# [--cycle] : default: 01 +# [--use-valgrind] : default: off +# [--batch-system] : , default: Slurm +# [--queue] : default: compute +# [--softw-topdir] : top level dir for softw installations, default: /user/costasa/projects/GENIE/softw/ +# [--jobs-topdir] : top level dir for job files, default: /scratch/costasa/GENIE/ +# +# Examples: +# % perl submit_xsec_calc_jobs_vN.pl --gen-version v3.06.00 --tune G18_10a_02_11b --xsec-spline-set chm +# % perl submit_xsec_calc_jobs_vN.pl --gen-version v3.06.00 --tune G18_10a_02_11b --xsec-spline-set chm,nue,qel +# % perl submit_xsec_calc_jobs_vN.pl --gen-version v3.06.00 --tune G18_10a_02_11b --xsec-spline-set all +# +# Author: +# Costas Andreopoulos +# University of Liverpool +# +# Copyright: +# Copyright (c) 2003-2025, The GENIE Collaboration +# For the full text of the license visit http://copyright.genie-mc.org +#------------------------------------------------------------------------------------------------------------- + +use File::Path; + +# inputs +# +$iarg=0; +foreach (@ARGV) { + if($_ eq '--gen-version') { $gen_version = $ARGV[$iarg+1]; } + if($_ eq '--tune') { $tune = $ARGV[$iarg+1]; } + if($_ eq '--xsec-spline-set') { $xsplset = $ARGV[$iarg+1]; } + if($_ eq '--arch') { $arch = $ARGV[$iarg+1]; } + if($_ eq '--production') { $production = $ARGV[$iarg+1]; } + if($_ eq '--cycle') { $cycle = $ARGV[$iarg+1]; } + if($_ eq '--use-valgrind') { $use_valgrind = $ARGV[$iarg+1]; } + if($_ eq '--batch-system') { $batch_system = $ARGV[$iarg+1]; } + if($_ eq '--queue') { $queue = $ARGV[$iarg+1]; } + if($_ eq '--time-limit') { $time_limit = $ARGV[$iarg+1]; } + if($_ eq '--softw-topdir') { $softw_topdir = $ARGV[$iarg+1]; } + if($_ eq '--jobs-topdir') { $jobs_topdir = $ARGV[$iarg+1]; } + $iarg++; +} +die("** Aborting [Undefined set of cross section splines #. Use the --xsplset option]") +unless defined $xsplset; +die("** Aborting [Undefined GENIE Generator version. Use the --gen-version option]") +unless defined $gen_version; +die("** Aborting [Undefined GENIE physics tune. Use the --tune option]") +unless defined $tune; + +$use_valgrind = 0 unless defined $use_valgrind; +$arch = "el7.x86_64" unless defined $arch; +$production = "prod" unless defined $production; +$cycle = "01" unless defined $cycle; +$batch_system = "Slurm" unless defined $batch_system; +$queue = "compute" unless defined $queue; +$time_limit = "10:00:00" unless defined $time_limit; +$softw_topdir = "/user/costasa/projects/GENIE/softw/" unless defined $softw_topdir; +$jobs_topdir = "/scratch/costasa/GENIE/" unless defined $jobs_topdir; +$gen_setup_script = "$softw_topdir/generator/builds/$arch/$gen-version-setup.sh"; +$jobs_dir = "$jobs_topdir/$production\_$cycle-$gen_version-$tune-XSvN/"; +$time_limit = "10:00:00"; + +$nkots = 500; +$emax = 500; + +%NUPDG = ( 'chm' => '12,-12,14,-14,16,-16', + 'nue' => '12,-12,14,-14,16,-16', + 'qel' => '12,-12,14,-14,16,-16', + 'dfr' => '12,-12,14,-14,16,-16', + 'dis_ebar_cc' => '-12', + 'dis_ebar_nc' => '-12', + 'dis_e_cc' => '12', + 'dis_e_nc' => '12', + 'dis_mubar_cc' => '-14', + 'dis_mubar_nc' => '-14', + 'dis_mu_cc' => '14', + 'dis_mu_nc' => '14', + 'dis_taubar_cc' => '-16', + 'dis_taubar_nc' => '-16', + 'dis_tau_cc' => '16', + 'dis_tau_nc' => '16', + 'res_ebar_cc' => '-12', + 'res_ebar_nc' => '-12', + 'res_e_cc' => '12', + 'res_e_nc' => '12', + 'res_mubar_cc' => '-14', + 'res_mubar_nc' => '-14', + 'res_mu_cc' => '14', + 'res_mu_nc' => '14', + 'res_taubar_cc' => '-16', + 'res_taubar_nc' => '-16', + 'res_tau_cc' => '16', + 'res_tau_nc' => '16' ); + +%TGTPDG = ( 'chm' => '1000010010,1000000010', + 'nue' => '1000010010,1000000010', + 'qel' => '1000010010,1000000010', + 'dfr' => '1000010010,1000000010', + 'dis_ebar_cc' => '1000010010,1000000010', + 'dis_ebar_nc' => '1000010010,1000000010', + 'dis_e_cc' => '1000010010,1000000010', + 'dis_e_nc' => '1000010010,1000000010', + 'dis_mubar_cc' => '1000010010,1000000010', + 'dis_mubar_nc' => '1000010010,1000000010', + 'dis_mu_cc' => '1000010010,1000000010', + 'dis_mu_nc' => '1000010010,1000000010', + 'dis_taubar_cc' => '1000010010,1000000010', + 'dis_taubar_nc' => '1000010010,1000000010', + 'dis_tau_cc' => '1000010010,1000000010', + 'dis_tau_nc' => '1000010010,1000000010', + 'res_ebar_cc' => '1000010010,1000000010', + 'res_ebar_nc' => '1000010010,1000000010', + 'res_e_cc' => '1000010010,1000000010', + 'res_e_nc' => '1000010010,1000000010', + 'res_mubar_cc' => '1000010010,1000000010', + 'res_mubar_nc' => '1000010010,1000000010', + 'res_mu_cc' => '1000010010,1000000010', + 'res_mu_nc' => '1000010010,1000000010', + 'res_taubar_cc' => '1000010010,1000000010', + 'res_taubar_nc' => '1000010010,1000000010', + 'res_tau_cc' => '1000010010,1000000010', + 'res_tau_nc' => '1000010010,1000000010' ); + +%GEVGL = ( 'chm' => 'Charm', + 'nue' => 'NuE', + 'qel' => 'QE', + 'dfr' => 'DFR', + 'dis_ebar_cc' => 'CCDIS', + 'dis_ebar_nc' => 'NCDIS', + 'dis_e_cc' => 'CCDIS', + 'dis_e_nc' => 'NCDIS', + 'dis_mubar_cc' => 'CCDIS', + 'dis_mubar_nc' => 'NCDIS', + 'dis_mu_cc' => 'CCDIS', + 'dis_mu_nc' => 'NCDIS', + 'dis_taubar_cc' => 'CCDIS', + 'dis_taubar_nc' => 'NCDIS', + 'dis_tau_cc' => 'CCDIS', + 'dis_tau_nc' => 'NCDIS', + 'res_ebar_cc' => 'CCRES', + 'res_ebar_nc' => 'NCRES', + 'res_e_cc' => 'CCRES', + 'res_e_nc' => 'NCRES', + 'res_mubar_cc' => 'CCRES', + 'res_mubar_nc' => 'NCRES', + 'res_mu_cc' => 'CCRES', + 'res_mu_nc' => 'NCRES', + 'res_taubar_cc' => 'CCRES', + 'res_taubar_nc' => 'NCRES', + 'res_tau_cc' => 'CCRES', + 'res_tau_nc' => 'NCRES' ); + +%OUTXML = ( 'chm' => 'partial-xspl-chm.xml', + 'nue' => 'partial-xspl-nue.xml', + 'qel' => 'partial-xspl-qel.xml', + 'dfr' => 'partial-xspl-dfr.xml', + 'dis_ebar_cc' => 'partial-xspl-dis_ebar_cc.xml', + 'dis_ebar_nc' => 'partial-xspl-dis_ebar_nc.xml', + 'dis_e_cc' => 'partial-xspl-dis_e_cc.xml', + 'dis_e_nc' => 'partial-xspl-dis_e_nc.xml', + 'dis_mubar_cc' => 'partial-xspl-dis_mubar_cc.xml', + 'dis_mubar_nc' => 'partial-xspl-dis_mubar_nc.xml', + 'dis_mu_cc' => 'partial-xspl-dis_mu_cc.xml', + 'dis_mu_nc' => 'partial-xspl-dis_mu_nc.xml', + 'dis_taubar_cc' => 'partial-xspl-dis_taubar_cc.xml', + 'dis_taubar_nc' => 'partial xspl-dis_taubar_nc.xml', + 'dis_tau_cc' => 'partial-xspl-dis_tau_cc.xml', + 'dis_tau_nc' => 'partial-xspl-dis_tau_nc.xml', + 'res_ebar_cc' => 'partial-xspl-res_ebar_cc.xml', + 'res_ebar_nc' => 'partial-xspl-res_ebar_nc.xml', + 'res_e_cc' => 'partial-xspl-res_e_cc.xml', + 'res_e_nc' => 'partial-xspl-res_e_nc.xml', + 'res_mubar_cc' => 'partial-xspl-res_mubar_cc.xml', + 'res_mubar_nc' => 'partial-xspl-res_mubar_nc.xml', + 'res_mu_cc' => 'partial-xspl-res_mu_cc.xml', + 'res_mu_nc' => 'partial-xspl-res_mu_nc.xml', + 'res_taubar_cc' => 'partial-xspl-res_taubar_cc.xml', + 'res_taubar_nc' => 'partial-xspl-res_taubar_nc.xml', + 'res_tau_cc' => 'partial-xspl-res_tau_cc.xml', + 'res_tau_nc' => 'partial-xspl-res_tau_nc.xml' ); + +# make the jobs directory +# +print "@@ Creating job directory: $jobs_dir \n"; +mkpath ($jobs_dir, {verbose => 1, mode=>0777}); + +for my $curr_xsplset (keys %OUTXML) { + if($xsplset=~m/$curr_xsplset/ || $xsplset eq "all") { + + # Get runnu-dependent info + # ------------------------------------------------------------- + + $nu = $NUPDG {$curr_xsplset}; + $tgt = $TGTPDG {$curr_xsplset}; + $gevgl = $GEVGL {$curr_xsplset}; + $outxml = $OUTXML {$curr_xsplset}; + + $job_name = "XSvN-$curr_xsplset"; + $filename_basepath = "$jobs_dir/$job_name"; + + $grep_pipe = "grep -B 100 -A 30 -i \"warn\\|error\\|fatal\""; + $valgrind_cmd = "valgrind --tool=memcheck --error-limit=no --leak-check=yes --show-reachable=yes"; + $gmkspl_opt = "-p $nu -t $tgt -n $nkots -e $emax -o $outxml --event-generator-list $gevgl --tune $tune"; + $gmkspl_cmd = "gmkspl $gmkspl_opt"; + + print "@@ exec: $gmkspl_cmd \n"; + + # Submit jobs + # ------------------------------------------------------------- + + # Slurm case + if($batch_system eq 'Slurm') { + ##my $time_lim = `sinfo -h -p batch -o %l`; + ##my ($days, $hours, $remainder) = $time_lim =~ /([0]+)-([0-9]+):(.*)/; + ##my $newhours = $days * 24 + $hours; + ##my $new_time_lim = "$newhours:$remainder"; + ##$time_limit = $new_time_lim lt $time_limit ? $new_time_lim : $time_limit; + $batch_script = "$filename_basepath.sh"; + open(SLURM, ">$batch_script") or die("Can not create the Slurm batch script"); + print SLURM "#!/bin/bash \n"; + print SLURM "#SBATCH-p $queue \n"; + print SLURM "#SBATCH-J $job_name \n"; + print SLURM "#SBATCH-N 1 \n"; + print SLURM "#SBATCH-c 1 \n"; + print SLURM "#SBATCH-o $filename_basepath.slurmout.log \n"; + print SLURM "#SBATCH-e $filename_basepath.slurmerr.log \n"; + print SLURM "#SBATCH-t $time_limit \n"; + print SLURM "source $gen_setup_script \n"; + print SLURM "cd $jobs_dir \n"; + print SLURM "$gmkspl_cmd | $grep_pipe &> $filename_basepath.mkspl.log \n"; + close(SLURM); + `sbatch $batch_script`; + } #Slurm + + # PBS case + if($batch_system eq 'PBS') { + $batch_script = "$filename_basepath.pbs"; + open(PBS, ">$batch_script") or die("Can not create the PBS batch script"); + print PBS "#!/bin/bash \n"; + print PBS "#PBS -N $job_name \n"; + print PBS "#PBS -o $filename_basepath.pbsout.log \n"; + print PBS "#PBS -e $filename_basepath.pbserr.log \n"; + print PBS "source $gen_setup_script \n"; + print PBS "cd $jobs_dir \n"; + print PBS "$gmkspl_cmd | $grep_pipe &> $filename_basepath.mkspl.log \n"; + close(PBS); + $job_submission_command = "qsub"; + `$job_submission_command -q $queue $batch_script`; + } #PBS + + # LSF case + if($batch_system eq 'LSF') { + $batch_script = "$filename_basepath.sh"; + open(LSF, ">$batch_script") or die("Can not create the LSF batch script"); + print LSF "#!/bin/bash \n"; + print PBS "#BSUB-j $job_name \n"; + print LSF "#BSUB-q $queue \n"; + print LSF "#BSUB-o $filename_basepath.lsfout.log \n"; + print LSF "#BSUB-e $filename_basepath.lsferr.log \n"; + print LSF "source $gen_setup_script \n"; + print LSF "cd $jobs_dir \n"; + print LSF "$gmkspl_cmd | $grep_pipe &> $filename_basepath.mkspl.log \n"; + close(LSF); + `bsub < $batch_script`; + } #LSF + + # no batch system, run jobs interactively + if($batch_system eq 'none') { + system("source $gen_setup_script $gen_version; cd $jobs_dir; $gmkspl_cmd"); + } # interactive mode + + + } +}