source: LMDZ4/tags/LMDZ4_V3_2/makegcm @ 912

Last change on this file since 912 was 912, checked in by (none), 16 years ago

This commit was manufactured by cvs2svn to create tag 'LMDZ4_V3_2'.

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