Commit 57872fc9 authored by Plaszczynski Stephane's avatar Plaszczynski Stephane
Browse files

a l'air bon

parent a2aadad9
#!/bin/bash
if [ $# -ne 2 ]; then
echo "usage: parFile Ntir"
exit
fi
HERE=$PWD
cd `dirname $1`
dirpar=$PWD
cd $HERE
parbase=`basename $1`
# class
fileClass=$dirpar/$parbase
if [ ! -f "$fileClass" ] ; then
echo "mssing $fileClass"
exit
fi
declare -i Ntir
Ntir=$2
#
dirout=${parbase%".par"}_bf
if [ -d "$dirout" ] ; then
echo "directory $dirout exists: still want to run? (o/n)"
read answer
if [ $answer != 'o' ] ; then
echo "exiting"
exit 1
fi
fi
mkdir $dirout
if [ -z "${CAMELROOT}" ] ; then
echo "CAMELROOT undefined"
exit
fi
if [ -z "$CLIKDIR" ] ; then
echo "miss CLIKDIR"
exit
fi
OUTDIR=$HERE/$dirout
cd $OUTDIR
pwd
###################################################
cat > camelrun <<EOBATCH
#!/bin/bash
#$ -N $(basename $(dirname $PWD))_$(basename $PWD)
#$ -l os=sl6
#$ -R y
#$ -j y
#$ -o $PWD
#$ -e $PWD
cd \$TMPDIR
export OMP_NUM_THREADS=8
#for pico
export PYTHONPATH=${PICO_CODE}
# copies localeS
cp $CAMELROOT/$CMTCONFIG/Minimize .
cp $CAMELROOT/$CMTCONFIG/FitClassFromPico .
cp $CAMELROOT/batch/awk/genrand.awk .
cp $CAMELROOT/batch/awk/toPico.awk .
cp $CAMELROOT/batch/python/changepars.py .
chmod u+x changepars.py
#
# create corresponding pico file
awk -f toPico.awk $fileClass > parfile_in1
#================================
#randomize si id ne 1
#================================
if [ \${SGE_TASK_ID} -eq 1 ] ; then
cp parfile_in1 parfile1
else
RANDOM=\${SGE_TASK_ID}
zerand=\$RANDOM
awk -v seed=\$zerand -f genrand.awk parfile_in1 > parfile1
fi
echo "PICO PAR"
cat parfile1
cp parfile1 $OUTDIR/camelPico\${SGE_TASK_ID}.par
#================================
# Camel run
#================================
#PICO RUN
./Minimize parfile1 bestfit_pico covmat_pico
echo "PICO BESTFIT="
cat bestfit_pico
cp -f bestfit_pico $OUTDIR/best_fitPico\${SGE_TASK_ID}
cp -f covmat_pico $OUTDIR/covmat_pico\${SGE_TASK_ID}.dat
#MODIFY par BESTFIT
cp $fileClass parfile2
python ./changepars.py parfile2 bestfit_pico > parfile3
echo "CLASS PAR(pico improved)"
cat parfile3
cp parfile3 $OUTDIR/camelClass\${SGE_TASK_ID}.par
#CLASS RUN
./FitClassFromPico parfile3 bestfit_class
cp -f bestfit_class $OUTDIR/best_fitClass\${SGE_TASK_ID}
EOBATCH
##############################################################################################
if [ -z "${QSUB_CMD}" ] ; then
QSUB_CMD="qsub -P P_$GROUP -pe multicores 8 -q mc_long -R y -j y -l sps=1"
fi
jobsub="${QSUB_CMD} -o $PWD -N $(basename $dirout) -t 1-$Ntir camelrun"
echo "about to run : $jobsub"
echo "OK? [o/n]"
read answer
if [ $answer != 'o' ] ; then
echo "exiting"
exit 1
fi
eval $jobsub
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment