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/IOIPSL |
---|
14 | #### Set default options |
---|
15 | # Activate compilation of LMDZ for regular latlon grid without DYNAMICO |
---|
16 | regular_latlon=y |
---|
17 | # Atmospheric resolution for regular grid for LMDZ/ORCHIDEE, if regular_latlon=y |
---|
18 | resol_atm=144x142x79 |
---|
19 | # Coupled with ocean biogeochemistry (y/n) |
---|
20 | nemotop=y |
---|
21 | # Optimization mode |
---|
22 | # optmode=prod/dev/debug |
---|
23 | optmode=prod |
---|
24 | # fcm_arch |
---|
25 | fcm_arch=default |
---|
26 | # Default values to be overritten |
---|
27 | parallel=mpi_omp |
---|
28 | export fcm_arch parallel xios |
---|
29 | full_flag="" |
---|
30 | full_nemo=n |
---|
31 | full_inca="" |
---|
32 | full_xios="" |
---|
33 | full_lmdz="" |
---|
34 | full_orch="" |
---|
35 | full_dyna="" |
---|
36 | full_oasis=n |
---|
37 | # choose radiative code compilation option |
---|
38 | rad=rrtm |
---|
39 | opt_rad="" |
---|
40 | #choose chemistry inca configuration |
---|
41 | optchimie=GES |
---|
42 | |
---|
43 | # subconfig : which sub-configuration to compile. By default, the full extracted configuration is compiled. |
---|
44 | subconfig=default |
---|
45 | |
---|
46 | # orchversion tells if ORCHIDEE_2_2 or ORCHIDEE_4 is compiled. This is used as argument and also in the suffix of the executables. |
---|
47 | orchversion=orch22 |
---|
48 | # orchdriver : Permet to compile the ORCHIDEE offline drivers. This option is activated by setting -orchdriver as argument. |
---|
49 | # Drivers are now compiled by default |
---|
50 | orchdriver="-driver" |
---|
51 | |
---|
52 | # Default netcdf_lib is used for XIOS but can be change by argument |
---|
53 | netcdf_lib="" |
---|
54 | |
---|
55 | # Output text file for compilation of each component |
---|
56 | datestr=`LC_ALL=C date +"%Y%m%dT%H%M"` |
---|
57 | outfile=$submitdir/out_compile_ipslcm7.$datestr |
---|
58 | echo > $outfile |
---|
59 | echo; echo "Text output from compilation will be stored in file out_compile_ipslcm7.$datestr"; echo |
---|
60 | |
---|
61 | |
---|
62 | rm -f out_compile_ipslcm7 |
---|
63 | ln -s ${outfile} out_compile_ipslcm7 |
---|
64 | |
---|
65 | |
---|
66 | #### Read arguments |
---|
67 | # Loop over all arguments to modify default set up |
---|
68 | while (($# > 0)) ; do |
---|
69 | case $1 in |
---|
70 | "-h"|"-help") cat <<end_help |
---|
71 | ######################################################################## |
---|
72 | # Usage of the script compile_ipslcm7.sh |
---|
73 | # |
---|
74 | ######################################################################## |
---|
75 | |
---|
76 | ./compile_ipslcm7.sh [Options] |
---|
77 | |
---|
78 | Description of all options: |
---|
79 | |
---|
80 | [-full] Full recompilation of all components. This option can be added to all other options. |
---|
81 | [-cleannemo] Full recompilation of NEMO component only. |
---|
82 | [-regular_latlon yes/no] Activate or deactivate compilation of LMDZ dynamics for regular latlon grid. |
---|
83 | Default resol_atm size is used. This option is set in addition to the compilation of the icosahedric grid. |
---|
84 | [-resol_atm XXXxYYYxZZ] Define which regular grid to compile. A default grid is set if this option is not used. |
---|
85 | [-debug / -dev / -prod] Level of optimization. One of these can be added to all other compile options. Default: -prod. |
---|
86 | [-subconfig X] Set this option if you want to compile a sub-configuration. X can be one of following sub-configurations : |
---|
87 | ICOLMDZORINCA, ICOLMDZOR, LMDZORINCA, LMDZOR, IPSLCM-reg or IPSLCM |
---|
88 | By default, all available components are compiled. |
---|
89 | [-orch4 / -orch22] Choice of ORCHIDEE version. The source code are found in modeles/ORCHIDEE_4 or modeles/ORCHIDEE_2_2 |
---|
90 | and a link will be set to the choosen model version. Default version is currently ORCHIDEE_2_2 (-orch22). |
---|
91 | [-orchdriver] Activate compilation of orchidee offline drivers |
---|
92 | |
---|
93 | Example 1: Default compilation of IPSLCM7 |
---|
94 | ./compile_ipslcm7.sh |
---|
95 | |
---|
96 | Example 2: Default compilation in debug mode |
---|
97 | ./compile_ipslcm7.sh -debug |
---|
98 | |
---|
99 | Example 3: Default compilation with full recompilation of all components. No clean is needed. |
---|
100 | ./compile_ipslcm7.sh -full |
---|
101 | |
---|
102 | Example 4: Compilation in addition of LMDZ in regular lat-lon for a specific resolution : |
---|
103 | ./compile_ipslcm7.sh -resol_atm 144x142x95 |
---|
104 | |
---|
105 | Example 5: Compilation without regular grid (only icosaedric grid) |
---|
106 | ./compile_ipslcm7.sh -regular_latlon no |
---|
107 | |
---|
108 | Example 5: Compilation of ORCHIDEE_4 version |
---|
109 | ./compile_ipslcm7.sh -orch4 |
---|
110 | |
---|
111 | Example 6: compilation of a specific chemistry for INCA (default is GES) |
---|
112 | ./compile_ipslcm7.sh -chimie NMHC_AER_S |
---|
113 | |
---|
114 | Example 7: Compilation of sub-configuration LMDZOR : |
---|
115 | ./compile_ipslcm7.sh -subconfig LMDZOR |
---|
116 | |
---|
117 | end_help |
---|
118 | exit;; |
---|
119 | |
---|
120 | "-parallel") parallel=$2 ; shift ; shift ;; |
---|
121 | "-arch") fcm_arch="$2" ; shift ; shift ;; |
---|
122 | "-debug") optmode=debug ; shift ;; |
---|
123 | "-dev") optmode=dev ; shift ;; |
---|
124 | "-prod") optmode=prod ; shift ;; |
---|
125 | "-regular_latlon") regular_latlon=$2 ; shift ; shift ;; |
---|
126 | "-resol_atm") regular_latlon=y ; resol_atm=$2 ; shift ; shift ;; |
---|
127 | "-subconfig") subconfig=$2 ; shift ; shift ;; |
---|
128 | "-full") full_flag="-full"; full_nemo=y ; full_xios="--full" ; full_lmdz="-full" ; full_orch="-full" ; full_oasis=y ; full_inca="-clean" ; full_dyna="-full" ; shift ;; |
---|
129 | "-full_xios") full_xios="--full" ; shift ;; # Note only full_xios is using double dash: --full |
---|
130 | "-full_lmdz") full_lmdz="-full" ; shift ;; |
---|
131 | "-full_orch") full_orch="-full" ; shift ;; |
---|
132 | "-full_nemo") full_nemo=y ; shift ;; |
---|
133 | "-full_inca") full_inca="-clean"; shift ;; |
---|
134 | "-full_dyna") full_dyna="-full" ; shift ;; |
---|
135 | "-full_oasis") full_oasis=y ; shift ;; |
---|
136 | "-cleannemo") full_nemo=y ; shift ;; |
---|
137 | "-rad") rad=$2; shift ; shift ;; |
---|
138 | "-orch22") orchversion="orch22"; shift ;; |
---|
139 | "-orch4") orchversion="orch4"; shift ;; |
---|
140 | "-orchdriver") orchdriver="-driver"; shift ;; |
---|
141 | "-chimie") optchimie=$2; shift ; shift;; |
---|
142 | *) echo "unknown option "$1" , exiting..." ; exit |
---|
143 | esac |
---|
144 | done |
---|
145 | |
---|
146 | |
---|
147 | # Define which sub-configuration to compile. By default all extracted source components are compiled. |
---|
148 | source define_config.sh |
---|
149 | |
---|
150 | echo "Following options are set in current compiling:" >> $outfile |
---|
151 | echo " regular_latlon=$regular_latlon (if yes, then resol_atm=${resol_atm})" >> $outfile |
---|
152 | echo " resol_atm=${resol_atm}, nemotop=${nemotop}" >> $outfile |
---|
153 | echo " optmode = $optmode, parallel = $parallel, fcm_arch = $fcm_arch " >> $outfile |
---|
154 | 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, full_oasis=$full_oasis" >> $outfile |
---|
155 | echo " compinca=$compinca compnemo=$compnemo compoasis=$compoasis compdyna=$compdyna complmdz=y comporch=y compxios=y" >> $outfile |
---|
156 | echo >> $outfile |
---|
157 | ### Verification of argument |
---|
158 | # Set argorch depeinding on the version of ORCHIDEE. This is argument needed for the compilation of LMDZ to consider coherent interface. |
---|
159 | if [ $orchversion == orch22 ] ; then |
---|
160 | argorch=orchidee2.1 |
---|
161 | elif [ $orchversion == orch4 ] ; then |
---|
162 | argorch=orchideetrunk |
---|
163 | else |
---|
164 | echo "ERROR in version of ORCHIDEE. It is only possible to have orch22 or orch4 for now" |
---|
165 | fi |
---|
166 | |
---|
167 | ### Read host dependent default values |
---|
168 | ### These variables will not be changed if they were set as argument |
---|
169 | ###./host.sh $host |
---|
170 | # Later : Following lines should be set in host.sh file |
---|
171 | # begin host.sh |
---|
172 | if [ $fcm_arch == default ] ; then |
---|
173 | # Find out current host and source specific paths and commands for the host |
---|
174 | case $( hostname -s ) in |
---|
175 | jean-zay*) |
---|
176 | if [[ $( hostname -s ) != *"pp"* ]] ; then |
---|
177 | echo "Warning! You MUST compile on jean-zay-pp." |
---|
178 | echo "EXIT" |
---|
179 | exit |
---|
180 | else |
---|
181 | fcm_arch=X64_JEANZAY |
---|
182 | fi ;; |
---|
183 | irene170|irene171|irene190|irene191|irene192|irene193) |
---|
184 | fcm_arch=X64_IRENE;; |
---|
185 | irene172|irene173|irene194|irene195) |
---|
186 | fcm_arch=X64_IRENE-AMD;; |
---|
187 | asterix*|obelix*) |
---|
188 | fcm_arch=ifort_LSCE |
---|
189 | if [ "${parallel}" == "mpi_omp" ] ; then |
---|
190 | echo "Warning!! Currently at Obelix hybrid mode is not possible." |
---|
191 | echo " Option -parallel mpi_omp is now changed to -parallel mpi" |
---|
192 | echo "" |
---|
193 | parallel=mpi |
---|
194 | else |
---|
195 | echo "You used -parallel" $parallel |
---|
196 | fi ;; |
---|
197 | spirit*) |
---|
198 | fcm_arch=ifort_MESOIPSL;; |
---|
199 | ciclad*|climserv*|loholt*|camelot*) |
---|
200 | fcm_arch=ifort_CICLAD;; |
---|
201 | *) |
---|
202 | echo Current host is not known. You must use option -arch to specify which architecuture files to use. |
---|
203 | echo Exit now. |
---|
204 | exit |
---|
205 | esac |
---|
206 | fi |
---|
207 | |
---|
208 | # Set a link to arch.env if arch-${fcm_arch}.env file exist for current fcm_arch. |
---|
209 | # The link arch.env is also set in config.card and will be used by libIGCM to ensure the same running environnement. |
---|
210 | if [ -f ARCH/arch-${fcm_arch}.env ] ; then |
---|
211 | echo >> $outfile |
---|
212 | echo "The file ARCH/arch-${fcm_arch}.env will now be sourced with modules needed for compilation for all components." |
---|
213 | echo "Note that this new environement might be kept after compilation." |
---|
214 | echo "If this is the case, source again your personal environment after compilation." |
---|
215 | echo " Personal module list before sourcing of ARCH/arch.env file:" >> $outfile |
---|
216 | module list >> $outfile 2>&1 |
---|
217 | svn_version=$(module list -t | grep subversion) |
---|
218 | |
---|
219 | # Make a link to this file, to be used also in config.card |
---|
220 | rm -f ARCH/arch.env |
---|
221 | ln -s arch-${fcm_arch}.env ARCH/arch.env |
---|
222 | |
---|
223 | # Source the file |
---|
224 | source ARCH/arch.env >> $outfile 2>&1 |
---|
225 | if [ X$svn_version != X ] ; then |
---|
226 | module load ${svn_version} |
---|
227 | fi |
---|
228 | echo >> $outfile |
---|
229 | echo " New module list after sourcing of ARCH/arch.env file:" >> $outfile |
---|
230 | module list >> $outfile 2>&1 |
---|
231 | fi |
---|
232 | |
---|
233 | |
---|
234 | #### Clean if full_orch |
---|
235 | # If full recompilation of ORCHIDEE then first clean modipsl/lib folder |
---|
236 | if [ X${full_orch} == X"-full" ] ; then |
---|
237 | rm -f $modipsl/lib/* |
---|
238 | fi |
---|
239 | |
---|
240 | #### 2 Do the compilation |
---|
241 | ## 2.1 Compile ioipsl |
---|
242 | cd $modipsl/modeles/IOIPSL |
---|
243 | echo; echo "NOW COMPILE IOIPSL" |
---|
244 | echo >> $outfile ; echo " NOW COMPILE IOIPSL" >> $outfile |
---|
245 | |
---|
246 | echo ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile |
---|
247 | ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag >> $outfile 2>&1 |
---|
248 | # Test if compiling succeded |
---|
249 | if [[ $? != 0 ]] ; then |
---|
250 | echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP" |
---|
251 | exit |
---|
252 | fi |
---|
253 | |
---|
254 | if [ $compoasis == y ] ; then |
---|
255 | ## 2.2 Compile oasis3-mct |
---|
256 | if [ $full_oasis == y ] ; then |
---|
257 | rm -rf $modipsl/oasis3-mct/BLD |
---|
258 | fi |
---|
259 | cd $modipsl/oasis3-mct/util/make_dir |
---|
260 | echo; echo "NOW COMPILE OASIS3-MCT" |
---|
261 | echo >> $outfile ; echo " NOW COMPILE OASIS3-MCT" >> $outfile |
---|
262 | cp $mysrc_path/OASIS3-MCT/make_${fcm_arch} make.inc |
---|
263 | |
---|
264 | echo make -f TopMakefileOasis3 >> $outfile |
---|
265 | make -f TopMakefileOasis3 >> $outfile 2>&1 |
---|
266 | if [[ $? != 0 ]] ; then |
---|
267 | echo "THERE IS A PROBLEM IN OASIS COMPILATION - STOP" |
---|
268 | exit |
---|
269 | fi |
---|
270 | |
---|
271 | |
---|
272 | else |
---|
273 | echo ; echo No compilation of OASIS |
---|
274 | fi |
---|
275 | |
---|
276 | ## 2.3 Compile xios |
---|
277 | cd $modipsl/modeles/XIOS |
---|
278 | echo; echo "NOW COMPILE XIOS" |
---|
279 | echo >> $outfile ; echo " NOW COMPILE XIOS" >> $outfile |
---|
280 | if [ $compoasis == y ] ; then |
---|
281 | argoasis="--use_oasis oasis3_mct " |
---|
282 | else |
---|
283 | argoasis=" " |
---|
284 | fi |
---|
285 | echo ./make_xios $argoasis --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios >> $outfile |
---|
286 | ./make_xios $argoasis --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios >> $outfile 2>&1 |
---|
287 | # Test if compiling succeded |
---|
288 | if [[ $? != 0 ]] ; then |
---|
289 | echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP" |
---|
290 | exit |
---|
291 | fi |
---|
292 | # Move executables to modipsl/bin |
---|
293 | if [ -f $modipsl/modeles/XIOS/bin/xios_server.exe ] ; then |
---|
294 | mv $modipsl/modeles/XIOS/bin/xios_server.exe $modipsl/bin/xios_server_${optmode}.exe |
---|
295 | else |
---|
296 | echo "THERE IS A PROBLEM IN XIOS COMPILATION EXECUTABLE MISSING - STOP" |
---|
297 | exit |
---|
298 | fi |
---|
299 | |
---|
300 | |
---|
301 | ## 2.4 Compile ORCHIDEE |
---|
302 | # Choose ORCHIDEE version to compile and create a link to generic folder name ORCHIDEE. |
---|
303 | # This link is needed for the compilation of ICOSA_LMDZ for it to find the orchidee librarie. |
---|
304 | cd $modipsl/modeles |
---|
305 | rm -f ORCHIDEE |
---|
306 | if [ $orchversion == orch22 ] ; then |
---|
307 | ln -s ORCHIDEE_2_2 ORCHIDEE |
---|
308 | cd $modipsl/modeles/ORCHIDEE_2_2 |
---|
309 | echo; echo "NOW COMPILE ORCHIDEE_2_2" |
---|
310 | echo >> $outfile ; echo " NOW COMPILE ORCHIDEE_2_2" >> $outfile |
---|
311 | else |
---|
312 | ln -s ORCHIDEE_4 ORCHIDEE |
---|
313 | cd $modipsl/modeles/ORCHIDEE_4 |
---|
314 | echo; echo "NOW COMPILE ORCHIDEE_4 (trunk)" |
---|
315 | echo >> $outfile ; echo " NOW COMPILE ORCHIDEE_4 (trunk)" >> $outfile |
---|
316 | fi |
---|
317 | |
---|
318 | # Check if the compilation of ORCHIDEE was previsouly interupted prematured. |
---|
319 | # In that case, the files fcm.bld.lock exist. If the file exist, it is here removed to avoid makeorchidee_fcm |
---|
320 | # to ask question and wait for interactivly answer from the user. |
---|
321 | if [ -f build/fcm.bld.lock ] ; then |
---|
322 | echo >> $outfile |
---|
323 | echo " WARNING!! The file ORCHIDEE/build/fcm.bld.lock exist. " >> $outfile |
---|
324 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
325 | echo " The file will now be removed. " >> $outfile |
---|
326 | echo >> $outfile |
---|
327 | rm -f build/fcm.bld.lock |
---|
328 | fi |
---|
329 | |
---|
330 | if [ $compoasis == y ] ; then |
---|
331 | # For this case, XIOS library needs to be linked with OASIS library |
---|
332 | argoasis="-linkwithoasis" |
---|
333 | else |
---|
334 | argoasis="" |
---|
335 | fi |
---|
336 | |
---|
337 | echo ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path ${argoasis} $full_orch $orchdriver >> $outfile |
---|
338 | ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path ${argoasis} $full_orch $orchdriver >> $outfile 2>&1 |
---|
339 | # Test if compiling finished |
---|
340 | if [[ $? != 0 ]] ; then |
---|
341 | echo "THERE IS A PROBLEM IN ORCHIDEE COMPILATION - STOP" |
---|
342 | exit |
---|
343 | fi |
---|
344 | |
---|
345 | # Rename exetubles for ORCHIDEE offline driver with suffix version |
---|
346 | cd $modipsl/bin |
---|
347 | if [ -f orchideedriver ] ; then |
---|
348 | mv orchideedriver orchideedriver.${orchversion}_$optmode |
---|
349 | ln -sf orchideedriver.${orchversion}_$optmode orchideedriver_$optmode |
---|
350 | fi |
---|
351 | if [ -f orchidee_ol ] ; then |
---|
352 | mv orchidee_ol orchidee_ol.${orchversion}_$optmode |
---|
353 | ln -sf orchidee_ol.${orchversion}_$optmode orchidee_ol_$optmode |
---|
354 | fi |
---|
355 | |
---|
356 | ## 2.5 Compile NEMO |
---|
357 | if [ $compnemo == y ] ; then |
---|
358 | nemo_root=$modipsl/modeles/NEMO |
---|
359 | cfg_ref=ORCA2_ICE_PISCES |
---|
360 | cfg_wrk=ORCA_ICE_TRC |
---|
361 | addkeys="key_oasis3 key_top key_si3 key_isf" |
---|
362 | delkeys="" |
---|
363 | |
---|
364 | if [ ${nemotop} == n ] ; then |
---|
365 | cfg_wrk=ORCA_ICE |
---|
366 | delkeys="key_top" |
---|
367 | fi |
---|
368 | |
---|
369 | if [ ${nemotop} == n ] ; then |
---|
370 | echo; echo "NOW COMPILE NEMO with ice model SI3 without passive tracer model TOP" |
---|
371 | echo >> $outfile ; echo " NOW COMPILE NEMO with ice model SI3 without passive tracer model TOP" >> $outfile |
---|
372 | else |
---|
373 | echo; echo "NOW COMPILE NEMO with ice model SI3 and passive tracer model TOP" |
---|
374 | echo >> $outfile ; echo " NOW COMPILE NEMO with ice model SI3 and passive tracer model TOP" >> $outfile |
---|
375 | fi |
---|
376 | |
---|
377 | echo >> $outfile ; echo cd $nemo_root >> $outfile |
---|
378 | echo >> $outfile ; echo cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm arch/CNRS/. >> $outfile |
---|
379 | echo >> $outfile |
---|
380 | |
---|
381 | cd $nemo_root ; cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm arch/CNRS/. |
---|
382 | |
---|
383 | # creation of config |
---|
384 | echo >> $outfile ; echo cd $nemo_root >> $outfile |
---|
385 | echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j0 add_key "$addkeys" del_key "$delkeys" >> $outfile |
---|
386 | echo >> $outfile |
---|
387 | cd $nemo_root |
---|
388 | ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j0 add_key "$addkeys" del_key "$delkeys" >> $outfile 2>&1 |
---|
389 | |
---|
390 | |
---|
391 | # Copy of specfic source files |
---|
392 | echo >> $outfile ; echo cp $mysrc_path/NEMO/*.*90 $nemo_root/cfgs/$cfg_wrk/MY_SRC/. >> $outfile |
---|
393 | echo >> $outfile |
---|
394 | cp $mysrc_path/NEMO/*.*90 $nemo_root/cfgs/$cfg_wrk/MY_SRC/. |
---|
395 | |
---|
396 | |
---|
397 | if [ $full_nemo == y ] ; then |
---|
398 | # To make a full compilation, first make a clean to remove all files produced during previous compilation |
---|
399 | echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref clean >> $outfile |
---|
400 | echo >> $outfile |
---|
401 | ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref clean >> $outfile 2>&1 |
---|
402 | fi |
---|
403 | echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j8 >> $outfile |
---|
404 | echo >> $outfile |
---|
405 | ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j8 >> $outfile 2>&1 |
---|
406 | |
---|
407 | echo >> $outfile |
---|
408 | echo "Move nemo executable to modipsl/bin" >> $outfile |
---|
409 | echo ls -lrt $nemo_root/cfgs/$cfg_wrk/BLD/bin >> $outfile |
---|
410 | ls -lrt $nemo_root/cfgs/$cfg_wrk/BLD/bin >> $outfile |
---|
411 | echo >> $outfile |
---|
412 | |
---|
413 | if [ -f $nemo_root/cfgs/$cfg_wrk/BLD/bin/nemo.exe ] ; then |
---|
414 | mv $nemo_root/cfgs/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa_${optmode}.exe |
---|
415 | else |
---|
416 | echo "ERROR nemo.exe executable does not exist." |
---|
417 | echo "THERE IS A PROBLEM IN NEMO COMPILATION - STOP" |
---|
418 | exit |
---|
419 | fi |
---|
420 | |
---|
421 | else |
---|
422 | echo ; echo No compilation of NEMO |
---|
423 | fi |
---|
424 | |
---|
425 | ##2.6 Compile INCA |
---|
426 | if [ $compinca == y ] ; then |
---|
427 | cd $modipsl/modeles/INCA |
---|
428 | |
---|
429 | echo; echo "NOW COMPILE INCA ${optchimie}" |
---|
430 | echo >> $outfile ; echo " NOW COMPILE INCA ${optchimie}" >> $outfile |
---|
431 | |
---|
432 | echo ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_inca >> $outfile |
---|
433 | ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch} -arch_path $arch_path $full_inca >> $outfile 2>&1 |
---|
434 | |
---|
435 | # Test if compiling finished |
---|
436 | if [[ $? != 0 ]] ; then |
---|
437 | echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP" |
---|
438 | echo "ALL INFORMATION IN FILE $outfile" |
---|
439 | exit |
---|
440 | fi |
---|
441 | |
---|
442 | echo "Move inca.dat modipsl/bin" |
---|
443 | if [[ -f $modipsl/modeles/INCA/SIMULATIONS/${optchimie}/inca.dat ]] ; then |
---|
444 | mv $modipsl/modeles/INCA/SIMULATIONS/${optchimie}/inca.dat $modipsl/bin/inca_${optchimie}.dat ; |
---|
445 | else |
---|
446 | echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP" |
---|
447 | echo "ALL INFORMATION IN FILE $outfile" |
---|
448 | exit |
---|
449 | fi |
---|
450 | |
---|
451 | echo "Move tracer.def to modipsl/bin" |
---|
452 | if [[ -f $modipsl/modeles/INCA/tracer.def ]] ; then |
---|
453 | mv $modipsl/modeles/INCA/tracer.def $modipsl/bin/tracer_${optchimie}.def ; |
---|
454 | fi |
---|
455 | |
---|
456 | else |
---|
457 | echo ; echo No compilation of INCA |
---|
458 | fi |
---|
459 | |
---|
460 | ## 2.7 Compile LMDZ |
---|
461 | cd $modipsl/modeles/LMDZ |
---|
462 | |
---|
463 | # Temporary use of SOURCES/LMDZ to handle modifications needed by IPSLCM7 for LMDZ 4876 |
---|
464 | # To be removed for newer versions of LMDZ |
---|
465 | ln -sf $mysrc_path/LMDZ/phylmd/*.*90 libf/phylmd/. |
---|
466 | |
---|
467 | # Compile LMDZ as library to couple to DYNAMICO |
---|
468 | if [ $compdyna == y ] ; then |
---|
469 | echo; echo "NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO" |
---|
470 | echo >> $outfile ; echo " NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO" >> $outfile |
---|
471 | |
---|
472 | |
---|
473 | # Check if the compilation of LMDZ was previsouly interupted prematured. |
---|
474 | # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm |
---|
475 | # to ask question and wait for interactivly answer from the user. |
---|
476 | if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then |
---|
477 | echo >> $outfile |
---|
478 | echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. " >> $outfile |
---|
479 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
480 | echo " The files dimension.h and .lock will now be removed. " >> $outfile |
---|
481 | echo >> $outfile |
---|
482 | rm -f libf/grid/dimensions.h |
---|
483 | rm -f .lock |
---|
484 | fi |
---|
485 | |
---|
486 | # Need to define the proper option for radiative code compilation. By default, we use rrtm |
---|
487 | case $rad in |
---|
488 | oldrad) opt_rad="" ;; |
---|
489 | rrtm) opt_rad="-rad rrtm" ;; |
---|
490 | ecrad) opt_rad="-rad ecrad" ;; |
---|
491 | *) echo Only oldrad rrtm ecrad for rad option ; exit |
---|
492 | esac |
---|
493 | |
---|
494 | |
---|
495 | if [ $compinca == y ] ; then |
---|
496 | arginca="-chimie INCA " |
---|
497 | else |
---|
498 | arginca=" " |
---|
499 | fi |
---|
500 | |
---|
501 | if [ $compoasis == y ] ; then |
---|
502 | argoasis="-c OMCT " |
---|
503 | else |
---|
504 | argoasis=" " |
---|
505 | fi |
---|
506 | |
---|
507 | echo ./makelmdz_fcm -p lmd $argoasis $opt_rad -$optmode -mem -parallel $parallel -libphy -v $argorch $arginca -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz >> $outfile |
---|
508 | ./makelmdz_fcm -p lmd $argoasis $opt_rad -$optmode -mem -parallel $parallel -libphy -v $argorch $arginca -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz >> $outfile 2>&1 |
---|
509 | |
---|
510 | |
---|
511 | # Test if compiling finished |
---|
512 | if [[ $? != 0 ]] ; then |
---|
513 | echo "THERE IS A PROBLEM IN LMDZ PHYSICS COMPILATION - STOP" |
---|
514 | exit |
---|
515 | fi |
---|
516 | fi |
---|
517 | |
---|
518 | |
---|
519 | ## 2.8 Compile DYNAMICO |
---|
520 | if [ $compdyna == y ] ; then |
---|
521 | cd $modipsl/modeles/DYNAMICO |
---|
522 | echo; echo "NOW COMPILE DYNAMICO " |
---|
523 | echo >> $outfile ; echo " NOW COMPILE DYNAMICO" >> $outfile |
---|
524 | |
---|
525 | if [ $compoasis == y ] ; then |
---|
526 | argoasis="-with_oasis " |
---|
527 | else |
---|
528 | argoasis=" " |
---|
529 | fi |
---|
530 | if [ $compinca == y ] ; then |
---|
531 | arginca="-with_inca " |
---|
532 | else |
---|
533 | arginca=" " |
---|
534 | fi |
---|
535 | |
---|
536 | |
---|
537 | echo ./make_icosa -$optmode -parallel $parallel -external_ioipsl $argoasis -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna >> $outfile |
---|
538 | ./make_icosa -$optmode -parallel $parallel -external_ioipsl $argoasis -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna >> $outfile 2>&1 |
---|
539 | # Test if compiling finished |
---|
540 | if [[ $? != 0 ]] ; then |
---|
541 | echo "THERE IS A PROBLEM IN DYNAMICO COMPILATION - STOP" |
---|
542 | exit |
---|
543 | fi |
---|
544 | fi |
---|
545 | |
---|
546 | ## 2.9 Compile interface ICOSA_LMDZ |
---|
547 | if [ $compdyna == y ] ; then |
---|
548 | cd $modipsl/modeles/ICOSA_LMDZ |
---|
549 | echo; echo "NOW COMPILE ICOSA_LMDZ " |
---|
550 | echo >> $outfile ; echo " NOW COMPILE ICOSA_LMDZ" >> $outfile |
---|
551 | |
---|
552 | echo ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel $argoasis -with_orchidee $arginca -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna >> $outfile |
---|
553 | ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel $argoasis -with_orchidee $arginca -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna >> $outfile 2>&1 |
---|
554 | # Test if compiling finished |
---|
555 | if [[ $? != 0 ]] ; then |
---|
556 | echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION - STOP" |
---|
557 | exit |
---|
558 | fi |
---|
559 | # Move executables to modipsl/bin |
---|
560 | if [ -f $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe ] ; then |
---|
561 | if [ $compinca == y ] ; then |
---|
562 | mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/icosa_lmdz_${orchversion}_${optmode}_${optchimie}.exe |
---|
563 | # Create link to be use by IPSLCM and LMDZOR without any change in the executable name |
---|
564 | cd $modipsl/bin |
---|
565 | rm -f icosa_lmdz_${orchversion}_${optmode}.exe |
---|
566 | ln -s icosa_lmdz_${orchversion}_${optmode}_${optchimie}.exe icosa_lmdz_${orchversion}_${optmode}.exe |
---|
567 | else |
---|
568 | mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/icosa_lmdz_${orchversion}_${optmode}.exe |
---|
569 | fi |
---|
570 | else |
---|
571 | echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION EXECUTABLE MISSING - STOP" |
---|
572 | exit |
---|
573 | fi |
---|
574 | fi |
---|
575 | |
---|
576 | |
---|
577 | ## 2.10 Compile LMDZ for regular latlon configuration |
---|
578 | if [ $regular_latlon = y ] && [ $complmdz = y ] ; then |
---|
579 | |
---|
580 | cd $modipsl/modeles/LMDZ |
---|
581 | # Compile LMDZ regular lat-lon exectuable |
---|
582 | echo; echo "NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" |
---|
583 | echo >> $outfile ; echo " NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}" >> $outfile |
---|
584 | # Check if the compilation of LMDZ was previsouly interupted prematured. |
---|
585 | # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm |
---|
586 | # to ask question and wait for interactivly answer from the user. |
---|
587 | if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then |
---|
588 | echo >> $outfile |
---|
589 | echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. " >> $outfile |
---|
590 | echo " This means that the compilation is either currently on going in another terminal was previous interupted before the end." >> $outfile |
---|
591 | echo " The files dimension.h and .lock will now be removed. " >> $outfile |
---|
592 | echo >> $outfile |
---|
593 | rm -f libf/grid/dimensions.h |
---|
594 | rm -f .lock |
---|
595 | fi |
---|
596 | |
---|
597 | # Need to define the proper option for radiative code compilation. By default, we use rrtm |
---|
598 | case $rad in |
---|
599 | oldrad) opt_rad="" ;; |
---|
600 | rrtm) opt_rad="-rad rrtm" ;; |
---|
601 | ecrad) opt_rad="-rad ecrad" ;; |
---|
602 | *) echo Only oldrad rrtm ecrad for rad option ; exit |
---|
603 | esac |
---|
604 | |
---|
605 | if [ $compinca == y ] ; then |
---|
606 | arginca="-chimie INCA" |
---|
607 | else |
---|
608 | arginca="" |
---|
609 | fi |
---|
610 | |
---|
611 | if [ $compoasis == y ] ; then |
---|
612 | argoasis="-c OMCT" |
---|
613 | else |
---|
614 | argoasis="" |
---|
615 | fi |
---|
616 | echo ./makelmdz_fcm -d ${resol_atm} $argoasis -p lmd $opt_rad -$optmode -mem -parallel $parallel $arginca -io xios -v $argorch -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile |
---|
617 | ./makelmdz_fcm -d ${resol_atm} $argoasis -p lmd $opt_rad -$optmode -mem -parallel $parallel $arginca -io xios -v $argorch -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm >> $outfile 2>&1 |
---|
618 | # Test if compiling finished |
---|
619 | if [[ $? != 0 ]] ; then |
---|
620 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
621 | exit |
---|
622 | fi |
---|
623 | |
---|
624 | # Find executable suffix |
---|
625 | suffix=_${resol_atm}_phylmd |
---|
626 | suffix=${suffix}_${rad} |
---|
627 | if [ $parallel == seq ] || [ $parallel == none ] ; then |
---|
628 | suffix=${suffix}_seq_orch_inca.e |
---|
629 | else |
---|
630 | if [ $compoasis == y ] ; then |
---|
631 | suffix=${suffix}_para_mem_orch_couple |
---|
632 | else |
---|
633 | suffix=${suffix}_para_mem_orch |
---|
634 | fi |
---|
635 | if [ $compinca == y ] ; then |
---|
636 | suffix=${suffix}_inca.e |
---|
637 | else |
---|
638 | suffix=${suffix}.e |
---|
639 | fi |
---|
640 | fi |
---|
641 | echo gcm suffix = $suffix |
---|
642 | |
---|
643 | # Move executables to modipsl/bin folder |
---|
644 | echo "Move gcm.e executable to modipsl/bin" |
---|
645 | if [ -f $modipsl/modeles/LMDZ/bin/gcm${suffix} ] ; then |
---|
646 | if [ $compinca == y ] ; then |
---|
647 | mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${orchversion}_${optmode}_${optchimie}.e |
---|
648 | # Create link to be use by IPSLCM and LMDZOR without any change in the executable name |
---|
649 | cd $modipsl/bin |
---|
650 | rm -f gcm_${resol_atm}_${orchversion}_${optmode}.e |
---|
651 | ln -s gcm_${resol_atm}_${orchversion}_${optmode}_${optchimie}.e gcm_${resol_atm}_${orchversion}_${optmode}.e |
---|
652 | else |
---|
653 | mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${orchversion}_${optmode}.e |
---|
654 | fi |
---|
655 | else |
---|
656 | echo "ERROR gcm${suffix} executable does not exist." |
---|
657 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
658 | exit |
---|
659 | fi |
---|
660 | |
---|
661 | # Find executable suffix |
---|
662 | suffix=_${resol_atm}_phylmd |
---|
663 | suffix=${suffix}_${rad} |
---|
664 | if [ $parallel == seq ] || [ $parallel == none ] ; then |
---|
665 | suffix=${suffix}_seq_orch.e |
---|
666 | else |
---|
667 | if [ $compoasis == y ] ; then |
---|
668 | suffix=${suffix}_para_mem_orch_couple.e |
---|
669 | else |
---|
670 | suffix=${suffix}_para_mem_orch.e |
---|
671 | fi |
---|
672 | fi |
---|
673 | echo ce0l suffix = $suffix |
---|
674 | |
---|
675 | # Compile ce0l initialization program for LMDZ regular lat-lon exectuable |
---|
676 | cd $modipsl/modeles/LMDZ |
---|
677 | echo; echo "NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" |
---|
678 | echo >> $outfile ; echo " NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}" >> $outfile |
---|
679 | |
---|
680 | echo ./makelmdz_fcm -d ${resol_atm} $argoasis -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v $argorch -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile |
---|
681 | ./makelmdz_fcm -d ${resol_atm} $argoasis -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v $argorch -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l >> $outfile 2>&1 |
---|
682 | # Test if compiling finished |
---|
683 | if [[ $? != 0 ]] ; then |
---|
684 | echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP" |
---|
685 | exit |
---|
686 | fi |
---|
687 | |
---|
688 | |
---|
689 | # Move executable ce0l to modipsl/bin folder |
---|
690 | echo "Move ce0l executable to modipsl/bin" |
---|
691 | if [ -f $modipsl/modeles/LMDZ/bin/ce0l${suffix} ] ; then |
---|
692 | mv $modipsl/modeles/LMDZ/bin/ce0l${suffix} $modipsl/bin/ce0l_${resol_atm}_${optmode}.e |
---|
693 | else |
---|
694 | echo "ERROR ce0l${suffix} executable does not exist." |
---|
695 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
696 | exit |
---|
697 | fi |
---|
698 | fi |
---|
699 | |
---|
700 | echo >>$outfile ; echo "ALL COMPILING FINISHED" >> $outfile |
---|
701 | echo ls -lrt modipsl/bin >> $outfile |
---|
702 | ls -lrt $modipsl/bin >> $outfile |
---|
703 | |
---|
704 | echo; echo "ALL COMPILING FINISHED" ; echo |
---|
705 | echo "Executables are found in modipsl/bin" |
---|
706 | echo "Check that executable names correspond with the name set in config.card before launching the job" |
---|
707 | echo ls -lrt modipsl/bin |
---|
708 | ls -lrt $modipsl/bin |
---|
709 | |
---|
710 | date |
---|
711 | |
---|
712 | exit |
---|
713 | |
---|
714 | |
---|