source: LMDZ4/tags/LMDZ4V5.0/makegcm

Last change on this file was 1279, checked in by Laurent Fairhead, 14 years ago

Merged LMDZ4-dev branch changes r1241:1278 into the trunk
Running trunk and LMDZ4-dev in LMDZOR configuration on local
machine (sequential) and SX8 (4-proc) yields identical results
(restart and restartphy are identical binarily)
Log history from r1241 to r1278 is available by switching to
source:LMDZ4/branches/LMDZ4-dev-20091210

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