| 1 | #!/bin/csh |
|---|
| 2 | # |
|---|
| 3 | # $Header$ |
|---|
| 4 | # |
|---|
| 5 | # FH : on ne crée plus le fichier arch.mk qui est supposé exister par |
|---|
| 6 | # FH : ailleurs. |
|---|
| 7 | # FH : ultérieurement, ce fichier sera pré-existant pour une série |
|---|
| 8 | # FH : de configurations en versions optimisées et debug qui seront |
|---|
| 9 | # FH : liés (ln -s) avec arch.mk en fonction de l'architecture. |
|---|
| 10 | # FH : Pour le moment, cette version est en test et on peut créer les |
|---|
| 11 | # FH : arch.mk en lançant une première fois makegcm7. |
|---|
| 12 | # |
|---|
| 13 | set verbose echo |
|---|
| 14 | ######################################################################## |
|---|
| 15 | # options par defaut pour la commande make |
|---|
| 16 | ######################################################################## |
|---|
| 17 | |
|---|
| 18 | set dim="96x72x19" |
|---|
| 19 | set physique=lmd |
|---|
| 20 | set ntrac = 4 |
|---|
| 21 | set filtre=filtrez |
|---|
| 22 | set grille=reg |
|---|
| 23 | set couple=false |
|---|
| 24 | set veget=false |
|---|
| 25 | set chimie=false |
|---|
| 26 | set parallel=false |
|---|
| 27 | set io=ioipsl |
|---|
| 28 | set LIBPREFIX="" |
|---|
| 29 | |
|---|
| 30 | set LMDGCM=`/bin/pwd` |
|---|
| 31 | set LIBOGCM=$LMDGCM/libo |
|---|
| 32 | set LIBFGCM=$LMDGCM/libf |
|---|
| 33 | |
|---|
| 34 | ######################################################################## |
|---|
| 35 | # Quelques initialisations de variables du shell. |
|---|
| 36 | ######################################################################## |
|---|
| 37 | |
|---|
| 38 | set CPP_KEY="" |
|---|
| 39 | set INCLUDE="" |
|---|
| 40 | set LIB="" |
|---|
| 41 | set adjnt="" |
|---|
| 42 | |
|---|
| 43 | |
|---|
| 44 | ######################################################################## |
|---|
| 45 | # lecture des options de mymake |
|---|
| 46 | ######################################################################## |
|---|
| 47 | |
|---|
| 48 | top: |
|---|
| 49 | if ($#argv > 0) then |
|---|
| 50 | switch ($1:q) |
|---|
| 51 | |
|---|
| 52 | case -h: |
|---|
| 53 | cat <<fin |
|---|
| 54 | manuel complet sur http://... |
|---|
| 55 | Usage : |
|---|
| 56 | makegcm |
|---|
| 57 | [-h] : manuel abrégé |
|---|
| 58 | [-d [[IMx]JMx]LM] : IM, JM, LM sont les dims en x, y, z (def: $dim) |
|---|
| 59 | [-t NTRAC] : nombre de traceurs (def: 4) |
|---|
| 60 | [-p PHYS] : compilation avec la physique libf/phyPHYS, (def: lmd) |
|---|
| 61 | [-debug] : compile avec options debug. |
|---|
| 62 | [-c false/MPI1/MPI2] : couplé océan : MPI1/MPI2/false (def: false) |
|---|
| 63 | [-v false/true] : avec ou sans végétation (def: false) |
|---|
| 64 | [-chimie SCHEMA/false] : nom du schéma chimique ou false (def) |
|---|
| 65 | [-parallel true/false] : parallelisation, en développement (def: false) |
|---|
| 66 | [-g GRI] : conf. grille dans dyn3d/GRI_xy.h\ |
|---|
| 67 | (def: reg inclue un zoom) |
|---|
| 68 | [-io IO] : choix d'une librairie I/O, experts (def: ioipsl) |
|---|
| 69 | [-include INCLUDES] : variables supplementaires pour include cpp, experts. |
|---|
| 70 | [-adjnt] : adjoint, a remettre en route ... |
|---|
| 71 | [-filtre NOMFILTRE] : prend le filtre dans libf/NOMFILTRE (def: filtrez) |
|---|
| 72 | [-link LINKS] : liens optionels avec d'autres librairies |
|---|
| 73 | [-m arch] : nom de l'architecture cible |
|---|
| 74 | fin |
|---|
| 75 | exit |
|---|
| 76 | |
|---|
| 77 | case -d: |
|---|
| 78 | set dim=$2 ; shift ; shift ; goto top |
|---|
| 79 | |
|---|
| 80 | case -O: |
|---|
| 81 | echo "option obsolete dans cette version intermediaire de makegcm" |
|---|
| 82 | exit |
|---|
| 83 | |
|---|
| 84 | case -p |
|---|
| 85 | set physique="$2" ; shift ; shift ; goto top |
|---|
| 86 | |
|---|
| 87 | case -g |
|---|
| 88 | set grille="$2" ; shift ; shift ; goto top |
|---|
| 89 | |
|---|
| 90 | case -c |
|---|
| 91 | set couple="$2" ; shift ; shift ; goto top |
|---|
| 92 | |
|---|
| 93 | case -io |
|---|
| 94 | set io="$2" ; shift ; shift ; goto top |
|---|
| 95 | |
|---|
| 96 | case -v |
|---|
| 97 | set veget="$2" ; shift ; shift ; goto top |
|---|
| 98 | |
|---|
| 99 | case -chimie |
|---|
| 100 | set chimie="$2" ; shift ; shift ; goto top |
|---|
| 101 | |
|---|
| 102 | case -parallel |
|---|
| 103 | set parallel="$2" ; shift ; shift ; goto top |
|---|
| 104 | |
|---|
| 105 | case -t |
|---|
| 106 | set ntrac=$2 ; shift ; shift ; goto top |
|---|
| 107 | |
|---|
| 108 | case -include |
|---|
| 109 | set INCLUDE="$INCLUDE -I$2" ; shift ; shift ; goto top |
|---|
| 110 | |
|---|
| 111 | case -adjnt |
|---|
| 112 | echo 'otpion a reactiver ';exit |
|---|
| 113 | set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d " |
|---|
| 114 | set optim="$optim -Dadj" ; shift ; goto top |
|---|
| 115 | |
|---|
| 116 | |
|---|
| 117 | case -filtre |
|---|
| 118 | set filtre=$2 ; shift ; shift ; goto top |
|---|
| 119 | |
|---|
| 120 | case -link |
|---|
| 121 | set LIB="$LIB $2" ; shift ; shift ; goto top |
|---|
| 122 | |
|---|
| 123 | case -m |
|---|
| 124 | set arch=$2 ; shift ; shift ; goto top |
|---|
| 125 | |
|---|
| 126 | case -debug |
|---|
| 127 | echo 'option a reactiver' ; exit |
|---|
| 128 | |
|---|
| 129 | default |
|---|
| 130 | set code="$1" ; shift ; goto top |
|---|
| 131 | |
|---|
| 132 | endsw |
|---|
| 133 | endif |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | ############################################################### |
|---|
| 137 | # lecture des chemins propres à l'architecture de la machine # |
|---|
| 138 | ############################################################### |
|---|
| 139 | |
|---|
| 140 | rm -f ./arch.path |
|---|
| 141 | ln -s ./machine/arch-${arch}.path ./arch.path |
|---|
| 142 | source arch.path |
|---|
| 143 | |
|---|
| 144 | ######################################################################## |
|---|
| 145 | # Definition des clefs CPP, des chemins des includes et modules |
|---|
| 146 | # et des libraries |
|---|
| 147 | ######################################################################## |
|---|
| 148 | |
|---|
| 149 | |
|---|
| 150 | if ( "$physique" == 'nophys' ) then |
|---|
| 151 | |
|---|
| 152 | else |
|---|
| 153 | set CPP_KEY="$CPP_KEY CPP_PHYS" |
|---|
| 154 | endif |
|---|
| 155 | |
|---|
| 156 | |
|---|
| 157 | if ( "$chimie" == 'AER' ) then |
|---|
| 158 | set CPP_KEY="$CPP_KEY INCA INCA_AER" |
|---|
| 159 | set INCLUDE="$INCLUDE -I${INCA_INCDIR}" |
|---|
| 160 | set LIB="$LIB -L${INCA_LIBDIR} -lchimie" |
|---|
| 161 | else if ( "$chimie" == 'CH4' ) then |
|---|
| 162 | set CPP_KEY="$CPP_KEY INCA INCA_CH4" |
|---|
| 163 | set INCLUDE="$INCLUDE -I${INCA_INCDIR}" |
|---|
| 164 | set LIB="$LIB -L${INCA_LIBDIR} -lchimie" |
|---|
| 165 | else if ( "$chimie" == 'CH4_AER' ) then |
|---|
| 166 | set CPP_KEY="$CPP_KEY INCA INCA_AER INCA_CH4" |
|---|
| 167 | set INCLUDE="$INCLUDE -I${INCA_INCDIR}" |
|---|
| 168 | set LIB="$LIB -L${INCA_LIBDIR} -lchimie" |
|---|
| 169 | else if ( "$chimie" == 'NMHC' ) then |
|---|
| 170 | set CPP_KEY="$CPP_KEY INCA INCA_NMHC" |
|---|
| 171 | set INCLUDE="$INCLUDE -I${INCA_INCDIR}" |
|---|
| 172 | set LIB="$LIB -L${INCA_LIBDIR} -lchimie" |
|---|
| 173 | else if ( "$chimie" == 'NMHC_AER' ) then |
|---|
| 174 | set CPP_KEY="$CPP_KEY INCA INCA_AER INCA_NMHC" |
|---|
| 175 | set INCLUDE="$INCLUDE -I${INCA_INCDIR}" |
|---|
| 176 | set LIB="$LIB -L${INCA_LIBDIR} -lchimie" |
|---|
| 177 | else if ( "$chimie" == 'GES' ) then |
|---|
| 178 | set CPP_KEY="$CPP_KEY INCA" |
|---|
| 179 | set INCLUDE="$INCLUDE -I${INCA_INCDIR}" |
|---|
| 180 | set LIB="$LIB -L${INCA_LIBDIR} -lchimie" |
|---|
| 181 | endif |
|---|
| 182 | |
|---|
| 183 | if ( "$couple" != 'false' ) then |
|---|
| 184 | set CPP_KEY="$CPP_KEY CPP_COUPLE" |
|---|
| 185 | set INCLUDE="$INCLUDE -I${OASIS_INCDIR}" |
|---|
| 186 | set LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.${couple} -lmpp_io" |
|---|
| 187 | endif |
|---|
| 188 | |
|---|
| 189 | if ( "$parallel" == 'true' ) then |
|---|
| 190 | set CPP_KEY="$CPP_KEY CPP_PARA" |
|---|
| 191 | endif |
|---|
| 192 | |
|---|
| 193 | if ( "$veget" == 'true' ) then |
|---|
| 194 | set CPP_KEY="$CPP_KEY CPP_VEGET" |
|---|
| 195 | set INCLUDE="${INCLUDE} -I${ORCH_INCDIR}" |
|---|
| 196 | set LIB="${LIB} -L${ORCH_LIBDIR} -l${LIBPREFIX}sechiba -l${LIBPREFIX}parameters -l${LIBPREFIX}stomate -l${LIBPREFIX}parallel -l${LIBPREFIX}orglob" |
|---|
| 197 | endif |
|---|
| 198 | |
|---|
| 199 | if ( $io == ioipsl ) then |
|---|
| 200 | set CPP_KEY="$CPP_KEY CPP_IOIPSL" |
|---|
| 201 | set INCLUDE="$INCLUDE -I${IOIPSL_INCDIR}" |
|---|
| 202 | set LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl" |
|---|
| 203 | endif |
|---|
| 204 | |
|---|
| 205 | set INCLUDE="$INCLUDE -I${NETCDF_INCDIR}" |
|---|
| 206 | set LIB="$LIB -L${NETCDF_LIBDIR} -lnetcdf" |
|---|
| 207 | |
|---|
| 208 | |
|---|
| 209 | ######################################################################## |
|---|
| 210 | # choix du nombre de traceur par defaut si il n'a pas ete choisi, |
|---|
| 211 | # suivant la physique |
|---|
| 212 | ######################################################################## |
|---|
| 213 | |
|---|
| 214 | if ( $ntrac == 0 ) then |
|---|
| 215 | if ( "$physique" == 'nophys' ) then |
|---|
| 216 | set ntrac=1 |
|---|
| 217 | else if ( "$physique" == 'lmd' ) then |
|---|
| 218 | set ntrac=2 |
|---|
| 219 | else if ( "$physique" == 'lmd_test_li' ) then |
|---|
| 220 | set ntrac=2 |
|---|
| 221 | else if ( "$physique" == 'ec' ) then |
|---|
| 222 | set ntrac=1 |
|---|
| 223 | else |
|---|
| 224 | set ntrac = 1 |
|---|
| 225 | endif |
|---|
| 226 | endif |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | ######################################################################## |
|---|
| 230 | # calcul du nombre de dimensions |
|---|
| 231 | ######################################################################## |
|---|
| 232 | |
|---|
| 233 | |
|---|
| 234 | set dim_full=$dim |
|---|
| 235 | set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
|---|
| 236 | set dimc=`echo $dim | wc -w` |
|---|
| 237 | |
|---|
| 238 | echo calcul de la dimension |
|---|
| 239 | echo dim $dim |
|---|
| 240 | echo dimc $dimc |
|---|
| 241 | |
|---|
| 242 | |
|---|
| 243 | ######################################################################## |
|---|
| 244 | # Gestion des dimensions du modele. |
|---|
| 245 | # on cree ou remplace le fichier des dimensions/nombre de traceur |
|---|
| 246 | ######################################################################## |
|---|
| 247 | |
|---|
| 248 | cd $LIBFGCM/grid/dimension |
|---|
| 249 | ./makdim $ntrac $dim |
|---|
| 250 | cat $LIBFGCM/grid/dimensions.h |
|---|
| 251 | cd $LMDGCM |
|---|
| 252 | |
|---|
| 253 | |
|---|
| 254 | ######################################################################## |
|---|
| 255 | # Differentes dynamiques (3d, 2d, 1d) |
|---|
| 256 | ######################################################################## |
|---|
| 257 | |
|---|
| 258 | set dimension=`echo $dim | wc -w` |
|---|
| 259 | echo dimension $dimension |
|---|
| 260 | |
|---|
| 261 | if ( $dimension != 3 ) then |
|---|
| 262 | echo "Probleme dans les dimensions de la dynamique !!" |
|---|
| 263 | echo "Non reactive pour l'instant !!!" |
|---|
| 264 | endif |
|---|
| 265 | |
|---|
| 266 | if ( $dimension == 3 ) then |
|---|
| 267 | cd $LIBFGCM/grid |
|---|
| 268 | \rm fxyprim.h |
|---|
| 269 | cp -p fxy_${grille}.h fxyprim.h |
|---|
| 270 | endif |
|---|
| 271 | |
|---|
| 272 | ###################################################################### |
|---|
| 273 | # Traitement special pour le nouveau rayonnement de Laurent Li. |
|---|
| 274 | # ---> YM desactive pour le traitemement en parallele |
|---|
| 275 | ###################################################################### |
|---|
| 276 | |
|---|
| 277 | #if ( -f $libf/phy$physique/raddim.h ) then |
|---|
| 278 | # if ( -f $libf/phy$physique/raddim.$dimh.h ) then |
|---|
| 279 | # \rm -f $libf/phy$physique/raddim.h |
|---|
| 280 | # cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h |
|---|
| 281 | # echo $libf/phy$physique/raddim.$dimh.h |
|---|
| 282 | # cat $libf/phy$physique/raddim.h |
|---|
| 283 | # else |
|---|
| 284 | # echo On peut diminuer la taille de l executable en creant |
|---|
| 285 | # echo le fichier $libf/phy$physique/raddim.$dimh.h |
|---|
| 286 | # \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h |
|---|
| 287 | # endif |
|---|
| 288 | #endif |
|---|
| 289 | |
|---|
| 290 | ###################################################################### |
|---|
| 291 | # Gestion du filtre qui n'existe qu'en 3d. |
|---|
| 292 | ###################################################################### |
|---|
| 293 | |
|---|
| 294 | if ( `expr $dimc \> 2` == 1 ) then |
|---|
| 295 | set filtre="FILTRE=$filtre" |
|---|
| 296 | else |
|---|
| 297 | set filtre="FILTRE= L_FILTRE= " |
|---|
| 298 | endif |
|---|
| 299 | echo MACRO FILTRE $filtre |
|---|
| 300 | |
|---|
| 301 | echo $dimc |
|---|
| 302 | |
|---|
| 303 | |
|---|
| 304 | |
|---|
| 305 | ###################################################################### |
|---|
| 306 | # Creation du suffixe de la configuration |
|---|
| 307 | ###################################################################### |
|---|
| 308 | |
|---|
| 309 | |
|---|
| 310 | set SUFF_NAME=_${dim_full} |
|---|
| 311 | set SUFF_NAME=${SUFF_NAME}_t${ntrac}_phy${physique} |
|---|
| 312 | |
|---|
| 313 | if ( "$parallel" == 'true' ) then |
|---|
| 314 | set SUFF_NAME=${SUFF_NAME}_para |
|---|
| 315 | set DYN=dyn${dimc}dpar |
|---|
| 316 | else |
|---|
| 317 | set SUFF_NAME=${SUFF_NAME}_seq |
|---|
| 318 | set DYN=dyn${dimc}d |
|---|
| 319 | endif |
|---|
| 320 | |
|---|
| 321 | if ( $veget == "true" ) then |
|---|
| 322 | set SUFF_NAME=${SUFF_NAME}_orch |
|---|
| 323 | endif |
|---|
| 324 | |
|---|
| 325 | if ( $couple != "false" ) then |
|---|
| 326 | set SUFF_NAME=${SUFF_NAME}_couple |
|---|
| 327 | endif |
|---|
| 328 | |
|---|
| 329 | if ( $chimie == "true" ) then |
|---|
| 330 | set SUFF_NAME=${SUFF_NAME}_inca |
|---|
| 331 | endif |
|---|
| 332 | |
|---|
| 333 | cd $LMDGCM |
|---|
| 334 | set config_fcm="config.fcm" |
|---|
| 335 | rm -f $config_fcm |
|---|
| 336 | touch $config_fcm |
|---|
| 337 | rm -f bin/${code}${SUFF_NAME}.e |
|---|
| 338 | rm -f arch.fcm |
|---|
| 339 | |
|---|
| 340 | echo "%ARCH $arch" >> $config_fcm |
|---|
| 341 | echo "%INCDIR $INCLUDE" >> $config_fcm |
|---|
| 342 | echo "%LIB $LIB" >> $config_fcm |
|---|
| 343 | echo "%ROOT_PATH $PWD" >> $config_fcm |
|---|
| 344 | echo "%LIBF $LIBFGCM" >> $config_fcm |
|---|
| 345 | echo "%LIBO $LIBOGCM" >> $config_fcm |
|---|
| 346 | echo "%DYN $DYN" >> $config_fcm |
|---|
| 347 | echo "%PHYS phy${physique}" >> $config_fcm |
|---|
| 348 | echo "%CPP_KEY $CPP_KEY" >> $config_fcm |
|---|
| 349 | echo "%EXEC $code" >> $config_fcm |
|---|
| 350 | echo "%SUFF_NAME $SUFF_NAME" >> $config_fcm |
|---|
| 351 | |
|---|
| 352 | ln -s machine/arch-${arch}.fcm arch.fcm |
|---|
| 353 | ./build_gcm |
|---|
| 354 | |
|---|
| 355 | rm -f tmp_src |
|---|
| 356 | rm -f config |
|---|
| 357 | ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config config |
|---|
| 358 | ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config/tmp tmp_src |
|---|
| 359 | #\rm -f $libf/grid/dimensions.h |
|---|