]> Creatis software - clitk.git/commitdiff
Modified to use .bashrc settings as default
authorSimon Rit <simon.rit@creatis.insa-lyon.fr>
Thu, 27 Jun 2013 14:25:25 +0000 (16:25 +0200)
committerSimon Rit <simon.rit@creatis.insa-lyon.fr>
Thu, 27 Jun 2013 14:25:25 +0000 (16:25 +0200)
cluster_tools/gate_job_cluster.job
cluster_tools/gate_run_submit_cluster.sh

index 86d277ae7892beaad53d4c35c3dda352babf9c55..506e125ec5db68bdebc31d72bd93de471b471b79 100644 (file)
@@ -4,7 +4,6 @@
 # MACROFILE
 # RELEASEDIR
 # OUTPUTDIR
-# SCRIPTDIR
 # INDEX
 # INDEXMAX
 # PARAM
@@ -36,26 +35,32 @@ 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}"
+if test "$RELEASEDIR" = "NONE"
+then
+       echo Using $(which Gate)
+       ldd $(which Gate)
+else
+       test -d "${RELEASEDIR}" || error "can't find release"
+       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}"
+fi
+test -d "${MACRODIR}" && test -d "${MACRODIR}/mac" || error "invalid macro"
 
 
 echo "Copying inputs"
@@ -64,35 +69,24 @@ 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
+if test "$RELEASEDIR" = "NONE"
 then
-    echo "Parsing detected particle"
-    ${SCRIPTDIR}/phspdetected.py output || warning "detection failed"
+       Gate ${PARAM} ${MACROFILE} || error "gate failed"
+else
+       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"
 fi
 
 echo "Copying data back"
index f20e28780c3bef0677a4f8a89504b65465a9d687..f47ed6dcdba0923b7a915880ec5e5746b1d5dfc3 100755 (executable)
@@ -9,24 +9,31 @@ usage
 exit 1
 }
 
-DEFAULTRELEASESUFFIX="07b"
+DEFAULTRELEASESUFFIX="NONE"
 DEFAULTNUMBEROFJOBS="10"
 
 function usage {
 echo "${SCRIPTNAME} mac/main.mac njobs releasesuffix paramtogate"
 echo "default njobs = ${DEFAULTNUMBEROFJOBS}"
-echo "default releasesuffix = ${DEFAULTRELEASESUFFIX}"
+echo "default releasesuffix = ${DEFAULTRELEASESUFFIX} (NONE means use Gate in PATH)"
 }
 
 test $# -eq 0 && usage && exit 0
 
 SCRIPTDIR="${HOME}/git/gate-tests/bin"
-RELEASEDIR="${HOME}/releases/grid_release${3:-"${DEFAULTRELEASESUFFIX}"}"
+RELEASESUFFIX=${3:-"${DEFAULTRELEASESUFFIX}"}
+RELEASEDIR="${HOME}/releases/grid_release${RELEASESUFFIX}"
 JOBFILE="$(dirname $0)/gate_job_cluster.job"
 
 echo "Checking stuff"
 test -f ${JOBFILE} || error "can't find job file ${JOBFILE}"
-test -d ${RELEASEDIR} || error "invalid release dir ${RELEASEDIR}"
+if test "${RELEASESUFFIX}" = "${DEFAULTRELEASESUFFIX}"
+then
+       RELEASEDIR="NONE"
+       which Gate 2>&1 >/dev/null || error "there is no Gate in the PATH"
+else
+       test -d ${RELEASEDIR} || error "invalid release dir ${RELEASEDIR}"
+fi
 MACRODIR=$(pwd)
 test -d ${MACRODIR}/mac && test -d ${MACRODIR}/data || error "invalid path"
 MACROFILE=${1:?"provide relative macro path"}
@@ -42,7 +49,12 @@ echo "Lets roll!!"
 echo "runid is ${RUNID}"
 echo "qsub is $(which qsub)"
 test -z "${PARAM}" && echo "no param" || echo "param is ${PARAM}"
-echo "using release $(basename ${RELEASEDIR})"
+if test "$RELEASESUFFIX" = "$DEFAULTRELEASESUFFIX"
+then
+       echo "using $(which Gate)"
+else
+       echo "using release $(basename ${RELEASEDIR})"
+fi
 echo "submitting ${NJOBS} jobs"
 
 PARAMFILE="${OUTPUTDIR}/params.txt"