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
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
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" \
fi
echo "Copying data back"
+pwd
mv output "${OUTPUTDIR}/output.${PBS_JOBID%%.*}"
echo "Cleanup"
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##*.}