source: dynamico_lmdz/aquaplanet/ICOSA_LMDZ/make_icosa_lmdz @ 4249

Last change on this file since 4249 was 4249, checked in by aclsce, 5 years ago

Modified to handle the use of oasis coupler in IPSLCM7 configuration.

  • Property svn:executable set to *
File size: 5.5 KB
Line 
1#!/bin/bash
2#set -x
3
4# Use FCM from DYNAMICO
5export PATH=$PWD/../DYNAMICO/tools/FCM/bin:$PATH
6export ROOT=$PWD
7
8echo $0 $* > rebuild_all
9chmod a+x rebuild_all
10
11compil_mode_defined="FALSE"
12compil_mode="prod"
13
14job=1
15full_defined="FALSE"
16with_xios_defined="TRUE"
17with_orchidee_defined="FALSE"
18with_oasis_defined="FALSE"
19arch_defined="FALSE"
20parallel_defined="FALSE"
21arch_path="../ARCH"
22arch_default_path="arch"
23parallel="none"
24phys="none"
25build_deps="TRUE"
26CPP_KEY="CPP_NONE" 
27ICOSA_LIB=""
28rrtm="false"
29
30while (($# > 0))
31  do
32  case $1 in
33      "-h") cat <<fin
34Usage :
35makegcm [options] -m arch -p phys  exec
36[-h]                       : help
37[-prod / -dev / -debug]    : compilation en mode production (default) / developpement / debug .
38[-nodeps]                  : do not build dependencies (XIOS, IOIPSL, LMDZ, DYNAMICO must be compiled already)
39 -arch nom_arch            : nom de l\'architecture cible
40 -p phys                   : physics package (e.g. std , venus , ...)
41[-p_opt "options"]         : additional options for physics package
42fin
43          exit;;
44
45      "-p")
46          phys=$2 ; shift ; shift ;;
47     
48      "-p_opt")
49          phys_opt=$2 ; shift ; shift ;;
50
51      "-rrtm")
52          rrtm=$2 ; shift ; shift ;;
53         
54      "-prod")
55          compil_mode="prod" ; shift ;;
56
57      "-dev")
58          compil_mode="dev" ; shift ;;
59
60      "-debug")
61          compil_mode="debug" ; shift ;;
62
63      "-arch")
64          arch=$2 ; arch_defined="TRUE"; shift ; shift ;;
65 
66      "-arch_path")
67          arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;;
68
69      "-parallel")
70          parallel=$2 ; parallel_defined="TRUE"; shift ; shift ;;
71
72      "-job")
73          job=$2 ; shift ; shift;;
74
75      "-full")
76          full_defined="TRUE" ; shift ;;
77
78      "-nodeps")
79          build_deps="FALSE" ; shift ;;
80
81      "-with_xios")
82          with_xios_defined="TRUE" ; shift ;;
83
84      "-with_orchidee")
85          with_orchidee_defined="TRUE" ; shift ;;
86
87      "-with_oasis")
88      with_oasis_defined="TRUE" ; shift ;;
89
90
91      *)
92          code="$1" ; shift ;;
93  esac
94done
95
96rm -f .void_file
97echo > .void_file
98rm -rf .void_dir
99mkdir .void_dir
100
101if [[ "$arch_defined" == "TRUE" ]]
102then
103  rm -f arch.path
104  rm -f arch.fcm
105  rm -f arch.env
106
107  if test -f $arch_path/arch-${arch}.path
108  then
109    ln -s $arch_path/arch-${arch}.path arch.path
110  elif test -f $arch_default_path/arch-${arch}.path
111  then
112    ln -s $arch_default_path/arch-${arch}.path arch.path
113  fi
114       
115  if test -f $arch_path/arch-${arch}.fcm
116  then
117    ln -s $arch_path/arch-${arch}.fcm arch.fcm
118  elif test -f $arch_default_path/arch-${arch}.fcm
119  then
120    ln -s $arch_default_path/arch-${arch}.fcm arch.fcm
121  fi
122
123  if test -f $arch_path/arch-${arch}.env
124  then
125    ln -s $arch_path/arch-${arch}.env arch.env
126  elif test -f $arch_default_path/arch-${arch}.env
127  then
128    ln -s $arch_default_path/arch-${arch}.env arch.env
129  else
130    ln -s .void_file arch.env
131  fi
132  source arch.env
133  source arch.path
134else
135  echo "Please define a target architecture"
136  exit 1
137fi
138
139LD_FLAGS="%BASE_LD"
140
141if [[ "$compil_mode" == "prod" ]]
142then
143  COMPIL_FFLAGS="%PROD_FFLAGS"
144elif [[ "$compil_mode" == "dev" ]]
145then
146  COMPIL_FFLAGS="%DEV_FFLAGS"
147elif [[ "$compil_mode" == "debug" ]]
148then
149  COMPIL_FFLAGS="%DEBUG_FFLAGS"
150fi
151
152if [[ "$parallel" == "mpi" ]]
153then
154  CPP_KEY="$CPP_KEY CPP_USING_MPI"
155elif [[ "$parallel" == "omp" ]]
156then
157  CPP_KEY="$CPP_KEY CPP_USING_OMP"
158  COMPIL_FFLAGS="$COMPIL_FFLAGS %OMP_FFLAGS"
159  LD_FLAGS="$LD_FLAGS %OMP_LD"
160elif [[ "$parallel" == "mpi_omp" ]]
161then
162  CPP_KEY="$CPP_KEY CPP_USING_MPI CPP_USING_OMP"
163  COMPIL_FFLAGS="$COMPIL_FFLAGS %OMP_FFLAGS"
164  LD_FLAGS="$LD_FLAGS %OMP_LD"
165elif [[ "$parallel" == "none" ]]
166then
167  parallel="none"
168else 
169  echo "-parallel value $parallel is invalid, only permited <none>, <mpi>, <omp> or <mpi_omp>"
170  exit 1
171fi
172
173if [[ "$with_orchidee_defined" == "TRUE" ]]
174then
175  ICOSA_LIB="$ICOSA_LIB $ORCHIDEE_LIBDIR $ORCHIDEE_LIB"
176fi 
177
178if [[ "$with_oasis_defined" == "TRUE" ]]
179then
180  ICOSA_LIB="$ICOSA_LIB $OASIS_LIBDIR $OASIS_LIB"
181fi
182
183
184if [[ "$with_xios_defined" == "TRUE" ]]
185then
186  CPP_KEY="$CPP_KEY CPP_USING_XIOS"
187  COMPIL_FFLAGS="$COMPIL_FFLAGS $XIOS_INCDIR"
188  ICOSA_LIB="$ICOSA_LIB $XIOS_LIBDIR $XIOS_LIB"
189fi 
190
191ICOSA_LIB="$ICOSA_LIB $IOIPSL_LIBDIR $IOIPSL_LIB $NETCDF_LIBDIR $NETCDF_LIB $HDF5_LIBDIR $HDF5_LIB"
192
193rm bin/*
194
195if [[ "$full_defined" == "TRUE" ]]
196then
197  full_flag="-full"
198  full_flag2="--full"
199else 
200  full_flag=""
201  full_flag2=""
202fi
203
204rm -f config.fcm
205
206echo "%COMPIL_FFLAGS $COMPIL_FFLAGS $NETCDF_INCDIR" >> config.fcm
207echo "%LD_FLAGS $LD_FLAGS" >> config.fcm
208echo "%CPP_KEY $CPP_KEY" >> config.fcm
209echo "%PHYS phy$phys" >> config.fcm
210echo "%LIB $ICOSA_LIB">> config.fcm
211
212if [[ "$build_deps" == "TRUE" ]]
213then
214
215    cd ../IOIPSL
216    ./makeioipsl_fcm -$compil_mode -parallel -arch $arch -arch_path $arch_path -j $job $full_flag  || exit 1
217    cd -
218
219    cd ../XIOS
220    ./make_xios --$compil_mode --arch $arch --arch_path $arch_path --job $job $full_flag2 || exit 1
221    cd -
222
223    if [[ "$with_orchidee_defined" == "TRUE" ]]
224    then
225        cd ../ORCHIDEE
226        ./makeorchidee_fcm -$compil_mode -parallel $parallel -xios2 -arch $arch -arch_path $arch_path -j $job $full_flag  || exit 1
227        cd -
228    fi
229
230    cd ../LMDZ
231    lmdz_veget="false"
232    if [[ "$with_orchidee_defined" == "TRUE" ]]
233    then
234        lmdz_veget="orchidee2.0 -cpp ORCHIDEE_NOZ0H"
235    fi
236    ./makelmdz_fcm -p $phys $phys_opt -rrtm $rrtm -$compil_mode -mem -parallel $parallel -libphy -io xios -v $lmdz_veget -arch $arch -arch_path $arch_path -j $job $full_flag || exit 1
237    cd -
238
239    cd ../DYNAMICO
240    ./make_icosa -$compil_mode -parallel $parallel -external_ioipsl -with_xios -arch $arch -arch_path $arch_path -job $job $full_flag || exit 1
241    cd -
242fi
243
244./build --job $job $full_flag2
Note: See TracBrowser for help on using the repository browser.