source: dynamico_lmdz/aquaplanet/ICOSA_LMDZ/make_icosa_lmdz @ 4193

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