source: LMDZ6/trunk/makelmdz_fcm @ 4167

Last change on this file since 4167 was 4103, checked in by Laurent Fairhead, 3 years ago

Inclusion of some corrections and optimisations for XIOS done by
Arnaud Durocher during his TGCC mission.
Included here are r3703, r3704, r3750, r3751, r3752 from his
LMDZ6/branches/Optimisation_LMDZ branch

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 22.0 KB
Line 
1#!/bin/bash
2# $Id: makelmdz_fcm 4103 2022-03-17 10:51:36Z evignon $
3# This is a script in Bash.
4
5# FH : on ne cr\'ee plus le fichier arch.mk qui est suppos\'e exister par
6# FH : ailleurs.
7# FH : ulterieurement, ce fichier sera pr\'e-existant pour une s\'erie
8# FH : de configurations en versions optimis\'ees et debug qui seront
9# FH : li\'es (ln -s) avec arch.mk en fonction de l'architecture.
10# FH : Pour le moment, cette version est en test et on peut cr\'eer les
11# FH : arch.mk en lan\c{}cant une premi\`ere fois makegcm.
12#
13##set -x
14set -e
15########################################################################
16# options par defaut pour la commande make
17########################################################################
18
19dim="96x72x19"
20physique=lmd
21filtre=filtrez
22grille=reg
23couple=false
24veget=false
25inlandsis=false
26rrtm=false
27rad="old"
28dust=false
29strataer=false
30chimie=false
31parallel=none
32paramem="mem"
33compil_mod=prod
34io=ioipsl
35LIBPREFIX=""
36cosp=false
37cosp2=false
38cospv2=false
39job=1
40full=''
41libphy=false
42isotopes=false
43isoverif=false
44diagiso=false
45isotrac=false
46force_compile=false
47
48arch_defined="FALSE"
49arch_path="arch"
50arch_default_path="arch"
51
52LMDGCM=`/bin/pwd`
53LIBOGCM=$LMDGCM/libo
54LIBFGCM=$LMDGCM/libf
55DYN_COMMON_PATH=$LIBFGCM/dyn3d_common
56# path for optional packages, but default set to ".void_dir"
57FILTRE_PATH=$LMDGCM/.void_dir
58DYN_PHYS_PATH=$LMDGCM/.void_dir
59DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
60PHY_COMMON_PATH=$LMDGCM/.void_dir
61RAD_PATH=$LMDGCM/.void_dir
62INLANDSIS_PATH=$LMDGCM/.void_dir
63DUST_PATH=$LMDGCM/.void_dir
64STRATAER_PATH=$LMDGCM/.void_dir
65COSP_PATH=$LMDGCM/.void_dir
66fcm_path=$LMDGCM/tools/fcm/bin
67
68########################################################################
69#  Quelques initialisations de variables du shell.
70########################################################################
71
72CPP_KEY="IN_LMDZ" 
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 :
90makelmdz_fcm [options] -arch nom_arch exec
91[-h]                       : brief help
92[-d [[IMx]JMx]LM]          : IM, JM, LM are the dimensions in x, y, z (default: $dim)
93[-p PHYS]                  : set of physical parametrizations (in libf/phyPHYS), (default: lmd)
94[-prod / -dev / -debug]    : compilation mode production (default) / developement / debug
95[-c false/MPI1/OMCT]       : coupling with ocean model : MPI1/OMCT/false (default: false)
96[-v false/orchidee2.0/orchidee1.9/true] : version of the vegetation model to include (default: false)
97          false       : no vegetation model
98          orchidee2.1 : compile using ORCHIDEE 2.1 (or more recent version)
99          orchidee2.0 : compile using ORCHIDEE 2.0
100          orchidee1.9 : compile using ORCHIDEE up to the version including OpenMP in ORCHIDEE : tag 1.9-1.9.5(version AR5)-1.9.6
101          true        : (obsolete; for backward compatibility) use ORCHIDEE tag 1.9-1.9.6
102[-chimie INCA/false]       : with INCA chemistry model or without (default: false)
103[-cosp true/false]    : compile with/without cosp package (default: false)
104[-cosp2 true/false]    : compile with/without cosp2 package (default: false)
105[-cospv2 true/false]    : compile with/without cospv2 package (default: false)
106[-inlandsis true/false]  : compile with/without inlandsis package (default: false)
107[-rrtm true/false]    : compile with/without rrtm package (default: false)
108[-rad old/rrtm/ecrad]    : compile with old/rrtm/ecrad radiatif code (default: old)
109[-dust true/false]    : compile with/without the dust package by Boucher and co (default: false)
110[-strataer true/false]    : compile with/without the strat aer package by Boucher and co (default: false)
111[-isotopes true/false]    : compile with/without water isotopes in the physics
112[-isoverif true/false]    : compile with/without verifications for water isotopes in the physics
113[-diagiso true/false]    : compile with/without special diagnostics for water isotopes in the physics
114[-isotrac true/false]    : compile with/without tracers of water isotopes in the physics
115[-parallel none/mpi/omp/mpi_omp] : parallelism (default: none) : mpi, openmp or mixted mpi_openmp
116[-g GRI]                   : grid configuration in dyn3d/GRI_xy.h  (default: reg, inclues a zoom)
117[-io ioipsl/mix/xios]                   : Input/Output library (default: ioipsl)
118[-include INCLUDES]        : extra include path to add
119[-cpp CPP_KEY]             : additional preprocessing definitions
120[-adjnt]                   : adjoint model, not operational ...
121[-mem]                     : reduced memory dynamics (obsolete flag; always on in parallel mode)
122[-filtre NOMFILTRE]        : use filtre from libf/NOMFILTRE (default: filtrez)
123[-link LINKS]              : additional links with other libraries
124[-j n]                     : active parallel compiling on ntask
125[-full]                    : full recompiling
126[-libphy]                  : only compile physics package (no dynamics or main program)
127[-fcm_path path]           : path to the fcm tool (default: tools/fcm/bin)
128[-ext_src path]            : path to an additional set of routines to compile with the model
129[-arch_path path]          : path to architecture files (default: $arch_default_path)
130[-force_compile]           : recompile although there seems to be an on-going compilation
131 -arch nom_arch            : target architecture
132 exec                      : executable to build
133fin
134          exit;;
135
136      "-d")
137          dim=$2 ; shift ; shift ;;
138     
139      "-p")
140          physique="$2" ;  shift ; shift ;;
141
142      "-g")
143          grille="$2" ; shift ; shift ;;
144
145      "-c")
146          couple="$2" ; shift ; shift ;;
147
148      "-prod")
149          compil_mod="prod" ; shift ;;
150
151      "-dev")
152          compil_mod="dev" ; shift ;;
153
154      "-debug")
155          compil_mod="debug" ; shift ;;
156
157      "-io")
158          io="$2" ; shift ; shift ;;
159
160      "-v")
161          veget="$2" ; shift ; shift ;;
162
163      "-inlandsis")
164          inlandsis="$2" ; shift ; shift ;;
165
166      "-rrtm")
167          rrtm="$2" ; if [ "$2" = "false" ] ; then rad="old" ; else rad="rrtm" ; fi ; shift ; shift ;;
168
169      "-rad")
170          rad="$2" ; shift ; shift ;;
171
172      "-dust")
173          dust="$2" ; shift ; shift ;;
174
175      "-strataer")
176          strataer="$2" ; shift ; shift ;;
177
178      "-chimie")
179          chimie="$2" ; shift ; shift ;;
180
181      "-isotopes")
182          isotopes="$2" ; shift ; shift ;;
183
184      "-isoverif")
185          isoverif="$2" ; shift ; shift ;;
186
187      "-diagiso")
188          diagiso="$2" ; shift ; shift ;;
189
190      "-isotrac")
191          isotrac="$2" ; shift ; shift ;;
192
193      "-parallel")
194          parallel="$2" ; shift ; shift ;;
195     
196      "-include")
197          INCLUDE="$INCLUDE -I$2" ; shift ; shift ;;
198
199      "-cpp")
200          CPP_KEY="$CPP_KEY $2" ; shift ; shift ;;
201
202      "-adjnt")
203          echo "not operational ... work to be done here ";exit
204          opt_dep="$opt_dep adjnt" ; adjnt="-ladjnt -ldyn3d "
205          optim="$optim -Dadj" ; shift ;;
206
207      "-cosp")
208          cosp="$2" ; shift ; shift ;;
209
210      "-cosp2")
211          cosp2="$2" ; shift ; shift ;;
212
213      "-cospv2")
214          cospv2="$2" ; shift ; shift ;;
215     
216      "-mem")
217          echo "option -mem is obsolete (now always on in parallel)"
218          paramem="mem" ; shift ;;
219
220      "-filtre")
221          filtre=$2 ; shift ; shift ;;
222
223      "-link")
224          LIB="$LIB $2" ; shift ; shift ;;
225
226      "-fcm_path")
227          fcm_path=$2 ; shift ; shift ;;
228
229      "-ext_src")
230          EXT_SRC=$2 ; shift ; shift ;;
231
232      "-j")
233          job=$2 ; shift ; shift ;;
234
235      "-full")
236          full="-full" ; shift ;;
237
238      "-libphy")
239          libphy="true" ; shift ;;
240
241      "-arch")
242          arch=$2 ; arch_defined="TRUE" ; shift ; shift ;;
243
244      "-arch_path")
245          arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;;
246
247      "-force_compile")
248          force_compile=true ; shift ;;
249
250      *)
251          code="$1" ; shift ;;
252  esac
253done
254
255###############################################################
256# path to fcm
257###############################################################
258# handle case when provided path to fcm was given as a relative
259# path (from makelmdz_fcm script directory) and not an absolute path
260if [[ ${fcm_path:0:1} != "/" ]] ; then
261  # prepend with makelmdz_fcm location
262  fcm_path=$(cd $(dirname $0) ; pwd)"/"${fcm_path}
263fi
264
265# add fcm_path to PATH
266export PATH=${fcm_path}:${PATH}
267
268echo "Path to fcm:"
269echo ${fcm_path}
270
271###############################################################
272# lecture des chemins propres \`a l'architecture de la machine #
273###############################################################
274rm -f .void_file
275echo > .void_file
276rm -rf .void_dir
277mkdir .void_dir
278
279if [[ "$arch_defined" == "TRUE" ]]
280then
281  rm -f arch.path
282  rm -f arch.fcm
283  rm -f arch.env
284
285  if test -f $arch_path/arch-${arch}.path
286  then
287    ln -s $arch_path/arch-${arch}.path arch.path
288  elif test -f $arch_default_path/arch-${arch}.path
289  then
290    ln -s $arch_default_path/arch-${arch}.path arch.path
291  fi
292       
293  if test -f $arch_path/arch-${arch}.fcm
294  then
295    ln -s $arch_path/arch-${arch}.fcm arch.fcm
296  elif test -f $arch_default_path/arch-${arch}.fcm
297  then
298    ln -s $arch_default_path/arch-${arch}.fcm arch.fcm
299  fi
300
301  if test -f $arch_path/arch-${arch}.env
302  then
303    ln -s $arch_path/arch-${arch}.env arch.env
304  elif test -f $arch_default_path/arch-${arch}.env
305  then
306    ln -s $arch_default_path/arch-${arch}.env arch.env
307  else
308    ln -s .void_file arch.env
309  fi
310  # source architecture PATH and ENV files
311  source arch.env
312  source arch.path
313else
314  echo "You must define a target architecture"
315  exit 1
316fi
317
318########################################################################
319# Definition des clefs CPP, des chemins des includes et modules
320#  et des libraries
321########################################################################
322
323if [[ "$compil_mod" == "prod" ]]
324then
325  COMPIL_FFLAGS="%PROD_FFLAGS"
326elif [[ "$compil_mod" == "dev" ]]
327then
328  COMPIL_FFLAGS="%DEV_FFLAGS"
329elif [[ "$compil_mod" == "debug" ]]
330then
331  COMPIL_FFLAGS="%DEBUG_FFLAGS"
332fi
333
334phys_root=$physique
335if [[ "${physique:0:3}" == "lmd" ]] ; then phys_root=lmd ; fi
336if [[ "${physique:0:4}" == "mars" ]] ; then phys_root=mars ; fi
337if [[ "${physique:0:3}" == "std" ]] ; then phys_root=std ; fi
338if [[ "${physique:0:5}" == "venus" ]] ; then phys_root=venus ; fi
339if [[ "${physique:0:5}" == "titan" ]] ; then phys_root=titan ; fi
340if [[ "${physique:0:3}" == "dev" ]] ; then phys_root=dev ; fi
341
342if [[ "$physique" != "nophys" ]]
343then
344   #We'll use some physics
345   CPP_KEY="$CPP_KEY CPP_PHYS"
346   if [[ "${phys_root}" == "lmd" ]]
347   then
348   #For lmd physics, default planet type is Earth
349   CPP_KEY="$CPP_KEY CPP_EARTH"
350   fi
351   # set physics common utilities path
352   PHY_COMMON_PATH="${LIBFGCM}/phy_common"
353   # set the dyn/phys interface path
354   DYN_PHYS_PATH="${LIBFGCM}/dynphy_lonlat"
355   DYN_PHYS_SUB_PATH="${LIBFGCM}/dynphy_lonlat/phy${phys_root}"
356fi
357
358if [[ "$filtre" == "filtrez" ]]
359then
360   FILTRE_PATH=${LIBFGCM}/$filtre
361fi
362
363if [[ "$chimie" == "INCA" ]]
364then
365   CPP_KEY="$CPP_KEY INCA"
366   INCLUDE="$INCLUDE -I${INCA_INCDIR}"
367   LIB="$LIB -L${INCA_LIBDIR} -lchimie"
368fi
369
370if [[ "$isotopes" == "true" ]]
371then
372   CPP_KEY="$CPP_KEY ISO"
373fi
374
375if [[ "$isoverif" == "true" ]]
376then
377   CPP_KEY="$CPP_KEY ISOVERIF"
378fi
379
380if [[ "$diagiso" == "true" ]]
381then
382   CPP_KEY="$CPP_KEY DIAGISO"
383fi
384
385if [[ "$isotrac" == "true" ]]
386then
387   CPP_KEY="$CPP_KEY ISOTRAC"
388fi
389
390if [[ "$couple" != "false" ]]
391then
392    if [[ "$couple" == "MPI1" ]]
393    then
394        CPP_KEY="$CPP_KEY CPP_COUPLE"
395        export OASIS_INCDIR=$LMDGCM/../../prism/X64/build/lib/psmile.MPI1
396        export OASIS_LIBDIR=$LMDGCM/../../prism/X64/lib
397        INCLUDE="$INCLUDE -I${OASIS_INCDIR}"
398        LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.MPI1 -lmpp_io"
399    else
400        CPP_KEY="$CPP_KEY CPP_COUPLE CPP_OMCT"
401        INCLUDE="$INCLUDE -I${OASIS_INCDIR}"
402        LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.MPI1 -lscrip -lmct -lmpeu"
403    fi
404fi
405
406if [[ "$parallel" == "mpi" ]]
407then
408   CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI"
409   PARA_FFLAGS="%MPI_FFLAGS"
410   PARA_LD="%MPI_LD"
411elif [[ "$parallel" == "omp" ]]
412then
413   CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP"
414   PARA_FFLAGS="%OMP_FFLAGS"
415   PARA_LD="%OMP_LD"
416elif [[ "$parallel" == "mpi_omp" ]]
417then
418   CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI CPP_OMP"
419   PARA_FFLAGS="%MPI_FFLAGS %OMP_FFLAGS"
420   PARA_LD="%MPI_LD %OMP_LD"
421fi
422
423if [[ ( "$parallel" == "omp" || "$parallel" == "mpi_omp" ) \
424   && "$compil_mod" == "debug" ]]
425then
426    echo "Usually, parallelization with OpenMP requires some optimization."
427    echo "We suggest switching to \"-dev\"."
428fi
429
430if [ "$veget" = "true" -o "$veget" = "orchidee1.9" -o "$veget" = "orchidee2.0" -o "$veget" = "orchidee2.1" ]
431then
432#NB: option 'true': for backward compatibility. To be used with ORCHIDEE tag 1.9-1.9.6
433#    For this case, cpp flag ORCHIDEE_NOOPENMP must be added to the makelmdz_fcm arguments
434#    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
435   INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
436   CPP_KEY="$CPP_KEY CPP_VEGET"
437# temporary, for Orchidee versions 1.9.* (before openmp activation)
438   if [[ "$veget" == "orchidee1.9" ]] ; then
439      CPP_KEY="$CPP_KEY ORCHIDEE_NOOPENMP"
440   fi
441   if [[ "$veget" == "orchidee2.0" ]] ; then
442      orch_libs="sechiba parameters stomate parallel orglob orchidee"
443      CPP_KEY="$CPP_KEY ORCHIDEE_NOUNSTRUCT"
444   elif [[ "$veget" == "orchidee2.1" ]] ; then
445      orch_libs="sechiba parameters stomate parallel orglob orchidee"
446   else
447      orch_libs="sechiba parameters stomate parallel orglob"
448   fi
449   LIB="${LIB} -L${ORCH_LIBDIR}"
450   for lib in ${orch_libs} ; do
451      if [ -f ${ORCH_LIBDIR}/lib${LIBPREFIX}$lib.a ] ; then
452         LIB="${LIB} -l${LIBPREFIX}$lib "
453      fi
454   done
455elif [[ "$veget" != "false" ]] ; then
456   echo "Option -v $veget does not exist"
457   echo "Use ./makelmdz_fcm -h for more information"
458   exit 
459fi
460
461if [[ "$inlandsis" == "true" ]]
462then
463   CPP_KEY="$CPP_KEY CPP_INLANDSIS"
464   INLANDSIS_PATH="$LIBFGCM/%PHYS/inlandsis"
465fi
466
467
468if [[ "$rad" == "rrtm" ]]
469then
470   CPP_KEY="$CPP_KEY CPP_RRTM"
471   RAD_PATH="$LIBFGCM/%PHYS/rrtm"
472fi
473if [[ "$rad" == "ecrad" ]]
474then
475   CPP_KEY="$CPP_KEY CPP_ECRAD"
476   RAD_PATH="$LIBFGCM/%PHYS/ecrad"
477fi
478
479if [[ "$dust" == "true" ]]
480then
481   CPP_KEY="$CPP_KEY CPP_Dust"
482   DUST_PATH="$LIBFGCM/%PHYS/Dust"
483fi
484
485if [[ "$strataer" == "true" ]]
486then
487   CPP_KEY="$CPP_KEY CPP_StratAer"
488   STRATAER_PATH="$LIBFGCM/%PHYS/StratAer"
489fi
490
491if [[ $io == ioipsl ]]
492then
493   CPP_KEY="$CPP_KEY CPP_IOIPSL"
494   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR}"
495   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl"
496elif [[ $io == mix ]]
497then
498   # For now, xios implies also using ioipsl
499   CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS"
500   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR} -I${XIOS_INCDIR}"
501   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios -l${LIBPREFIX}stdc++"
502elif [[ $io == xios ]]
503then
504   # For now, xios implies also using ioipsl
505   CPP_KEY="$CPP_KEY CPP_IOIPSL CPP_XIOS CPP_IOIPSL_NO_OUTPUT"
506   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR} -I${XIOS_INCDIR}"
507   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl -L${XIOS_LIBDIR} -l${LIBPREFIX}stdc++ -l${LIBPREFIX}xios -l${LIBPREFIX}stdc++"
508fi
509
510if [[ "$cosp" == "true" ]]
511then
512   CPP_KEY="$CPP_KEY CPP_COSP"
513   COSP_PATH="$LIBFGCM/phylmd/cosp"
514#   LIB="${LIB} -l${LIBPREFIX}cosp"
515fi
516
517if [[ "$cosp2" == "true" ]]
518then
519   CPP_KEY="$CPP_KEY CPP_COSP2"
520   COSP_PATH="$LIBFGCM/phylmd/cosp2"
521#   LIB="${LIB} -l${LIBPREFIX}cosp2"
522fi
523
524if [[ "$cospv2" == "true" ]]
525then
526   CPP_KEY="$CPP_KEY CPP_COSPV2"
527   COSP_PATH="$LIBFGCM/phylmd/cospv2"
528#   LIB="${LIB} -l${LIBPREFIX}cosp2"
529fi
530
531
532
533INCLUDE="$INCLUDE ${NETCDF_INCDIR}"
534LIB="$LIB ${NETCDF_LIBDIR}"
535
536########################################################################
537# calcul du nombre de dimensions
538########################################################################
539
540
541dim_full=$dim
542dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
543set $dim
544dimc=$#
545echo calcul de la dimension
546echo dim $dim
547echo dimc $dimc
548
549
550########################################################################
551# Gestion des dimensions du modele.
552# on cree ou remplace le fichier des dimensions
553########################################################################
554
555cd $LIBFGCM/grid
556if [[ -f dimensions.h ]]
557then
558    if [[ $force_compile == true ]]
559    then
560        \rm -f $LIBFGCM/grid/dimensions.h
561    else
562        echo "WARNING: you are probably already compiling the model somewhere else."
563        echo "Wait until the first compilation is finished before launching this one."
564        echo "If you are sure that you are not compiling elsewhere, "
565        echo "run makelmdz_fcm with option -force_compile"
566        exit 1
567    fi
568fi
569
570
571cd $LIBFGCM/grid/dimension
572./makdim $dim
573cat $LIBFGCM/grid/dimensions.h
574cd $LMDGCM
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  CPP_KEY="$CPP_KEY CPP_1D"
597##in 1D, add dyn3d to include path (because main prog is in physics)
598  INCLUDE="$INCLUDE -Ilibf/dyn3d -Ilibf/dyn3d_common"
599## no filtre in 1d:
600  FILTRE_PATH=$LMDGCM/.void_dir
601## no need to compile all routines in dyn3d_common either:
602  DYN_COMMON_PATH=$LMDGCM/.void_dir
603## no need to compile all routines in dynlmdz_phy... ;
604## (because key ones are included in 1D main program)
605  DYN_PHYS_PATH=$LMDGCM/.void_dir
606  DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
607fi
608
609######################################################################
610#   Traitement special pour le nouveau rayonnement de Laurent Li.
611#   ---> YM desactive pour le traitemement en parallele
612######################################################################
613
614#if [[ -f $libf/phy$physique/raddim.h ]]
615#then
616# if [[ -f $libf/phy$physique/raddim.$dimh.h ]]
617#then
618#  \rm -f $libf/phy$physique/raddim.h
619#  cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h
620#  echo $libf/phy$physique/raddim.$dimh.h
621#  cat $libf/phy$physique/raddim.h
622# else
623#  echo On peut diminuer la taille de l executable en creant
624#  echo le fichier $libf/phy$physique/raddim.$dimh.h
625#  \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h
626# fi
627#fi
628
629######################################################################
630# Gestion du filtre qui n'existe qu'en 3d.
631######################################################################
632
633if (( `expr $dimc \> 2` == 1 ))
634then
635   filtre="FILTRE=$filtre"
636else
637   filtre="FILTRE= L_FILTRE= "
638fi
639echo MACRO FILTRE $filtre
640
641echo $dimc
642
643
644
645######################################################################
646# Creation du suffixe de la configuration
647######################################################################
648
649
650SUFF_NAME=_${dim_full}
651SUFF_NAME=${SUFF_NAME}_phy${physique}
652
653if [[ "$parallel" != "none" ]]
654then
655  SUFF_NAME=${SUFF_NAME}_para
656  DYN=dyn${dimc}d${paramem}
657  if [[ "$paramem" == "mem" ]]
658  then
659      SUFF_NAME=${SUFF_NAME}_${paramem}
660  else
661      echo "The version of the dynamics in dyn3dpar is no longer updated."
662      echo "You should use option \"-mem\"."
663      exit 1
664  fi
665else
666  SUFF_NAME=${SUFF_NAME}_seq
667  if (( $dimension == 1 ))
668  then
669    # dynamics-related routines in"dyn1d" subdirectory of phy${physique}
670    DYN=phy${physique}/dyn1d
671  else
672    DYN=dyn${dimc}d
673  fi
674fi
675
676if [[ $veget != "false" ]]
677then
678  SUFF_NAME=${SUFF_NAME}_orch
679fi
680
681if [[ $dust == "true" ]]
682then
683  SUFF_NAME=${SUFF_NAME}_spla
684fi
685
686if [[ $couple != "false" ]]
687then
688  SUFF_NAME=${SUFF_NAME}_couple
689fi
690
691if [[ $chimie == "INCA" ]]
692then
693  SUFF_NAME=${SUFF_NAME}_inca
694fi
695
696if [[ "$isotopes" == "true" ]]
697then
698  SUFF_NAME=${SUFF_NAME}_iso
699fi
700if [[ "$isoverif" == "true" ]]
701then
702  SUFF_NAME=${SUFF_NAME}_isoverif
703fi
704if [[ "$isotrac" == "true" ]]
705then
706  SUFF_NAME=${SUFF_NAME}_isotrac
707fi
708if [[ "$diagiso" == "true" ]]
709then
710  SUFF_NAME=${SUFF_NAME}_diagiso
711fi
712
713if [[ $libphy == "true" ]]
714then
715  # special case where we compile only the physics
716  DYN=$LMDGCM/.void_dir
717  DYN_COMMON_PATH=$LMDGCM/.void_dir
718  FILTRE_PATH=$LMDGCM/.void_dir
719  DYN_PHYS_PATH=$LMDGCM/.void_dir
720  DYN_PHYS_SUB_PATH=$LMDGCM/.void_dir
721  #and there is no main program to generate
722  code=""
723  SUFF_NAME=""
724else
725  SUFF_NAME=${SUFF_NAME}.e
726fi
727
728cd $LMDGCM
729config_fcm="config.fcm"
730rm -f $config_fcm
731touch $config_fcm
732rm -f bin/${code}${SUFF_NAME}.e
733rm -f arch.fcm
734rm -f arch.opt
735
736echo "%ARCH          $arch"          >> $config_fcm
737echo "%INCDIR        $INCLUDE"       >> $config_fcm 
738echo "%LIB           $LIB"           >> $config_fcm
739echo "%ROOT_PATH     $PWD"           >> $config_fcm
740echo "%LIBF          $LIBFGCM"       >> $config_fcm
741echo "%LIBO          $LIBOGCM"       >> $config_fcm
742echo "%DYN           $DYN"           >> $config_fcm
743echo "%DYN_COMMON    $DYN_COMMON_PATH" >> $config_fcm
744echo "%PHY_COMMON    $PHY_COMMON_PATH" >> $config_fcm
745echo "%FILTRE        $FILTRE_PATH"   >> $config_fcm
746echo "%PHYS          phy${physique}" >> $config_fcm
747echo "%DYN_PHYS      $DYN_PHYS_PATH" >> $config_fcm
748echo "%DYN_PHYS_SUB  $DYN_PHYS_SUB_PATH" >> $config_fcm
749echo "%RAD           $RAD_PATH"     >> $config_fcm
750echo "%DUST          $DUST_PATH"     >> $config_fcm
751echo "%STRATAER      $STRATAER_PATH" >> $config_fcm
752echo "%INLANDSIS     $INLANDSIS_PATH" >> $config_fcm
753echo "%COSP          $COSP_PATH"     >> $config_fcm
754echo "%CPP_KEY       $CPP_KEY"       >> $config_fcm
755echo "%EXEC          $code"          >> $config_fcm
756echo "%SUFF_NAME     $SUFF_NAME"     >> $config_fcm
757echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> $config_fcm
758echo "%PARA_FFLAGS   $PARA_FFLAGS"   >> $config_fcm
759echo "%PARA_LD       $PARA_LD"       >> $config_fcm
760echo "%EXT_SRC       $EXT_SRC"       >> $config_fcm
761
762
763
764ln -s arch/arch-${arch}.fcm arch.fcm
765if test -f arch/arch-${arch}.opt &&  [ $compil_mod = "prod" ]
766  then
767  ln -s arch/arch-${arch}.opt arch.opt
768else
769  ln -s .void_file arch.opt
770fi
771
772set +e
773
774rm -f $LIBOGCM/${arch}${SUFF_NAME}/.config/fcm.bld.lock
775./build_gcm ${fcm_path} -j $job $full
776build_status=$?
777
778err=$?
779# Check error message from fcm build
780if [ $err != 0 ] ; then
781  exit 1
782fi
783
784rm -rf tmp_src
785rm -rf config
786ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config config
787ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config/ppsrc tmp_src
788
789
790if [[ -r $LIBFGCM/grid/dimensions.h ]]
791then
792  # Cleanup: remove dimension.h file
793  \rm -f $LIBFGCM/grid/dimensions.h
794fi
795
796exit $build_status
Note: See TracBrowser for help on using the repository browser.