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