Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /job_submission_slurm/scripts/submit.sh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #!/bin/bash
0002 #SBATCH --output=LOG/SLURM/%A_%4a.out
0003 #SBATCH --mail-type=FAIL,TIME_LIMIT,TIME_LIMIT_90
0004 #SBATCH --time=24:00:00
0005 #SBATCH --mem-per-cpu=3G
0006 #SBATCH --cpus-per-task=1
0007 
0008 # check arguments
0009 if [ $# -lt 2 ] ; then
0010   echo "Usage: "
0011   echo "  $0 <input> [n_chunk=10000]"
0012   echo "  sbatch --array 1-<N> $0 <type> <input> [n_chunk=10000]"
0013   echo
0014   echo "This job is intended to be run as an array job:"
0015   echo "  sbatch --array 1-<N> $0 <type> <input> [n_chunk=10000]"
0016   echo "where N tasks of n_chunk events will be dispatched."
0017   echo
0018   echo "Note: The job with task ID 1 will start with the first event."
0019   echo
0020   echo "Additional useful options to sbatch are:"
0021   echo " --mail-user=$USER@$HOSTNAME"
0022   echo " --mail-type=ALL"
0023   echo
0024   echo "In interactive use, the number of events per task is still honored,"
0025   echo "but the sequence always starts from the first event."
0026   echo "  $0 <type> <input> [n_chunk=10000]"
0027   echo
0028   echo "A typical npsim run requires from 0.5 to 5 core-seconds per event,"
0029   echo "and uses under 3 GB of memory. The output ROOT file for"
0030   echo "10k events take up about 2 GB in disk space."
0031   exit
0032 fi
0033 
0034 # startup
0035 date
0036 echo "Arguments: $*"
0037 
0038 # Parse arguments
0039 # - type of simulation
0040 TYPE=${1}
0041 shift
0042 # - input file
0043 INPUT_FILE=${1}
0044 shift
0045 # - number of events
0046 EVENTS_PER_TASK=${1:-10000}
0047 shift
0048 
0049 # determine directory this is being run from
0050 if [ -n "$SLURM_JOB_ID" ] ;  then
0051   BASEDIR=$(realpath ${SLURM_SUBMIT_DIR})
0052   INPUT_FILE_SHORT=${INPUT_FILE//EVGEN\//}
0053   INPUT_FILE_SHORT=${INPUT_FILE_SHORT//SINGLE\//}
0054   NAME=${INPUT_FILE_SHORT//\//_}_${EVENTS_PER_TASK}
0055   scontrol update jobid=${SLURM_JOB_ID} Name=${NAME}
0056 else
0057   BASEDIR=$(realpath $(dirname ${0})/..)
0058 fi
0059 cd ${BASEDIR}
0060 pwd
0061 
0062 # find singularity
0063 if [ -z "${SINGULARITY:-}" ] ; then
0064   if which singularity 2> /dev/null ; then
0065     SINGULARITY=$(which singularity)
0066   else
0067     SINGULARITY="/cvmfs/oasis.opensciencegrid.org/mis/singularity/bin/singularity"
0068   fi
0069 fi
0070 echo "Using SINGULARITY=${SINGULARITY}"
0071 
0072 # find eic-shell
0073 if [ -z "${EICSHELL:-}" ] ; then
0074   # bind base dir for lustre symlinked systems
0075   BINDPATH="/$(realpath ${BASEDIR} | cut -d "/" -f2)"
0076   EICSHELL="${SINGULARITY} exec -B ${BINDPATH} /cvmfs/singularity.opensciencegrid.org/eicweb/eic_xl:${JUGGLER_TAG:-nightly} eic-shell"
0077 fi
0078 echo "Using EICSHELL=${EICSHELL}"
0079 
0080 # dispatch job
0081 cat << EOF | ${EICSHELL}
0082 
0083   ${CAMPAIGNS:-/opt/campaigns}/${TYPE}/scripts/run.sh ${INPUT_FILE} ${EVENTS_PER_TASK} ${SLURM_ARRAY_TASK_ID:-}
0084 
0085 EOF
0086 
0087 # closeout
0088 date