source: LMDZ4/branches/IPSL-CM4_IPCC_patches/makegcm

Last change on this file was 742, checked in by Laurent Fairhead, 17 years ago

On rajoute les options qu'il faut pour compiler IPCC_patch sur brodie
LF

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 30.0 KB
Line 
1#!/bin/csh
2#
3# $Header$
4#
5#set verbose echo
6########################################################################
7# options par defaut pour la commande make
8########################################################################
9set dim="96x71x19"
10set physique=lmd
11set phys="PHYS=$physique"
12set include='-I$(LIBF)/grid -I$(LIBF)/bibio -I. '
13set ntrac = 4
14set filtre=filtrez
15set grille=reg
16set couple=false
17set veget=true
18set psmile=false
19set OPT_STACK='-Wf,-init stack=nan'
20set OPT_STACK=' '
21set OPTIMI='-C debug -eC '
22set OPTIMI=' -ftrace '
23set io=ioipsl
24
25########################################################################
26# path a changer contenant les sources et les objets du modele
27########################################################################
28
29###### VERSION LMDZ.4
30# set LMDGCM=$HOME/LMDZ.4
31#
32
33setenv localdir "`pwd`"
34set MODIPSL=0
35echo $localdir | grep modipsl >& /dev/null
36if ( ! $status ) then
37  set MODIPSL=1
38  setenv LMDGCM $localdir
39  cd ../..
40  setenv LIBOGCM "`pwd`/lib"
41  setenv IOIPSLDIR $LIBOGCM
42  setenv MODIPSLDIR $LIBOGCM
43  cd $localdir
44  if ( `hostname` == rhodes ) then
45    set NCDFINC=`grep sxnec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
46    set NCDFLIB=`grep sxnec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
47  else
48    if ( `hostname` == nymphea0 ) then
49      set NCDFINC=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
50      set NCDFLIB=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
51    else if ( `hostname` == mercure ) then
52      set NCDFINC=`grep sx6nec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
53      set NCDFLIB=`grep sx6nec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
54    else  if ( `hostname` == brodie ) then
55      set NCDFINC=`grep sx8brodie ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
56      set NCDFLIB=`grep sx8brodie ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
57    else
58      echo 'Probleme de definition des variables NCDFINC et NCDFLIB'
59    endif
60  endif
61else
62  if ( ! $?LMDGCM ) then
63    echo You must initialize the variable LMDGCM in your environnement
64    echo for instance: "setenv LMDGCM /usr/myself/supergcm" in .cshrc
65    exit
66  endif
67  if ( ! $?LIBOGCM ) then
68    set LIBOGCM=$LMDGCM/libo
69  endif
70  if ( ! $?IOIPSLDIR ) then
71    echo You must initialize the variable IOIPSLDIR in your environnement
72    echo for instance: "setenv IOIPSLDIR /usr/myself/ioipsl" in .cshrc
73    exit
74  else
75      setenv MODIPSLDIR $IOIPSLDIR
76  endif
77  if ( ! $?NCDFLIB ) then
78    echo You must initialize the variable NCDFLIB in your environnement
79    echo for instance: "setenv NCDFLIB /usr/myself/netcdf" in .cshrc
80    exit
81  endif
82  if ( ! $?NCDFINC ) then
83    echo You must initialize the variable NCDFINC in your environnement
84    echo for instance: "setenv NCDFINC /usr/myself/netcdf" in .cshrc
85    exit
86  endif
87endif
88set model=$LMDGCM
89set libo=$LIBOGCM
90
91########################################################################
92#  Les differentes platformes reconnues
93########################################################################
94
95set HP=0
96set IBM=0
97set SUN=0
98set VPP=0
99set CRAY=0
100set DEC=0
101set LINUX=0
102set NEC=0
103set XNEC=0
104set X6NEC=0
105set X8BRODIE=0
106if ( `uname` == HP-UX ) then
107   set machine=HP
108   set HP=1
109else if (`uname` == UNIX_System_V ) then
110   set machine=VPP
111   set VPP=1
112else if (`uname` == SunOS ) then
113   set machine=SUN
114   set SUN=1
115else if ( `uname` == AIX ) then
116   set machine=IBM
117   set IBM=1
118else if ( `uname` == OSF1 ) then
119   set machine=ALPHA
120   set DEC=1
121else if ( `uname` == Linux && `hostname` != mercure  && `hostname` != brodie ) then
122   set machine=LINUX
123   set LINUX=1
124else if ( `hostname` == atlas || `hostname` == axis  || `hostname` == etoile ) then
125   set machine=CRAY
126   set CRAY=1
127else if ( `uname` == SUPER-UX ) then
128   set machine=NEC
129   set NEC=1
130else if ( `hostname` == rhodes) then
131   set machine=XNEC
132   set XNEC=1
133else if ( `hostname` == mercure) then
134   set machine=X6NEC
135   set X6NEC=1
136else if ( `hostname` == brodie) then
137   set machine=X8BRODIE
138   set X8BRODIE=1
139else
140   echo Vous travaillez sur une machine non prevue par le reglement
141   exit
142endif
143
144if ( ! -d $libo )  then
145   mkdir $libo
146endif
147
148
149if $VPP then
150set netcdf=netcdf_v
151else
152set netcdf=netcdf
153endif
154########################################################################
155#  Quelques initialisations de variables du shell.
156########################################################################
157
158set dyn=
159set opt_link=""
160set adjnt=""
161set opt_dep=""
162
163set optim=""
164set optimbis=""
165set optim90=""
166set oplink=""
167
168########################################################################
169#  Optimisations par defaut suivant les machines
170########################################################################
171
172echo "Optimisations par defaut suivant les machines"
173set libf=$model/libf
174#setenv localdir "LOCAL_DIR=`pwd`"
175#setenv localdir "`pwd`"
176cd $model
177#############
178if $CRAY then
179#############
180#   set optim="-Wf'-ei' -dp -Wf'-a static'"
181   set optimbis=" -DCRAY "
182   set optim90="-Wp'-P' -DCRAY -p$IOIPSLDIR "'-p$(LIBO) -eiv '
183   set optim="$optim90"
184   set oplink="-Wl'-DSTACK=128 -f indef' -L$IOIPSLDIR -lioipsl  -L$NCDFLIB -lnetcdf "
185   set mod_loc_dir=" "
186   set mod_suffix=" "
187#################
188else if $SUN then
189#################
190   set optim=" -fast "
191   set optimbis=" "
192   set optim90=" -fast -fixed "
193   set optimtru90=" -fast -free "
194   set opt_link="-lf77compat -L$MODIPSLDIR -lsechiba -lparameters -lstomate -lioipsl -L$NCDFLIB -lnetcdf "
195   set mod_loc_dir=$localdir
196   set mod_suffix=mod
197#################
198else if $HP then
199#################
200   set optim=" +U77 -O +E1 "
201   set optimbis=" "
202#################
203else if $IBM then
204#################
205   set optim=" -O3 -qtune=pwr2 -qarch=pwr2"
206   set optimbis=" "
207#################
208else if $VPP then
209#################
210#   set optim="-Dasuxm  -On, -g -Ad -Potilax -Eciplume -Si"
211#   set optimbis="  -Wv,-m3 -Wp,-DVPP -Z $LMDGCM/listage"
212   set optimbis=" -Wp,-DNC_DOUBLE -Ad -Z $LMDGCM/listage -X9"
213   set optim90="$optim $optimbis -X9 -w"
214   set mod_loc_dir=$MODIPSLDIR
215   set mod_suffix=mod
216#################
217else if $DEC then
218#################
219   set optim=" "
220   set optimbis=" "
221#################
222else if $LINUX then
223#################
224   set optim="-fast "
225   set optim90=" -fast "
226   set optimtru90=" -fast -c -Mfree -module $MODIPSLDIR "
227   set opt_link=" -Mfree -L /usr/local/pgi/linux86/lib -lpgf90 -lpgftnrtl -lpghpf -lpghpf2 -L$MODIPSLDIR -lsechiba -lparameters -lstomate -L$NCDFLIB -lnetcdf -lioipsl -Wl,-Bstatic -L/usr/lib/gcc-lib/i386-linux/2.95.2/"
228   set mod_loc_dir=$MODIPSLDIR
229   set mod_suffix=mod
230#################
231else if $NEC then
232#################
233   set optim90=' -clear -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "'
234   set optimtru90=' -clear -f4 -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "'
235   set optim="$optim90"
236   set optimbis=" "
237   set opt_link=" -C hopt -float0 -ew -P static -L$MODIPSLDIR -lioipsl  $NCDFLIB -lnetcdf_i8r8_v "
238   set mod_loc_dir="."
239   set mod_suffix="mod"
240#################
241else if $XNEC then
242#################
243   set optdbl='-dw -Wf\"-A dbl4\"'
244   set optim90=' -clear -float0 -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
245   set optimtru90=' -clear -f4 -float0 -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R2 -R3 -R4 -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume"'
246   set optim="$optim90"
247   set optimbis=" "
248   set mod_suffix="mod"
249   set mod_loc_dir="./"
250else if $X6NEC then
251   set optdbl='-dw -Wf\"-A dbl4\"' 
252   set optim90=' -clear -float0 -size_t64 -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
253   set optimtru90=' -clear -f4 -float0 -size_t64 -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R2 -R3 -R4 -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume"'
254   set optim="$optim90"
255   set optimbis=" "
256   set mod_suffix="mod"
257   set mod_loc_dir="./"
258#################
259else if $X8BRODIE then
260##################
261   set optdbl='-dw -Wf\"-A dbl4\"' 
262   set optim90='-P stack -Wf,-pvctl res=whole,-A dbl4,-ptr byte -EP -R5 -float0 -dw -Wf,"-pvctl loopcnt=999999 fullmsg noassume" -I/SX/usr/include'
263   set optimtru90="$optim90"
264   set optim90="$optim90"
265   set optim="$optim90"
266   set optimbis=" "
267   set mod_suffix="mod"
268   set mod_loc_dir="./"
269else
270   set optim=""
271   set optimbis=" "
272endif
273
274set nomlib=$machine
275
276########################################################################
277# lecture des options de mymake
278########################################################################
279
280top:
281if ($#argv > 0) then
282    switch ($1:q)
283
284    case -h:
285
286########################################################################
287# Manuel en ligne
288########################################################################
289more <<eod
290
291
292makegcm [Options] prog
293
294
295
296
297Par default, la commande makegcm:
298---------------------------------
299
3001. compile une serie de sous programmes se trouvant dans des sous-repertoires
301de $LMDGCM/libf.
302Les sous programmes sont ensuite stokes sur dans des librairies FORTRAN
303sur $LIBOGCM.
304
3052. Ensuite, makegcm compile le programme prog.f se trouvant par default sur
306$LMDGCM/libf/dyn3d et effectue le lien avec l ensemble des librairies.
307
308La variable '$LMDGCM' doit etre initialisee dans votre .cshrc ou en dur
309dans la comande makegcm.
310
311La commande makegcm est faite pour permettre de gerer en parallele des
312versions differentes du modele, compilees avec des options de compilation
313et des dimensions differentes sans avoir a chaque fois a recompiler tout
314le modele.
315
316Les librairies FORTRAN sont stoquees sur le directory $LIBOGCM.
317
318
319OPTIONS:
320--------
321
322Les options suivantes peuvent etre definies soit par defaut en editant le
323"script" makegcm, soit en interactif:
324
325-d imxjmxlm  ou im, jm, et lm sont resp. le nombre de longitudes, latitudes
326             et couches verticales.
327
328-t ntrac   selectionne le nombre de traceur advectes par la dynamique.
329           Dans les versions courantes du modele terrestre on a par exemple
330           ntrac=2 pour l'eau vapeur et liquide
331
332             L'effet des options -d et -t est d'ecraser le fichier
333             $LMDGCM/libf/grid/dimensions.h
334             qui contient sous forme de 4 PARAMETER FORTRAN les 3 dimensions
335             de la grille horizontale im, jm, lm plus le nombre de traceurs
336             advectes passivement par la dynamique ntrac, par un nouveu fichier
337             $LMDGCM/libf/grid/dimension/dimensions.im.jm.lm.tntrac
338             Si ce fichier n'existe pas encore, il est cree par le script
339             $LMDGCM/libf/grid/dimension/makdim
340
341-p PHYS    pour selectionner le jeu de parametrisations physiques avec
342           lequel on veut compiler le modele.
343           Le modele sera alors compile en prenant les sources des
344           parametrisations physiques dans le repertoire:
345            $LMDGCM/libf/phyPHYS
346
347-c false|true
348           pour selectionner le mode force (par defaut) ou couple
349
350-io ioipsl|noioipsl
351           pour selectionner le logiciel IO : IOIPSL par defaut
352
353-psmile false|true
354           pour selectionner le mode psmile ou non (par defaut)
355
356-v true|false
357           pour selectionner la vegetation (par defaut) ou non
358
359-g grille  selectionne le type de grille qu'on veut utiliser.
360           L'effet de cette option est d'ecraser le fichier
361           $LMDGCM/libf/grid/fxyprim.h
362           avec le fichier
363           $LMDGCM/libf/grid/fxy_grille.h
364           grille peut prendre les valeurs:
365           1. reg pour la grille reguliere
366           2. sin pour avoir des points equidistants en sinus de la latitude
367           3. new pour pouvoir zoomer sur une partie du globe
368
369-O "optimisation fortran" ou les optimisations fortran sont les options de la
370            commande f77
371
372-include path
373           Dans le cas ou on a dans des sous programmes des fichiers
374           #include (cpp) qui se trouve sur des repertoires non references
375           par defaut
376
377-adjnt     Pour compiler la l'adjoint du code dynamique
378
379-filtre  filtre
380           Pour choisir le filtre en longitude dans les regions polaires.
381           "filtre" correspond au nom d'un repertoire se trouvant sur
382           $LMDGCM/libf. Le filtre standard du modele est "filtrez" qui peut
383           etre utilise aussi bien pour une grille reguliere que pour une
384           grille zoomee en longitude.
385
386-link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..."
387          Pour rajouter un lien avec les librairies FORTRAN
388          libfile1.a, libfile2.a ... se trouvant respectivement sur les
389          repertoires dir1, dir2 ...
390          Si dirn est un repertoire dont le chemin est automatique (comme
391          par exemple /usr/lib ...) il n'est pas besoin de specifier -Ldirn.
392
393Auteur: Frederic Hourdin  (hourdin@lmd.jussieu.fr)
394eod
395exit
396
397########################################################################
398# Lecture des differentes options
399########################################################################
400
401    case -d:
402        set dim=$2 ; shift ; shift ; goto top
403                       
404    case -O:
405        set optim="$2" ; shift ; shift ; goto top
406
407     case -p
408        set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top
409
410     case -g
411        set grille="$2" ; shift ; shift ; goto top
412
413     case -c
414        set couple="$2" ; shift ; shift ; goto top
415
416     case -io
417        set io="$2" ; shift ; shift ; goto top
418
419     case -v
420        set veget="$2" ; shift ; shift ; goto top
421
422     case -psmile
423        set psmile="$2" ; shift ; shift ; goto top
424 
425     case -t
426        set ntrac=$2 ; shift ; shift ; goto top
427
428     case -include
429        set include="$include -I$2" ; shift ; shift ; goto top
430
431     case -adjnt
432        set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d "
433        set optim="$optim -Dadj" ; shift ; goto top
434
435     case -filtre
436        set filtre=$2 ; shift ; shift ; goto top
437
438     case -link
439        set opt_link="$opt_link $2" ; shift ; shift ; goto top
440
441     case -debug
442        if $HP then
443           set optim=" -g "
444        else if $SUN then
445           setenv PARALLEL 2
446# Il faut rajouter l'option -dalign a -g pour pouvoir editer les liens
447# avec des programmes compiles avec -fast
448           set optim=" -g -dalign "
449           set optim90=" -fixed -g "
450           set optimtru90=" -free -g -C -dalign "
451        else if $CRAY then
452           set optim="$optim"" -g "
453           set optim90="$optim90"" -G1 "
454        else if $LINUX then
455           set optim="$optim"" -g -Mbounds -C "
456           set optim90="$optim90"" -g -Mbounds -C "
457        else
458           echo pas d option debug predefinie pour cette machine
459           exit
460        endif
461        shift ; goto top
462
463     default
464        set code="$1" ; shift ; goto top
465
466   endsw
467endif
468
469########################################################################
470# Definition des clefs CPP
471########################################################################
472
473set cppflags=''
474
475if $X8BRODIE then
476  set cppflags="$cppflags -DNC_DOUBLE -DBLAS -DSGEMV=DGEMV -DSGEMM=DGEMM"
477endif
478
479if ( $io == ioipsl ) then
480   set optim="$optim -DCPP_IOIPSL"
481   set optim90="$optim"
482   set optimtru90="$optimtru90 -DCPP_IOIPSL"
483endif
484
485if ( "$physique" == 'nophys' ) then
486   set phys="L_PHY= LIBPHY="
487else
488   set optim="$optim -DCPP_PHYS"
489   set optim90="$optim"
490   set optimtru90="$optimtru90 -DCPP_PHYS"
491endif
492
493set link_veget=" "
494if ( "$veget" == 'true' ) then
495   set optim="$optim -DCPP_VEGET"
496   set optim90="$optim"
497   set optimtru90="$optimtru90 -DCPP_VEGET"
498   set link_veget=" -lsechiba -lparameters -lstomate"
499   if ( $XNEC ) then
500      set link_veget=" -lsxsechiba -lsxparameters -lsxstomate"
501   endif
502endif
503
504
505########################################################################
506# cas special sans physique
507########################################################################
508if ( "$physique" == 'nophys' ) then
509   set phys="L_PHY= LIBPHY="
510endif
511
512########################################################################
513# choix du nombre de traceur par defaut si il n'a pas ete choisi,
514# suivant la physique
515########################################################################
516
517if ( $ntrac == 0  ) then
518    if ( "$physique" == 'nophys' ) then
519        set ntrac=1
520    else if ( "$physique" == 'lmd' ) then
521        set ntrac=2
522    else if ( "$physique" == 'lmd_test_li' ) then
523        set ntrac=2
524    else if ( "$physique" == 'ec' ) then
525        set ntrac=1
526    else
527        set ntrac = 1
528    endif
529endif
530
531########################################################################
532#subtilites sur le nom de la librairie
533########################################################################
534
535\rm -f tmp ; touch tmp
536\rm -f tmp90 ; touch tmp90
537foreach i ( $optim )
538   echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g'  >> tmp
539end
540set suf=
541foreach i ( `sort tmp | uniq ` )
542   set suf=$suf$i
543end
544if ( ! $IBM ) then
545   set nomlib="$nomlib$suf"
546endif
547if ( $DEC ) then
548   set nomlib=DEC
549endif
550if ( $IBM ) then
551   set dim=`echo $dim | sed -en 's/[^0-9]/ /g'`
552   set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'`
553else if ( $SUN ) then
554   set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
555   set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
556else
557   set dim=`echo $dim | sed -n -e 's/[^0-9]/ /gp'`
558   set dim_=`echo $dim | sed -n -e 's/[^0-9]/_/gp'`
559endif
560set nomlib=${nomlib}${physique}_${dim_}_t${ntrac}_$grille
561## M-A-F nomlib trop long sur CRAY pour ar
562if ( $CRAY ) then
563    set nomlib=F90_${dim_}_t${ntrac}
564endif
565if ( $NEC || $XNEC || $X6NEC || $X8BRODIE ) then
566    set nomlib=F90_${dim_}_t${ntrac}
567endif
568echo calcul de la dimension
569set dimc=`echo $dim | wc -w`
570
571if ( "$dimc" == "2" ) then
572set include="$include "'-I$(LIBF)/dyn2d '
573set dimh=$dim
574else
575set include="$include "'-I$(LIBF)/dyn3d '
576set dimh=`echo $dim | awk ' { print $1 "." $2 } '`
577endif
578echo $dimc
579
580########################################################################
581# path pour les #include
582########################################################################
583
584if ( $XNEC ) then
585  set include="$include -I$NCDFINC -I$IOIPSLDIR"
586else
587  set include="$include -I$NCDFINC -I$IOIPSLDIR"
588endif
589echo $include
590
591########################################################################
592# Gestion des dimensions du modele.
593# on cree ou remplace le fichier des dimensions/nombre de traceur
594########################################################################
595
596cd $libf/grid
597if ( -f dimensions.h ) then
598echo 'ATTENTION: vous etes sans doute en train de compiler le modele par ailleurs'
599echo "Attendez que la premiere compilation soit terminee pour relancer la suivante."
600echo "Si vous etes sur que vous ne compilez pas le modele par ailleurs,"
601echo  vous pouvez continuer en repondant oui.
602echo "Voulez-vous vraiment continuer?"
603if ( $< == "oui" ) then
604\rm -f $libf/grid/dimensions.h
605else
606exit
607endif
608endif
609
610cd dimension
611./makdim $ntrac $dim
612cat $libf/grid/dimensions.h
613
614cd $LMDGCM
615set libo=$libo/$nomlib
616if ( ! -d $libo )  then
617   mkdir $libo
618   cd $model
619endif
620
621########################################################################
622# Differentes dynamiques (3d, 2d, 1d)
623########################################################################
624
625set dimension=`echo $dim | wc -w`
626echo dimension $dimension
627if ( $dimension == 1 ) then
628echo pas de dynamique
629set dyn="L_DYN= DYN= L_FILTRE= DIRMAIN=phy$physique "
630endif
631endif
632cd $model
633if ( $dimension == 3 ) then
634cd libf/grid
635\rm fxyprim.h
636cp -p fxy_${grille}.h fxyprim.h
637endif
638
639######################################################################
640#   Traitement special pour le nouveau rayonnement de Laurent Li.
641######################################################################
642
643if ( -f $libf/phy$physique/raddim.h ) then
644 if ( -f $libf/phy$physique/raddim.$dimh.h ) then
645  \rm -f $libf/phy$physique/raddim.h
646  cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h
647  echo $libf/phy$physique/raddim.$dimh.h
648  cat $libf/phy$physique/raddim.$dimh.h
649  cat $libf/phy$physique/raddim.h
650 else
651  echo On peut diminuer la taille de l executable en creant
652  echo le fichier $libf/phy$physique/raddim.$dimh.h
653  \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h
654 endif
655endif
656
657######################################################################
658# Gestion du filtre qui n'existe qu'en 3d.
659######################################################################
660
661if ( `expr $dimc \> 2` == 1 ) then
662   set filtre="FILTRE=$filtre"
663else
664   set filtre="FILTRE= L_FILTRE= "
665endif
666echo MACRO FILTRE $filtre
667
668echo $dimc
669
670########################################################################
671#  utilisation des vraies routines de couplage si on est en couple
672########################################################################
673if ( $couple == 'true' ) then
674  banner couple
675  pwd
676  if ( `diff $libf/phy$physique/oasis.F $libf/phy$physique/oasis.true | wc -w` ) then
677   \cp $libf/phy$physique/oasis.F $libf/phy$physique/oasis.dummy
678   \cp $libf/phy$physique/oasis.true $libf/phy$physique/oasis.F
679  endif
680else
681  if ( `diff $libf/phy$physique/oasis.F $libf/phy$physique/oasis.dummy | wc -w` ) then
682   \cp $libf/phy$physique/oasis.F $libf/phy$physique/oasis.true
683   \cp $libf/phy$physique/oasis.dummy $libf/phy$physique/oasis.F
684  endif
685endif
686########################################################################
687#  Avant de lancer le make, on recree le makefile si necessaire
688########################################################################
689# c'est a dire dans 3 cas:
690# 1. si la liste des fichiers .F et .h a ete modifiee depuis la
691#    derniere creation du makefile
692# 2. si le fichier contenant cette liste "liste_des_sources"
693#    n'existe pas.
694# 3. Si le makefile n'existe pas.
695########################################################################
696
697cd $model
698find libf -name '*.[Fh]' -print >! tmp77
699find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90
700find libf -name '*.[Fh]90' -print >> tmp90
701
702if (    `diff tmp77 liste_des_sources_f77 | wc -w` \
703     || `diff tmp90 liste_des_sources_f90 | wc -w` \
704     || ! -f makefile \
705     || ! -f liste_des_sources_f90 \
706     || ! -f liste_des_sources_f77 ) then
707        echo les fichiers suivants ont ete crees ou detruits
708        echo ou les fichiers suivants sont passes ou ne sont plus en Fortran 90
709        diff liste_des_sources_f77 tmp77
710        diff liste_des_sources_f90 tmp90
711        \cp tmp77 liste_des_sources_f77
712        \cp tmp90 liste_des_sources_f90
713        echo On recree le makefile
714        ./create_make_gcm >! tmp
715        \mv tmp makefile
716        echo Nouveau makefile cree.
717endif
718
719########################################################################
720#  Execution de la comande make
721########################################################################
722
723echo PHYSIQUE $phys
724echo dynamique $dyn $dimension
725echo OPTIM="$optim" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code
726echo PATH pour les fichiers INCLUDE $include
727echo OPLINK="$oplink"
728
729#################
730if $HP then
731#################
732   set f77='fort77 +OP'
733   set f90='jensaisrien'
734   set opt_link="$opt_link -lm"
735#################
736else  if $VPP then
737#################
738   set f77=frt
739   set f90=$f77
740   if ($couple == true) then
741     set opt_link="-Wg,-c $MODIPSLDIR/liboasis2.4_mpi2.a /usr/lang/mpi2/lib64/libmpi.a /usr/lang/mpi2/lib64/libmp.a -L$MODIPSLDIR -lioipsl /usr/local/lib/lib64/libnetcdf_cc_31.a"
742     set oplink="-Wl,-t,-P,-dy "
743   else
744     set opt_link="-Wg,-c -L$MODIPSLDIR -lioipsl /usr/local/lib/lib64/libnetcdf_cc_31.a"
745     set oplink="-Wl,-t,-dy "
746   endif
747   if ($veget == true) then
748     set opt_link="$opt_link $link_veget -lioipsl /usr/local/lib/lib64/libnetcdf_cc_31.a"
749   endif
750#################
751else if $CRAY then
752#################
753   set f77=f90
754   set f90=f90
755#################
756else if $LINUX then
757#################
758   set f77=pgf90
759   set f90=pgf90
760   set opt_link=" -Mfree -L /usr/local/pgi/linux86/lib -lpgf90 -lpgftnrtl -lpghpf -lpghpf2 -L$MODIPSLDIR $link_veget -L$NCDFLIB -lnetcdf -lioipsl -Wl,-Bstatic -L/usr/lib/gcc-lib/i386-linux/2.95.2/"
761#################
762else if $SUN then
763#################
764   set f77=f90
765   set f90=f90
766   set opt_link="-lf77compat -L$MODIPSLDIR $link_veget -lioipsl -L$NCDFLIB -lnetcdf "
767#################
768else if $NEC then
769#################
770   set f77=f90 -ftrace
771   set f90=f90 -ftrace
772   set opt_link="-L$MODIPSLDIR"
773   if ($veget == true) then
774     set opt_link="$opt_link $link_veget"
775   endif
776   if ($couple == true) then
777     set opt_link="$opt_link -lioipsl -loasis2.4_mpi2 -float0 -ew -P static $NCDFLIB "
778   else
779     set opt_link="$opt_link -L$MODIPSLDIR -lioipsl -float0 -ew -P static $NCDFLIB "
780   endif
781   set mod_loc_dir="./"
782#################
783else if $XNEC then
784#################
785   set f77="sxmpif90 -ftrace"
786   set f90="sxmpif90 -ftrace"
787   if $MODIPSL then
788     set opt_link="-L$MODIPSLDIR"
789     if ($veget == true) then
790       set opt_link="$opt_link $link_veget"
791     endif
792     if ($couple == true) then
793       set opt_link="$opt_link -lsxioipsl -loasis2.4_mpi2 -float0 $optdbl -P static $NCDFLIB "
794       if ($psmile == true) then
795       endif
796     else
797       set opt_link="$opt_link -lsxioipsl -float0 $optdbl -P static $NCDFLIB "
798     endif
799   else
800     if ($couple == true) then
801       set opt_link="-L$MODIPSLDIR"
802       set opt_link="$opt_link $link_veget -lsxioipsl -loasis2.4_mpi2 -float0 $optdbl -P static $NCDFLIB "
803     else
804       set opt_link=" -C hopt -float0 $optdbl -P static -L$MODIPSLDIR $link_veget -lsxioipsl $NCDFLIB "
805     endif
806   endif
807   set mod_loc_dir="./"
808##################
809else if $X6NEC then
810##################
811   set f77=sxmpif90
812   set f90=sxmpif90
813   if $MODIPSL then
814     set opt_link="-L$MODIPSLDIR"
815     if ($veget == true) then
816       set opt_link="$opt_link -lsxsechiba -lsxparameters -lsxstomate"
817     endif
818     if ($couple == true) then
819       set opt_link="$opt_link -lsxioipsl -loasis2.4_mpi2 -float0 -size_t64 $optdbl -P static $NCDFLIB "
820     else
821       set opt_link="$opt_link -lsxioipsl -float0 -size_t64 $optdbl -P static $NCDFLIB "
822     endif
823   else
824     set opt_link=" -float0 -size_t64 $optdbl -P static -L$MODIPSLDIR -lsxsechiba -lsxparameters -lsxstomate -lsxioipsl $NCDFLIB "
825   endif
826   set mod_loc_dir="./"
827##################
828else if $X8BRODIE then
829##################
830   set f77=sxmpif90
831   set f90=sxmpif90
832   if $MODIPSL then
833     set opt_link="$opt_link -float0 -Wf,-A dbl4 -L$MODIPSLDIR -lblas"
834     if ($veget == true) then
835       set opt_link="$opt_link $link_veget"
836     endif
837     if ($couple == true) then
838        if ($psmile == true) then
839        set opt_link="$opt_link -lsxioipsl -float0 $optdbl -P static $NCDFLIB "
840        else
841        set opt_link="$opt_link -lsxioipsl -loasis2.4_mpi2 -float0 $optdbl -P static $NCDFLIB "
842        endif
843     else
844       set opt_link="$opt_link -lsxioipsl -float0 $optdbl -P static $NCDFLIB "
845     endif
846   else
847#     set opt_link=" -float0 $optdbl -P static -L$MODIPSLDIR -lsxsechiba -lsxparameters -lsxstomate -lsxioipsl $NCDFLIB "
848     set opt_link=" -float0 $optdbl -P static -L$MODIPSLDIR -lsxioipsl $NCDFLIB "
849
850   endif
851   set mod_loc_dir="./"
852#################
853else
854#################
855   set f77=f77
856   set f90=f90
857endif
858
859cd $model
860
861if $VPP then
862set make="gmake RANLIB=ls"
863else if $CRAY then
864set make="make RANLIB=ls"
865else if $NEC then
866set make="make RANLIB=ls"
867else if $LINUX then
868set make="make -k RANLIB=ranlib"
869else if $XNEC then
870set make="gmake RANLIB=ls"
871else if $X6NEC then
872set make="gmake RANLIB=ls"
873else if $X8BRODIE then
874set make="gmake RANLIB=ls"
875else
876set make="make RANLIB=ranlib"
877endif
878
879
880
881#
882# les deux test suivants sont "temporaires" pour pallier des "faiblesses" du
883# compilateur fortran Sun: f90: SC4.0 11 Sep 1995 FORTRAN 90 1.1
884#
885#if ($code == 'create_limit' && $SUN) then
886#   set link=f77
887#   set opt_link="-L$NCDFLIB -lnetcdf"
888#endif
889
890#if ($code == 'create_etat0' && $SUN) then
891#   if ( ! -f $libo/libdyn3d.a ) then
892#     echo "Priere de compiler gcm en premier pour des raisons d'optimisation"
893#     \rm $libf/grid/dimensions.h
894#     exit
895#   endif
896#   set optim=" -dalign "
897#   set optim90=" -dalign -fixed "
898#   set opt_link="-L$IOIPSLDIR -lioipsl  -L$NCDFLIB -lnetcdf"
899#   set link="$f90 $optim90"
900#   touch $LMDGCM/libf/dyn3d/startvar.F
901#   touch $LMDGCM/libf/dyn3d/etat0_netcdf.F
902#endif
903
904#
905# etat0_netcdf a besoin d'info de la physique
906# A revoir
907set include="$include"' -I$(LIBF)/phy'"$physique"
908#
909# le programme principal create_limit a besoin de l'info du module
910# startvar: on met donc libo dans les include pour Nec
911set include="$include"' -I$(LIBO)'
912
913
914#################################################################
915# Execution de la comande make... ENFIN!
916#################################################################
917
918if $VPP then
919  set optim90=" $optim90 -Am -M$libo"
920  set optimtru90="$optim90"
921 \cp $IOIPSLDIR/*.mod $libo
922else if $SUN then
923 set optim90=" $optim90 -M$libo -M$MODIPSLDIR "
924 set optimtru90=" $optimtru90 -M$libo -M$MODIPSLDIR "
925 set optim="$optim90"
926 \cp $IOIPSLDIR/*.mod $libo
927else if $NEC then
928 set optim90=" $optim90 -I$libo "
929else if $XNEC then
930 set optim90=" $optim90 -I$libo "
931 set optimtru90=" $optimtru90 -I$libo "
932else if $X6NEC then
933 set optim90=" $optim90 -I$libo "
934 set optimtru90=" $optimtru90 -I$libo "
935else if $X8BRODIE then
936 set optim90=" $optim90 -I$libo "
937 set optimtru90=" $optimtru90 -I$libo "
938else if $LINUX then
939 set optim90=" $optim90 -module $libo "
940 set optim="$optim90"
941 set mod_loc_dir=$libo
942 \cp /d3/fairhead/sechiba/ioipsl/*.mod $libo
943 \cp $IOIPSLDIR/*.mod $libo
944endif
945
946set link="$f90 $optim90"
947
948set ar=ar
949
950if $XNEC then
951  set link="sxld $opt_link"
952  set link="$f90 "
953#  set ar=sxar
954else if $X6NEC then
955  set link="sxld $opt_link"
956  set link="$f90 -Wl,-hlib_cyclic "
957else if $X8BRODIE then
958  set link="sxld $opt_link"
959  set link="$f90 -Wl,-hlib_cyclic "
960endif
961
962
963cd $localdir
964
965echo $make -f $LMDGCM/makefile \
966OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
967OPTIM90="$optim90" \
968OPTIMTRU90="$optimtru90" \
969OPTIM="$optim$optimbis" \
970INCLUDE="$include" \
971$filtre \
972LIBO=$libo \
973$dyn \
974$phys \
975DIM=$dimc \
976L_ADJNT="$adjnt" \
977LOCAL_DIR="$localdir"  \
978F77="$f77" \
979F90="$f90" \
980OPLINK="$oplink" \
981LINK="$link" \
982GCM="$LMDGCM" \
983MOD_LOC_DIR=$mod_loc_dir \
984MOD_SUFFIX=$mod_suffix \
985AR=$ar \
986PROG=$code
987
988$make -f $LMDGCM/makefile \
989OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
990OPTIM90="$optim90" \
991OPTIMTRU90="$optimtru90" \
992OPTIM="$optim$optimbis" \
993INCLUDE="$include" \
994$filtre \
995LIBO=$libo \
996$dyn \
997$phys \
998DIM=$dimc \
999L_ADJNT="$adjnt" \
1000LOCAL_DIR="$localdir"  \
1001F77="$f77" \
1002F90="$f90" \
1003OPLINK="$oplink" \
1004LINK="$link" \
1005GCM="$LMDGCM" \
1006MOD_LOC_DIR=$mod_loc_dir \
1007MOD_SUFFIX=$mod_suffix \
1008AR=$ar \
1009PROG=$code
1010
1011\rm -f $libf/grid/dimensions.h
Note: See TracBrowser for help on using the repository browser.