source: trunk/LMDZ.GENERIC/makegcm_pgf90 @ 1315

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