1 | #!/bin/bash |
---|
2 | # Default options |
---|
3 | # |
---|
4 | # |
---|
5 | # |
---|
6 | date |
---|
7 | #### 1 Set up the compiling options |
---|
8 | #### Define some directories |
---|
9 | submitdir=$( pwd ) |
---|
10 | modipsl=$submitdir/../.. |
---|
11 | arch_path=$submitdir/ARCH |
---|
12 | mysrc_path=$submitdir/SOURCES |
---|
13 | export ROOT=$modipsl/modeles/DYNAMICO |
---|
14 | #### Set default options |
---|
15 | # Resolution if compiling LMDZ in regular mode without DYNAMICO |
---|
16 | # Use for example following "./compile_icolmdzor.sh -regular_latlon 144x142x79" |
---|
17 | regular_latlon=no |
---|
18 | # Atmospheric resolution, for LMDZ/ORCHIDEE in regular mode |
---|
19 | resol_atm=144x142x79 |
---|
20 | # Coupled with ocean biogeochemistry (y/n) |
---|
21 | nemotop=y |
---|
22 | # Optimization mode |
---|
23 | # optmode=prod/dev/debug |
---|
24 | optmode=prod |
---|
25 | # Resolution if compiling LMDZ in regular mode without DYNAMICO |
---|
26 | # Use for example following "./compile_icolmdzor.sh -regular_latlon 144x142x79" |
---|
27 | regular_latlon=no |
---|
28 | # fcm_arch |
---|
29 | fcm_arch=default |
---|
30 | # Default values to be overritten |
---|
31 | parallel=mpi_omp |
---|
32 | export fcm_arch parallel xios |
---|
33 | full_flag="" |
---|
34 | full_nemo=n |
---|
35 | full_inca="" |
---|
36 | full_xios="" |
---|
37 | full_lmdz="" |
---|
38 | full_orch="" |
---|
39 | full_dyna="" |
---|
40 | # choose radiative code compilation option |
---|
41 | rad=rrtm |
---|
42 | opt_rad="" |
---|
43 | |
---|
44 | # orchversion tells if ORCHIDEE_2_2 or ORCHIDEE_trunk is compiled. This is used as argument and also in the suffix of the executables. |
---|
45 | # orchcomp is the key word needed for LMDZ for the compilation of coherent interface. Only used internal to the compilation script. |
---|
46 | orchversion=orch22 |
---|
47 | orchcomp=orchidee2.1 |
---|
48 | |
---|
49 | # Default netcdf_lib is used for XIOS but can be change by argument |
---|
50 | netcdf_lib="" |
---|
51 | |
---|
52 | # Output text file for compilation of each component |
---|
53 | datestr=`LC_ALL=C date +"%Y%m%dT%H%M"` |
---|
54 | outfile=$submitdir/out_compile_ipslcm7.$datestr |
---|
55 | echo > $outfile |
---|
56 | echo; echo "Text output from compilation will be stored in file out_compile_ipslcm7.$datestr"; echo |
---|
57 | |
---|
58 | #### Read arguments |
---|
59 | # Loop over all arguments to modify default set up |
---|
60 | while (($# > 0)) ; do |
---|
61 | case $1 in |
---|
62 | "-h") cat <<end_help |
---|
63 | ######################################################################## |
---|
64 | # Usage of the script compile_ipslcm7.sh |
---|
65 | # |
---|
66 | ######################################################################## |
---|
67 | |
---|
68 | ./compile_ipslcm7.sh [Options] |
---|
69 | |
---|
70 | |
---|
71 | Options: [-full] Full recompilation of all components. This option can be added to all other options. |
---|
72 | [-cleannemo] Full recompilation of NEMO component only. |
---|
73 | [-regular_latlon] |
---|
74 | [-debug / -dev / -prod] Level of optimization. One of these can be added to all other compile options. Default: -prod. |
---|
75 | |
---|
76 | |
---|
77 | Example 1: Default compilation of IPSLCM7 for resolution LR |
---|
78 | (Resolution atmos: nbp40 ) |
---|
79 | ./compile_ipslcm7.sh |
---|
80 | |
---|
81 | Example 2: Default resolution (LR) compiled in debug mode |
---|
82 | ./compile_ipslcm7.sh -debug |
---|
83 | |
---|
84 | Example 3: Default compilation with full recompilation of all components. No clean is needed. |
---|
85 | ./compile_ipslcm7.sh -full |
---|
86 | |
---|
87 | Example 4: Compilation of LMDZ in regular lat-lon for dimension 144x142x79. |
---|
88 | The dimension can be changed to any other 3d dimension. DYNAMICO is also compiled as default. |
---|
89 | ./compile_ipslcm7.sh -regular_latlon 144x142x79 |
---|
90 | |
---|
91 | Example 5: Compiltion of ORCHIDEE_trunk version |
---|
92 | Note that for compiling ORCHIDEE trunk you must first have extracted ORCHIDEE_trunk folder in modeles. |
---|
93 | modeles/ORCHIDEE_2_2 folder can be kept at the same time. |
---|
94 | ./compile_ipslcm7.sh -orch4 |
---|
95 | ./compile_ipslcm7.sh -regular_latlon 144x142x79 -orch4 |
---|
96 | |
---|
97 | end_help |
---|
98 | exit;; |
---|
99 | |
---|
100 | "-parallel") parallel=$2 ; shift ; shift ;; |
---|
101 | "-arch") fcm_arch="$2" ; shift ; shift ;; |
---|
102 | "-debug") optmode=debug ; shift ;; |
---|
103 | "-dev") optmode=dev ; shift ;; |
---|
104 | "-prod") optmode=prod ; shift ;; |
---|
105 | "-regular_latlon") regular_latlon=yes ; resol_atm=$2 ; shift ; shift ;; |
---|
106 | "-full") full_flag="-full"; full_nemo=y ; full_xios="--full" ; full_lmdz="-full" ; full_orch="-full" ; shift ;; |
---|
107 | "-full_xios") full_xios="--full" ; shift ;; # Note only full_xios is using double dash: --full |
---|
108 | "-full_lmdz") full_lmdz="-full" ; shift ;; |
---|
109 | "-full_orch") full_orch="-full" ; shift ;; |
---|
110 | "-full_nemo") full_nemo=y ; shift ;; |
---|
111 | "-full_inca") full_inca="-clean"; shift ;; |
---|
112 | "-cleannemo") full_nemo=y ; shift ;; |
---|
113 | "-rad") rad=$2; shift ; shift ;; |
---|
114 | "-orch22") orchversion="orch22"; orchcomp=orchidee2.1; shift ; shift ;; |
---|
115 | "-orch4") orchversion="orch4"; orchcomp=orchideetrunk; shift ; shift ;; |
---|
116 | *) echo "unknown option "$1" , exiting..." ; exit |
---|
117 | esac |
---|
118 | done |
---|
119 | |
---|
120 | echo "Following options are set in current compiling:" >> $outfile |
---|
121 | echo " regular_latlon=$regular_latlon (if yes, then resol_atm=${resol_atm})" >> $outfile |
---|
122 | echo " resol_atm=${resol_atm}, resol_oce=${resol_oce}, icemodel=${icemodel}, nemotop=${nemotop}" >> $outfile |
---|
123 | echo " optmode = $optmode, parallel = $parallel, fcm_arch = $fcm_arch " >> $outfile |
---|
124 | echo " full_flag=$full_flag, full_xios=$full_xios, full_lmdz=$full_lmdz, full_orch=$full_orch, full_nemo=$full_nemo, full_dyna=$full_dyna" >> $outfile |
---|
125 | echo >> $outfile |
---|
126 | |
---|
127 | ### Read host dependent default values |
---|
128 | ### These variables will not be changed if they were set as argument |
---|
129 | ###./host.sh $host |
---|
130 | # Later : Following lines should be set in host.sh file |
---|
131 | # begin host.sh |
---|
132 | if [ $fcm_arch == default ] ; then |
---|
133 | # Find out current host and source specific paths and commands for the host |
---|
134 | case $( hostname -s ) in |
---|
135 | jean-zay*) |
---|
136 | fcm_arch=X64_JEANZAY;; |
---|
137 | irene170|irene171|irene190|irene191|irene192|irene193) |
---|
138 | fcm_arch=X64_IRENE;; |
---|
139 | irene172|irene173|irene194|irene195) |
---|
140 | fcm_arch=X64_IRENE-AMD;; |
---|
141 | asterix*|obelix*) |
---|
142 | fcm_arch=ifort_LSCE |
---|
143 | if [ "${parallel}" == "mpi_omp" ] ; then |
---|
144 | echo "Warning!! Currently at Obelix hybrid mode is not possible." |
---|
145 | echo " Option -parallel mpi_omp is now changed to -parallel mpi" |
---|
146 | echo "" |
---|
147 | parallel=mpi |
---|
148 | else |
---|
149 | echo "You used -parallel" $parallel |
---|
150 | fi ;; |
---|
151 | spirit*) |
---|
152 | fcm_arch=ifort_MESOIPSL;; |
---|
153 | ciclad*|climserv*|loholt*|camelot*) |
---|
154 | fcm_arch=ifort_CICLAD;; |
---|
155 | *) |
---|
156 | echo Current host is not known. You must use option -arch to specify which architecuture files to use. |
---|
157 | echo Exit now. |
---|
158 | exit |
---|
159 | esac |
---|
160 | fi |
---|
161 | |
---|
162 | # Set a link to arch.env if arch-${fcm_arch}.env file exist for current fcm_arch. |
---|
163 | # The link arch.env is also set in config.card and will be used by libIGCM to ensure the same running environnement. |
---|
164 | if [ -f ARCH/arch-${fcm_arch}.env ] ; then |
---|
165 | echo >> $outfile |
---|
166 | echo "The file ARCH/arch-${fcm_arch}.env will now be sourced with modules needed for compilation for all components." |
---|
167 | echo "Note that this new environement might be kept after compilation." |
---|
168 | echo "If this is the case, source again your personal environment after compilation." |
---|
169 | echo " Personal module list before sourcing of ARCH/arch.env file:" >> $outfile |
---|
170 | module list >> $outfile 2>&1 |
---|
171 | svn_version=$(module list -t | grep subversion) |
---|
172 | |
---|
173 | # Make a link to this file, to be used also in config.card |
---|
174 | rm -f ARCH/arch.env |
---|
175 | ln -s arch-${fcm_arch}.env ARCH/arch.env |
---|
176 | |
---|
177 | # Source the file |
---|
178 | source ARCH/arch.env >> $outfile 2>&1 |
---|
179 | if [ X$svn_version != X ] ; then |
---|
180 | module load ${svn_version} |
---|
181 | fi |
---|
182 | echo >> $outfile |
---|
183 | echo " New module list after sourcing of ARCH/arch.env file:" >> $outfile |
---|
184 | module list >> $outfile 2>&1 |
---|
185 | fi |
---|
186 | |
---|
187 | |
---|
188 | #### Clean if full_orch |
---|
189 | # If full recompilation of ORCHIDEE then first clean modipsl/lib folder |
---|
190 | if [ X${full_orch} == X"-full" ] ; then |
---|
191 | rm -f $modipsl/lib/* |
---|
192 | fi |
---|
193 | |
---|
194 | #### 2 Do the compilation |
---|
195 | ## 2.1 Compile ioipsl |
---|
196 | cd $modipsl/modeles/IOIPSL |
---|
197 | echo; echo "NOW COMPILE IOIPSL" |
---|
198 | echo >> $outfile ; echo " NOW COMPILE IOIPSL" >> $outfile |
---|
199 | |
---|
200 | echo ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile |
---|
201 | ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile 2>&1 |
---|
202 | # Test if compiling succeded |
---|
203 | if [[ $? != 0 ]] ; then |
---|
204 | echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP" |
---|
205 | exit |
---|
206 | fi |
---|
207 | |
---|
208 | ## 2.2 Compile oasis3-mct |
---|
209 | cd $modipsl/oasis3-mct/util/make_dir |
---|
210 | echo; echo "NOW COMPILE OASIS3-MCT" |
---|
211 | echo >> $outfile ; echo " NOW COMPILE OASIS3-MCT" >> $outfile |
---|
212 | cp $mysrc_path/OASIS3-MCT/make_${fcm_arch} make.inc |
---|
213 | |
---|
214 | echo make -f TopMakefileOasis3 >> $outfile |
---|
215 | make -f TopMakefileOasis3 >> $outfile 2>&1 |
---|
216 | |
---|
217 | |
---|
218 | ## 2.3 Compile xios |
---|
219 | cd $modipsl/modeles/XIOS |
---|
220 | echo; echo "NOW COMPILE XIOS" |
---|
221 | echo >> $outfile ; echo " NOW COMPILE XIOS" >> $outfile |
---|
222 | echo ./make_xios --use_oasis oasis3_mct --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios >> $outfile |
---|
223 | ./make_xios --use_oasis oasis3_mct --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios >> $outfile 2>&1 |
---|
224 | # Test if compiling succeded |
---|
225 | if [[ $? != 0 ]] ; then |
---|
226 | echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP" |
---|
227 | exit |
---|
228 | fi |
---|
229 | # Move executables to modipsl/bin |
---|
230 | if [ -f $modipsl/modeles/XIOS/bin/xios_server.exe ] ; then |
---|
231 | mv $modipsl/modeles/XIOS/bin/xios_server.exe $modipsl/bin/xios_server_${optmode}.exe |
---|
232 | else |
---|
233 | echo "THERE IS A PROBLEM IN XIOS COMPILATION EXECUTABLE MISSING - STOP" |
---|
234 | exit |
---|
235 | fi |
---|
236 | |
---|
237 | |
---|
238 | ## 2.4 Compile ORCHIDEE |
---|
239 | # Choose ORCHIDEE version to compile and create a link to generic folder name ORCHIDEE. |
---|
240 | # This link is needed for the compilation of ICOSA_LMDZ for it to find the orchidee librarie. |
---|
241 | cd $modipsl/modeles |
---|
242 | rm -f ORCHIDEE |
---|
243 | if [ $orchversion == orch22 ] ; then |
---|
244 | ln -s ORCHIDEE_2_2 ORCHIDEE |
---|
245 | cd $modipsl/modeles/ORCHIDEE_2_2 |
---|
246 | echo; echo "NOW COMPILE ORCHIDEE_2_2" |
---|
247 | echo >> $outfile ; echo " NOW COMPILE ORCHIDEE_2_2" >> $outfile |
---|
248 | else |
---|
249 | ln -s ORCHIDEE_trunk ORCHIDEE |
---|
250 | cd $modipsl/modeles/ORCHIDEE_trunk |
---|
251 | echo; echo "NOW COMPILE ORCHIDEE_trunk v4" |
---|
252 | echo >> $outfile ; echo " NOW COMPILE ORCHIDEE_trunk v4" >> $outfile |
---|
253 | fi |
---|
254 | |
---|
255 | # Check if the compilation of ORCHIDEE was previsouly interupted prematured. |
---|
256 | # In that case, the files fcm.bld.lock exist. If the file exist, it is here removed to avoid makeorchidee_fcm |
---|
257 | # to ask question and wait for interactivly answer from the user. |
---|
258 | if [ -f build/fcm.bld.lock ] ; then |
---|
259 | echo >> $outfile |
---|
260 | echo " WARNING!! The file ORCHIDEE/build/fcm.bld.lock exist. " >> $outfile |
---|
261 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
262 | echo " The file will now be removed. " >> $outfile |
---|
263 | echo >> $outfile |
---|
264 | rm -f build/fcm.bld.lock |
---|
265 | fi |
---|
266 | |
---|
267 | echo ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch >> $outfile |
---|
268 | ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch >> $outfile 2>&1 |
---|
269 | # Test if compiling finished |
---|
270 | if [[ $? != 0 ]] ; then |
---|
271 | echo "THERE IS A PROBLEM IN ORCHIDEE COMPILATION - STOP" |
---|
272 | exit |
---|
273 | fi |
---|
274 | |
---|
275 | # Rename exetubles for ORCHIDEE offline driver with suffix version |
---|
276 | cd $modipsl/bin |
---|
277 | if [ -f orchideedriver ] ; then mv orchideedriver orchideedriver.$orchversion ; fi |
---|
278 | if [ -f orchidee_ol ] ; then mv orchidee_ol orchidee_ol.$orchversion ; fi |
---|
279 | |
---|
280 | |
---|
281 | ## 2.5 Compile NEMO |
---|
282 | nemo_root=$modipsl/modeles/NEMO |
---|
283 | cfg_ref=ORCA2_ICE_PISCES |
---|
284 | cfg_wrk=ORCA_ICE_TRC |
---|
285 | addkeys="key_oasis3 key_top key_si3 key_isf" |
---|
286 | delkeys="" |
---|
287 | |
---|
288 | if [ ${nemotop} == n ] ; then |
---|
289 | cfg_wrk=ORCA_ICE |
---|
290 | delkeys="key_top" |
---|
291 | fi |
---|
292 | |
---|
293 | if [ ${nemotop} == n ] ; then |
---|
294 | echo; echo "NOW COMPILE NEMO with ice model SI3 without passive tracer model TOP" |
---|
295 | echo >> $outfile ; echo " NOW COMPILE NEMO with ice model SI3 without passive tracer model TOP" >> $outfile |
---|
296 | else |
---|
297 | echo; echo "NOW COMPILE NEMO with ice model SI3 and passive tracer model TOP" |
---|
298 | echo >> $outfile ; echo " NOW COMPILE NEMO with ice model SI3 and passive tracer model TOP" >> $outfile |
---|
299 | fi |
---|
300 | |
---|
301 | echo >> $outfile ; echo cd $nemo_root >> $outfile |
---|
302 | echo >> $outfile ; echo cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm arch/CNRS/. >> $outfile |
---|
303 | echo >> $outfile |
---|
304 | |
---|
305 | cd $nemo_root ; cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm arch/CNRS/. |
---|
306 | |
---|
307 | # creation of config |
---|
308 | echo >> $outfile ; echo cd $nemo_root >> $outfile |
---|
309 | echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j0 add_key "$addkeys" del_key "$delkeys" >> $outfile |
---|
310 | echo >> $outfile |
---|
311 | cd $nemo_root |
---|
312 | ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j0 add_key "$addkeys" del_key "$delkeys" >> $outfile 2>&1 |
---|
313 | |
---|
314 | |
---|
315 | # Copy of specfic source files |
---|
316 | echo >> $outfile ; echo cp $mysrc_path/NEMO/*.*90 $nemo_root/cfgs/$cfg_wrk/MY_SRC/. >> $outfile |
---|
317 | echo >> $outfile |
---|
318 | cp $mysrc_path/NEMO/*.*90 $nemo_root/cfgs/$cfg_wrk/MY_SRC/. |
---|
319 | |
---|
320 | |
---|
321 | if [ $full_nemo == y ] ; then |
---|
322 | # To make a full compilation, first make a clean to remove all files produced during previous compilation |
---|
323 | echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref clean >> $outfile |
---|
324 | echo >> $outfile |
---|
325 | ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref clean >> $outfile 2>&1 |
---|
326 | fi |
---|
327 | echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j8 >> $outfile |
---|
328 | echo >> $outfile |
---|
329 | ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j8 >> $outfile 2>&1 |
---|
330 | |
---|
331 | echo >> $outfile |
---|
332 | echo "Move nemo executable to modipsl/bin" >> $outfile |
---|
333 | echo ls -lrt $nemo_root/cfgs/$cfg_wrk/BLD/bin >> $outfile |
---|
334 | ls -lrt $nemo_root/cfgs/$cfg_wrk/BLD/bin >> $outfile |
---|
335 | echo >> $outfile |
---|
336 | |
---|
337 | if [ -f $nemo_root/cfgs/$cfg_wrk/BLD/bin/nemo.exe ] ; then |
---|
338 | mv $nemo_root/cfgs/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa_${optmode}.exe |
---|
339 | else |
---|
340 | echo "ERROR nemo.exe executable does not exist." |
---|
341 | echo "THERE IS A PROBLEM IN NEMO COMPILATION - STOP" |
---|
342 | exit |
---|
343 | fi |
---|
344 | |
---|
345 | |
---|
346 | ## 2.6 Compile LMDZ |
---|
347 | cd $modipsl/modeles/LMDZ |
---|
348 | # Compile LMDZ as library to couple to DYNAMICO |
---|
349 | echo; echo "NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO" |
---|
350 | echo >> $outfile ; echo " NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO" >> $outfile |
---|
351 | |
---|
352 | # Retrieve the final svn release number, needed for radiative code suffix of executable |
---|
353 | lmdzsvn=`svnversion . | egrep -o "[0-9]+" | awk 'NR==1'` |
---|
354 | # Temporary use of SOURCES/LMDZ to handle modifications needed by IPSLCM7 |
---|
355 | cp $mysrc_path/LMDZ/*.*90 libf/phylmd/. |
---|
356 | |
---|
357 | # Check if the compilation of LMDZ was previsouly interupted prematured. |
---|
358 | # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm |
---|
359 | # to ask question and wait for interactivly answer from the user. |
---|
360 | if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then |
---|
361 | echo >> $outfile |
---|
362 | echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. " >> $outfile |
---|
363 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
364 | echo " The files dimension.h and .lock will now be removed. " >> $outfile |
---|
365 | echo >> $outfile |
---|
366 | rm -f libf/grid/dimensions.h |
---|
367 | rm -f .lock |
---|
368 | fi |
---|
369 | |
---|
370 | # Need to define the proper option for radiative code compilation. By default, we use rrtm |
---|
371 | case $rad in |
---|
372 | oldrad) opt_rad="" ;; |
---|
373 | rrtm) if [ $lmdzsvn -le 4185 ] ; then opt_rad="-rrtm true" ; else opt_rad="-rad rrtm" ; fi ;; |
---|
374 | ecrad) opt_rad="-rad ecrad" ;; |
---|
375 | *) echo Only oldrad rrtm ecrad for rad option ; exit |
---|
376 | esac |
---|
377 | |
---|
378 | if [ $lmdzsvn -le 4185 -a $rad = "ecrad" ] ; then echo "ecrad only available for LMDZ rev starting with 4186 " ; exit ; fi |
---|
379 | |
---|
380 | echo ./makelmdz_fcm -p lmd -c OMCT $opt_rad -$optmode -mem -parallel $parallel -libphy -v $orchcomp -io xios -arch $fcm_arch -j 8 $full_lmdz >> $outfile |
---|
381 | ./makelmdz_fcm -p lmd -c OMCT $opt_rad -$optmode -mem -parallel $parallel -libphy -v $orchcomp -io xios -arch $fcm_arch -j 8 $full_lmdz >> $outfile 2>&1 |
---|
382 | # Test if compiling finished |
---|
383 | if [[ $? != 0 ]] ; then |
---|
384 | echo "THERE IS A PROBLEM IN LMDZ PHYSICS COMPILATION - STOP" |
---|
385 | exit |
---|
386 | fi |
---|
387 | |
---|
388 | |
---|
389 | ## 2.6 Compile DYNAMICO |
---|
390 | cd $modipsl/modeles/DYNAMICO |
---|
391 | echo; echo "NOW COMPILE DYNAMICO " |
---|
392 | echo >> $outfile ; echo " NOW COMPILE DYNAMICO" >> $outfile |
---|
393 | |
---|
394 | echo ./make_icosa -$optmode -with_fcm1 -parallel $parallel -external_ioipsl -with_oasis -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna >> $outfile |
---|
395 | ./make_icosa -$optmode -with_fcm1 -parallel $parallel -external_ioipsl -with_oasis -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna >> $outfile 2>&1 |
---|
396 | # Test if compiling finished |
---|
397 | if [[ $? != 0 ]] ; then |
---|
398 | echo "THERE IS A PROBLEM IN DYNAMICO COMPILATION - STOP" |
---|
399 | exit |
---|
400 | fi |
---|
401 | |
---|
402 | |
---|
403 | ## 2.7 Compile interface ICOSA_LMDZ |
---|
404 | cd $modipsl/modeles/ICOSA_LMDZ |
---|
405 | echo; echo "NOW COMPILE ICOSA_LMDZ " |
---|
406 | echo >> $outfile ; echo " NOW COMPILE ICOSA_LMDZ" >> $outfile |
---|
407 | |
---|
408 | echo ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel -with_oasis -with_orchidee -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna >> $outfile |
---|
409 | ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel -with_oasis -with_orchidee -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna >> $outfile 2>&1 |
---|
410 | # Test if compiling finished |
---|
411 | if [[ $? != 0 ]] ; then |
---|
412 | echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION - STOP" |
---|
413 | exit |
---|
414 | fi |
---|
415 | # Move executables to modipsl/bin |
---|
416 | if [ -f $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe ] ; then |
---|
417 | mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/icosa_lmdz_${orchversion}_${optmode}.exe |
---|
418 | else |
---|
419 | echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION EXECUTABLE MISSING - STOP" |
---|
420 | exit |
---|
421 | fi |
---|
422 | |
---|
423 | |
---|
424 | |
---|
425 | ## 2.8 Compile LMDZ for regular latlon configuration |
---|
426 | if [ $regular_latlon = yes ] ; then |
---|
427 | |
---|
428 | cd $modipsl/modeles/LMDZ |
---|
429 | # Compile LMDZ regular lat-lon exectuable |
---|
430 | echo; echo "NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" |
---|
431 | echo >> $outfile ; echo " NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" >> $outfile |
---|
432 | # Check if the compilation of LMDZ was previsouly interupted prematured. |
---|
433 | # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm |
---|
434 | # to ask question and wait for interactivly answer from the user. |
---|
435 | if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then |
---|
436 | echo >> $outfile |
---|
437 | echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. " >> $outfile |
---|
438 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
439 | echo " The files dimension.h and .lock will now be removed. " >> $outfile |
---|
440 | echo >> $outfile |
---|
441 | rm -f libf/grid/dimensions.h |
---|
442 | rm -f .lock |
---|
443 | fi |
---|
444 | echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -p lmd $opt_rad -$optmode -mem -parallel $parallel -io xios -v $orchcomp -arch $fcm_arch -j 8 $full_lmdz gcm >> $outfile |
---|
445 | ./makelmdz_fcm -d ${resol_atm} -c OMCT -p lmd $opt_rad -$optmode -mem -parallel $parallel -io xios -v $orchcomp -arch $fcm_arch -j 8 $full_lmdz gcm >> $outfile 2>&1 |
---|
446 | # Test if compiling finished |
---|
447 | if [[ $? != 0 ]] ; then |
---|
448 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
449 | exit |
---|
450 | fi |
---|
451 | |
---|
452 | # Find executable suffix |
---|
453 | suffix=_${resol_atm}_phylmd |
---|
454 | if [ $lmdzsvn -ge 4186 ] ; then suffix=${suffix}_${rad} ; fi |
---|
455 | if [ $parallel == seq ] || [ $parallel == none ] ; then |
---|
456 | suffix=${suffix}_seq_orch.e |
---|
457 | else |
---|
458 | suffix=${suffix}_para_mem_orch_couple.e |
---|
459 | fi |
---|
460 | echo gcm suffix = $suffix |
---|
461 | |
---|
462 | # Move executables to modipsl/bin folder |
---|
463 | echo "Move gcm.e executable to modipsl/bin" |
---|
464 | if [ -f $modipsl/modeles/LMDZ/bin/gcm${suffix} ] ; then |
---|
465 | mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${orchversion}_${optmode}.e |
---|
466 | else |
---|
467 | echo "ERROR gcm${suffix} executable does not exist." |
---|
468 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
469 | exit |
---|
470 | fi |
---|
471 | |
---|
472 | # Compile ce0l initialization program for LMDZ regular lat-lon exectuable |
---|
473 | echo; echo "NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" |
---|
474 | echo >> $outfile ; echo " NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" >> $outfile |
---|
475 | |
---|
476 | echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v $orchcomp -arch $fcm_arch -j 8 $full_lmdz ce0l >> $outfile |
---|
477 | ./makelmdz_fcm -d ${resol_atm} -c OMCT -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v $orchcomp -arch $fcm_arch -j 8 $full_lmdz ce0l >> $outfile 2>&1 |
---|
478 | # Test if compiling finished |
---|
479 | if [[ $? != 0 ]] ; then |
---|
480 | echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP" |
---|
481 | exit |
---|
482 | fi |
---|
483 | |
---|
484 | |
---|
485 | # Move executable ce0l to modipsl/bin folder |
---|
486 | echo "Move ce0l executable to modipsl/bin" |
---|
487 | if [ -f $modipsl/modeles/LMDZ/bin/ce0l${suffix} ] ; then |
---|
488 | mv $modipsl/modeles/LMDZ/bin/ce0l${suffix} $modipsl/bin/ce0l_${resol_atm}_${optmode}.e |
---|
489 | else |
---|
490 | echo "ERROR ce0l${suffix} executable does not exist." |
---|
491 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
492 | exit |
---|
493 | fi |
---|
494 | fi |
---|
495 | |
---|
496 | echo >>$outfile ; echo "ALL COMPILING FINISHED" >> $outfile |
---|
497 | echo ls -lrt modipsl/bin >> $outfile |
---|
498 | ls -lrt $modipsl/bin >> $outfile |
---|
499 | |
---|
500 | echo; echo "ALL COMPILING FINISHED" ; echo |
---|
501 | echo "Executables are found in modipsl/bin" |
---|
502 | echo "Check that executable names correspond with the name set in config.card before launching the job" |
---|
503 | echo ls -lrt modipsl/bin |
---|
504 | ls -lrt $modipsl/bin |
---|
505 | |
---|
506 | date |
---|
507 | |
---|
508 | exit |
---|
509 | |
---|
510 | |
---|