| 1 | #!/bin/bash |
|---|
| 2 | # $Id: check_version.sh 3971 2021-07-30 13:58:02Z dcugnet $ |
|---|
| 3 | |
|---|
| 4 | ######################################################################### |
|---|
| 5 | # Verification de a convergence du modele par rapport aux versions |
|---|
| 6 | # precedentes |
|---|
| 7 | # + 1+1=2 |
|---|
| 8 | ######################################################################### |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | version_ref=latest |
|---|
| 12 | resolution=48x36x19 |
|---|
| 13 | resolution=48x36x39 #20160622 : nouveau bench avec deux versions de la physique |
|---|
| 14 | compilo=gfortran |
|---|
| 15 | parallel=none |
|---|
| 16 | parallel=mpi_omp |
|---|
| 17 | justcheck=0 # just compare results not writing of results in RESUBENCH |
|---|
| 18 | tmpdir=/tmp/`whoami` ; mkdir -p $tmpdir |
|---|
| 19 | |
|---|
| 20 | if [ `whoami` = lmdz ] ; then |
|---|
| 21 | get="ln -sf /u/lmdz/WWW/pub" |
|---|
| 22 | getold="ln -sf /u/lmdz/WWW/Distrib" |
|---|
| 23 | else |
|---|
| 24 | get="wget https://www.lmd.jussieu.fr/~lmdz/pub" |
|---|
| 25 | getold="wget https://www.lmd.jussieu.fr/~lmdz/Distrib" |
|---|
| 26 | fi |
|---|
| 27 | |
|---|
| 28 | if [ `hostname` != cameron.lmd.jussieu.fr ] ; then |
|---|
| 29 | echo Machine non prevu |
|---|
| 30 | fi |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | # Option pour le debug du script check_version lui meme qui consiste a ne |
|---|
| 34 | # pars reexecuter l'installation et les simulations mais a simplement |
|---|
| 35 | # refaire les diff sur des simulations existantes. |
|---|
| 36 | diagonly=0 |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | while (($# > 0)) |
|---|
| 41 | do |
|---|
| 42 | case $1 in |
|---|
| 43 | "-h") cat <<fin |
|---|
| 44 | check_version.sh [-h] version [version_ref] |
|---|
| 45 | version is the name of the version of LMDZ to be checked modipsl.version.tar.gz |
|---|
| 46 | version_ref is the version to be compared with. |
|---|
| 47 | Default "latest". |
|---|
| 48 | enfo |
|---|
| 49 | fin |
|---|
| 50 | exit;; |
|---|
| 51 | |
|---|
| 52 | "-c") |
|---|
| 53 | compilo="$2" ; shift ; shift ;; |
|---|
| 54 | "-j") |
|---|
| 55 | justcheck="$2" ; shift ; shift ;; |
|---|
| 56 | *) |
|---|
| 57 | version="$1" ; shift ; if [ "$#" = 1 ] ; then version_ref=$1 ; shift ; fi ;; |
|---|
| 58 | esac |
|---|
| 59 | done |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | # branche=`echo $version | cut -d. -f2` |
|---|
| 63 | branche=`echo $version |cut -c 10-` |
|---|
| 64 | datelmdz=`echo $version | cut -d. -f1` |
|---|
| 65 | echo version $version $branche $datelmdz |
|---|
| 66 | |
|---|
| 67 | RESU_D=~/WWW/RESUBENCH/$branche/$compilo |
|---|
| 68 | mkdir -p $RESU_D |
|---|
| 69 | resubench=$RESU_D/$datelmdz |
|---|
| 70 | latest=$RESU_D/$version_ref |
|---|
| 71 | echo version_ref $version_ref $latest |
|---|
| 72 | ls -l $latest |
|---|
| 73 | |
|---|
| 74 | # recuperation de la version a laquelle on compare pour le message final : |
|---|
| 75 | comparea=`ls -ld $RESU_D/$version_ref | awk -F/ ' { print $NF } '` |
|---|
| 76 | |
|---|
| 77 | # LANCEMENT D UN CERTAIN NOMBRE DE TESTS |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | # Edition de install.sh, install.sh avec bench 48x36x19 |
|---|
| 81 | cd $tmpdir |
|---|
| 82 | MODEL=$tmpdir/LMDZ$version |
|---|
| 83 | if [ $diagonly = 0 ] ; then |
|---|
| 84 | \rm -f install_lmdz.sh ; $get/install_lmdz.sh ; chmod +x install_lmdz.sh |
|---|
| 85 | ./install_lmdz.sh -v $version -d $resolution -SCM -parallel $parallel -veget CMIP6 |
|---|
| 86 | fi |
|---|
| 87 | |
|---|
| 88 | ###################################################### |
|---|
| 89 | # Sauvegarde du 1D |
|---|
| 90 | ###################################################### |
|---|
| 91 | outf=$MODEL/1D/EXEC/NPv6.1L79/ARMCU/REF/restartphy.nc |
|---|
| 92 | if [ -f $outf ] ; then |
|---|
| 93 | if [ $justcheck = 0 ] ; then |
|---|
| 94 | mkdir -p $resubench/ARMCU/REF |
|---|
| 95 | cp $MODEL/1D/EXEC/NPv6.1L79/ARMCU/REF/restartphy.nc $resubench/ARMCU/REF/ |
|---|
| 96 | fi |
|---|
| 97 | # cmp -s $resubench/ARMCU/REF/restartphy.nc $latest/ARMCU/REF/restartphy.nc |
|---|
| 98 | cmp -s $MODEL/1D/EXEC/NPv6.1L79/ARMCU/REF/restartphy.nc $latest/ARMCU/REF/restartphy.nc |
|---|
| 99 | if [ $? = 0 ] ; then converge1D=U ; else converge1D=u ; fi |
|---|
| 100 | else |
|---|
| 101 | converge1D=- |
|---|
| 102 | fi |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | ###################################################### |
|---|
| 106 | BENCH=BENCH$resolution |
|---|
| 107 | cd $MODEL/modipsl/mod*/LMD*/$BENCH |
|---|
| 108 | echo BENCH FINI |
|---|
| 109 | ls -lrt |
|---|
| 110 | pwd |
|---|
| 111 | |
|---|
| 112 | |
|---|
| 113 | |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | if [ -f restartphy.nc ] ; then |
|---|
| 117 | ######################################################################### |
|---|
| 118 | echo Verification de la convergence avec la version precedente |
|---|
| 119 | ######################################################################### |
|---|
| 120 | # Faite soit sur les restart.nc soit sur une exctraction de ps.nc |
|---|
| 121 | # A une epoque, ne marchait paps avec les restart a cause des traceurs. |
|---|
| 122 | # Le 2014/01/30, ne marchait plus avec ps.nc car les axes de lattiudes |
|---|
| 123 | # s'étaient inversés pour une raison inconnue. |
|---|
| 124 | # 2016/06/21 : on utilise deux versions de la physique pour le test. |
|---|
| 125 | |
|---|
| 126 | # Aide a l'interpretation de resultats problematiques |
|---|
| 127 | # Les resultats de la simu ancienne physique sont directement |
|---|
| 128 | # dans BENC* |
|---|
| 129 | # Les resultats de la nouvelle physique sont dans SIM1 utilise |
|---|
| 130 | # pour 1+1=2 |
|---|
| 131 | # Les resultats de la simulation debug sont dans SIMD |
|---|
| 132 | |
|---|
| 133 | if [ $justcheck = 0 ] ; then mkdir -p $resubench/$BENCH; fi |
|---|
| 134 | if [ -f restartphy.nc ] ; then |
|---|
| 135 | if [ $justcheck = 0 ] ; then |
|---|
| 136 | ncks -M -m -h -v ps -O restart.nc $resubench/$BENCH/ps.nc |
|---|
| 137 | cp restart.nc $resubench/$BENCH/restart.nc |
|---|
| 138 | fi |
|---|
| 139 | # cmp -s $resubench/$BENCH/restart.nc $latest/$BENCH/restart.nc |
|---|
| 140 | cmp -s ./restart.nc $latest/$BENCH/restart.nc |
|---|
| 141 | if [ $? = 0 ] ; then converge=S ; else converge=s ; fi |
|---|
| 142 | else |
|---|
| 143 | converge=- |
|---|
| 144 | fi |
|---|
| 145 | |
|---|
| 146 | ######################################################################### |
|---|
| 147 | echo Verification de 1+1=2 |
|---|
| 148 | ######################################################################### |
|---|
| 149 | # 2016/06/21 : 1+1=2 est fait sur la nouvelle physique |
|---|
| 150 | # Permet de tester aussi la convergence numérique |
|---|
| 151 | |
|---|
| 152 | suf=NPv5.5 |
|---|
| 153 | suf=NPv6.0.14splith |
|---|
| 154 | # cp -f config.def_oraer config.def |
|---|
| 155 | sed -e 's/VEGET=y/VEGET=n/' config.def_oraer > config.def |
|---|
| 156 | if [ -f physiq.def_$suf ] ; then \cp -f physiq.def_$suf physiq.def ; fi |
|---|
| 157 | if [ $diagonly = 0 ] ; then |
|---|
| 158 | $getold/unpun.sh |
|---|
| 159 | chmod +x unpun.sh ; ./unpun.sh -parallel $parallel |
|---|
| 160 | fi |
|---|
| 161 | cmp -s SIM2/ps_end.nc SIM1+1/ps_end.nc |
|---|
| 162 | if [ $? = 0 ] ; then |
|---|
| 163 | unpun=OK |
|---|
| 164 | else |
|---|
| 165 | unpun=- |
|---|
| 166 | fi |
|---|
| 167 | |
|---|
| 168 | ######################################################################### |
|---|
| 169 | echo Test en fonction du nombre de processeurs |
|---|
| 170 | ######################################################################### |
|---|
| 171 | if [ "$parallel" == "mpi_omp" ] ; then |
|---|
| 172 | mkdir SIM1_41 |
|---|
| 173 | cd SIM1_41 |
|---|
| 174 | ln -s ../SIM1/start* ../SIM1/limit* ../SIM1/sechiba_rest_in.nc ../SIM1/aer*nc ../SIM1/*def . |
|---|
| 175 | ../run_local.sh 4 1 ../gcm.e > listing |
|---|
| 176 | cd .. |
|---|
| 177 | cmp -s SIM1/restart.nc SIM1_41/restart.nc |
|---|
| 178 | if [ $? = 0 ] ; then |
|---|
| 179 | if [ "$unpun" = "OK" ] ; then |
|---|
| 180 | unpun=OK2 |
|---|
| 181 | else |
|---|
| 182 | unpun=-OK |
|---|
| 183 | fi |
|---|
| 184 | else |
|---|
| 185 | unpun=${unpun}- |
|---|
| 186 | fi |
|---|
| 187 | fi |
|---|
| 188 | |
|---|
| 189 | # 2016/06/21 : comparaison des versions nouvelles physique (dans SIM1) |
|---|
| 190 | # if [ -f restartphy.nc ] ; then Correction 2017/04/26 |
|---|
| 191 | if [ -f SIM1/restartphy.nc ] ; then |
|---|
| 192 | if [ $justcheck = 0 ] ; then |
|---|
| 193 | ncks -M -m -h -v ps -O SIM1/restart.nc $resubench/$BENCH/ps$suf.nc |
|---|
| 194 | cp SIM1/restart.nc $resubench/$BENCH/restart$suf.nc |
|---|
| 195 | fi |
|---|
| 196 | \rm sechiba_out_2.nc sechiba_history.nc sechiba_rest_out.nc |
|---|
| 197 | # cmp -s $resubench/$BENCH/restart$suf.nc $latest/$BENCH/restart$suf.nc |
|---|
| 198 | cmp -s SIM1/restart.nc $latest/$BENCH/restart$suf.nc |
|---|
| 199 | if [ $? = 0 ] ; then convergeNP=N ; else convergeNP=n ; fi |
|---|
| 200 | else |
|---|
| 201 | convergeNP=- |
|---|
| 202 | fi |
|---|
| 203 | |
|---|
| 204 | ######################################################################### |
|---|
| 205 | echo Verification en mode debug + parallele |
|---|
| 206 | ######################################################################### |
|---|
| 207 | if [ -f compilegcm.sh ] ; then |
|---|
| 208 | mv gcm.e gcm.install |
|---|
| 209 | ./compilegcm.sh -debug |
|---|
| 210 | mkdir SIMD |
|---|
| 211 | cd SIMD |
|---|
| 212 | ln -s ../SIM1/start* ../SIM1/limit* ../SIM1/sechiba_rest_in.nc ../SIM1/aer*nc ../SIM1/*def . |
|---|
| 213 | ../run_local.sh 2 2 ../gcm.e > listing 2>&1 |
|---|
| 214 | cd ../ |
|---|
| 215 | suf=D |
|---|
| 216 | if [ -f SIMD/restartphy.nc ] ; then |
|---|
| 217 | if [ $justcheck = 0 ] ; then |
|---|
| 218 | ncks -M -m -h -v ps -O SIMD/restart.nc $resubench/$BENCH/ps$suf.nc |
|---|
| 219 | cp SIMD/restart.nc $resubench/$BENCH/restart$suf.nc |
|---|
| 220 | fi |
|---|
| 221 | cmp -s SIMD/restart.nc $latest/$BENCH/restart$suf.nc |
|---|
| 222 | if [ $? = 0 ] ; then convergeD=D ; else convergeD=d ; fi |
|---|
| 223 | else |
|---|
| 224 | convergeD=- |
|---|
| 225 | fi |
|---|
| 226 | fi |
|---|
| 227 | ######################################################################### |
|---|
| 228 | echo Verification des isotopes |
|---|
| 229 | ######################################################################### |
|---|
| 230 | cd .. |
|---|
| 231 | ./makelmdz_fcm -arch local -j 8 -rrtm true -d 48x36x39 -v false -p lmdiso -isotopes true -isoverif true gcm |
|---|
| 232 | if [ -f ./bin/gcm_48x36x39_phylmdiso_seq_iso_isoverif.e ] ; then |
|---|
| 233 | cd $BENCH |
|---|
| 234 | mkdir ISO |
|---|
| 235 | cp ../bin/gcm_48x36x39_phylmdiso_seq_iso_isoverif.e ISO/gcm_iso.e |
|---|
| 236 | cd ISO |
|---|
| 237 | ln -s ../SIM1/start* ../SIM1/limit* ../SIM1/aer*nc . |
|---|
| 238 | cp ../SIM1/physiq.def ../SIM1/gcm.def ../SIM1/vert.def . |
|---|
| 239 | for def in gcm run config traceur physiq |
|---|
| 240 | do |
|---|
| 241 | cp ../${def}_iso.def ${def}.def |
|---|
| 242 | done |
|---|
| 243 | cp ../iso.def . |
|---|
| 244 | ./gcm_iso.e > listing 2>&1 |
|---|
| 245 | cd .. |
|---|
| 246 | suf=I |
|---|
| 247 | if [ -f ISO/restartphy.nc ] ; then |
|---|
| 248 | if [ $justcheck = 0 ] ; then |
|---|
| 249 | cp SIMD/restart.nc $resubench/$BENCH/restart$suf.nc |
|---|
| 250 | fi |
|---|
| 251 | cmp -s SIMD/restart.nc $latest/$BENCH/restart$suf.nc |
|---|
| 252 | if [ $? = 0 ] ; then convergeI=I ; else convergeI=i ; fi |
|---|
| 253 | else |
|---|
| 254 | convergeI=- |
|---|
| 255 | fi |
|---|
| 256 | else |
|---|
| 257 | # compilation failed; cleaning up for next compilation |
|---|
| 258 | convergeI=- |
|---|
| 259 | \rm -f libf/grid/dimensions.h |
|---|
| 260 | \rm -f .lock |
|---|
| 261 | fi |
|---|
| 262 | |
|---|
| 263 | ######################################################################### |
|---|
| 264 | echo Verification de initialisation |
|---|
| 265 | ###############################################################y########## |
|---|
| 266 | cd $BENCH |
|---|
| 267 | rm -rf ../INIT |
|---|
| 268 | mkdir ../INIT |
|---|
| 269 | cp *def ../INIT |
|---|
| 270 | cd ../INIT |
|---|
| 271 | pwd |
|---|
| 272 | $getold/initialisation.sh |
|---|
| 273 | sed -e 's/grid_resolution=48x36x39/grid_resolution='$resolution'/' initialisation.sh > ini.sh |
|---|
| 274 | chmod +x ini.sh ; ./ini.sh |
|---|
| 275 | if [ -f limit.nc ] ; then |
|---|
| 276 | var=Tsoil01srf01 |
|---|
| 277 | if [ $justcheck = 0 ] ; then |
|---|
| 278 | mkdir -p $resubench/START$resolution |
|---|
| 279 | ncks -M -m -h -v $var startphy.nc -O $resubench/START$resolution/$var.nc |
|---|
| 280 | cp startphy.nc $resubench/START$resolution/ |
|---|
| 281 | fi |
|---|
| 282 | #! cmp -s $resubench/START$resolution/$var.nc $latest/START$resolution/$var.nc |
|---|
| 283 | cmp -s startphy.nc $latest/START$resolution/startphy.nc |
|---|
| 284 | if [ $? = 0 ] ; then |
|---|
| 285 | init=OK |
|---|
| 286 | else |
|---|
| 287 | init=noc |
|---|
| 288 | fi |
|---|
| 289 | else |
|---|
| 290 | init=- |
|---|
| 291 | fi |
|---|
| 292 | |
|---|
| 293 | ######################################################################## |
|---|
| 294 | echo end of test cases |
|---|
| 295 | ######################################################################## |
|---|
| 296 | bench=OK |
|---|
| 297 | else |
|---|
| 298 | echo PROBLEME : LE BENCH N EST PAS ALLE AU BOUT |
|---|
| 299 | bench=- |
|---|
| 300 | fi |
|---|
| 301 | |
|---|
| 302 | if [ $justcheck = 0 ] ; then |
|---|
| 303 | latest=$RESU_D/latest |
|---|
| 304 | \rm -f $latest |
|---|
| 305 | ln -sf $resubench $latest |
|---|
| 306 | fi |
|---|
| 307 | |
|---|
| 308 | |
|---|
| 309 | cd $MODEL/m*/m*/ |
|---|
| 310 | LMDZ=`\ls -d LMD*` #Nom du modele LMDZ sur modeles/ : LMDZ4, LMDZ5, LMDZ |
|---|
| 311 | |
|---|
| 312 | svn upgrade # Il faut mettre à jour le svn si la version sur |
|---|
| 313 | # laquelle le checkout a ete fait est plus ancienne |
|---|
| 314 | # ce qu'on souhaite par ailleurs pour pouvoir ensuite |
|---|
| 315 | # commettre depuis une version ancienne de svn (comme celles |
|---|
| 316 | # des SL du réseau local |
|---|
| 317 | svnrel=`svn info $LMDZ | grep 'Changed Rev' | head -1 | awk ' { print $4 } '` |
|---|
| 318 | #FH 20160822 |
|---|
| 319 | if [ "$svnrel" = "" ] ; then |
|---|
| 320 | svnrel=`svn info $LMDZ | grep vision | head -1 | awk ' { print $2 } '` |
|---|
| 321 | fi |
|---|
| 322 | |
|---|
| 323 | ccc=$converge$convergeNP$convergeD$converge1D$convergeI |
|---|
| 324 | if [ "$ccc" = "SNDUI" ] ; then ccc="OK " ; fi |
|---|
| 325 | |
|---|
| 326 | |
|---|
| 327 | echo $version' '$svnrel' '$bench' '$ccc ' '$unpun' '$init' (ref:' $comparea ')' |
|---|
| 328 | |
|---|
| 329 | exit |
|---|
| 330 | rm -fr $MODEL |
|---|