]> Creatis software - clitk.git/commitdiff
bugfix in cluster jobs and submission script
authorPierre Gueth <gueth@linux6.dg.creatis.insa-lyon.fr>
Mon, 30 Jan 2012 15:06:15 +0000 (16:06 +0100)
committerSimon Rit <simon.rit@creatis.insa-lyon.fr>
Thu, 27 Jun 2013 12:58:51 +0000 (14:58 +0200)
cluster_tools/gate_job_cluster.job [new file with mode: 0644]

diff --git a/cluster_tools/gate_job_cluster.job b/cluster_tools/gate_job_cluster.job
new file mode 100644 (file)
index 0000000..86d277a
--- /dev/null
@@ -0,0 +1,104 @@
+#!/bin/bash
+#
+# MACRODIR
+# MACROFILE
+# RELEASEDIR
+# OUTPUTDIR
+# SCRIPTDIR
+# INDEX
+# INDEXMAX
+# PARAM
+#
+#PBS -r n
+#PBS -l walltime=100:00:00
+#PBS -j oe
+
+#env
+#pwd
+#exit 1
+
+
+function error {
+echo "ERROR: $1"
+exit 1
+}
+
+function warning {
+echo "WARNING: $1"
+}
+
+test -f ${HOME}/.bashrc && echo "Sourcing bashrc" && source ${HOME}/.bashrc
+set -u
+
+echo "Checking"
+uname -a
+echo "MACRODIR=${MACRODIR:?"unknown MACRODIR"}"
+echo "MACROFILE=${MACROFILE:?"unknown MACROFILE"}"
+echo "RELEASEDIR=${RELEASEDIR:?"unknown RELEASEDIR"}"
+echo "OUTPUTDIR=${OUTPUTDIR:?"unknown OUTPUTDIR"}"
+echo "SCRIPTDIR=${SCRIPTDIR:?"unknown SCRIPTDIR"}"
+echo "PBS_JOBID=${PBS_JOBID}"
+echo "INDEX=${INDEX}"
+echo "INDEXMAX=${INDEX}"
+echo "PARAM=${PARAM}"
+test -d "${RELEASEDIR}" || error "can't find release"
+test -d "${MACRODIR}" && test -d "${MACRODIR}/mac" || error "invalid macro"
+md5sum ${RELEASEDIR}/Gate
+test -f ${RELEASEDIR}/libGate.so && md5sum ${RELEASEDIR}/libGate.so
+
+echo "Finding libraries"
+ROOTLIBS="${RELEASEDIR}/libCore.so:${RELEASEDIR}/libCint.so:${RELEASEDIR}/libRIO.so:${RELEASEDIR}/libNet.so:${RELEASEDIR}/libHist.so:${RELEASEDIR}/libGraf.so:${RELEASEDIR}/libGraf3d.so:${RELEASEDIR}/libGpad.so:${RELEASEDIR}/libTree.so:${RELEASEDIR}/libRint.so:${RELEASEDIR}/libPostscript.so:${RELEASEDIR}/libMatrix.so:${RELEASEDIR}/libPhysics.so:${RELEASEDIR}/libMathCore.so:${RELEASEDIR}/libThread.so:"
+echo "ROOTLIBS=${ROOTLIBS}"
+G4LIBS="$(for library in $(find "${RELEASEDIR}" -maxdepth 1 -name 'libG4*.so'); do echo -n "${library}:"; done)"
+echo "G4LIBS=${G4LIBS}"
+CLHEPLIBS="$(for library in $(find "${RELEASEDIR}" -maxdepth 1 -name 'libCLHEP*.so'); do echo -n "${library}:"; done)"
+echo "CLHEPLIBS=${CLHEPLIBS}"
+GATELIBS=""
+test -f ${RELEASEDIR}/libGate.so && GATELIBS="${RELEASEDIR}/libGate.so:"
+echo "GATELIBS=${GATELIBS}"
+
+
+echo "Copying inputs"
+LOCALMACRODIR=$(mktemp -d)
+cd ${LOCALMACRODIR}
+cp -r -L "${MACRODIR}"/{data,mac} .
+mkdir output
+
+#echo "Search for param generation script"
+#if [ -x "${MACRODIR}/generate_placements.py" -a ! -z "${PARAM}" ]; then
+#    echo "found generate_placements.py and non null param"
+#    cp "${MACRODIR}/generate_placements.py" .
+#    ./generate_placements.py ${PARAM}
+#fi
+
+echo "Lauching macro"
+date
+LD_PRELOAD="${ROOTLIBS}${G4LIBS}${CLHEPLIBS}${GATELIBS}" \
+G4LEVELGAMMADATA="${RELEASEDIR}/PhotonEvaporation2.1" \
+G4RADIOACTIVEDATA="${RELEASEDIR}/RadioactiveDecay3.3" \
+G4LEDATA="${RELEASEDIR}/G4EMLOW6.19" \
+G4NEUTRONHPDATA="${RELEASEDIR}/G4NDL3.14" \
+G4ABLADATA="${RELEASEDIR}/G4ABLA3.0" \
+G4REALSURFACEDATA="${RELEASEDIR}/RealSurface1.0" \
+G4NEUTRONXSDATA="${RELEASEDIR}/G4NEUTRONXS1.0" \
+G4PIIDATA="${RELEASEDIR}/G4PII1.2" \
+/usr/bin/time --format="real %es\nuser %Us\nsys %Ss\nmaxmem %Mk" \
+${RELEASEDIR}/Gate ${PARAM} ${MACROFILE} \
+|| error "gate failed"
+
+#echo "Convert to energy"
+#${SCRIPTDIR}/phsptoenergy.py output/phspTarget.root output/energyTarget.mat || warning "convertion failed"
+
+if test $(find output -name '*-detected.root' | wc -l) -ne 0
+then
+    echo "Parsing detected particle"
+    ${SCRIPTDIR}/phspdetected.py output || warning "detection failed"
+fi
+
+echo "Copying data back"
+mv output "${OUTPUTDIR}/output.${PBS_JOBID%%.*}"
+
+echo "Cleanup"
+rm -r ${LOCALMACRODIR}
+
+echo "Success!!!"