source: trunk/ICOSA_LMDZ/make_icosa_lmdz @ 1780

Last change on this file since 1780 was 1721, checked in by emillour, 7 years ago

Adding an interface to the Dynamico dynamical core for Venus physics.
EM

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