multiprof.sh 3.54 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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
#!/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
val=(0.9 0.95 1 1.03 1.05 1.07 1.10 1.15 1.20 1.3)

#var=tau_reio
#val=(0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.12)
#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)
#val=(0.095)


#var=N_eff
#TE
#val=(1.5 1.6 1.7 1.8 1.9 2 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3. 3.2 3.5)
#val=(0.7 0.9 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3. 3.2 3.5 )

#EE
#val=(0.1 0.5 1. 1.5 2 2.5 3 3.5 4 4.5 5)
#;val=(0.2 0.3 0.4 0.6 0.7 0.8 0.9 1.1 1.2 1.3 1.4 1.6 1.7 1.8 1.9 2.1 2.2 2.3 2.4 2.6 2.7 2.8 2.9 3.1 3.2 3.3 3.4 3.6 3.7)

#TT
#val=(0.5 0.7 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3. 3.2 3.4 )
#val=(3.5 3.6 3.7 3.8 3.9 4)
######################################

cd `dirname $1`
dirpar=$PWD
cd -
parbase=`basename $1`

file=$dirpar/$parbase

dirout=${parbase%".par"}_mprof_"${var}"

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


if [ ! -f  "$file" ] ; then
echo "mssing $file"
exit
fi

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
###################################################
cat > camelrun_$zeval  <<EOBATCH
#!/bin/bash
#$ -N  $(basename $(dirname $PWD))_$zeval
#$  -R y
#$  -j y
#$  -o $PWD
#$  -e $PWD

cd \$TMPDIR

uname -a
echo "NSLOTS=\$NSLOTS"
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=8


# copies localeS
cp $CAMELROOT/$CMTCONFIG/Minimize .
cp $CAMELROOT/batch/genrand.awk .

#
#input file -> transforme en pico et enleve var
grep -v "$var" $file > parfile_in

#compute var
echo "fix  $var  cosmo  $zeval" >>   parfile_in

echo "init par:"
cat parfile_in
 #================================
#randomize si id ne 1
 #================================
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

cp parfile "$OUTDIR"/camel\${SGE_TASK_ID}.par
echo "***************************************************************"
  #================================
  # Camel run
  #================================

#PICO RUN
./Minimize parfile best_fit covmat
cp -f best_fit "$OUTDIR"/best_fit\${SGE_TASK_ID}
cp -f covmat "$OUTDIR"/covmat\${SGE_TASK_ID}

EOBATCH
#####################################################################################################################################
140 141
qsub -P P_planck_prod -t 6-10 -pe openmpi_8 8 -q pa_long -l sps=1 -V camelrun_$zeval
qsub -P P_planck_prod -t 1-5 -pe multicores 8 -q mc_long -l sps=1 -V camelrun_$zeval
Plaszczynski Stephane's avatar
Plaszczynski Stephane committed
142 143
#####################################################################################################################################
done