source: dynamico_lmdz/aquaplanet/ICOSA_LMDZ/make_icosa_lmdz @ 3989

Last change on this file since 3989 was 3966, checked in by ymipsl, 8 years ago

Update ICOSA_LMDZ configuration environnement for ADA

YM

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