source: trunk/LMDZ.GENERIC/makegcm_ifort @ 1243

Last change on this file since 1243 was 1216, checked in by emillour, 11 years ago

Generic model:
Major cleanup, in order to ease the use of LMDZ.GENERIC with (parallel) dynamics
in LMDZ.COMMON: (NB: this will break LMDZ.UNIVERSAL, which should be thrashed
in the near future)

  • Updated makegcm_* scripts (and makdim) and added the "-full" (to enforce full recomputation of the model) option
  • In dyn3d: converted control.h to module control_mod.F90 and converted iniadvtrac.F to module infotrac.F90
  • Added module mod_const_mpi.F90 in dyn3d (not used in serial mode)
  • Rearanged input/outputs routines everywhere to handle serial/MPI cases. physdem.F => phyredem.F90 , phyetat0.F => phyetat0.F90 ; all read/write routines for startfi files are gathered in module iostart.F90
  • added parallelism related routines init_phys_lmdz.F90, comgeomphy.F90, dimphy.F90, iniphysiq.F90, mod_grid_phy_lmdz.F90, mod_phys_lmdz_mpi_data.F90, mod_phys_lmdz_mpi_transfert.F90, mod_phys_lmdz_omp_data.F90, mod_phys_lmdz_omp_transfert.F90, mod_phys_lmdz_para.F90, mod_phys_lmdz_transfert_para.F90 in phymars and mod_const_mpi.F90 in dyn3d (for compliance with parallelism)
  • added created generic routines 'planetwide_maxval' and 'planetwide_minval', in module "planetwide_mod", that enable obtaining the max and min of a field over the whole planet. This should be further imroved with computation of means (possibly area weighed), etc.

EM

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