source: LMDZ5/trunk/makegcm @ 1513

Last change on this file since 1513 was 1499, checked in by Laurent Fairhead, 13 years ago

makegcm error on merge: g95 lost as a possible compiler


erreur au moment de la synchro: on avait perdu g95 comme compilateur

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 32.6 KB
Line 
1#!/bin/csh
2#
3# $Id: makegcm 1499 2011-03-11 21:12:58Z jghattas $
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 -fdefault-real-8"
26set OPT_LINUX="-O3 -fdefault-real-8"
27set io=ioipsl
28set cosp=false
29
30set FC_LINUX=g95
31set FC_LINUX=gfortran
32#set FC_LINUX=pgf90
33if ( $FC_LINUX == g95 ) then
34  set OPT_LINUX="-O3"
35else if ( $FC_LINUX == gfortran ) then
36  set OPT_LINUX="-fdefault-real-8 -O3"
37#   set OPT_LINUX="-O3 -fno-second-underscore"
38  set OPT_LINUX="-O3 "
39else
40# pgf90 options
41  set OPT_LINUX="-i4 -r8 -O2 -Munroll -Mnoframe -Mautoinline -Mcache_align"
42endif
43
44########################################################################
45# path a changer contenant les sources et les objets du modele
46########################################################################
47
48###### VERSION LMDZ.4
49set INCALIB=../INCA3/config/lib
50set LMDGCM="`pwd`"
51setenv LIBOGCM $LMDGCM/libo
52#
53#
54setenv IOIPSLDIR /d4/fairhead/LMDZ20100928.trunk/modipsl/lib
55setenv MODIPSLDIR /d4/fairhead/LMDZ20100928.trunk/modipsl/lib
56setenv NCDFINC /d4/fairhead/LMDZ20100928.trunk/netcdf-4.0.1/include
57setenv NCDFLIB /d4/fairhead/LMDZ20100928.trunk/netcdf-4.0.1/lib
58
59
60
61
62
63setenv localdir "`pwd`"
64set MODIPSL=0
65echo $localdir | grep modipsl >& /dev/null
66if ( ! $status ) then
67  set MODIPSL=1
68  setenv LMDGCM $localdir
69  cd ../..
70  setenv LIBOGCM "`pwd`/lib"
71  setenv IOIPSLDIR $LIBOGCM
72  setenv MODIPSLDIR $LIBOGCM
73  cd $localdir
74  if ( `hostname` == rhodes ) then
75    set NCDFINC=`grep sxnec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
76    set NCDFLIB=`grep sxnec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
77  else
78    if ( `hostname` == nymphea0 ) then
79      set NCDFINC=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
80      set NCDFLIB=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
81    else if ( `hostname` == mercure ) then
82      set NCDFINC=`grep sx6nec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
83      set NCDFLIB=`grep sx6nec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
84    else  if ( `hostname` == brodie ) then
85      set NCDFINC=`grep sx8brodie ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
86      set NCDFLIB=`grep sx8brodie ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
87    else
88      echo 'Probleme de definition des variables NCDFINC et NCDFLIB'
89    endif
90  endif
91else
92  if ( ! $?LMDGCM ) then
93    echo You must initialize the variable LMDGCM in your environnement
94    echo for instance: "setenv LMDGCM /usr/myself/supergcm" in .cshrc
95    exit
96  endif
97  if ( ! $?LIBOGCM ) then
98    set LIBOGCM=$LMDGCM/libo
99  endif
100  if ( ! $?IOIPSLDIR ) then
101    echo You must initialize the variable IOIPSLDIR in your environnement
102    echo for instance: "setenv IOIPSLDIR /usr/myself/ioipsl" in .cshrc
103    exit
104  else
105      setenv MODIPSLDIR $IOIPSLDIR
106  endif
107  if ( ! $?NCDFLIB ) then
108    echo You must initialize the variable NCDFLIB in your environnement
109    echo for instance: "setenv NCDFLIB /d4/fairhead/LMDZ20100928.trunk/netcdf-4.0.1/lib
110    exit
111  endif
112  if ( ! $?NCDFINC ) then
113    echo You must initialize the variable NCDFINC in your environnement
114    echo for instance: "setenv NCDFINC /d4/fairhead/LMDZ20100928.trunk/netcdf-4.0.1/include
115    exit
116  endif
117endif
118set model=$LMDGCM
119set libo=$LIBOGCM
120
121########################################################################
122#  Les differentes platformes reconnues
123########################################################################
124
125set HP=0
126set IBM=0
127set SUN=0
128set VPP=0
129set CRAY=0
130set DEC=0
131set LINUX=0
132set NEC=0
133set XNEC=0
134set X6NEC=0
135set X8BRODIE=0
136if ( `uname` == HP-UX ) then
137   set machine=HP
138   set HP=1
139else if (`uname` == UNIX_System_V ) then
140   set machine=VPP
141   set VPP=1
142else if (`uname` == SunOS ) then
143   set machine=SUN
144   set SUN=1
145else if ( `uname` == AIX ) then
146   set machine=IBM
147   set IBM=1
148else if ( `uname` == OSF1 ) then
149   set machine=ALPHA
150   set DEC=1
151else if ( `uname` == Linux && `hostname` != mercure  && `hostname` != brodie ) then
152   set machine=LINUX
153   set LINUX=1
154else if ( `hostname` == atlas || `hostname` == axis  || `hostname` == etoile ) then
155   set machine=CRAY
156   set CRAY=1
157else if ( `uname` == SUPER-UX ) then
158   set machine=NEC
159   set NEC=1
160else if ( `hostname` == rhodes) then
161   set machine=XNEC
162   set XNEC=1
163else if ( `hostname` == mercure) then
164   set machine=X6NEC
165   set X6NEC=1
166else if ( `hostname` == brodie) then
167   set machine=X8BRODIE
168   set X8BRODIE=1
169else
170   echo Vous travaillez sur une machine non prevue par le reglement
171   exit
172endif
173
174if ( ! -d $libo )  then
175   mkdir $libo
176endif
177
178
179if $VPP then
180set netcdf=netcdf_v
181else
182set netcdf=netcdf
183endif
184########################################################################
185#  Quelques initialisations de variables du shell.
186########################################################################
187
188set dyn=
189set opt_link=""
190set adjnt=""
191set lcosp=""
192set opt_dep=""
193set libchimie=""
194
195set optim=""
196set optimbis=""
197set optim90=""
198set oplink=""
199
200########################################################################
201#  Optimisations par defaut suivant les machines
202########################################################################
203
204echo "Optimisations par defaut suivant les machines"
205set libf=$model/libf
206#setenv localdir "LOCAL_DIR=`pwd`"
207#setenv localdir "`pwd`"
208cd $model
209#############
210if $CRAY then
211#############
212#   set optim="-Wf'-ei' -dp -Wf'-a static'"
213   set optimbis=" -DCRAY "
214   set optim90="-Wp'-P' -DCRAY -p$IOIPSLDIR "'-p$(LIBO) -eiv '
215   set optim="$optim90"
216   if ( $io == "ioipsl" ) then
217     set oplink="-Wl'-DSTACK=128 -f indef' -L$IOIPSLDIR -lioipsl  -L$NCDFLIB -lnetcdf "
218   else
219     set oplink="-Wl'-DSTACK=128 -f indef' -L$IOIPSLDIR -L$NCDFLIB -lnetcdf "
220   endif
221   set mod_loc_dir=" "
222   set mod_suffix=" "
223#################
224else if $SUN then
225#################
226   set optim=" -fast "
227   set optimbis=" "
228   set optim90=" -fast -fixed "
229   set optimtru90=" -fast -free "
230   if ( $io == "ioipsl" ) then
231     set opt_link="-lf77compat -L$MODIPSLDIR -lsechiba -lparameters -lstomate -lioipsl -L$NCDFLIB -lnetcdf "
232   else
233     set opt_link="-lf77compat -L$MODIPSLDIR -lsechiba -lparameters -lstomate -L$NCDFLIB -lnetcdf "
234   endif
235   set mod_loc_dir=$localdir
236   set mod_suffix=mod
237#################
238else if $HP then
239#################
240   set optim=" +U77 -O +E1 "
241   set optimbis=" "
242#################
243else if $IBM then
244#################
245   set optim=" -O3 -qtune=pwr2 -qarch=pwr2"
246   set optimbis=" "
247#################
248else if $VPP then
249#################
250#   set optim="-Dasuxm  -On, -g -Ad -Potilax -Eciplume -Si"
251#   set optimbis="  -Wv,-m3 -Wp,-DVPP -Z $LMDGCM/listage"
252   set optimbis=" -Wp,-DNC_DOUBLE -Ad -Z $LMDGCM/listage -X9"
253   set optim90="$optim $optimbis -X9 -w"
254   set mod_loc_dir=$MODIPSLDIR
255   set mod_suffix=mod
256#################
257else if $DEC then
258#################
259   set optim=" "
260   set optimbis=" "
261#################
262else if $LINUX then
263#################
264   if ( $FC_LINUX == pgf90 || $FC_LINUX == g95 || $FC_LINUX == gfortran ) 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-cosp true|false     
432           Pour compiler avec cosp
433
434-filtre  filtre
435           Pour choisir le filtre en longitude dans les regions polaires.
436           "filtre" correspond au nom d'un repertoire se trouvant sur
437           $LMDGCM/libf. Le filtre standard du modele est "filtrez" qui peut
438           etre utilise aussi bien pour une grille reguliere que pour une
439           grille zoomee en longitude.
440
441-link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..."
442          Pour rajouter un lien avec les librairies FORTRAN
443          libfile1.a, libfile2.a ... se trouvant respectivement sur les
444          repertoires dir1, dir2 ...
445          Si dirn est un repertoire dont le chemin est automatique (comme
446          par exemple /usr/lib ...) il n'est pas besoin de specifier -Ldirn.
447
448Auteur: Frederic Hourdin  (hourdin@lmd.jussieu.fr)
449eod
450exit
451
452########################################################################
453# Lecture des differentes options
454########################################################################
455
456    case -d:
457        set dim=$2 ; shift ; shift ; goto top
458                       
459    case -O:
460        set optim="$2" ; shift ; shift ; goto top
461
462     case -p
463        set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top
464
465     case -g
466        set grille="$2" ; shift ; shift ; goto top
467
468     case -c
469        set couple="$2" ; shift ; shift ; goto top
470
471     case -io
472        set io="$2" ; shift ; shift ; goto top
473
474     case -v
475        set veget="$2" ; shift ; shift ; goto top
476
477     case -chimie
478        set chimie="$2" ; shift ; shift ; goto top
479
480     case -parallel
481        set parallel="$2" ; shift ; shift ; goto top
482 
483     case -include
484        set include="$include -I$2" ; shift ; shift ; goto top
485
486     case -adjnt
487        set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d "
488        set optim="$optim -Dadj" ; shift ; goto top
489
490     case -cosp
491        set cosp="$2"; shift ; shift ; goto top
492
493     case -filtre
494        set filtre=$2 ; shift ; shift ; goto top
495
496     case -link
497        set opt_link="$opt_link $2" ; shift ; shift ; goto top
498
499     case -debug
500        if $HP then
501           set optim=" -g "
502        else if $SUN then
503           setenv PARALLEL 2
504# Il faut rajouter l'option -dalign a -g pour pouvoir editer les liens
505# avec des programmes compiles avec -fast
506           set optim=" -g -dalign "
507           set optim90=" -fixed -g "
508           set optimtru90=" -free -g -C -dalign "
509        else if $CRAY then
510           set optim="$optim"" -g "
511           set optim90="$optim90"" -G1 "
512        else if $LINUX then
513           if ( $FC_LINUX == "pgf90" ) then
514             set optim="$optim"" -g -C -Mbounds "
515             set optim90="$optim90"" -g -C -Mbounds "
516             set optimtru90="$optimtru90"" -g -C -Mbounds "
517           else if ( $FC_LINUX == 'gfortran' ) then
518             set optim="$optim"" -g -fbounds-check "
519             set optim90="$optim90"" -g -fbounds-check "
520             set optimtru90="$optimtru90"" -g -fbounds-check "
521           else
522             echo 'compilateur linux non reconnu'
523             exit
524           endif
525        else
526           echo pas d option debug predefinie pour cette machine
527           exit
528        endif
529        shift ; goto top
530
531     default
532        set code="$1" ; shift ; goto top
533
534   endsw
535endif
536
537########################################################################
538# Definition des clefs CPP
539########################################################################
540
541set cppflags=''
542
543if $X8BRODIE then
544  set cppflags="$cppflags -DNC_DOUBLE -DBLAS -DSGEMV=DGEMV -DSGEMM=DGEMM"
545endif
546
547if ( $io == ioipsl ) then
548   set cppflags="$cppflags -DCPP_IOIPSL"
549endif
550
551if ( "$cosp" == 'true' ) then
552    set cppflags="$cppflags -DCPP_COSP"
553    set include="$include"' -I$(LIBF)/cosp '
554    set opt_dep="$opt_dep cosp"
555#    set lcosp="-lcosp -lphy$physique "
556     set lcosp="-lcosp "
557   if ( $XNEC || $X8BRODIE || $X6NEC) then
558#    set lcosp="-lsxcosp -lsxphy$physique "
559     set lcosp="-lsxcosp "
560   endif
561endif
562
563if ( "$physique" == 'nophys' ) then
564   set phys="L_PHY= LIBPHY="
565else
566   #Default planet type is Earth
567   set cppflags="$cppflags -DCPP_EARTH"
568endif
569
570set link_veget=" "
571if ( "$veget" == 'true' ) then
572   set cppflags="$cppflags -DCPP_VEGET"
573#   set link_veget=" -lsechiba -lparameters -lstomate  "
574   set link_veget=" -lsechiba -lparameters -lstomate"
575   if ( $XNEC || $X8BRODIE || $X6NEC) then
576#      set link_veget=" -lsxsechiba -lsxparameters -lsxstomate -lsxorglob -lsxparallel"
577      set link_veget=" -lsxsechiba -lsxparameters -lsxstomate "
578   endif
579endif
580
581if ( "$chimie" == 'INCA' ) then
582    set cppflags="$cppflags -DINCA" 
583    set libchimie=" -L$INCALIB -lchimie"
584    set opt_link="$opt_link  -L$INCALIB -lchimie"
585endif
586   
587if ( "$couple" == 'true' ) then
588   set cppflags="$cppflags -DCPP_COUPLE"
589endif
590
591set FLAG_PARA=''
592if ( "$parallel" == 'true' ) then
593   set cppflags="$cppflags -DCPP_PARA"
594   set FLAG_PARA='par'
595endif
596
597set optim="$optim $cppflags"
598set optim90="$optim90 $cppflags"
599set optimtru90="$optimtru90 $cppflags"
600
601
602########################################################################
603# cas special sans physique
604########################################################################
605if ( "$physique" == 'nophys' ) then
606   set phys="L_PHY= LIBPHY="
607endif
608
609########################################################################
610#subtilites sur le nom de la librairie
611########################################################################
612
613\rm -f tmp ; touch tmp
614\rm -f tmp90 ; touch tmp90
615foreach i ( $optim )
616   echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g'  >> tmp
617end
618set suf=
619foreach i ( `sort tmp | uniq ` )
620   set suf=$suf$i
621end
622if ( ! $IBM ) then
623   set nomlib="$nomlib$suf"
624endif
625if ( $DEC ) then
626   set nomlib=DEC
627endif
628if ( $IBM ) then
629   set dim=`echo $dim | sed -en 's/[^0-9]/ /g'`
630   set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'`
631else if ( $SUN ) then
632   set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
633   set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
634else
635   set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
636   set dim=`echo $dim | sed -e 's/[^0-9]/ /g'`
637endif
638set nomlib=${nomlib}${physique}_${dim_}_$grille
639## M-A-F nomlib trop long sur CRAY pour ar
640if ( $CRAY ) then
641    set nomlib=F90_${dim_}
642endif
643if ( $NEC || $XNEC || $X6NEC || $X8BRODIE ) then
644    set nomlib=F90_${dim_}_'phy'${physique}${FLAG_PARA}
645endif
646echo calcul de la dimension
647set dimc=`echo $dim | wc -w`
648
649if ( "$dimc" == "2" ) then
650set include="$include "'-I$(LIBF)/dyn2d '
651set dimh=$dim
652else
653set include="$include "'-I$(LIBF)/dyn3d${FLAG_PARA} '
654set dimh=`echo $dim | awk ' { print $1 "." $2 } '`
655endif
656echo $dimc
657
658########################################################################
659# path pour les #include
660########################################################################
661
662if ( $XNEC ) then
663  set include="$include -I$NCDFINC -I$IOIPSLDIR"
664else
665  set include="$include -I$NCDFINC -I$IOIPSLDIR"
666endif
667echo $include
668
669########################################################################
670# Gestion des dimensions du modele.
671# on cree ou remplace le fichier des dimensions
672########################################################################
673
674cd $libf/grid
675if ( -f dimensions.h ) then
676echo 'ATTENTION: vous etes sans doute en train de compiler le modele par ailleurs'
677echo "Attendez que la premiere compilation soit terminee pour relancer la suivante."
678echo "Si vous etes sur que vous ne compilez pas le modele par ailleurs,"
679echo  vous pouvez continuer en repondant oui.
680echo "Voulez-vous vraiment continuer?"
681if ( $< == "oui" ) then
682\rm -f $libf/grid/dimensions.h
683else
684exit
685endif
686endif
687
688cd dimension
689./makdim $dim
690cat $libf/grid/dimensions.h
691
692cd $LMDGCM
693set libo=$libo/$nomlib
694if ( ! -d $libo )  then
695   mkdir $libo
696   cd $model
697endif
698
699########################################################################
700# Differentes dynamiques (3d, 2d, 1d)
701########################################################################
702
703set dimension=`echo $dim | wc -w`
704echo dimension $dimension
705if ( $dimension == 1 ) then
706echo pas de dynamique
707set dyn="L_DYN= DYN= L_FILTRE= DIRMAIN=phy$physique "
708endif
709endif
710cd $model
711if ( $dimension == 3 ) then
712cd libf/grid
713\rm fxyprim.h
714cp -p fxy_${grille}.h fxyprim.h
715endif
716
717######################################################################
718#   Traitement special pour le nouveau rayonnement de Laurent Li.
719######################################################################
720
721#if ( -f $libf/phy$physique/raddim.h ) then
722# if ( -f $libf/phy$physique/raddim.$dimh.h ) then
723#  \rm -f $libf/phy$physique/raddim.h
724#  cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h
725#  echo $libf/phy$physique/raddim.$dimh.h
726#  cat $libf/phy$physique/raddim.$dimh.h
727#  cat $libf/phy$physique/raddim.h
728# else
729#  echo On peut diminuer la taille de l executable en creant
730#  echo le fichier $libf/phy$physique/raddim.$dimh.h
731#  \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h
732# endif
733#endif
734
735######################################################################
736# Gestion du filtre qui n'existe qu'en 3d.
737######################################################################
738
739if ( `expr $dimc \> 2` == 1 ) then
740   set filtre="FILTRE=$filtre"
741else
742   set filtre="FILTRE= L_FILTRE= "
743endif
744echo MACRO FILTRE $filtre
745
746echo $dimc
747
748########################################################################
749#  Avant de lancer le make, on recree le makefile si necessaire
750########################################################################
751########################################################################
752# c'est a dire dans 3 cas:
753# 1. si la liste des fichiers .F et .h a ete modifiee depuis la
754#    derniere creation du makefile
755# 2. si le fichier contenant cette liste "liste_des_sources"
756#    n'existe pas.
757# 3. Si le makefile n'existe pas.
758########################################################################
759##########################################
760# On adapte d'abord certains include à F90
761##########################################
762##########################################
763cd $model
764find libf -name '*.[Fh]' -print >! tmp77
765find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90
766find libf -name '*.[Fh]90' -print >> tmp90
767
768if (    `diff tmp77 liste_des_sources_f77 | wc -w` \
769     || `diff tmp90 liste_des_sources_f90 | wc -w` \
770     || ! -f makefile \
771     || ! -f liste_des_sources_f90 \
772     || ! -f liste_des_sources_f77 ) then
773        echo les fichiers suivants ont ete crees ou detruits
774        echo ou les fichiers suivants sont passes ou ne sont plus en Fortran 90
775        diff liste_des_sources_f77 tmp77
776        diff liste_des_sources_f90 tmp90
777        \cp tmp77 liste_des_sources_f77
778        \cp tmp90 liste_des_sources_f90
779        echo On recree le makefile
780        ./create_make_gcm >! tmp
781        \mv tmp makefile
782        echo Nouveau makefile cree.
783endif
784
785########################################################################
786#  Execution de la comande make
787########################################################################
788
789echo PHYSIQUE $phys
790echo dynamique $dyn $dimension
791echo OPTIM="$optim" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code
792echo PATH pour les fichiers INCLUDE $include
793echo OPLINK="$oplink"
794
795#################
796if $HP then
797#################
798   set f77='fort77 +OP'
799   set f90='jensaisrien'
800   set opt_link="$opt_link -lm"
801#################
802else  if $VPP then
803#################
804   set f77=frt
805   set f90=$f77
806   if ($couple == true) then
807     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"
808     set oplink="-Wl,-t,-P,-dy "
809   else
810     set opt_link="-Wg,-c -L$MODIPSLDIR -lioipsl /usr/local/lib/lib64/libnetcdf_cc_31.a"
811     set oplink="-Wl,-t,-dy "
812   endif
813   if ($veget == true) then
814     set opt_link="$opt_link $link_veget -lioipsl /usr/local/lib/lib64/libnetcdf_cc_31.a"
815   endif
816#################
817else if $CRAY then
818#################
819   set f77=f90
820   set f90=f90
821#################
822else if $LINUX then
823#################
824#   set f77=pgf90
825#   set f90=pgf90
826   set f77=$FC_LINUX
827   set f90=$FC_LINUX
828   if ( $FC_LINUX == 'pgf90' ) then
829     if ( $io == "ioipsl" ) then
830       set opt_link=" -L$MODIPSLDIR $link_veget -L$NCDFLIB -lioipsl -lnetcdf "
831     else
832       set opt_link=" -L$MODIPSLDIR $link_veget -L$NCDFLIB -lnetcdf "
833     endif
834   else if ($FC_LINUX == 'g95' || $FC_LINUX == 'gfortran' ) then
835     if ( $io == "ioipsl" ) then
836       set opt_link="-L$MODIPSLDIR $link_veget -lioipsl -L$NCDFLIB -lnetcdf -lioipsl -lnetcdf "
837     else
838       set opt_link="-L$MODIPSLDIR $link_veget -lioipsl -L$NCDFLIB -lnetcdf -lnetcdf "
839     endif
840   else
841     set opt_link=" "
842   endif
843#################
844else if $SUN then
845#################
846   set f77=f90
847   set f90=f90
848   if ( $io == "ioipsl" ) then
849     set opt_link="-lf77compat -L$MODIPSLDIR $link_veget -lioipsl -L$NCDFLIB -lnetcdf "
850   else
851     set opt_link="-lf77compat -L$MODIPSLDIR $link_veget -L$NCDFLIB -lnetcdf "
852   endif
853#################
854else if $NEC then
855#################
856   set f77=f90 -ftrace
857   set f90=f90 -ftrace
858   set opt_link="-L$MODIPSLDIR"
859   if ($veget == true) then
860     set opt_link="$opt_link $link_veget"
861   endif
862   if ($couple == true) then
863     set opt_link="$opt_link -lioipsl -loasis2.4_mpi2 -float0 -ew -P static $NCDFLIB "
864   else
865     set opt_link="$opt_link -L$MODIPSLDIR -lioipsl -float0 -ew -P static $NCDFLIB "
866   endif
867   set mod_loc_dir="./"
868#################
869else if $XNEC then
870#################
871   set f77="sxmpif90 -ftrace"
872   set f90="sxmpif90 -ftrace"
873   if $MODIPSL then
874     set opt_link="-L$MODIPSLDIR"
875     if ($veget == true) then
876       set opt_link="$opt_link $link_veget"
877     endif
878     if ($couple == true) then
879       if ($psmile == true) then
880       set opt_link="$opt_link -lsxioipsl -float0 $optdbl -P static $NCDFLIB "
881       else
882       set opt_link="$opt_link -lsxioipsl -loasis2.4_mpi2 -float0 $optdbl -P static $NCDFLIB "
883       endif
884     else
885       set opt_link="$opt_link -lsxioipsl -float0 $optdbl -P static $NCDFLIB "
886     endif
887   else
888     if ($couple == true) then
889       set opt_link="-L$MODIPSLDIR"
890       set opt_link="$opt_link $link_veget -lsxioipsl -loasis2.4_mpi2 -float0 $optdbl -P static $NCDFLIB "
891     else
892       set opt_link=" -C hopt -float0 $optdbl -P static -L$MODIPSLDIR $link_veget -lsxioipsl $NCDFLIB "
893     endif
894   endif
895   set mod_loc_dir="./"
896##################
897else if $X6NEC then
898##################
899   set f77=sxmpif90
900   set f90=sxmpif90
901   if $MODIPSL then
902     set opt_link="$opt_link -L$MODIPSLDIR"
903     if ($veget == true) then
904       set opt_link="$opt_link $link_veget"
905     endif
906     if ($couple == true) then
907        if ($psmile == true) then
908        set opt_link="$opt_link -lsxioipsl -float0 -size_t64 $optdbl -P static $NCDFLIB "
909        else
910        set opt_link="$opt_link -lsxioipsl -loasis2.4_mpi2 -float0 -size_t64 $optdbl -P static $NCDFLIB "
911        endif
912     else
913       set opt_link="$opt_link -lsxioipsl -float0 -size_t64 $optdbl -P static $NCDFLIB "
914     endif
915   else
916#     set opt_link=" -float0 -size_t64 $optdbl -P static -L$MODIPSLDIR -lsxsechiba -lsxparameters -lsxstomate -lsxioipsl $NCDFLIB "
917     set opt_link=" $opt_link -float0 -size_t64 $optdbl -P static -L$MODIPSLDIR -lsxioipsl $NCDFLIB "
918
919   endif
920   set mod_loc_dir="./"
921##################
922else if $X8BRODIE then
923##################
924   set f77=sxmpif90
925   set f90=sxmpif90
926   if $MODIPSL then
927     set opt_link="$opt_link -float0 -Wf,-A dbl4 -L$MODIPSLDIR -lblas"
928     if ($veget == true) then
929       set opt_link="$opt_link $link_veget"
930     endif
931     if ($couple == true) then
932       set opt_link="$opt_link -lsxioipsl -float0 $optdbl -P static $NCDFLIB "
933     else
934       set opt_link="$opt_link -lsxioipsl -float0 $optdbl -P static $NCDFLIB "
935     endif
936   else
937#     set opt_link=" -float0 $optdbl -P static -L$MODIPSLDIR -lsxsechiba -lsxparameters -lsxstomate -lsxioipsl $NCDFLIB "
938     set opt_link=" -float0 $optdbl -P static -L$MODIPSLDIR -lsxioipsl $NCDFLIB -lblas"
939
940   endif
941   set mod_loc_dir="./"
942#################
943else
944#################
945   set f77=f77
946   set f90=f90
947endif
948
949cd $model
950
951if $VPP then
952set make="gmake RANLIB=ls"
953else if $CRAY then
954set make="make RANLIB=ls"
955else if $NEC then
956set make="make RANLIB=ls"
957else if $LINUX then
958set make="make -k RANLIB=ranlib"
959else if $XNEC then
960set make="gmake RANLIB=ls"
961else if $X6NEC then
962set make="gmake RANLIB=ls"
963else if $X8BRODIE then
964set make="gmake RANLIB=ls"
965else
966set make="make RANLIB=ranlib"
967endif
968
969
970
971
972#
973# etat0_netcdf a besoin d'info de la physique
974# A revoir
975set include="$include"' -I$(LIBF)/phy'"$physique"
976#
977# le programme principal create_limit a besoin de l'info du module
978# startvar: on met donc libo dans les include pour Nec
979set include="$include"' -I$(LIBO)'
980
981
982#################################################################
983# Execution de la comande make... ENFIN!
984#################################################################
985
986if $VPP then
987  set optim90=" $optim90 -Am -M$libo"
988  set optimtru90="$optim90"
989 \cp $IOIPSLDIR/*.mod $libo
990else if $SUN then
991 set optim90=" $optim90 -M$libo -M$MODIPSLDIR "
992 set optimtru90=" $optimtru90 -M$libo -M$MODIPSLDIR "
993 set optim="$optim90"
994 \cp $IOIPSLDIR/*.mod $libo
995else if $NEC then
996 set optim90=" $optim90 -I$libo "
997else if $XNEC then
998 set optim90=" $optim90 -I$libo "
999 set optimtru90=" $optimtru90 -I$libo "
1000else if $X6NEC then
1001 set optim90=" $optim90 -I$libo "
1002 set optimtru90=" $optimtru90 -I$libo "
1003else if $X8BRODIE then
1004 set optim90=" $optim90 -I$libo "
1005 set optimtru90=" $optimtru90 -I$libo "
1006else if $LINUX then
1007 if ( $FC_LINUX == "pgf90" ) then
1008   set optimtru90=" $optimtru90 -module $libo "
1009   set optim90=" $optim90 -module $libo "
1010 else if ( $FC_LINUX == 'g95' ) then
1011   set optimtru90=" $optimtru90 -fmod=$libo  "
1012   set optim90=" $optim90 -fmod=$libo  "
1013 else if ( $FC_LINUX == 'gfortran' ) then
1014   set optimtru90=" $optimtru90 -M $libo  "
1015   set optim90=" $optim90 -M $libo  "
1016 endif
1017 set optim="$optim90"
1018 set mod_loc_dir=$libo
1019# \cp /d3/fairhead/sechiba/ioipsl/*.mod $libo
1020# \cp $IOIPSLDIR/*.mod $libo
1021endif
1022
1023set link="$f90 $optim90"
1024
1025set ar=ar
1026
1027if $XNEC then
1028  set link="sxld $opt_link"
1029  set link="$f90 "
1030#  set ar=sxar
1031else if $X6NEC then
1032  set link="sxld $opt_link"
1033  set link="$f90 -Wl,-hlib_cyclic "
1034#  set ar=sxar
1035else if $X8BRODIE then
1036  set link="sxld $opt_link"
1037  set link="$f90 -Wl,-hlib_cyclic "
1038#  set ar=sxar
1039endif
1040
1041
1042cd $localdir
1043
1044set source_code=${code}.F
1045if ( -f $LMDGCM/libf/dyn${dimc}d${FLAG_PARA}/${code}.F90 ) then
1046  set source_code=${code}.F90
1047endif
1048
1049echo $make -f $LMDGCM/makefile \
1050OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
1051OPTIM90="$optim90" \
1052OPTIMTRU90="$optimtru90" \
1053OPTIM="$optim$optimbis" \
1054INCLUDE="$include" \
1055$filtre \
1056LIBO=$libo \
1057$dyn \
1058$phys \
1059DIM=$dimc \
1060FLAG_PARA="$FLAG_PARA"\
1061L_ADJNT="$adjnt" \
1062L_COSP="$lcosp" \
1063L_CHIMIE="$libchimie" \
1064LOCAL_DIR="$localdir"  \
1065F77="$f77" \
1066F90="$f90" \
1067OPLINK="$oplink" \
1068LINK="$link" \
1069GCM="$LMDGCM" \
1070MOD_LOC_DIR=$mod_loc_dir \
1071MOD_SUFFIX=$mod_suffix \
1072AR=$ar \
1073SOURCE=$source_code \
1074PROG=$code
1075
1076$make -f $LMDGCM/makefile \
1077OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
1078OPTIM90="$optim90" \
1079OPTIMTRU90="$optimtru90" \
1080OPTIM="$optim$optimbis" \
1081INCLUDE="$include" \
1082$filtre \
1083LIBO=$libo \
1084$dyn \
1085$phys \
1086DIM=$dimc \
1087FLAG_PARA="$FLAG_PARA"\
1088L_ADJNT="$adjnt" \
1089L_COSP="$lcosp" \
1090L_CHIMIE="$libchimie" \
1091LOCAL_DIR="$localdir"  \
1092F77="$f77" \
1093F90="$f90" \
1094OPLINK="$oplink" \
1095LINK="$link" \
1096GCM="$LMDGCM" \
1097MOD_LOC_DIR=$mod_loc_dir \
1098MOD_SUFFIX=$mod_suffix \
1099AR=$ar \
1100SOURCE=$source_code \
1101PROG=$code
1102
1103\rm -f $libf/grid/dimensions.h
Note: See TracBrowser for help on using the repository browser.