#!/bin/env bash NCHAINS=4 MCORE=20 myexec=$CAMELROOT/$CMTCONFIG/mcmc if [ $# -ne 2 ]; then echo "usage: parFile NSAMPLES" exit fi if [ -z "$CLIKDIR" ] ; then echo "miss CLIKDIR" exit fi if ! [ -f $myexec ] ; then echo "missing exec" exit fi localexec=`basename $myexec` parFile=$1 NSAMPLES=$2 if ! [ -f $parFile ] ; then echo "wrong parFile $parFile" exit fi #cat $parFile cd `dirname $parFile` dirpar=$PWD cd - parbase=`basename $parFile` zeroot=${parbase%".par"}_MC if [ -d "$zeroot" ] ; then echo "directory $zeroot exists: still want to run? (o/n)" read answer if [ $answer != 'o' ] ; then echo "exiting" exit 1 fi fi ndim=`awk '$1=="par"{n++}; END {print n}' $parFile` mkdir $zeroot cd $zeroot #MCMC stuff :TT cov=$dirpar/covmat.dat if ! [ -f $cov ] ; then echo "$cov" echo "no covariance matrix found ndim=$ndim" exit fi cat > mc_setup < zerun.sh < $parbase cat $PWD/mc_setup >> $parbase RANDOM=\${SGE_TASK_ID} echo "seed=\$RANDOM" >> $parbase cp $parbase $PWD/camel.par ./$localexec $parbase $PWD/samples\${SGE_TASK_ID}.txt cp ar_vs_length.txt ar_$PWD/vs_length\${SGE_TASK_ID}.txt cp scale_vs_length.txt $PWD/scale_vs_length\${SGE_TASK_ID}.txt cp corr.txt $PWD/corr\${SGE_TASK_ID}.txt qstat -j \${JOB_ID} -nenv eof echo "**************************************" cat zerun.sh echo "OK? [o/n]" read answer if [ $answer != 'o' ] ; then echo "exiting" exit 1 fi #qsub -P P_planck_prod -t 1-$NCHAINS -pe openmpi_$MCORE $MCORE -q pa_long -l sps=1 -V -R y -j y -o $PWD -e $PWD -N $zeroot zerun.sh qsub -P P_planck_prod -t 1-$NCHAINS -pe multicores $MCORE -q mc_longlasting -l sps=1 -V -R y -j y -o $PWD -e $PWD -N $zeroot zerun.sh cd -