Minimize.sh 1.59 KB
Newer Older
Plaszczynski Stephane's avatar
Plaszczynski Stephane committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
#!/bin/env bash

#choose the queue you want
NCORES=8

#QUEUE="pa_long -pe openmpi_$NCORES $NCORES"
QUEUE="mc_long -pe multicores $NCORES"
#QUEUE="long"

if [ "$QUEUE" = "long" ] ; then
NCORES=1
echo "WARING you asked for $NCORES cores and long queue: putting ONE"
fi


if [ $# -ne 1 ]; then
echo "missing parFile"
exit
fi
parFile=$1

exec=$CAMELROOT/$CMTCONFIG/Minimize
if ! [ -f $exec ] ; then
echo "missing exec"
exit
fi
localexec=`basename $exec`

if [ -z "$CLIKDIR" ] ; then
echo "miss CLIKDIR"
exit
fi

if ! [ -f $parFile ] ; then
echo "wrong parFile $parFile"
exit
fi

#cat $parFile
cd `dirname $parFile`
dirpar=$PWD
cd -

parbase=`basename $parFile`
zeroot=$CAMELROOT/batch/${parbase%".par"}

echo "Ouptut will be in: $zeroot"
if [ -d $zeroot ]  ; then
echo "$zeroot already exists: remove or rename "
exit
fi

mkdir $zeroot
cd $zeroot

cat > zerun.sh  <<eof
echo "running on : \$(uname -a)"
export CLIKDIR=$CLIKDIR
source \$CLIKDIR/bin/clik_profile.sh
export PYTHONHOME=/usr/local/python/python-2.7
export PYTHONPATH=/afs/in2p3.fr/group/planck/plaszczy/python2.7/site-packages/pypico
source /usr/local/bin/python27_env.sh
export OMP_NUM_THREADS=$NCORES

cd \$TMPDIR

cp $exec .
cp $dirpar/$parbase .

cp $parbase $PWD/

./$localexec $parbase bestfit.dat covmat.dat

cp bestfit.dat $PWD/
cp covmat.dat $PWD/
qstat -j \${JOB_ID} -nenv
eof

echo "**************************************"
#cat zerun.sh
echo "running on queue=$QUEUE"
echo "OK? [o/n]"
read answer
if [ $answer != 'o' ] ; then
echo "exiting"
exit 1
fi
88
qsub -P P_cobesix -q $QUEUE -l sps=1 -V -R y -j y -o $PWD -e $PWD -N $(basename $zeroot) zerun.sh
Plaszczynski Stephane's avatar
Plaszczynski Stephane committed
89 90

cd -