📣 An issue occured with the embedded container registry on October 25 2021, between 10:30 and 12:10 (UTC+2). Any persisting issues should be reported to CC-IN2P3 Support. 🐛

Commit 226fd059 authored by Matthieu Tristram's avatar Matthieu Tristram
Browse files

Interation best-fit

parent 07468a61
#!/bin/bash
##Parameters
nargs=$#
if ! [ $nargs -eq 2 -o $nargs -eq 3 ]; then
echo "usage: MinimizeIter.sh parFile Niter (range) "
echo "the optional \"range\" parameter can be used to specify different starting points "
echo "It must be given in the form: begin-end (eg. 1-5 for jobs 1 to 5)"
echo "Job 1 corresponding to not changing the parFile starting values, while other values"
echo "will send jobs shuffling the parameters randomly within the min-max bounds of the parFile"
exit
fi
parFile=$1
Niter=$2
range="1-1"
if [ $# -eq 3 ] ; then
range=$3
fi
##some checks
if [ -z "${CAMELROOT}" ] ; then
echo "CAMELROOT undefined: did you sourced camel_setup.sh?"
exit
fi
if [ -z "$CLIKDIR" ] ; then
echo "miss CLIKDIR"
exit
fi
if ! [ -f $CAMELROOT/$CMTCONFIG/Minimize ] ; then
echo "missing Minimize executable: rum make exec in cmt/"
fi
file=$(readlink -e $parFile)
parbase=$(basename $file)
if [ ! -f "$file" ] ; then
echo "no parfile=$file"
exit
fi
dirout=${parbase%".par"}_"minit"
OUTDIR=$PWD/$dirout
if [ -d "$dirout" ] ; then
echo "Output directory $dirout already exists: still want to run? (y/n)"
read answer
if [ $answer != 'y' ] ; then
echo "exiting"
exit 1
fi
else
mkdir $dirout
fi
cd $OUTDIR
###################################################
cat > camelrun <<EOBATCH
#!/bin/bash
#$ -N $(basename $dirout)
#$ -R y
#$ -j y
#$ -o $PWD
#$ -e $PWD
#$ -P P_$GROUP
#$ -l sps=1
cd \$TMPDIR
export OMP_NUM_THREADS=8
export PYTHONPATH=${PICO_CODE}
# copies localeS
cp $CAMELROOT/$CMTCONFIG/Minimize .
cp $CAMELROOT/work/tools/awk/genrand.awk .
cp $CAMELROOT/work/tools/python/changepars.py .
chmod u+x changepars.py
cp $file parfile_in
#================================
#randomize si id ne 1
#================================
echo "***************************************************************"
if [ \${SGE_TASK_ID} -eq 1 ] ; then
cp parfile_in parfile
else
RANDOM=\${SGE_TASK_ID}
zerand=\$RANDOM
awk -v seed=\$zerand -f genrand.awk parfile_in > parfile
fi
echo "***************************************************************"
for((N=1; N<=$Niter; N++)); do
cp parfile $OUTDIR/camel\${SGE_TASK_ID}_min\${N}.par
#================================
# Camel run
#================================
./Minimize parfile bestfit covmat
#MODIFY par BESTFIT
python ./changepars.py parfile bestfit > newparfile
mv bestfit $OUTDIR/best\${N}_fit\${SGE_TASK_ID}
mv covmat $OUTDIR/covmat\${N}_\${SGE_TASK_ID}.dat
mv newparfile parfile
done
EOBATCH
##############################################################################################
if [ -z "${QSUB_CMD}" ] ; then
QSUB_CMD="qsub -pe multicores 8 -q mc_long"
fi
jobsub="${QSUB_CMD} -t $range camelrun"
echo "about to run : $jobsub"
echo "OK? [y/n]"
read answer
if [ $answer != 'y' ] ; 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