source: CONFIG/UNIFORM/v7/IPSLCM7/compile_ipslcm7.sh @ 6547

Last change on this file since 6547 was 6544, checked in by acosce, 13 months ago

Add INCA compilation
Create a link for the executable to not modify the name to be used by configuration without Inca

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