source: dynamico_lmdz/aquaplanet/ICOSA_LMDZ/make_icosa_lmdz

Last change on this file 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
RevLine 
[3834]1#!/bin/bash
[4130]2#set -x
[3834]3
[4130]4# Use FCM from DYNAMICO
5export PATH=$PWD/../DYNAMICO/tools/FCM/bin:$PATH
[3851]6export ROOT=$PWD
[4130]7
[3931]8echo $0 $* > rebuild_all
9chmod a+x rebuild_all
[3834]10
11compil_mode_defined="FALSE"
12compil_mode="prod"
13
14job=1
15full_defined="FALSE"
[3911]16with_xios_defined="TRUE"
[3906]17with_orchidee_defined="FALSE"
[4249]18with_oasis_defined="FALSE"
[3834]19arch_defined="FALSE"
20parallel_defined="FALSE"
[3966]21arch_path="../ARCH"
22arch_default_path="arch"
[3834]23parallel="none"
[4130]24phys="none"
[3931]25build_deps="TRUE"
[3834]26CPP_KEY="CPP_NONE" 
27ICOSA_LIB=""
[4120]28rrtm="false"
[3834]29
30while (($# > 0))
31  do
32  case $1 in
33      "-h") cat <<fin
34Usage :
[4028]35makegcm [options] -m arch -p phys  exec
[3834]36[-h]                       : help
37[-prod / -dev / -debug]    : compilation en mode production (default) / developpement / debug .
[4129]38[-nodeps]                  : do not build dependencies (XIOS, IOIPSL, LMDZ, DYNAMICO must be compiled already)
[3834]39 -arch nom_arch            : nom de l\'architecture cible
[4028]40 -p phys                   : physics package (e.g. std , venus , ...)
41[-p_opt "options"]         : additional options for physics package
[3834]42fin
43          exit;;
44
[4028]45      "-p")
46          phys=$2 ; shift ; shift ;;
47     
48      "-p_opt")
49          phys_opt=$2 ; shift ; shift ;;
[4120]50
51      "-rrtm")
52          rrtm=$2 ; shift ; shift ;;
53         
[3834]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
[3931]78      "-nodeps")
79          build_deps="FALSE" ; shift ;;
80
[3834]81      "-with_xios")
82          with_xios_defined="TRUE" ; shift ;;
83
[3906]84      "-with_orchidee")
85          with_orchidee_defined="TRUE" ; shift ;;
86
[4249]87      "-with_oasis")
88      with_oasis_defined="TRUE" ; shift ;;
89
90
[3834]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
[3966]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
[3834]123  if test -f $arch_path/arch-${arch}.env
[3966]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
[3834]132  source arch.env
133  source arch.path
134else
[3966]135  echo "Please define a target architecture"
[3834]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
[3906]173if [[ "$with_orchidee_defined" == "TRUE" ]]
174then
175  ICOSA_LIB="$ICOSA_LIB $ORCHIDEE_LIBDIR $ORCHIDEE_LIB"
176fi 
[3834]177
[4249]178if [[ "$with_oasis_defined" == "TRUE" ]]
179then
180  ICOSA_LIB="$ICOSA_LIB $OASIS_LIBDIR $OASIS_LIB"
181fi
182
183
[3834]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
[3911]191ICOSA_LIB="$ICOSA_LIB $IOIPSL_LIBDIR $IOIPSL_LIB $NETCDF_LIBDIR $NETCDF_LIB $HDF5_LIBDIR $HDF5_LIB"
[3834]192
[3840]193rm bin/*
[3834]194
[3864]195if [[ "$full_defined" == "TRUE" ]]
196then
197  full_flag="-full"
[3931]198  full_flag2="--full"
[3864]199else 
200  full_flag=""
[3931]201  full_flag2=""
[3864]202fi
203
[3834]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
[4028]209echo "%PHYS phy$phys" >> config.fcm
[3834]210echo "%LIB $ICOSA_LIB">> config.fcm
211
[3931]212if [[ "$build_deps" == "TRUE" ]]
[3834]213then
[3931]214
215    cd ../IOIPSL
[3966]216    ./makeioipsl_fcm -$compil_mode -parallel -arch $arch -arch_path $arch_path -j $job $full_flag  || exit 1
[3931]217    cd -
218
219    cd ../XIOS
[3966]220    ./make_xios --$compil_mode --arch $arch --arch_path $arch_path --job $job $full_flag2 || exit 1
[3931]221    cd -
222
223    if [[ "$with_orchidee_defined" == "TRUE" ]]
224    then
225        cd ../ORCHIDEE
[3966]226        ./makeorchidee_fcm -$compil_mode -parallel $parallel -xios2 -arch $arch -arch_path $arch_path -j $job $full_flag  || exit 1
[3931]227        cd -
228    fi
229
[4129]230    cd ../LMDZ
[3931]231    lmdz_veget="false"
232    if [[ "$with_orchidee_defined" == "TRUE" ]]
233    then
[3991]234        lmdz_veget="orchidee2.0 -cpp ORCHIDEE_NOZ0H"
[3931]235    fi
[4120]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
[3931]237    cd -
238
[4129]239    cd ../DYNAMICO
[3966]240    ./make_icosa -$compil_mode -parallel $parallel -external_ioipsl -with_xios -arch $arch -arch_path $arch_path -job $job $full_flag || exit 1
[3931]241    cd -
[3834]242fi
[3931]243
244./build --job $job $full_flag2
Note: See TracBrowser for help on using the repository browser.