source: trunk/LMDZ.COMMON/makelmdz_fcm @ 1853

Last change on this file since 1853 was 1841, checked in by mturbet, 7 years ago

debugage

File size: 22.2 KB
Line 
1#!/bin/bash
2# $Id: makelmdz_fcm 1615 2012-02-10 15:42:26Z emillour $
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
18dim="96x72x19"
19physique=lmd
20filtre=filtrez
21grille=reg
22couple=false
23veget=false
24sisvat=false
25rrtm=false
26dust=false
27strataer=false
28chimie=false
29chemistry=false
30parallel=none
31paramem="par"
32compil_mod=prod
33io=ioipsl
34LIBPREFIX=""
35cosp=false
36bands=""
37scatterers=""
38job=1
39full=''
40libphy=false
41
42arch_defined="FALSE"
43arch_path="arch"
44arch_default_path="arch"
45
46LMDGCM=`/bin/pwd`
47LIBOGCM=$LMDGCM/libo
48LIBFGCM=$LMDGCM/libf
49DYN_COMMON_PATH=$LIBFGCM/dyn3d_common
50# path for optional packages, but default set to ".void_dir"
51FILTRE_PATH=$LMDGCM/.void_dir
52DYN_PHYS_PATH=$LMDGCM/.void_dir
53DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
54PHY_COMMON_PATH=$LMDGCM/.void_dir
55RRTM_PATH=$LMDGCM/.void_dir
56DUST_PATH=$LMDGCM/.void_dir
57STRATAER_PATH=$LMDGCM/.void_dir
58SISVAT_PATH=$LMDGCM/.void_dir
59COSP_PATH=$LMDGCM/.void_dir
60CHEM_PATH=$LMDGCM/.void_dir
61CLOUD_PATH=$LMDGCM/.void_dir
62MUPHY_PATH=$LMDGCM/.void_dir
63AERONO_PATH=$LMDGCM/.void_dir
64# Path to fcm utility:
65##fcm_path=$LMDGCM/tools/fcm/bin
66fcm_path=$(dirname $(which fcm))
67
68########################################################################
69#  Quelques initialisations de variables du shell.
70########################################################################
71
72CPP_KEY="" 
73INCLUDE=""
74LIB=""
75adjnt=""
76COMPIL_FFLAGS="%PROD_FFLAGS"
77PARA_FFLAGS=""
78PARA_LD=""
79EXT_SRC=""
80
81########################################################################
82# lecture des options de mymake
83########################################################################
84
85while (($# > 0))
86  do
87  case $1 in
88      "-h") cat <<fin
89Usage :
90makegcm [options] -arch arch exec
91[-h]                       : brief help
92[-d [[IMx]JMx]LM]          : IM, JM, LM are the dimensions in x, y, z (default: $dim)
93[-s nscat]                 : (Generic) Number of radiatively active scatterers
94[-b IRxVIS]                : (Generic) Number of infrared (IR) and visible (VIS) bands for radiative transfer
95[-p PHYS]                  : set of physical parametrizations (in libf/phyPHYS), (default: lmd)
96[-prod / -dev / -debug]    : compilation mode production (default) / developement / debug .
97[-c false/MPI1/OMCT]       : (Earth) coupling with ocean model : MPI1/OMCT/false (default: false)
98[-v false/orchidee2.0/orchidee1.9/true] : (Earth) version of the vegetation model to include (default: false)
99          false       : no vegetation model
100          orchidee2.0 : compile using ORCHIDEE 2.0 (or more recent version)
101          orchidee1.9 : compile using ORCHIDEE up to the version including OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6
102          true        : (obsolete; for backward compatibility) use ORCHIDEE tag 1.9-1.9.6
103[-chimie INCA/false]       : (Earth) with INCA chemistry model or without (default: false)
104[-cosp cosp/false]         : (Earth) add the cosp model (default: false)
105[-sisvat true/false]  : (Earth) compile with/without sisvat package (default: false)
106[-rrtm true/false]    : (Earth) compile with/without rrtm package (default: false)
107[-dust true/false]    : (Earth) compile with/without the dust package by Boucher and co (default: false)
108[-strataer true/false]    : (Earth) compile with/without the strat aer package by Boucher and co (default: false)
109[-parallel none/mpi/omp/mpi_omp] : parallelism (default: none) : mpi, openmp or mixted mpi_openmp
110[-g GRI]                   : grid configuration in dyn3d/GRI_xy.h  (default: reg, inclues a zoom)
111[-io ioipsl/mix/xios]                   : Input/Output library (default: ioipsl)
112[-include INCLUDES]        : extra include path to add
113[-cpp CPP_KEY]             : additional preprocessing definitions
114[-adjnt]                   : adjoint model, not operational ...
115[-mem]                     : reduced memory dynamics (if in parallel mode)
116[-filtre NOMFILTRE]        : use filtre from libf/NOMFILTRE (default: filtrez)
117[-link LINKS]              : additional links with other libraries
118[-j n]                     : active parallel compiling on ntask
119[-full]                    : full (re-)compilation (from scratch)
120[-fcm_path path]           : path to the fcm tool (default: tools/fcm/bin)
121[-ext_src path]            : path to an additional set of routines to compile with the model
122[-arch_path path]          : path to architecture files (default: $arch_default_path)
123 -arch arch                : target architecture
124 exec                      : executable to build
125fin
126          exit;;
127
128      "-d")
129          dim=$2 ; shift ; shift ;;
130     
131      "-p")
132          physique="$2" ;  shift ; shift ;;
133
134      "-s")
135          scatterers=$2 ; shift ; shift ;;
136
137      "-b")
138          bands=$2 ; shift ; shift ;;
139
140      "-g")
141          grille="$2" ; shift ; shift ;;
142
143      "-c")
144          couple="$2" ; shift ; shift ;;
145
146      "-prod")
147          compil_mod="prod" ; shift ;;
148
149      "-dev")
150          compil_mod="dev" ; shift ;;
151
152      "-debug")
153          compil_mod="debug" ; shift ;;
154
155      "-io")
156          io="$2" ; shift ; shift ;;
157
158      "-v")
159          veget="$2" ; shift ; shift ;;
160
161      "-sisvat")
162          sisvat="$2" ; shift ; shift ;;
163
164      "-rrtm")
165          rrtm="$2" ; shift ; shift ;;
166
167      "-dust")
168          dust="$2" ; shift ; shift ;;
169
170      "-strataer")
171          strataer="$2" ; shift ; shift ;;
172
173      "-chimie")
174          chimie="$2" ; shift ; shift ;;
175
176      "-parallel")
177          parallel="$2" ; shift ; shift ;;
178     
179      "-include")
180          INCLUDE="$INCLUDE -I$2" ; shift ; shift ;;
181
182      "-cpp")
183          CPP_KEY="$CPP_KEY $2" ; shift ; shift ;;
184
185      "-adjnt")
186          echo "not operational ... work to be done here ";exit
187          opt_dep="$opt_dep adjnt" ; adjnt="-ladjnt -ldyn3d "
188          optim="$optim -Dadj" ; shift ;;
189
190      "-cosp")
191          cosp="$2" ; shift ; shift ;;
192
193      "-mem")
194          paramem="mem" ; shift ;;
195
196      "-filtre")
197          filtre=$2 ; shift ; shift ;;
198
199      "-link")
200          LIB="$LIB $2" ; shift ; shift ;;
201
202      "-fcm_path")
203          fcm_path=$2 ; shift ; shift ;;
204
205      "-ext_src")
206          EXT_SRC=$2 ; shift ; shift ;;
207
208      "-j")
209          job=$2 ; shift ; shift ;;
210
211      "-full")
212          full="-full" ; shift ;;
213
214      "-libphy")
215          libphy="true" ; shift ;;
216
217      "-arch")
218          arch=$2 ; arch_defined="TRUE" ; shift ; shift ;;
219
220      "-arch_path")
221          arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;;
222
223      *)
224          code="$1" ; shift ;;
225  esac
226done
227
228###############################################################
229# path to fcm
230###############################################################
231# handle case when provided path to fcm was given as a relative
232# path (from makelmdz_fcm script directory) and not an absolute path
233if [[ ${fcm_path:0:1} != "/" ]] ; then
234  # prepend with makelmdz_fcm location
235  fcm_path=$(cd $(dirname $0) ; pwd)"/"${fcm_path}
236fi
237
238# add fcm_path to PATH
239export PATH=${fcm_path}:${PATH}
240
241echo "Path to fcm:"
242echo ${fcm_path}
243
244###############################################################
245# lecture des chemins propres à l'architecture de la machine #
246###############################################################
247rm -f .void_file
248echo > .void_file
249rm -rf .void_dir
250mkdir .void_dir
251
252if [[ "$arch_defined" == "TRUE" ]]
253then
254  rm -f arch.path
255  rm -f arch.fcm
256  rm -f arch.env
257
258  if test -f $arch_path/arch-${arch}.path
259  then
260    ln -s $arch_path/arch-${arch}.path arch.path
261  elif test -f $arch_default_path/arch-${arch}.path
262  then
263    ln -s $arch_default_path/arch-${arch}.path arch.path
264  fi
265       
266  if test -f $arch_path/arch-${arch}.fcm
267  then
268    ln -s $arch_path/arch-${arch}.fcm arch.fcm
269  elif test -f $arch_default_path/arch-${arch}.fcm
270  then
271    ln -s $arch_default_path/arch-${arch}.fcm arch.fcm
272  fi
273
274  if test -f $arch_path/arch-${arch}.env
275  then
276    ln -s $arch_path/arch-${arch}.env arch.env
277  elif test -f $arch_default_path/arch-${arch}.env
278  then
279    ln -s $arch_default_path/arch-${arch}.env arch.env
280  else
281    ln -s .void_file arch.env
282  fi
283  # source architecture PATH and ENV files
284  source arch.env
285  source arch.path
286else
287  echo "You must define a target architecture"
288  exit 1
289fi
290
291########################################################################
292# Definition des clefs CPP, des chemins des includes et modules
293#  et des libraries
294########################################################################
295
296if [[ "$compil_mod" == "prod" ]]
297then
298  COMPIL_FFLAGS="%PROD_FFLAGS"
299elif [[ "$compil_mod" == "dev" ]]
300then
301  COMPIL_FFLAGS="%DEV_FFLAGS"
302elif [[ "$compil_mod" == "debug" ]]
303then
304  COMPIL_FFLAGS="%DEBUG_FFLAGS"
305fi
306
307phys_root=$physique
308if [[ "${physique:0:3}" == "lmd" ]] ; then phys_root=lmd ; fi
309if [[ "${physique:0:3}" == "mar" ]] ; then phys_root=mar ; fi
310if [[ "${physique:0:4}" == "mars" ]] ; then phys_root=mars ; fi
311if [[ "${physique:0:3}" == "std" ]] ; then phys_root=std ; fi
312if [[ "${physique:0:5}" == "venus" ]] ; then phys_root=venus ; fi
313if [[ "${physique:0:5}" == "titan" ]] ; then phys_root=titan ; fi
314if [[ "${physique:0:3}" == "dev" ]] ; then phys_root=dev ; fi
315
316if [[ "$physique" != "nophys" ]]
317then
318   #We'll use some physics
319   CPP_KEY="$CPP_KEY CPP_PHYS"
320   if [[ "${phys_root}" == "lmd" ]]
321   then
322   #For lmd physics, default planet type is Earth
323   CPP_KEY="$CPP_KEY CPP_EARTH"
324   fi
325   # set physics common utilities path
326   PHY_COMMON_PATH="${LIBFGCM}/phy_common"
327   # set the dyn/phys interface path
328   DYN_PHYS_PATH="${LIBFGCM}/dynphy_lonlat"
329   DYN_PHYS_SUB_PATH="${LIBFGCM}/dynphy_lonlat/phy${phys_root}"
330fi
331
332if [[ "$filtre" == "filtrez" ]]
333then
334   FILTRE_PATH=${LIBFGCM}/$filtre
335fi
336
337if [[ "$chimie" == "INCA" ]]
338then
339   CPP_KEY="$CPP_KEY INCA"
340   INCLUDE="$INCLUDE -I${INCA_INCDIR}"
341   LIB="$LIB -L${INCA_LIBDIR} ${INCA_LIB}"
342fi
343
344if [[ "$couple" != "false" ]]
345then
346    if [[ "$couple" == "MPI1" ]]
347    then
348        CPP_KEY="$CPP_KEY CPP_COUPLE"
349        export OASIS_INCDIR=$LMDGCM/../../prism/X64/build/lib/psmile.MPI1
350        export OASIS_LIBDIR=$LMDGCM/../../prism/X64/lib
351        INCLUDE="$INCLUDE -I${OASIS_INCDIR}"
352        LIB="$LIB -L${OASIS_LIBDIR} ${OASIS_LIB}"
353    else
354        CPP_KEY="$CPP_KEY CPP_COUPLE CPP_OMCT"
355        INCLUDE="$INCLUDE -I${OASIS_INCDIR}"
356        LIB="$LIB -L${OASIS_LIBDIR} ${OASIS_LIB}"
357    fi
358fi
359
360if [[ "$parallel" != "none" && \
361     ( "$code" == "newstart" || "$code" == "start2archive" ) ]]
362then
363    echo "newstart or start2archive utilities should be run in serial!"
364    echo " Compile without -parallel [mpi|omp|mpi_omp] option!"
365    exit
366fi
367
368if [[ "$parallel" == "mpi" ]]
369then
370   CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI"
371   PARA_FFLAGS="%MPI_FFLAGS"
372   PARA_LD="%MPI_LD"
373elif [[ "$parallel" == "omp" ]]
374then
375   CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP"
376   PARA_FFLAGS="%OMP_FFLAGS"
377   PARA_LD="%OMP_LD"
378elif [[ "$parallel" == "mpi_omp" ]]
379then
380   CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI CPP_OMP"
381   PARA_FFLAGS="%MPI_FFLAGS %OMP_FFLAGS"
382   PARA_LD="%MPI_LD %OMP_LD"
383fi
384
385if [[ ( "$parallel" == "omp" || "$parallel" == "mpi_omp" ) \
386   && "$compil_mod" == "debug" ]]
387then
388    echo "Usually, parallelization with OpenMP requires some optimization."
389    echo "We suggest switching to \"-dev\"."
390fi
391
392if [ "$veget" = "true" -o "$veget" = "orchidee1.9" -o "$veget" = "orchidee2.0" ]
393then
394#NB: option 'true': for backward compatibility. To be used with ORCHIDEE tag 1.9-1.9.6
395#    For this case, cpp flag ORCHIDEE_NOOPENMP must be added to the makelmdz_fcm arguments
396#    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
397   INCLUDE="${INCLUDE} ${ORCHIDEE_INCDIR}"
398   CPP_KEY="$CPP_KEY CPP_VEGET"
399# temporary, for Orchidee versions 1.9.* (before openmp activation)
400   if [[ "$veget" == "orchidee1.9" ]] ; then
401      CPP_KEY="$CPP_KEY ORCHIDEE_NOOPENMP"
402   fi
403   if [[ "$veget" == "orchidee2.0" ]] ; then
404      orch_libs="sechiba parameters stomate parallel orglob orchidee"
405   else
406      orch_libs="sechiba parameters stomate parallel orglob"
407   fi
408   LIB="${LIB} -L${ORCHIDEE_LIBDIR} ${ORCHIDEE_LIB}"
409elif [[ "$veget" != "false" ]] ; then
410   echo "Option -v $veget does not exist"
411   echo "Use ./makelmdz_fcm -h for more information"
412   exit 
413fi
414
415if [[ "$sisvat" == "true" ]]
416then
417   CPP_KEY="$CPP_KEY CPP_SISVAT"
418   SISVAT_PATH="$LIBFGCM/%PHYS/sisvat"
419fi
420
421if [[ "$rrtm" == "true" ]]
422then
423   CPP_KEY="$CPP_KEY CPP_RRTM"
424   RRTM_PATH="$LIBFGCM/%PHYS/rrtm"
425fi
426
427if [[ "$dust" == "true" ]]
428then
429   CPP_KEY="$CPP_KEY CPP_Dust"
430   DUST_PATH="$LIBFGCM/%PHYS/Dust"
431fi
432
433if [[ "$strataer" == "true" ]]
434then
435   CPP_KEY="$CPP_KEY CPP_StratAer"
436   STRATAER_PATH="$LIBFGCM/%PHYS/StratAer"
437fi
438
439if [[ $io == ioipsl ]]
440then
441   CPP_KEY="$CPP_KEY CPP_IOIPSL"
442   INCLUDE="$INCLUDE ${IOIPSL_INCDIR}"
443   LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB}"
444elif [[ $io == mix ]]
445then
446   # For now, xios implies also using ioipsl
447   CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS"
448   INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}"
449   LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB} ${XIOS_LIBDIR} ${XIOS_LIB}"
450elif [[ $io == xios ]]
451then
452   # For now, xios implies also using ioipsl
453   CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS CPP_IOIPSL_NO_OUTPUT"
454   INCLUDE="$INCLUDE ${IOIPSL_INCDIR} ${XIOS_INCDIR}"
455   LIB="$LIB ${IOIPSL_LIBDIR} ${IOIPSL_LIB} ${XIOS_LIBDIR} ${XIOS_LIB}"
456fi
457
458if [[ "$cosp" == "true" ]]
459then
460   CPP_KEY="$CPP_KEY CPP_COSP"
461   COSP_PATH="$LIBFGCM/cosp"
462#   LIB="${LIB} -l${LIBPREFIX}cosp"
463fi
464
465# for Titan (but could be used by others as well), there is also "chimtitan"
466if [[ -d ${LIBFGCM}/chim${physique} ]]
467then
468   CHEM_PATH="${LIBFGCM}/chim${physique}"
469   INCLUDE="$INCLUDE -I${LIBFGCM}/chim${physique}"
470fi
471
472# for Titan add microphysics dependencies
473if [[ -d ${LIBFGCM}/muphy${physique} ]] ; then
474
475  # add muphy{physique} to the list of files to compile.
476  MUPHY_PATH="${LIBFGCM}/muphy${physique}"
477  # For Titan as we embbed some libraries with CPP keys, we define them:
478  #   -DPREC={32|64|80} real kind precision (32: simple, 64: double, 80: extended double)
479  #   -DHAVE_NC_FTN=1 (mandatory: for support of NetCDF in lintnd).
480  CPP_KEY="$CPP_KEY PREC=64 HAVE_NC_FTN=1"
481  if [[ "${physique}" == "titan" ]] ; then
482    echo "Yaahh you're about to use YAMMS in a GCM..."
483  fi
484fi
485
486# for Venus (but could be used by others as well), there is also "phyvenus/cloudvenus"
487if [[ -d ${LIBFGCM}/phy${physique}/cloud${physique} ]]
488then
489   CLOUD_PATH="${LIBFGCM}/phy${physique}/cloud${physique}"
490   INCLUDE="$INCLUDE -I${LIBFGCM}/phy${physique}/cloud${physique}"
491fi
492
493# for Mars (but could be used by others as well), there is also "aeronomars"
494if [[ -d ${LIBFGCM}/aerono${physique} ]]
495then
496   AERONO_PATH="${LIBFGCM}/aerono${physique}"
497   INCLUDE="$INCLUDE -I${LIBFGCM}/aerono${physique}"
498fi
499
500# NETCDF library include/library paths
501INCLUDE="$INCLUDE ${NETCDF_INCDIR}"
502LIB="$LIB ${NETCDF_LIBDIR} ${NETCDF_LIB}"
503
504########################################################################
505# calcul du nombre de dimensions
506########################################################################
507
508
509dim_full=$dim
510dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
511set $dim
512dimc=$#
513echo calcul de la dimension
514echo dim $dim
515echo dimc $dimc
516
517
518########################################################################
519# Gestion des dimensions du modele.
520# on cree ou remplace le fichier des dimensions
521########################################################################
522
523cd $LIBFGCM/grid
524if [[ -f dimensions.h ]]
525then
526  echo 'ATTENTION: vous etes sans doute en train de compiler le modele par ailleurs'
527  echo "Attendez que la premiere compilation soit terminee pour relancer la suivante."
528  echo "Si vous etes sur que vous ne compilez pas le modele par ailleurs,"
529  echo  vous pouvez continuer en repondant oui.
530  echo "Voulez-vous vraiment continuer?"
531  echo ""
532  echo "WARNING: you are probably already compiling the model somewhere else."
533  echo "Wait until the first compilation is finished before launching this one."
534  echo "If you are sure that you are not compiling elsewhere, just answer "
535  echo "yes (or 'oui') to the question below to proceed."
536  echo "Do you wish to continue?"
537  read reponse
538  if [[ $reponse == "oui" || $reponse == "yes" ]]
539  then
540    \rm -f $LIBFGCM/grid/dimensions.h
541  else
542    exit
543  fi
544fi
545
546
547cd $LIBFGCM/grid/dimension
548./makdim $dim
549if (($? != 0))
550then
551    exit 1
552fi
553
554cat $LIBFGCM/grid/dimensions.h
555cd $LMDGCM
556
557if [[ "$bands" != "" ]]
558then
559  # Generic model, recreate bands.h (IR & VIS bands for radiative transfer)
560  bands=$(echo $bands | sed -e 's/[^0-9]/ /g')
561  cd $LIBFGCM/phy$physique/bands
562  ./makbands $bands
563  cat $LIBFGCM/phy$physique/bands.h
564  cd $LMDGCM
565fi
566
567if [[ "$scatterers" != "" ]]
568then
569  # Generic model, recreate scatterers.h
570  cd $LIBFGCM/phy$physique/scatterers
571  ./make_scatterers $scatterers
572  cat $LIBFGCM/phy$physique/scatterers.h
573  cd $LMDGCM
574fi
575
576
577########################################################################
578# Differentes dynamiques (3d, 2d, 1d)
579########################################################################
580
581dimension=`echo $dim | wc -w`
582echo dimension $dimension
583
584if (( $dimension == 3 ))
585then
586  cd $LIBFGCM/grid
587  \rm fxyprim.h
588  cp -p fxy_${grille}.h fxyprim.h
589#else
590#  echo "Probleme dans les dimensions de la dynamique !!"
591#  echo "Non reactive pour l'instant !!!"
592fi
593
594if (( $dimension == 1 ))
595then
596## Sanity check: 1D models should be used in serial
597  if [[ $parallel != "none" ]]
598  then
599    echo "Error: a 1D model should not be compiled with "
600    echo "       -parallel [mpi|omp|mpi_omp] option!"
601    exit
602  fi
603  CPP_KEY="$CPP_KEY CPP_1D"
604##in 1D, add dyn3d to include path (because main prog is in physics)
605  INCLUDE="$INCLUDE -Ilibf/dyn3d -Ilibf/dyn3d_common"
606## no filtre in 1d:
607  FILTRE_PATH=$LMDGCM/.void_dir
608## no need to compile all routines in dyn3d_common either:
609  DYN_COMMON_PATH=$LMDGCM/.void_dir
610## no need to compile all routines in dynlmdz_phy... ;
611## (because key ones are included in 1D main program)
612  DYN_PHYS_PATH=$LMDGCM/.void_dir
613  DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
614fi
615
616######################################################################
617#   Traitement special pour le nouveau rayonnement de Laurent Li.
618#   ---> YM desactive pour le traitemement en parallele
619######################################################################
620
621#if [[ -f $libf/phy$physique/raddim.h ]]
622#then
623# if [[ -f $libf/phy$physique/raddim.$dimh.h ]]
624#then
625#  \rm -f $libf/phy$physique/raddim.h
626#  cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h
627#  echo $libf/phy$physique/raddim.$dimh.h
628#  cat $libf/phy$physique/raddim.h
629# else
630#  echo On peut diminuer la taille de l executable en creant
631#  echo le fichier $libf/phy$physique/raddim.$dimh.h
632#  \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h
633# fi
634#fi
635
636######################################################################
637# Gestion du filtre qui n'existe qu'en 3d.
638######################################################################
639
640if (( `expr $dimc \> 2` == 1 ))
641then
642   filtre="FILTRE=$filtre"
643else
644   filtre="FILTRE= L_FILTRE= "
645fi
646echo MACRO FILTRE $filtre
647
648echo $dimc
649
650
651
652######################################################################
653# Creation du suffixe de la configuration
654######################################################################
655
656
657SUFF_NAME=_${dim_full}
658SUFF_NAME=${SUFF_NAME}_phy${physique}
659
660if [[ "$parallel" != "none" ]]
661then
662  SUFF_NAME=${SUFF_NAME}_para
663  DYN=dyn${dimc}d${paramem}
664  if [[ "$paramem" == "mem" ]]
665  then
666   SUFF_NAME=${SUFF_NAME}_${paramem}
667  fi
668else
669  SUFF_NAME=${SUFF_NAME}_seq
670  if (( $dimension == 1 ))
671  then
672    # dynamics-related routines in"dyn1d" subdirectory of phy${physique}
673    DYN=phy${physique}/dyn1d
674  else
675    DYN=dyn${dimc}d
676  fi
677fi
678
679if [[ $veget != "false" ]]
680then
681  SUFF_NAME=${SUFF_NAME}_orch
682fi
683
684if [[ $couple != "false" ]]
685then
686  SUFF_NAME=${SUFF_NAME}_couple
687fi
688
689if [[ $chimie == "INCA" ]]
690then
691  SUFF_NAME=${SUFF_NAME}_inca
692fi
693
694if [[ $libphy == "true" ]]
695then
696  # special case where we compile only the physics
697  DYN=$LMDGCM/.void_dir
698  DYN_COMMON_PATH=$LMDGCM/.void_dir
699  FILTRE_PATH=$LMDGCM/.void_dir
700  DYN_PHYS_PATH=$LMDGCM/.void_dir
701  DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
702  #and there is no main program to generate
703  code=""
704  SUFF_NAME=""
705else
706  SUFF_NAME=${SUFF_NAME}.e
707fi
708
709cd $LMDGCM
710config_fcm="config.fcm"
711rm -f $config_fcm
712touch $config_fcm
713rm -f bin/${code}${SUFF_NAME}.e
714rm -f arch.fcm
715rm -f arch.opt
716
717echo "%ARCH          $arch"          >> $config_fcm
718echo "%INCDIR        $INCLUDE"       >> $config_fcm 
719echo "%LIB           $LIB"           >> $config_fcm
720echo "%ROOT_PATH     $PWD"           >> $config_fcm
721echo "%LIBF          $LIBFGCM"       >> $config_fcm
722echo "%LIBO          $LIBOGCM"       >> $config_fcm
723echo "%DYN           $DYN"           >> $config_fcm
724echo "%DYN_COMMON    $DYN_COMMON_PATH" >> $config_fcm
725echo "%PHY_COMMON    $PHY_COMMON_PATH" >> $config_fcm
726echo "%FILTRE        $FILTRE_PATH"   >> $config_fcm
727echo "%PHYS          phy${physique}" >> $config_fcm
728echo "%DYN_PHYS      $DYN_PHYS_PATH" >> $config_fcm
729echo "%DYN_PHYS_SUB  $DYN_PHYS_SUB_PATH" >> $config_fcm
730echo "%RRTM          $RRTM_PATH"     >> $config_fcm
731echo "%DUST          $DUST_PATH"     >> $config_fcm
732echo "%STRATAER      $STRATAER_PATH" >> $config_fcm
733echo "%SISVAT        $SISVAT_PATH"   >> $config_fcm
734echo "%COSP          $COSP_PATH"     >> $config_fcm
735echo "%CHEM          $CHEM_PATH"     >> $config_fcm
736echo "%CLOUD         $CLOUD_PATH"    >> $config_fcm
737echo "%MUPHY         $MUPHY_PATH"    >> $config_fcm
738echo "%AERONO        $AERONO_PATH"   >> $config_fcm
739echo "%CPP_KEY       $CPP_KEY"       >> $config_fcm
740echo "%EXEC          $code"          >> $config_fcm
741echo "%SUFF_NAME     $SUFF_NAME"     >> $config_fcm
742echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> $config_fcm
743echo "%PARA_FFLAGS   $PARA_FFLAGS"   >> $config_fcm
744echo "%PARA_LD       $PARA_LD"       >> $config_fcm
745echo "%EXT_SRC       $EXT_SRC"       >> $config_fcm
746
747
748
749ln -s arch/arch-${arch}.fcm arch.fcm
750if test -f arch/arch-${arch}.opt &&  [ $compil_mod = "prod" ]
751  then
752  ln -s arch/arch-${arch}.opt arch.opt
753else
754  ln -s .void_file arch.opt
755fi
756
757
758rm -f $LIBOGCM/${arch}${SUFF_NAME}/.config/fcm.bld.lock
759./build_gcm ${fcm_path} -j $job $full
760
761rm -rf tmp_src
762rm -rf config
763ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config config
764ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config/ppsrc tmp_src
765
766
767if [[ -r $LIBFGCM/grid/dimensions.h ]]
768then
769  # Cleanup: remove dimension.h file
770  \rm -f $LIBFGCM/grid/dimensions.h
771fi
Note: See TracBrowser for help on using the repository browser.