]> Creatis software - clitk.git/commitdiff
adapt to osx
authorDavid Sarrut <david.sarrut@creatis.insa-lyon.fr>
Wed, 26 Jul 2017 06:12:50 +0000 (08:12 +0200)
committerDavid Sarrut <david.sarrut@creatis.insa-lyon.fr>
Wed, 26 Jul 2017 06:12:50 +0000 (08:12 +0200)
cluster_tools/gate_job_cluster.job
cluster_tools/gate_run_submit_cluster.sh

index 9401268acb080c8e348d88d288feabf78ab30930..be749e50f4f46e1627f219dfd3eb4de34425b2e7 100644 (file)
@@ -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"
index edd798bf62839fdbaccd39d28e828be2086d808e..904a0d7162e2f12c664db4cec1e37efd16de5d4c 100755 (executable)
@@ -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##*.}