Commit cda35604 authored by Plaszczynski Stephane's avatar Plaszczynski Stephane
Browse files

prefit avec pico

parent 5554f0d0
#!/bin/bash
!/bin/bash
#vhl
#M=(0 0.06 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.7 0.80 0.90 1)
......@@ -80,7 +80,7 @@ cp $CAMELROOT/batch/awk/genrand.awk .
#
#input file
# enleve lo:w-l
grep -v ncdm $file | grep -v Alens | grep -v N_eff > parfile_in
grep -v ncdm $file | grep -v N_eff > parfile_in
#rajouter MNU
#================================
......@@ -121,7 +121,7 @@ EOBATCH
#####################################################################################################################################
qsub -P P_planck_prod -t 1-5 -pe multicores 8 -q mc_long camelrun
qsub -P P_planck_prod -t 6-10 -pe openmpi_8 8 -q pa_long camelrun
#qsub -P P_planck_prod -t 6-10 -pe openmpi_8 8 -q pa_long camelrun
#sps=1
#qsub -t 1-10 -pe multicores 8 -l sps=1 -q mc_long camelrun
......
......@@ -13,7 +13,7 @@
var=tau_reio
#val=(0.025 0.035 0.045 0.055 0.065 0.075 0.085 0.095)
#val=(0.01 0.02 0.025 0.03 0.035 0.04 0.045 0.05 0.055 0.06 0.065 0.07 0.075 0.08 0.085 0.09 0.095 0.10 0.12)
N=40
N=30
xmin=0.05
xmax=0.25
for ((i=0;i<N;i++)) ; do
......
#!/bin/bash
#var=Alens
#N=50
#xmin=0.8
#xmax=1.5
#val array
#for ((i=0;i<N;i++)) ; do
#val[$i]=$(echo | awk -v xmin=$xmin -v xmax=$xmax -v N=$N -v i=$i 'BEGIN{step=(xmax-xmin)/(N-1)} {printf("%f",xmin+(i)*step)}')
#done
var=tau_reio
#val=(0.025 0.035 0.045 0.055 0.065 0.075 0.085 0.095)
#val=(0.01 0.02 0.025 0.03 0.035 0.04 0.045 0.05 0.055 0.06 0.065 0.07 0.075 0.08 0.085 0.09 0.095 0.10 0.12)
N=30
xmin=0.05
xmax=0.25
for ((i=0;i<N;i++)) ; do
val[$i]=$(echo | awk -v xmin=$xmin -v xmax=$xmax -v N=$N -v i=$i 'BEGIN{step=(xmax-xmin)/(N-1)} {printf("%f",xmin+(i)*step)}')
done
file=$(readlink -e $1)
parbase=$(basename $file)
dirout=${parbase%".par"}_mprof_"${var}"
if [ -z "${CAMELROOT}" ] ; then
echo "CAMELROOT undefined"
exit
fi
if [ ! -f "$file" ] ; then
echo "mssing $file"
exit
fi
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
CAMELDIR=${GROUP_DIR}/camel
HERE=$PWD
##########LOOP################################
for i in $(seq 0 $((${#val[@]}-1))) ; do
zeval=${val[$i]}
echo $zeval
OUTDIR=$HERE/$dirout/"$var"_${zeval}
mkdir $OUTDIR
cd $OUTDIR
######################creation bestfitpico###############################
cat bfrun <<EOF
#!/bin/bash
#$ -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 .
#
#input file -> transforme en pico et enleve var
awk -f toPico.awk $file | grep -v "$var" > parfile_in
#compute var
echo "fix $var cosmo $zeval" >> parfile_in
echo "pico .par:"
cat parfile_in
#PICO RUN
./Minimize parfile_in bestfit_pico
echo "PICO BESTFIT="
cat bestfit_pico
cp -f bestfit_pico "$OUTDIR"/bestfit.pico
EOF
###################RUN A PARTIR de bestfit.pico################################
cat > camelrun <<EOBATCH
#!/bin/bash
#$ -l os=sl6
#$ -R y
#$ -j y
#$ -o $PWD
#$ -e $PWD
cd \$TMPDIR
export OMP_NUM_THREADS=8
export PYTHONPATH=${PICO_CODE}
#
if [ ! -f "$OUTDIR"/bestfit.pico ] ; then
echo "NO BESTFITPICO FOUND : CATASTROPHIC ERROR"
exit 1
fi
#compute var
cp "$OUTDIR"/bestfit.pico .
# copies localeS
cp $CAMELROOT/$CMTCONFIG/FitClassFromPico .
cp $CAMELROOT/batch/awk/genrand.awk .
cp $CAMELROOT/batch/python/changepars.py .
#
#MODIFY input .par according to bestfit
grep -v "$var" $file > parfile2
echo "fix $var cosmo $zeval" >> parfile2
python ./changepars.py parfile2 bestfit.pico > parfile_in
echo "***************************************************************"
if [ \${SGE_TASK_ID} -eq 1 ] ; then
cp parfile_in parfile
else
RANDOM=\${SGE_TASK_ID}
awk -v seed=\$RANDOM -f genrand.awk parfile_in > parfile
fi
echo "CLASS .par:"
cat parfile
cp parfile "$OUTDIR"/camelClass\${SGE_TASK_ID}.par
#CLASS RUN
./FitClassFromPico parfile bestfit_class
cp -f bestfit_class "$OUTDIR"/best_fitClass\${SGE_TASK_ID}
EOBATCH
#####################################################################################################################################
#qsub -P P_planck_prod -t 1-10 -pe openmpi_8 8 -q pa_long camelrun
#qsub -P P_planck_prod -t 1-10 -pe multicores 8 -q mc_long camelrun
base=$(basename $PWD)
picojob="picofit_$base"
#mc
#qsub -P P_planck_prod -pe multicores 8 -q mc_long -N $picojob bfrun
#qsub -P P_planck_prod -t 1-10 -pe multicores 8 -q mc_long -hold_jid $picojob -N "class_$base" camelrun
#pa
qsub -P P_planck_prod -pe openmpi_8 8 -q pa_long -N $picojob bfrun
qsub -P P_planck_prod -t 1-10 -pe openmpi_8 8 -q pa_long -hold_jid $picojob -N "class_$base" camelrun
#####################################################################################################################################
done
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