| 1 | #!/bin/bash |
|---|
| 2 | # $Id: makelmdz_fcm 1990 2014-03-05 10:33:03Z fairhead $ |
|---|
| 3 | # This is a script in Bash. |
|---|
| 4 | |
|---|
| 5 | # FH : on ne crée plus le fichier arch.mk qui est supposé exister par |
|---|
| 6 | # FH : ailleurs. |
|---|
| 7 | # FH : ulterieurement, 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 makegcm. |
|---|
| 12 | # |
|---|
| 13 | ##set -x |
|---|
| 14 | ######################################################################## |
|---|
| 15 | # options par defaut pour la commande make |
|---|
| 16 | ######################################################################## |
|---|
| 17 | |
|---|
| 18 | dim="96x72x19" |
|---|
| 19 | physique=lmd |
|---|
| 20 | filtre=filtrez |
|---|
| 21 | grille=reg |
|---|
| 22 | couple=false |
|---|
| 23 | veget=false |
|---|
| 24 | sisvat=false |
|---|
| 25 | rrtm=false |
|---|
| 26 | chimie=false |
|---|
| 27 | parallel=none |
|---|
| 28 | paramem="par" |
|---|
| 29 | compil_mod=prod |
|---|
| 30 | io=ioipsl |
|---|
| 31 | LIBPREFIX="" |
|---|
| 32 | cosp=false |
|---|
| 33 | job=1 |
|---|
| 34 | full='' |
|---|
| 35 | |
|---|
| 36 | LMDGCM=`/bin/pwd` |
|---|
| 37 | LIBOGCM=$LMDGCM/libo |
|---|
| 38 | LIBFGCM=$LMDGCM/libf |
|---|
| 39 | COSP_PATH=$LMDGCM/.void_dir |
|---|
| 40 | fcm_path=$LMDGCM/tools/fcm/bin |
|---|
| 41 | |
|---|
| 42 | ######################################################################## |
|---|
| 43 | # Quelques initialisations de variables du shell. |
|---|
| 44 | ######################################################################## |
|---|
| 45 | |
|---|
| 46 | CPP_KEY="" |
|---|
| 47 | INCLUDE="" |
|---|
| 48 | LIB="" |
|---|
| 49 | adjnt="" |
|---|
| 50 | COMPIL_FFLAGS="%PROD_FFLAGS" |
|---|
| 51 | PARA_FFLAGS="" |
|---|
| 52 | PARA_LD="" |
|---|
| 53 | EXT_SRC="" |
|---|
| 54 | |
|---|
| 55 | ######################################################################## |
|---|
| 56 | # lecture des options de mymake |
|---|
| 57 | ######################################################################## |
|---|
| 58 | |
|---|
| 59 | while (($# > 0)) |
|---|
| 60 | do |
|---|
| 61 | case $1 in |
|---|
| 62 | "-h") cat <<fin |
|---|
| 63 | Usage : |
|---|
| 64 | makelmdz_fcm [options] -arch nom_arch exec |
|---|
| 65 | [-h] : brief help |
|---|
| 66 | [-d [[IMx]JMx]LM] : IM, JM, LM are the dimensions in x, y, z (default: $dim) |
|---|
| 67 | [-p PHYS] : set of physical parametrizations (in libf/phyPHYS), (default: lmd) |
|---|
| 68 | [-prod / -dev / -debug] : compilation mode production (default) / developement / debug |
|---|
| 69 | [-c false/MPI1/OMCT] : coupling with ocean model : MPI1/OMCT/false (default: false) |
|---|
| 70 | [-v false/orchidee2.0/orchidee1.9/true] : version of the vegetation model to include (default: false) |
|---|
| 71 | false : no vegetation model |
|---|
| 72 | orchidee2.0 : compile using ORCHIDEE 2.0 (or more recent version) |
|---|
| 73 | orchidee1.9 : compile using ORCHIDEE up to the version including OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6 |
|---|
| 74 | true : (obsolete; for backward compatibility) use ORCHIDEE tag 1.9-1.9.6 |
|---|
| 75 | [-chimie INCA/false] : with INCA chemistry model or without (default: false) |
|---|
| 76 | [-parallel none/mpi/omp/mpi_omp] : parallelism (default: none) : mpi, openmp or mixted mpi_openmp |
|---|
| 77 | [-g GRI] : grid configuration in dyn3d/GRI_xy.h (default: reg, inclues a zoom) |
|---|
| 78 | [-io IO] : Input/Output library (default: ioipsl) |
|---|
| 79 | [-include INCLUDES] : extra include path to add |
|---|
| 80 | [-cpp CPP_KEY] : additional preprocessing definitions |
|---|
| 81 | [-adjnt] : adjoint model, not operational ... |
|---|
| 82 | [-mem] : reduced memory dynamics (if in parallel mode) |
|---|
| 83 | [-filtre NOMFILTRE] : use filtre from libf/NOMFILTRE (default: filtrez) |
|---|
| 84 | [-link LINKS] : additional links with other libraries |
|---|
| 85 | [-j n] : active parallel compiling on ntask |
|---|
| 86 | [-full] : full recompiling |
|---|
| 87 | [-fcm_path path] : path to the fcm tool (default: tools/fcm/bin) |
|---|
| 88 | [-ext_src path] : path to an additional set of routines to compile with the model |
|---|
| 89 | -arch nom_arch : target architecture |
|---|
| 90 | exec : executable to build |
|---|
| 91 | fin |
|---|
| 92 | exit;; |
|---|
| 93 | |
|---|
| 94 | "-d") |
|---|
| 95 | dim=$2 ; shift ; shift ;; |
|---|
| 96 | |
|---|
| 97 | "-p") |
|---|
| 98 | physique="$2" ; shift ; shift ;; |
|---|
| 99 | |
|---|
| 100 | "-g") |
|---|
| 101 | grille="$2" ; shift ; shift ;; |
|---|
| 102 | |
|---|
| 103 | "-c") |
|---|
| 104 | couple="$2" ; shift ; shift ;; |
|---|
| 105 | |
|---|
| 106 | "-prod") |
|---|
| 107 | compil_mod="prod" ; shift ;; |
|---|
| 108 | |
|---|
| 109 | "-dev") |
|---|
| 110 | compil_mod="dev" ; shift ;; |
|---|
| 111 | |
|---|
| 112 | "-debug") |
|---|
| 113 | compil_mod="debug" ; shift ;; |
|---|
| 114 | |
|---|
| 115 | "-io") |
|---|
| 116 | io="$2" ; shift ; shift ;; |
|---|
| 117 | |
|---|
| 118 | "-v") |
|---|
| 119 | veget="$2" ; shift ; shift ;; |
|---|
| 120 | |
|---|
| 121 | "-sisvat") |
|---|
| 122 | sisvat="$2" ; shift ; shift ;; |
|---|
| 123 | |
|---|
| 124 | "-rrtm") |
|---|
| 125 | rrtm="$2" ; shift ; shift ;; |
|---|
| 126 | |
|---|
| 127 | "-chimie") |
|---|
| 128 | chimie="$2" ; shift ; shift ;; |
|---|
| 129 | |
|---|
| 130 | "-parallel") |
|---|
| 131 | parallel="$2" ; shift ; shift ;; |
|---|
| 132 | |
|---|
| 133 | "-include") |
|---|
| 134 | INCLUDE="$INCLUDE -I$2" ; shift ; shift ;; |
|---|
| 135 | |
|---|
| 136 | "-cpp") |
|---|
| 137 | CPP_KEY="$CPP_KEY $2" ; shift ; shift ;; |
|---|
| 138 | |
|---|
| 139 | "-adjnt") |
|---|
| 140 | echo "not operational ... work to be done here ";exit |
|---|
| 141 | opt_dep="$opt_dep adjnt" ; adjnt="-ladjnt -ldyn3d " |
|---|
| 142 | optim="$optim -Dadj" ; shift ;; |
|---|
| 143 | |
|---|
| 144 | "-cosp") |
|---|
| 145 | cosp="$2" ; shift ; shift ;; |
|---|
| 146 | |
|---|
| 147 | "-mem") |
|---|
| 148 | paramem="mem" ; shift ;; |
|---|
| 149 | |
|---|
| 150 | "-filtre") |
|---|
| 151 | filtre=$2 ; shift ; shift ;; |
|---|
| 152 | |
|---|
| 153 | "-link") |
|---|
| 154 | LIB="$LIB $2" ; shift ; shift ;; |
|---|
| 155 | |
|---|
| 156 | "-fcm_path") |
|---|
| 157 | fcm_path=$2 ; shift ; shift ;; |
|---|
| 158 | |
|---|
| 159 | "-ext_src") |
|---|
| 160 | EXT_SRC=$2 ; shift ; shift ;; |
|---|
| 161 | "-j") |
|---|
| 162 | job=$2 ; shift ; shift ;; |
|---|
| 163 | "-full") |
|---|
| 164 | full="-full" ; shift ;; |
|---|
| 165 | |
|---|
| 166 | "-arch") |
|---|
| 167 | arch=$2 ; shift ; shift ;; |
|---|
| 168 | |
|---|
| 169 | *) |
|---|
| 170 | code="$1" ; shift ;; |
|---|
| 171 | esac |
|---|
| 172 | done |
|---|
| 173 | |
|---|
| 174 | ############################################################### |
|---|
| 175 | # path to fcm |
|---|
| 176 | ############################################################### |
|---|
| 177 | # handle case when provided path to fcm was given as a relative |
|---|
| 178 | # path (from makelmdz_fcm script directory) and not an absolute path |
|---|
| 179 | if [[ ${fcm_path:0:1} != "/" ]] ; then |
|---|
| 180 | # prepend with makelmdz_fcm location |
|---|
| 181 | fcm_path=$(cd $(dirname $0) ; pwd)"/"${fcm_path} |
|---|
| 182 | fi |
|---|
| 183 | |
|---|
| 184 | # add fcm_path to PATH |
|---|
| 185 | export PATH=${fcm_path}:${PATH} |
|---|
| 186 | |
|---|
| 187 | echo "Path to fcm:" |
|---|
| 188 | echo ${fcm_path} |
|---|
| 189 | |
|---|
| 190 | ############################################################### |
|---|
| 191 | # lecture des chemins propres à l'architecture de la machine # |
|---|
| 192 | ############################################################### |
|---|
| 193 | rm -f .void_file |
|---|
| 194 | echo > .void_file |
|---|
| 195 | rm -rf .void_dir |
|---|
| 196 | mkdir .void_dir |
|---|
| 197 | rm -f arch.path |
|---|
| 198 | ln -s arch/arch-${arch}.path ./arch.path |
|---|
| 199 | source arch.path |
|---|
| 200 | |
|---|
| 201 | ######################################################################## |
|---|
| 202 | # Definition des clefs CPP, des chemins des includes et modules |
|---|
| 203 | # et des libraries |
|---|
| 204 | ######################################################################## |
|---|
| 205 | |
|---|
| 206 | if [[ "$compil_mod" == "prod" ]] |
|---|
| 207 | then |
|---|
| 208 | COMPIL_FFLAGS="%PROD_FFLAGS" |
|---|
| 209 | elif [[ "$compil_mod" == "dev" ]] |
|---|
| 210 | then |
|---|
| 211 | COMPIL_FFLAGS="%DEV_FFLAGS" |
|---|
| 212 | elif [[ "$compil_mod" == "debug" ]] |
|---|
| 213 | then |
|---|
| 214 | COMPIL_FFLAGS="%DEBUG_FFLAGS" |
|---|
| 215 | fi |
|---|
| 216 | |
|---|
| 217 | if [[ "$physique" != "nophys" ]] |
|---|
| 218 | then |
|---|
| 219 | #We'll use some physics |
|---|
| 220 | CPP_KEY="$CPP_KEY CPP_PHYS" |
|---|
| 221 | if [[ "${physique:0:3}" == "lmd" ]] |
|---|
| 222 | then |
|---|
| 223 | #For lmd physics, default planet type is Earth |
|---|
| 224 | CPP_KEY="$CPP_KEY CPP_EARTH" |
|---|
| 225 | fi |
|---|
| 226 | fi |
|---|
| 227 | |
|---|
| 228 | if [[ "$chimie" == "INCA" ]] |
|---|
| 229 | then |
|---|
| 230 | CPP_KEY="$CPP_KEY INCA" |
|---|
| 231 | INCLUDE="$INCLUDE -I${INCA_INCDIR}" |
|---|
| 232 | LIB="$LIB -L${INCA_LIBDIR} -lchimie" |
|---|
| 233 | fi |
|---|
| 234 | |
|---|
| 235 | if [[ "$couple" != "false" ]] |
|---|
| 236 | then |
|---|
| 237 | if [[ "$couple" == "MPI1" ]] |
|---|
| 238 | then |
|---|
| 239 | CPP_KEY="$CPP_KEY CPP_COUPLE" |
|---|
| 240 | export OASIS_INCDIR=$LMDGCM/../../prism/X64/build/lib/psmile.MPI1 |
|---|
| 241 | export OASIS_LIBDIR=$LMDGCM/../../prism/X64/lib |
|---|
| 242 | INCLUDE="$INCLUDE -I${OASIS_INCDIR}" |
|---|
| 243 | LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.MPI1 -lmpp_io" |
|---|
| 244 | else |
|---|
| 245 | CPP_KEY="$CPP_KEY CPP_COUPLE CPP_OMCT" |
|---|
| 246 | INCLUDE="$INCLUDE -I${OASIS_INCDIR}" |
|---|
| 247 | LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.MPI1 -lscrip -lmct -lmpeu" |
|---|
| 248 | fi |
|---|
| 249 | fi |
|---|
| 250 | |
|---|
| 251 | if [[ "$parallel" == "mpi" ]] |
|---|
| 252 | then |
|---|
| 253 | CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI" |
|---|
| 254 | PARA_FFLAGS="%MPI_FFLAGS" |
|---|
| 255 | PARA_LD="%MPI_LD" |
|---|
| 256 | elif [[ "$parallel" == "omp" ]] |
|---|
| 257 | then |
|---|
| 258 | CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP" |
|---|
| 259 | PARA_FFLAGS="%OMP_FFLAGS" |
|---|
| 260 | PARA_LD="%OMP_LD" |
|---|
| 261 | elif [[ "$parallel" == "mpi_omp" ]] |
|---|
| 262 | then |
|---|
| 263 | CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI CPP_OMP" |
|---|
| 264 | PARA_FFLAGS="%MPI_FFLAGS %OMP_FFLAGS" |
|---|
| 265 | PARA_LD="%MPI_LD %OMP_LD" |
|---|
| 266 | fi |
|---|
| 267 | |
|---|
| 268 | if [[ ( "$parallel" == "omp" || "$parallel" == "mpi_omp" ) \ |
|---|
| 269 | && "$compil_mod" == "debug" ]] |
|---|
| 270 | then |
|---|
| 271 | echo "Usually, parallelization with OpenMP requires some optimization." |
|---|
| 272 | echo "We suggest switching to \"-dev\"." |
|---|
| 273 | fi |
|---|
| 274 | |
|---|
| 275 | if [ "$veget" = "true" -o "$veget" = "orchidee1.9" -o "$veget" = "orchidee2.0" ] |
|---|
| 276 | then |
|---|
| 277 | #NB: option 'true': for backward compatibility. To be used with ORCHIDEE tag 1.9-1.9.6 |
|---|
| 278 | # For this case, cpp flag ORCHIDEE_NOOPENMP must be added to the makelmdz_fcm arguments |
|---|
| 279 | # option orchidee1.9 : Compile with ORCHIDEE version up to the inclusion of OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6 |
|---|
| 280 | INCLUDE="${INCLUDE} -I${ORCH_INCDIR}" |
|---|
| 281 | CPP_KEY="$CPP_KEY CPP_VEGET" |
|---|
| 282 | # temporary, for Orchidee versions 1.9.* (before openmp activation) |
|---|
| 283 | if [[ "$veget" == "orchidee1.9" ]] ; then |
|---|
| 284 | CPP_KEY="$CPP_KEY ORCHIDEE_NOOPENMP" |
|---|
| 285 | fi |
|---|
| 286 | if [[ "$veget" == "orchidee2.0" ]] ; then |
|---|
| 287 | orch_libs="sechiba parameters stomate parallel orglob orchidee" |
|---|
| 288 | else |
|---|
| 289 | orch_libs="sechiba parameters stomate parallel orglob" |
|---|
| 290 | fi |
|---|
| 291 | LIB="${LIB} -L${ORCH_LIBDIR}" |
|---|
| 292 | for lib in ${orch_libs} ; do |
|---|
| 293 | if [ -f ${ORCH_LIBDIR}/lib${LIBPREFIX}$lib.a ] ; then |
|---|
| 294 | LIB="${LIB} -l${LIBPREFIX}$lib " |
|---|
| 295 | fi |
|---|
| 296 | done |
|---|
| 297 | elif [[ "$veget" != "false" ]] ; then |
|---|
| 298 | echo "Option -v $veget does not exist" |
|---|
| 299 | echo "Use ./makelmdz_fcm -h for more information" |
|---|
| 300 | exit |
|---|
| 301 | fi |
|---|
| 302 | |
|---|
| 303 | if [[ "$sisvat" == "true" ]] |
|---|
| 304 | then |
|---|
| 305 | CPP_KEY="$CPP_KEY CPP_SISVAT" |
|---|
| 306 | sed -e 's/^#src::sisvat/src::sisvat/' bld.cfg > bld.tmp |
|---|
| 307 | mv bld.tmp bld.cfg |
|---|
| 308 | fi |
|---|
| 309 | |
|---|
| 310 | if [[ "$rrtm" == "true" ]] |
|---|
| 311 | then |
|---|
| 312 | CPP_KEY="$CPP_KEY CPP_RRTM" |
|---|
| 313 | sed -e 's/^#src::rrtm/src::rrtm/' bld.cfg > bld.tmp |
|---|
| 314 | mv bld.tmp bld.cfg |
|---|
| 315 | fi |
|---|
| 316 | |
|---|
| 317 | if [[ $io == ioipsl ]] |
|---|
| 318 | then |
|---|
| 319 | CPP_KEY="$CPP_KEY CPP_IOIPSL" |
|---|
| 320 | INCLUDE="$INCLUDE -I${IOIPSL_INCDIR}" |
|---|
| 321 | LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl" |
|---|
| 322 | elif [[ $io == xios ]] |
|---|
| 323 | then |
|---|
| 324 | # For now, xios implies also using ioipsl |
|---|
| 325 | CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS" |
|---|
| 326 | INCLUDE="$INCLUDE -I${IOIPSL_INCDIR} -I${XIOS_INCDIR}" |
|---|
| 327 | LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios" |
|---|
| 328 | fi |
|---|
| 329 | |
|---|
| 330 | if [[ "$cosp" == "true" ]] |
|---|
| 331 | then |
|---|
| 332 | CPP_KEY="$CPP_KEY CPP_COSP" |
|---|
| 333 | COSP_PATH="$LIBFGCM/cosp" |
|---|
| 334 | # LIB="${LIB} -l${LIBPREFIX}cosp" |
|---|
| 335 | fi |
|---|
| 336 | |
|---|
| 337 | INCLUDE="$INCLUDE ${NETCDF_INCDIR}" |
|---|
| 338 | LIB="$LIB ${NETCDF_LIBDIR}" |
|---|
| 339 | |
|---|
| 340 | ######################################################################## |
|---|
| 341 | # calcul du nombre de dimensions |
|---|
| 342 | ######################################################################## |
|---|
| 343 | |
|---|
| 344 | |
|---|
| 345 | dim_full=$dim |
|---|
| 346 | dim=`echo $dim | sed -e 's/[^0-9]/ /g'` |
|---|
| 347 | set $dim |
|---|
| 348 | dimc=$# |
|---|
| 349 | echo calcul de la dimension |
|---|
| 350 | echo dim $dim |
|---|
| 351 | echo dimc $dimc |
|---|
| 352 | |
|---|
| 353 | |
|---|
| 354 | ######################################################################## |
|---|
| 355 | # Gestion des dimensions du modele. |
|---|
| 356 | # on cree ou remplace le fichier des dimensions |
|---|
| 357 | ######################################################################## |
|---|
| 358 | |
|---|
| 359 | cd $LIBFGCM/grid |
|---|
| 360 | if [[ -f dimensions.h ]] |
|---|
| 361 | then |
|---|
| 362 | echo 'ATTENTION: vous etes sans doute en train de compiler le modele par ailleurs' |
|---|
| 363 | echo "Attendez que la premiere compilation soit terminee pour relancer la suivante." |
|---|
| 364 | echo "Si vous etes sur que vous ne compilez pas le modele par ailleurs," |
|---|
| 365 | echo vous pouvez continuer en repondant oui. |
|---|
| 366 | echo "Voulez-vous vraiment continuer?" |
|---|
| 367 | echo "" |
|---|
| 368 | echo "WARNING: you are probably already compiling the model somewhere else." |
|---|
| 369 | echo "Wait until the first compilation is finished before launching this one." |
|---|
| 370 | echo "If you are sure that you are not compiling elsewhere, just answer " |
|---|
| 371 | echo "yes (or 'oui') to the question below to proceed." |
|---|
| 372 | echo "Do you wish to continue?" |
|---|
| 373 | read reponse |
|---|
| 374 | if [[ $reponse == "oui" || $reponse == "yes" ]] |
|---|
| 375 | then |
|---|
| 376 | \rm -f $LIBFGCM/grid/dimensions.h |
|---|
| 377 | else |
|---|
| 378 | exit |
|---|
| 379 | fi |
|---|
| 380 | fi |
|---|
| 381 | |
|---|
| 382 | |
|---|
| 383 | cd $LIBFGCM/grid/dimension |
|---|
| 384 | ./makdim $dim |
|---|
| 385 | cat $LIBFGCM/grid/dimensions.h |
|---|
| 386 | cd $LMDGCM |
|---|
| 387 | |
|---|
| 388 | |
|---|
| 389 | ######################################################################## |
|---|
| 390 | # Differentes dynamiques (3d, 2d, 1d) |
|---|
| 391 | ######################################################################## |
|---|
| 392 | |
|---|
| 393 | dimension=`echo $dim | wc -w` |
|---|
| 394 | echo dimension $dimension |
|---|
| 395 | |
|---|
| 396 | if (( $dimension == 3 )) |
|---|
| 397 | then |
|---|
| 398 | cd $LIBFGCM/grid |
|---|
| 399 | \rm fxyprim.h |
|---|
| 400 | cp -p fxy_${grille}.h fxyprim.h |
|---|
| 401 | else |
|---|
| 402 | echo "Probleme dans les dimensions de la dynamique !!" |
|---|
| 403 | echo "Non reactive pour l'instant !!!" |
|---|
| 404 | fi |
|---|
| 405 | |
|---|
| 406 | ###################################################################### |
|---|
| 407 | # Traitement special pour le nouveau rayonnement de Laurent Li. |
|---|
| 408 | # ---> YM desactive pour le traitemement en parallele |
|---|
| 409 | ###################################################################### |
|---|
| 410 | |
|---|
| 411 | #if [[ -f $libf/phy$physique/raddim.h ]] |
|---|
| 412 | #then |
|---|
| 413 | # if [[ -f $libf/phy$physique/raddim.$dimh.h ]] |
|---|
| 414 | #then |
|---|
| 415 | # \rm -f $libf/phy$physique/raddim.h |
|---|
| 416 | # cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h |
|---|
| 417 | # echo $libf/phy$physique/raddim.$dimh.h |
|---|
| 418 | # cat $libf/phy$physique/raddim.h |
|---|
| 419 | # else |
|---|
| 420 | # echo On peut diminuer la taille de l executable en creant |
|---|
| 421 | # echo le fichier $libf/phy$physique/raddim.$dimh.h |
|---|
| 422 | # \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h |
|---|
| 423 | # fi |
|---|
| 424 | #fi |
|---|
| 425 | |
|---|
| 426 | ###################################################################### |
|---|
| 427 | # Gestion du filtre qui n'existe qu'en 3d. |
|---|
| 428 | ###################################################################### |
|---|
| 429 | |
|---|
| 430 | if (( `expr $dimc \> 2` == 1 )) |
|---|
| 431 | then |
|---|
| 432 | filtre="FILTRE=$filtre" |
|---|
| 433 | else |
|---|
| 434 | filtre="FILTRE= L_FILTRE= " |
|---|
| 435 | fi |
|---|
| 436 | echo MACRO FILTRE $filtre |
|---|
| 437 | |
|---|
| 438 | echo $dimc |
|---|
| 439 | |
|---|
| 440 | |
|---|
| 441 | |
|---|
| 442 | ###################################################################### |
|---|
| 443 | # Creation du suffixe de la configuration |
|---|
| 444 | ###################################################################### |
|---|
| 445 | |
|---|
| 446 | |
|---|
| 447 | SUFF_NAME=_${dim_full} |
|---|
| 448 | SUFF_NAME=${SUFF_NAME}_phy${physique} |
|---|
| 449 | |
|---|
| 450 | if [[ "$parallel" != "none" ]] |
|---|
| 451 | then |
|---|
| 452 | SUFF_NAME=${SUFF_NAME}_para |
|---|
| 453 | DYN=dyn${dimc}d${paramem} |
|---|
| 454 | if [[ "$paramem" == "mem" ]] |
|---|
| 455 | then |
|---|
| 456 | SUFF_NAME=${SUFF_NAME}_${paramem} |
|---|
| 457 | fi |
|---|
| 458 | else |
|---|
| 459 | SUFF_NAME=${SUFF_NAME}_seq |
|---|
| 460 | DYN=dyn${dimc}d |
|---|
| 461 | fi |
|---|
| 462 | |
|---|
| 463 | if [[ $veget != "false" ]] |
|---|
| 464 | then |
|---|
| 465 | SUFF_NAME=${SUFF_NAME}_orch |
|---|
| 466 | fi |
|---|
| 467 | |
|---|
| 468 | if [[ $couple != "false" ]] |
|---|
| 469 | then |
|---|
| 470 | SUFF_NAME=${SUFF_NAME}_couple |
|---|
| 471 | fi |
|---|
| 472 | |
|---|
| 473 | if [[ $chimie == "INCA" ]] |
|---|
| 474 | then |
|---|
| 475 | SUFF_NAME=${SUFF_NAME}_inca |
|---|
| 476 | fi |
|---|
| 477 | |
|---|
| 478 | cd $LMDGCM |
|---|
| 479 | config_fcm="config.fcm" |
|---|
| 480 | rm -f $config_fcm |
|---|
| 481 | touch $config_fcm |
|---|
| 482 | rm -f bin/${code}${SUFF_NAME}.e |
|---|
| 483 | rm -f arch.fcm |
|---|
| 484 | rm -f arch.opt |
|---|
| 485 | |
|---|
| 486 | echo "%ARCH $arch" >> $config_fcm |
|---|
| 487 | echo "%INCDIR $INCLUDE" >> $config_fcm |
|---|
| 488 | echo "%LIB $LIB" >> $config_fcm |
|---|
| 489 | echo "%ROOT_PATH $PWD" >> $config_fcm |
|---|
| 490 | echo "%LIBF $LIBFGCM" >> $config_fcm |
|---|
| 491 | echo "%LIBO $LIBOGCM" >> $config_fcm |
|---|
| 492 | echo "%DYN $DYN" >> $config_fcm |
|---|
| 493 | echo "%PHYS phy${physique}" >> $config_fcm |
|---|
| 494 | echo "%COSP $COSP_PATH" >> $config_fcm |
|---|
| 495 | echo "%CPP_KEY $CPP_KEY" >> $config_fcm |
|---|
| 496 | echo "%EXEC $code" >> $config_fcm |
|---|
| 497 | echo "%SUFF_NAME $SUFF_NAME" >> $config_fcm |
|---|
| 498 | echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> $config_fcm |
|---|
| 499 | echo "%PARA_FFLAGS $PARA_FFLAGS" >> $config_fcm |
|---|
| 500 | echo "%PARA_LD $PARA_LD" >> $config_fcm |
|---|
| 501 | echo "%EXT_SRC $EXT_SRC" >> $config_fcm |
|---|
| 502 | |
|---|
| 503 | |
|---|
| 504 | |
|---|
| 505 | ln -s arch/arch-${arch}.fcm arch.fcm |
|---|
| 506 | if test -f arch/arch-${arch}.opt && [ $compil_mod = "prod" ] |
|---|
| 507 | then |
|---|
| 508 | ln -s arch/arch-${arch}.opt arch.opt |
|---|
| 509 | else |
|---|
| 510 | ln -s .void_file arch.opt |
|---|
| 511 | fi |
|---|
| 512 | |
|---|
| 513 | |
|---|
| 514 | rm -f $LIBOGCM/${arch}${SUFF_NAME}/.config/fcm.bld.lock |
|---|
| 515 | ./build_gcm ${fcm_path} -j $job $full |
|---|
| 516 | |
|---|
| 517 | rm -rf tmp_src |
|---|
| 518 | rm -rf config |
|---|
| 519 | ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config config |
|---|
| 520 | ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config/tmp tmp_src |
|---|
| 521 | |
|---|
| 522 | #eventual cleanup for SISVAT |
|---|
| 523 | sed -e 's/^src::sisvat/#src::sisvat/' bld.cfg > bld.tmp |
|---|
| 524 | mv bld.tmp bld.cfg |
|---|
| 525 | |
|---|
| 526 | #eventual cleanup for RRTM |
|---|
| 527 | sed -e 's/^src::rrtm/#src::rrtm/' bld.cfg > bld.tmp |
|---|
| 528 | mv bld.tmp bld.cfg |
|---|
| 529 | |
|---|
| 530 | |
|---|
| 531 | if [[ -r $LIBFGCM/grid/dimensions.h ]] |
|---|
| 532 | then |
|---|
| 533 | # Cleanup: remove dimension.h file |
|---|
| 534 | \rm -f $LIBFGCM/grid/dimensions.h |
|---|
| 535 | fi |
|---|