source: LMDZ4/branches/LMDZ4-dev/makegcm @ 1184

Last change on this file since 1184 was 1176, checked in by Laurent Fairhead, 15 years ago

Modif pour la compilation avec fcm sur Vargas SD
Corrections relatives au controle de histins et de l'utilisation des
options INST(X) pour l'appel au routines de IOIPSL FH
Mise en place de diagnostics sur les critères CFL pour l'advection
de traceurs. FH
Controle dans les .def de la dépendance verticale de l'efficacite
de la diffusion. Actif pour le moment uniquement avec ok_strato=y et llm=39. FH
LF

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