source: trunk/LMDZ.MARS/makegcm_ifort @ 1036

Last change on this file since 1036 was 1036, checked in by emillour, 12 years ago

Mars GCM: (a first step towards using parallel dynamics)

  • IMPORTANT CHANGE: Implemented dynamic tracers. It is no longer necessary to compile the model with the '-t #' option, number of tracers is simply read from tracer.def file (as before). Adapted makegcm_* scripts (and co.) accordingly. Technical aspects of the switch to dynamic tracers are:
    • advtrac.h (in dyn3d) removed and replaced by module infotrac.F
    • tracer.h (in phymars) removed and replaced by module tracer_mod.F90 (which contains nqmx, the number of tracers, etc. and can be used anywhere in the physics).
  • Included some side cleanups: removed unused files (in dyn3d) anldoppler2.F, anl_mcdstats.F and anl_stats-diag.F, and all the unecessary dimensions.* files in grid/dimension.
  • Checked that changes are clean and that GCM yields identical results (in debug mode) to previous svn version.

EM

  • Property svn:executable set to *
File size: 24.1 KB
Line 
1#!/bin/csh -f
2# $Header: /users/lmdz/cvsroot/LMDZ.3.3/makegcm,v 1.21 2001/07/04 08:41:44 lmdz Exp $
3#set verbose echo
4########################################################################
5# options par defaut pour la commande make
6########################################################################
7set dim="64x48x32"
8set physique=mars
9set phys="PHYS=$physique"
10set include='-I$(LIBF)/grid -I$(LIBF)/bibio -I. -I$(LIBF)/aeronomars'
11set ntrac = 1
12set filtre=filtrez
13set grille=reg
14set dyntype="dyn"
15set scatterers="1"
16########################################################################
17# path a changer contenant les sources et les objets du modele
18########################################################################
19
20#### If you want you can set environment variables here (instead of
21####  relying on the C-shell environment variables)
22# default LMDGCM to where makegcm script is located:
23set scriptdir=`dirname $0`
24setenv LMDGCM `readlink -f $scriptdir`
25# You may set LIBOGCM to something else; otherwise we default to:
26setenv LIBOGCM $LMDGCM/libo
27## NetCDF Libraries: what follows is OK on GNOME
28if ( `hostname` == n201 ) then
29    echo "GNOME cluster"
30    setenv NCDFLIB /usr/local/lib
31    setenv NCDFINC /usr/local/include
32else
33   # NetCDF, on LMD farm:
34    echo "LMD machines"
35    setenv NCDFLIB /donnees/emlmd/netcdf64-4.0.1_ifort/lib
36    setenv NCDFINC /donnees/emlmd/netcdf64-4.0.1_ifort/include
37endif
38
39setenv localdir "`pwd`"
40set MODIPSL=0
41echo $localdir | grep modipsl >& /dev/null
42if ( ! $status ) then
43  set MODIPSL=1
44  setenv LMDGCM $localdir
45  cd ../..
46  setenv LIBOGCM "`pwd`/lib"
47  cd $localdir
48  if ( `hostname` == rhodes ) then
49    set NCDFINC=`grep sxnec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
50    set NCDFLIB=`grep sxnec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
51  else
52    if ( `hostname` == nymphea0 ) then
53      set NCDFINC=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
54      set NCDFLIB=`grep fjvpp ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
55    else
56      echo 'Probleme de definition des variables NCDFINC et NCDFLIB'
57    endif
58  endif
59else
60  if ( ! $?LMDGCM ) then
61    echo You must initialize the variable LMDGCM in your environnement
62    echo for instance: "setenv LMDGCM /usr/myself/supergcm" in .cshrc
63    exit
64  endif
65  if ( ! $?LIBOGCM ) then
66    set LIBOGCM=$LMDGCM/libo
67  endif
68  if ( ! $?NCDFLIB ) then
69    echo You must initialize the variable NCDFLIB in your environnement
70    echo for instance: "setenv NCDFLIB /usr/myself/netcdf" in .cshrc
71    exit
72  endif
73  if ( ! $?NCDFINC ) then
74    echo You must initialize the variable NCDFINC in your environnement
75    echo for instance: "setenv NCDFINC /usr/myself/netcdf" in .cshrc
76    exit
77  endif
78endif
79set model=$LMDGCM
80set libo=$LIBOGCM
81
82########################################################################
83#  Les differentes platformes reconnues
84########################################################################
85
86set HP=0
87set IBM=0
88set SUN=0
89set VPP=0
90set CRAY=0
91set DEC=0
92set LINUX=0
93set NEC=0
94set XNEC=0
95if ( `uname` == HP-UX ) then
96   set machine=HP
97   set HP=1
98else if (`uname` == UNIX_System_V ) then
99   set machine=VPP
100   set VPP=1
101else if (`uname` == SunOS ) then
102   set machine=SUN
103   set SUN=1
104else if ( `uname` == AIX ) then
105   set machine=IBM
106   set IBM=1
107else if ( `uname` == OSF1 ) then
108   set machine=ALPHA
109   set DEC=1
110else if ( `uname` == Linux ) then
111   set machine=LINUX
112   set LINUX=1
113else if ( `hostname` == atlas || `hostname` == axis  || `hostname` == etoile ) then
114   set machine=CRAY
115   set CRAY=1
116else if ( `uname` == SUPER-UX ) then
117   set machine=NEC
118   set NEC=1
119else if ( `hostname` == rhodes) then
120   set machine=XNEC
121   set XNEC=1
122else
123   echo Vous travaillez sur une machine non prevue par le reglement
124   exit
125endif
126
127# create $libo directory if it doesn't exist
128if ( ! -d $libo )  then
129   mkdir $libo
130endif
131
132if $VPP then
133set netcdf=netcdf_v
134else
135set netcdf=netcdf
136endif
137########################################################################
138#  Quelques initialisations de variables du shell.
139########################################################################
140
141set dyn=
142set opt_link=""
143set adjnt=""
144set opt_dep=""
145
146set optim90=""
147set oplink=""
148
149########################################################################
150#  Optimisations par defaut suivant les machines
151########################################################################
152
153echo "Optimisations par defaut suivant les machines"
154set libf=$model/libf
155#setenv localdir "LOCAL_DIR=`pwd`"
156#setenv localdir "`pwd`"
157cd $model
158if $CRAY then
159   set optim90="-Wp'-P' -DCRAY "'-p$(LIBO) -eiv '
160   set oplink="-Wl'-DSTACK=128 -f indef' -L$NCDFLIB -lnetcdf "
161   set mod_loc_dir=" "
162   set mod_suffix=" "
163else if $SUN then
164   set optim90=" -fast"
165   set optimtru90=" -fast -free"
166   set opt_link="-L$NCDFLIB -lnetcdf"
167   set mod_loc_dir=$localdir
168   set mod_suffix=mod
169else if $HP then
170else if $IBM then
171else if $VPP then
172   set optim90="$optim -X9 -w"
173   if $COUPLE then
174     set opt_link="-Wg,-c $IOIPSLDIR/liboasis2.4_mpi2.a /usr/lang/mpi2/lib64/libmpi.a /usr/lang/mpi2/lib64/libmp.a /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl"
175     set oplink="-Wl,-t,-P,-dy "
176   else
177     set opt_link="-Wg,-c /usr/local/lib/lib64/libnetcdf_cc.a -L$IOIPSLDIR -lioipsl"
178     set oplink="-Wl,-t,-dy "
179   endif
180   set mod_loc_dir=$IOIPSLDIR
181   set mod_suffix=mod
182else if $DEC then
183else if $LINUX then
184# Ehouarn 'ifort' compiler
185   #NB: on gnome -O3 ==> NaNs ...
186   set optim="-auto -O2 -fp-model precise -ip -mkl=sequential -align all "
187   set optim90="-auto -O2 -fp-model precise -ip -mkl=sequential -align all "
188   set optimtru90="-auto -O2 -fp-model precise -ip -mkl=sequential -align all "
189#   set opt_link=" -Mfree -lpgf90 -lpgftnrtl -lpghpf -lpghpf2 -L$NCDFLIB -lnetcdf -Bstatic "
190#   set mod_loc_dir=$LIBOGCM
191# ifort puts mod files in local directory
192   set mod_loc_dir="."
193   set mod_suffix=mod
194else if $NEC then
195   set optim90=' -clear -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "'
196   set optimtru90=' -clear -f4 -C hopt -float0 -ew -P static -Wf,"-pvctl fullmsg noassume "'
197###   set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lioipsl  -L/u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v "
198   set opt_link=" -C hopt -float0 -ew -P static -L/SX/usr/local/lib  -lnetcdf_i8r8 "
199   set mod_loc_dir="."
200   set mod_suffix="mod"
201else if $XNEC then
202   set optim90=' -clear -R5 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
203   set optimtru90=' -clear -R5 -f4 -C vopt -float0 -ew -P static -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
204   if $MODIPSL then
205     if $COUPLE then
206       set opt_link="-L$IOIPSLDIR -lsxioipsl -loasis2.4_mpi2 -float0 -ew -P static -I$NCDFINC $NCDFLIB "
207     else
208       set opt_link="-L$IOIPSLDIR -lsxioipsl -float0 -ew -P static -I$NCDFINC $NCDFLIB "
209     endif
210     set mod_loc_dir="./"
211   else
212####     set opt_link=" -C hopt -float0 -ew -P static -L$IOIPSLDIR -lsxioipsl -L /u/rech/psl/rpsl003/IOIPSL -lnetcdf_i8r8_v -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8"
213     set opt_link=" -C hopt -float0 -ew -P static -I$NCDFINC -L/SX/usr/local/lib -lnetcdf_i8r8"
214     set mod_loc_dir="."
215   endif
216   set mod_suffix="mod"
217
218endif
219
220# Ehouarn: add 'g9fortran' string to pathname
221set nomlib=${machine}
222
223# Impose distinct name for 64 bit Linux machines (to avoid mixing 32 and 64)
224if (`uname` == Linux && `uname -m` == "x86_64") then
225  set nomlib=${machine}64
226endif
227
228########################################################################
229# lecture des options de mymake
230########################################################################
231
232top:
233if ($#argv > 0) then
234    switch ($1:q)
235
236    case -h:
237
238########################################################################
239# Manuel en ligne
240########################################################################
241more <<eod
242
243
244makegcm [Options] prog
245
246
247The makegcm script:
248-------------------
249
2501. compiles a series of subroutines located in the $LMDGCM/libf
251 sub-directories.
252 The objects are then stored in the libraries in $LIBOGCM.
253
2542. then, makegcm compiles program prog.f located by default in
255$LMDGCM/libf/dyn3d and makes the link with the libraries.
256
257Environment Variables '$LMDGCM' and '$LIBOGCM'
258 must be set as environment variables or directly
259 in the makegcm file.
260
261The makegcm command is used to control the different versions of the model
262 in parallel, compiled using the compilation options
263 and the various dimensions, without having to recompile the whole model.
264
265The FORTRAN libraries are stored in directory $LIBOGCM.
266
267
268OPTIONS:
269--------
270
271The following options can either be defined by default by editing the
272makegcm "script", or in interactive mode:
273
274-d imxjmxlm  where im, jm, and lm are the number of longitudes,
275             latitudes and vertical layers respectively.
276
277-t ntrac   Selects the number of tracers present in the model
278
279             Options -d and -t overwrite file
280             $LMDGCM/libf/grid/dimensions.h
281             which contains the 3 dimensions of the
282             horizontal grid
283             im, jm, lm plus the number of tracers passively advected
284             by the dynamics ntrac,
285             in 4 PARAMETER FORTRAN format
286             with a new file:
287             $LMDGCM/libf/grid/dimension/dimensions.im.jm.lm.tntrac
288             If the file does not exist already
289             it is created by the script
290             $LMDGCM/libf/grid/dimension/makdim
291
292-s nscat   Number of radiatively active scatterers
293
294-p PHYS    Selects the set of physical parameterizations
295           you want to compile the model with.
296           The model is then compiled using the physical
297           parameterization sources in directory:
298            $LMDGCM/libf/phyPHYS
299
300-g grille  Selects the grid type.
301           This option overwrites file
302           $LMDGCM/libf/grid/fxyprim.h
303           with file
304           $LMDGCM/libf/grid/fxy_grille.h
305           the grid can take the following values:
306           1. reg - the regular grid
307           2. sin - to obtain equidistant points in terms of sin(latitude)
308           3. new - to zoom into a part of the globe
309
310-O "compilation options" set of fortran compilation options to use
311
312-include path
313           Used if the subroutines contain #include files (ccp) that
314           are located in directories that are not referenced by default.
315
316-adjnt     Compiles the adjoint model to the dynamical code.
317
318-olddyn    To compile GCM with "old dynamics"
319
320-filtre  filter
321           To select the longitudinal filter in the polar regions.
322           "filter" corresponds to the name of a directory located in
323           $LMDGCM/libf. The standard filter for the model is "filtrez"
324           which can be used for a regular grid and for a 
325           grid with longitudinal zoom.
326
327-link "-Ldir1 -lfile1 -Ldir2 -lfile2 ..."
328           Adds a link to FORTRAN libraries
329           libfile1.a, libfile2.a ...
330           located in directories dir1, dir2 ...respectively
331           If dirn is a directory with an automatic path
332           (/usr/lib ... for example)
333           there is no need to specify  -Ldirn.
334
335eod
336exit
337
338########################################################################
339# Lecture des differentes options
340########################################################################
341
342    case -d:
343        set dim=$2 ; shift ; shift ; goto top
344                       
345    case -O:
346        set optim="$2" ; set optim90="$2" ; set optimtru90="$2" ; shift ; shift ; goto top
347
348     case -p
349        set physique="$2" ; set phys="PHYS=$physique" ; shift ; shift ; goto top
350
351     case -s
352        set scatterers="$2" ; shift ; goto top
353
354     case -g
355        set grille="$2" ; shift ; shift ; goto top
356
357     case -t
358        set ntrac=$2 ; shift ; shift ; goto top
359
360     case -include
361        set include="$include -I$2" ; shift ; shift ; goto top
362
363     case -adjnt
364        set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d "
365
366     case -olddyn
367        set dyntype="olddyn" ; shift; goto top
368
369     case -filtre
370        set filtre=$2 ; shift ; shift ; goto top
371
372     case -link
373        set opt_link="$opt_link $2" ; shift ; shift ; goto top
374
375     case -debug
376        if $HP then
377           set optim90=" -g "
378        else if $SUN then
379           setenv PARALLEL 4
380           set optim90=" -g -C "
381           set optimtru90=" -g -C "
382        else if $CRAY then
383           set optim90="$optim90"" -G1 "
384        else if $LINUX then
385           ## for ifort
386             set optim=" -g -O0 -fpe-all=0 -traceback -ftrapuv -fp-stack-check -check all -debug"
387             set optim90=" -g -O0 -fpe-all=0 -traceback -ftrapuv -fp-stack-check -check all -debug"
388             set optimtru90=" -g -O0 -fpe-all=0 -traceback -ftrapuv -fp-stack-check -check all -debug"
389        else
390           echo "pas d option debug predefinie pour cette machine"
391           exit
392        endif
393        shift ; goto top
394
395     default
396        set code="$1" ; shift ; goto top
397
398   endsw
399endif
400
401echo "apres les opts dim $dim"
402
403########################################################################
404# cas special sans physique
405########################################################################
406if ( "$physique" == 'nophys' ) then
407   set phys="L_PHY= LIBPHY="
408endif
409
410########################################################################
411# choix du nombre de traceur par defaut si il n'a pas ete choisi,
412# suivant la physique
413########################################################################
414
415if ( $ntrac == 0  ) then
416    if ( "$physique" == 'nophys' ) then
417        set ntrac=1
418    else if ( "$physique" == 'lmd' ) then
419        set ntrac=2
420    else if ( "$physique" == 'lmd_test_li' ) then
421        set ntrac=2
422    else if ( "$physique" == 'ec' ) then
423        set ntrac=1
424    else
425        set ntrac = 1
426    endif
427endif
428
429########################################################################
430#subtilites sur le nom de la librairie
431########################################################################
432
433\rm tmp ; touch tmp
434\rm tmp90 ; touch tmp90
435foreach i ( $optim90 )
436   echo $i | sed -e 's/\"//g' -e "s/\'//g" -e 's/-//g' -e 's/://g' -e 's/=//g' -e 's/%//g' >> tmp
437end
438set suf=
439foreach i ( `sort tmp | uniq ` )
440   set suf=$suf$i
441end
442if ( ! $IBM ) then
443   set nomlib="$nomlib$suf"
444endif
445if ( $DEC ) then
446   set nomlib=DEC
447endif
448
449# dimension
450
451echo "dimension avant sed $dim"
452if ( $IBM ) then
453   set dim=`echo $dim | sed -en 's/[^0-9]/ /g'`
454   set dim_=`echo $dim | sed -en 's/[^0-9]/_/g'`
455else if ( $SUN || $XNEC ) then
456   set dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 
457   set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
458else
459#   set dim=`echo $dim | sed -n -e 's/[^0-9]/ /gp'`
460#   set dim_=`echo $dim | sed -n -e 's/[^0-9]/_/gp'`
461     set dim=`echo $dim | sed -e 's/[^0-9]/ /g'`
462     set dim_=`echo $dim | sed -e 's/[^0-9]/_/g'`
463endif
464
465# build final name of libraries directory:
466if ( "$dyntype" == "olddyn" ) then
467  set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}_olddyn
468else
469  set nomlib=${nomlib}_${dim_}_t${ntrac}_s${scatterers}_${grille}
470endif
471
472# Append 'physique' type, if it is not mars, to nomlib
473if ( "$physique" != "mars" ) then
474  set nomlib=${nomlib}_${physique}
475endif
476
477## M-A-F nomlib trop long sur CRAY pour ar
478if ( $CRAY ) then
479    set nomlib=F90_${dim_}_t${ntrac}
480endif
481if ( $NEC || $XNEC ) then
482    set nomlib=F90_${dim_}_t${ntrac}
483endif
484
485echo "calcul de la dimension"
486set dimc=`echo $dim | wc -w`
487
488if ( "$dimc" == "2" ) then
489  set include="$include "'-I$(LIBF)/dyn2d '
490  set dimh=$dim
491else
492  if ( "$dyntype" == "olddyn" ) then
493    set include="$include "'-I$(LIBF)/olddyn3d '
494  else
495    set include="$include "'-I$(LIBF)/dyn3d '
496  endif
497  set dimh=`echo $dim | awk ' { print $1 "." $2 } '`
498endif
499echo "dimc is $dimc"
500
501########################################################################
502# path pour les #include
503########################################################################
504
505set include="$include -I$NCDFINC "
506echo $include
507
508########################################################################
509# Gestion des dimensions du modele.
510# on cree ou remplace le fichier des dimensions/nombre de traceur
511########################################################################
512
513cd $libf/grid
514if ( -f dimensions.h ) then
515  echo "WARNING: you are probably already compiling the model (perhaps"
516  echo " elsewhere). Wait until the first compilation ends before "
517  echo " compiling a different configuration."
518  echo "If you are sure that you are not already compiling, then you"
519  echo " may continue this compilation by answering yes."
520  echo "Do you want to continue?"
521  if ( $< == "yes" ) then
522    #remove old dimensions.h file
523    \rm -f $libf/grid/dimensions.h
524    #remove old scatterers.h file
525    \rm -f $libf/phy$physique/scatterers.h
526  else
527    exit
528  endif
529endif
530
531# Build the appropriate 'dimensions.h' file
532cd dimension
533./makdim $dim
534# echo contents of dimensions.h to standard output
535cat $libf/grid/dimensions.h
536
537cd $libf/phy$physique/scatterers
538# Build the appropriate 'scatterers.h' file
539./make_scatterers $scatterers
540# echo contents of scatterers.h to standard output
541cat $libf/phy$physique/scatterers.h
542
543cd $LMDGCM
544# set path to objects directory
545set libo=$libo/$nomlib
546# create objects directory, if it doesn't exist
547if ( ! -d $libo )  then
548   mkdir $libo
549   cd $model
550endif
551
552########################################################################
553# Differentes dynamiques (3d, 2d, 1d)
554########################################################################
555
556set dimension=`echo $dim | wc -w`
557echo dimension $dimension dim $dim
558if ( $dimension == 1 ) then
559  echo "No dynamics"
560##  set dyn="L_DYN= DYN= L_FILTRE= DIRMAIN=phy$physique "
561## NB: we still need to have L_DYN=libdyn3d to reach routines and module
562## objects which are located in dyn3d
563  set dyn="L_DYN=-ldyn3d DYN= L_FILTRE= DIRMAIN=phy$physique "
564endif
565endif
566
567cd $model
568if ( $dimension == 3 ) then
569  cd libf/grid
570  \rm fxyprim.h
571  cp -p fxy_${grille}.h fxyprim.h
572endif
573
574######################################################################
575#   Traitement special pour le nouveau rayonnement de Laurent Li.
576######################################################################
577
578if ( -f $libf/phy$physique/raddim.h ) then
579  if ( -f $libf/phy$physique/raddim.$dimh.h ) then
580    \rm $libf/phy$physique/raddim.h
581    cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h
582    echo $libf/phy$physique/raddim.$dimh.h
583    cat $libf/phy$physique/raddim.$dimh.h
584    cat $libf/phy$physique/raddim.h
585  else
586    echo On peut diminuer la taille de l executable en creant
587    echo le fichier $libf/phy$physique/raddim.$dimh.h
588    \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h
589  endif
590endif
591
592######################################################################
593# Gestion du filtre qui n'existe qu'en 3d.
594######################################################################
595
596# set filtre to 'oldfiltrez' if using -olddyn option
597if ( "$dyntype" == "olddyn" ) then
598  set filtre="oldfiltrez"
599endif
600
601if ( `expr $dimc \> 2` == 1 ) then
602   set filtre="FILTRE=$filtre"
603else
604   set filtre="FILTRE= L_FILTRE= "
605endif
606echo "MACRO FILTRE $filtre"
607
608echo "dimc $dimc"
609
610########################################################################
611#  Avant de lancer le make, on recree le makefile si necessaire
612########################################################################
613# c'est a dire dans 3 cas:
614# 1. si la liste des fichiers .F et .h a ete modifiee depuis la
615#    derniere creation du makefile
616# 2. si le fichier contenant cette liste "liste_des_sources"
617#    n'existe pas.
618# 3. Si le makefile n'existe pas.
619########################################################################
620
621cd $model
622find libf -name '*.[Fh]' -print | sort >! tmp77
623#find libf -name '*.[Fh]' -exec egrep -i " *use *ioipsl" {} \; -print >! tmp90
624find libf -name '*.[Fh]90' -print | sort >> tmp90
625
626if (    `diff tmp77 liste_des_sources_f77 | wc -w` \
627     || `diff tmp90 liste_des_sources_f90 | wc -w` \
628     || ! -f makefile \
629     || ! -f liste_des_sources_f90 \
630     || ! -f liste_des_sources_f77 ) then
631        echo "les fichiers suivants ont ete crees ou detruits"
632        echo "ou les fichiers suivants sont passes ou ne sont plus en Fortran 90"
633        diff liste_des_sources_f77 tmp77
634        diff liste_des_sources_f90 tmp90
635        \cp tmp77 liste_des_sources_f77
636        \cp tmp90 liste_des_sources_f90
637        echo "On recree le makefile"
638        if ("$dyntype" == "olddyn") then
639          ./create_make_gcm olddyn3d grid bibio aeronomars phy$physique >! tmp
640        else
641          ./create_make_gcm dyn3d grid bibio aeronomars phy$physique >! tmp
642        endif
643        \mv tmp makefile
644        echo "Nouveau makefile cree."
645endif
646
647########################################################################
648#  Execution de la comande make
649########################################################################
650
651echo PHYSIQUE $phys
652echo dynamique $dyn $dimension
653echo OPTIM90="$optim90" $filtre LIBO=$libo $dyn PHYS=$phys DIM=$dimc PROG=$code
654echo PATH pour les fichiers INCLUDE $include
655echo OPLINK="$oplink"
656
657if $HP then
658   set f77='fort77 +OP'
659   set f90='jensaisrien'
660   set opt_link="$opt_link -lm"
661else  if $VPP then
662   set f77=frt
663   set f90=$f77
664else if $CRAY then
665   set f77=f90
666   set f90=f90
667else if $LINUX then
668   set f77=ifort
669   set f90=ifort
670   set opt_link=" -L$LIBOGCM -L$NCDFLIB -lnetcdf "
671else if $SUN then
672   set f77=f90
673   set f90=f90
674else if $NEC then
675   set f77=f90
676   set f90=f90
677else if $XNEC then
678   set f77=sxmpif90
679   set f90=sxmpif90
680else
681   set f77=f77
682   set f90=f90
683endif
684
685cd $model
686
687if $VPP then
688  set make="gmake RANLIB=ls"
689else if $CRAY then
690  set make="make RANLIB=ls"
691else if $NEC then
692  set make="make RANLIB=ls"
693else if $LINUX then
694  set make="make -k RANLIB=ranlib"
695else if $XNEC then
696  set make="/usr/local/bin/gmake RANLIB=ls"
697  set make="/usr/freeware/bin/gmake RANLIB=ls"
698else
699  set make="make RANLIB=ranlib"
700endif
701
702set include="$include"" -I$libf/phy$physique"
703
704
705#################################################################
706# Execution de la comande make... ENFIN!
707#################################################################
708
709if $VPP then
710  set optim90=" $optim90 -Am -M$libo"
711  set optimtru90="$optim90"
712else if $SUN then
713 set optim90=" $optim90 -M$libo"
714 set optimtru90=" $optimtru90 "
715else if $NEC then
716 set optim90=" $optim90 -I$libo "
717else if $XNEC then
718 set optim90=" $optim90 -I$libo "
719 set optimtru90=" $optimtru90 -I$libo "
720else if $LINUX then
721# Ehouarn : adapt to gfortran
722 set optim="$optim -I${libo}"
723 set optim90="$optim90 -I${libo}"
724 set optimtru90="$optimtru90 -I${libo}"
725# Ehouarn: remove set mod_loc_dir def below; mod_loc_dir=$localdir (set above)
726# set mod_loc_dir=$libo
727endif
728
729set link="$f90 $optim90"
730
731set ar=ar
732
733if $XNEC then
734  set link="sxld $opt_link"
735  set link="$f90 "
736#  set ar=sxar
737endif
738
739
740cd $localdir
741
742## locate main program (could be in dyn3d or phy$physique
743##                      and could be .F or .F90)
744set source_code=${code}.F
745if ( -f $LMDGCM/libf/dyn3d/${code}.F90 ) then
746  set source_code=${code}.F90
747endif
748if ( -f $LMDGCM/libf/phy${physique}/${code}.F ) then
749  set source_code=${code}.F
750endif
751if ( -f $LMDGCM/libf/phy${physique}/${code}.F90 ) then
752  set source_code=${code}.F90
753endif
754
755## locate directory where main program is located
756if ( $dimension == 3 ) then
757  if ( -f $LMDGCM/libf/dyn3d/${source_code} ) then
758    set dyn="DIRMAIN=dyn3d "
759  endif
760  if ( -f $LMDGCM/libf/phy${physique}/${source_code} ) then
761    set dyn="DIRMAIN=phy${physique} "
762  endif
763endif
764
765echo $make -f $LMDGCM/makefile \
766OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
767OPTIM="$optim" \
768OPTIM90="$optim90" \
769OPTIMTRU90="$optimtru90" \
770INCLUDE="$include" \
771$filtre \
772LIBO=$libo \
773$dyn \
774$phys \
775DIM=$dimc \
776DYNTYPE="$dyntype" \
777L_ADJNT="$adjnt" \
778LOCAL_DIR="$localdir"  \
779F77="$f77" \
780F90="$f90" \
781OPLINK="$oplink" \
782LINK="$link" \
783GCM="$LMDGCM" \
784MOD_LOC_DIR=$mod_loc_dir \
785MOD_SUFFIX=$mod_suffix \
786AR=$ar \
787SOURCE=$source_code \
788PROG=$code
789
790
791$make -f $LMDGCM/makefile \
792OPTION_DEP="$opt_dep" OPTION_LINK="$opt_link" \
793OPTIM="$optim" \
794OPTIM90="$optim90" \
795OPTIMTRU90="$optimtru90" \
796INCLUDE="$include" \
797$filtre \
798LIBO=$libo \
799$dyn \
800$phys \
801DIM=$dimc \
802DYNTYPE="$dyntype" \
803L_ADJNT="$adjnt" \
804LOCAL_DIR="$localdir"  \
805F77="$f77" \
806F90="$f90" \
807OPLINK="$oplink" \
808LINK="$link" \
809GCM="$LMDGCM" \
810MOD_LOC_DIR=$mod_loc_dir \
811MOD_SUFFIX=$mod_suffix \
812AR=$ar \
813SOURCE=$source_code \
814PROG=$code
815
816# cleanup, remove dimensions.h and scatterers.h
817\rm -f $libf/grid/dimensions.h
818\rm -f $libf/phy$physique/scatterers.h
Note: See TracBrowser for help on using the repository browser.