#! /bin/ksh # Script launching in batches (on Icarus batch farm) the processing of multiples runs. # Pre-requisites: # 1- it has to be launched from a Squeeze machine at GSI (squeezelust64.gsi.de), # 2- the macro EXE has to be pre-compiled under ROOT (.L EXE.C++) on that machine. # 3- the environment variables AsyEOSRootVersion (e.g. asyeosroot_v6) and ASYEOSROOT (may contain the version number) have to be defined. # (ALF, 02/2013) SYS=$1 # example: au400 RUNMIN=$2 # example: 1670 RUNMAX=$3 # example: 1670 ################################################## BATCHSYS=1 # 1=Icarus batch farm or 2=interactive ################################################## CPU="ct=00:15:00" EXE="UnpackATOF" LDIR=/lustre/fopi/asyeos/data/tof/bin #LDIR=/u/le_fevre/AsyEOS ROOTSYS_misc=/misc/cbmsoft/Squeeze64/jan12/fairsoft # WARNING: /misc cannot be seen from Icarus - here, ROOT 5.32/00 - OK for interactive jobs ROOTSYS_cvmfs=/cvmfs/fairroot.gsi.de/fairsoft/sep12 LIBDIR=${LDIR}/${AsyEOSRootVersion} #mkdir -p ${LIBDIR}/build # DOIT DEJA EXISTER => INSTALLER ASYEOSROOT SUR LUSTRE OUTPUTDIR=/lustre/fopi/asyeos/data/tof/rootfiles/systematics LOGDIR=${OUTPUTDIR}/log # Set the ROOT environment compatible with Icarus - have to set before installing and building a new AsyEOSRoot version on a Squeeze64 machine export ASYEOSROOT=$LIBDIR ORIGDIR=${ASYEOSROOT} #. ${ASYEOSROOT}/build/config.sh # for AsyEosRoot (R3BRoot-FairRoot) - needs the "source" alias; for this reason it is executed at the end #mkdir -p ${LIBDIR}/macros/atof #cd ${LIBDIR}/macros/atof # Update and recompile SVN #echo "Update and recompile SVN source" #cd $LIBDIR #svn update ./ #cd $LIBDIR/build #make -j4 # Define ROOT version here # Warning: /misc/cbmsoft/Squeeze64/jan12/fairsoft/bin/root is not seen from Icarus SCRIPT_CONFIG=${ORIGDIR}/macros/atof/script_config.sh if [[ BATCHSYS -eq 1 ]]; then # batch mode cat > ${SCRIPT_CONFIG} << END_OF_FIL source ${ASYEOSROOT}/build/config.sh export ASYEOSROOT=${LIBDIR} export ROOTSYS=${ROOTSYS_cvmfs} export PATH=.:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/u/le_fevre/nedit:/src:/bin:${ROOTSYS}/bin export LD_LIBRARY_PATH=${LIBDIR}/build/lib:${ROOTSYS}/lib/root:${ROOTSYS}/lib export VMCWORKDIR=${LIBDIR} export Root=${ROOTSYS}/bin/root END_OF_FIL else # interactive mode cat > ${SCRIPT_CONFIG} << END_OF_FIL source ${ASYEOSROOT}/build/config.sh export ASYEOSROOT=${LIBDIR} export ROOTSYS=${ROOTSYS_cvmfs} #export ROOTSYS=${ROOTSYS_misc} export PATH=.:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/u/le_fevre/nedit:/src:/bin:${ROOTSYS}/bin export LD_LIBRARY_PATH=${ROOTSYS}/lib/root:${LIBDIR}/build/lib:${ROOTSYS}/lib export VMCWORKDIR=${LIBDIR} export Root=${ROOTSYS}/bin/root END_OF_FIL fi chmod +x ${SCRIPT_CONFIG} source ${SCRIPT_CONFIG} echo "=== VMCWORKDIR="${VMCWORKDIR} echo "=== PATH="${PATH} echo "=== LD_LIBRARY_PATH="${LD_LIBRARY_PATH} echo "=== ROOTSYS="${ROOTSYS} echo "=== Root="${Root} (( run = ${RUNMIN} )) # first run to treat while ((run <= ${RUNMAX})) # put here last run to treat do LOG="${SYS}_${run}.log" ERR="${SYS}_${run}.e*" rm -fv ${LOGDIR}/${LOG} rm -fv ${LOGDIR}/${ERR} LOG2=${LOGDIR}"/"${SYS}"_"${run}".log2" JOB=${SYS}"_"${run} # JOB=${EXE}"_"${SYS}"_"${run} COMMAND=${Root}" -b "${EXE}".C\(\\\""$SYS"\\\","${run}","${run}"\)" COMMANDINT=${Root}" -b "${EXE}".C(\""$SYS"\","${run}","${run}")" # COMMAND=${Root}" -b "${EXE}"\(\\\""$SYS"\\\","${run}","${run}"\)" # a besoin d'etre pre-compile avec .L et charge avec gSystem->Load (ds rootlogon.C) pour ca # COMMANDINT=${Root}" -b "${EXE}"\(\\\""$SYS"\\\","${run}","${run}"\)" # rq : ne tourne pas plus vite en pre-compile (librairies chargees dans la macro UnpackATOF) # COMMAND=${Root}" -b "${EXEL}"+\(\\\""$SYS"\\\","${run}","${run}"\)" # COMMANDINT=${Root}" -b "${EXEL}"+(\""$SYS"\","${run}","${run}")" echo "Write execution script for run ${SYS}_${run}" #echo "Write execution script for run = ${run}: ${COMMAND}" # --- write shell script for batch job --- SCRIPT=${LOGDIR}"/"${SYS}"_"${run}".sh" # name of the running script cat > $SCRIPT << END_OF_FIL source ${SCRIPT_CONFIG} #. ${ASYEOSROOT}/build/config.sh . ${ASYEOSROOT}/macros/atof/test.sh cd ${LIBDIR}/macros/atof ${COMMAND} < ${LOG2}" # to process on Icarus cluster at GSI (should be logged in on squeezelust64.gsi.de) # see for usage: http://wiki.gsi.de/cgi-bin/view/Linux/GridEngineUsage # -b y : because execution of a binary # qstat -r -> current status of personnal jobs (-r for full job name) # qstat -ext -> idem with more infos (CPU, etc.) # qstat -g c -> list and state of queues # qdel JOB_ID -> delete job JOD_ID # qhost -q -j _> list of hosts running my jobs # qstat -j JOB_ID -> more detailed infos on that job # qstat -j JOB_ID | grep usage -> ressource consumption of a job # qmod -cj JOB_ID. This will put your job back into the state qw (queued waiting) for the next scheduling interval 2) # run interactively ${COMMANDINT} <