From d0dce37ee2767e373340fd5d9fe906dcd1126d5c Mon Sep 17 00:00:00 2001 From: David Sarrut Date: Wed, 26 Jul 2017 08:12:50 +0200 Subject: [PATCH] adapt to osx --- cluster_tools/gate_job_cluster.job | 21 +++++++++++++++++---- cluster_tools/gate_run_submit_cluster.sh | 11 ++++++++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/cluster_tools/gate_job_cluster.job b/cluster_tools/gate_job_cluster.job index 9401268..be749e5 100644 --- a/cluster_tools/gate_job_cluster.job +++ b/cluster_tools/gate_job_cluster.job @@ -40,7 +40,13 @@ echo "PARAM=${PARAM}" if test "$RELEASEDIR" = "NONE" then echo Using $(which Gate) - ldd $(which Gate) + unamestr=`uname` + if [[ "$unamestr" != 'Darwin' ]]; then + ldd $(which Gate) + else + ## ldd "equivalent" on osx is otool + otool -L $(which Gate) + fi else test -d "${RELEASEDIR}" || error "can't find release" md5sum ${RELEASEDIR}/Gate @@ -64,7 +70,13 @@ echo "Copying inputs" LOCALMACRODIR=$(mktemp -d) trap "mv output ${OUTPUTDIR}/output.${PBS_JOBID%%.*} ; rm -r ${LOCALMACRODIR} ; exit 1" 1 2 3 15 cd ${LOCALMACRODIR} -cp -r -L "${MACRODIR}"/{data,mac} . +unamestr=`uname` +if [[ "$unamestr" == 'Darwin' ]]; then + ## cp is slightly different on OSX + cp -R -L "${MACRODIR}"/{data,mac} . +else + cp -r -L "${MACRODIR}"/{data,mac} . +fi mkdir output # Enforce one thread @@ -74,8 +86,8 @@ echo "Lauching macro" date if test "$RELEASEDIR" = "NONE" then - echo Gate ${PARAM} ${MACROFILE} - eval Gate ${PARAM} ${MACROFILE} || error "gate failed" + echo Gate ${PARAM} ${MACROFILE} + eval Gate ${PARAM} ${MACROFILE} || error "gate failed" else LD_PRELOAD="${ROOTLIBS}${G4LIBS}${CLHEPLIBS}${GATELIBS}" \ G4LEVELGAMMADATA="${RELEASEDIR}/PhotonEvaporation2.1" \ @@ -92,6 +104,7 @@ else fi echo "Copying data back" +pwd mv output "${OUTPUTDIR}/output.${PBS_JOBID%%.*}" echo "Cleanup" diff --git a/cluster_tools/gate_run_submit_cluster.sh b/cluster_tools/gate_run_submit_cluster.sh index edd798b..904a0d7 100755 --- a/cluster_tools/gate_run_submit_cluster.sh +++ b/cluster_tools/gate_run_submit_cluster.sh @@ -52,7 +52,16 @@ then OUTPUTDIR=$(mktemp -d -p "${MACRODIR}" run.XXXX || error "can't create temp dir") ssh -i ${HOME}/.ssh/ccin2p3 linux1.dg.creatis.insa-lyon.fr mkdir -p "cc/$(basename ${OUTPUTDIR})" else - OUTPUTDIR=$(mktemp --tmpdir=${MACRODIR} -d run.XXXX || error "can't create temp dir") + unamestr=`uname` + if [[ "$unamestr" == 'Darwin' ]]; then + ## On OSX (Darwin), mktemp version is different from Linux version . We + ## need the absolute folder here + OUTPUTDIR=$(mktemp -d run.XXXX || error "can't create temp dir") + OUTPUTDIR=${MACRODIR}/${OUTPUTDIR} + else + OUTPUTDIR=$(mktemp --tmpdir=${MACRODIR} -d run.XXXX || error "can't create temp dir") + fi + echo $OUTPUTDIR fi test -d ${OUTPUTDIR} || error "can't locate output dir" RUNID=${OUTPUTDIR##*.} -- 2.47.1