[4268] | 1 | #!/bin/bash |
---|
| 2 | #set -vx |
---|
| 3 | # Default options |
---|
| 4 | # |
---|
| 5 | # |
---|
| 6 | # |
---|
| 7 | #### 1 Set up the compiling options |
---|
| 8 | #### Define some directories |
---|
| 9 | submitdir=$( pwd ) |
---|
| 10 | modipsl=$submitdir/../.. |
---|
| 11 | echo modipsl=$modipsl |
---|
| 12 | echo submitdir=$submitdir |
---|
[4275] | 13 | arch_path=$submitdir/ARCH |
---|
[4268] | 14 | export ROOT=$modipsl/modeles/DYNAMICO |
---|
| 15 | |
---|
[4278] | 16 | #### Set default options |
---|
[4268] | 17 | # Optimization mode |
---|
| 18 | # optmode=prod/dev/debug |
---|
| 19 | optmode=prod |
---|
| 20 | # Resolution if compiling LMDZ in regular mode without DYNAMICO |
---|
[4278] | 21 | # Use for example following "./compile_icolmdzor.sh -regular_lonlat 144x142x79" |
---|
[4268] | 22 | regular_latlon=no |
---|
| 23 | # fcm_arch |
---|
| 24 | fcm_arch=default |
---|
| 25 | # Default values to be overritten |
---|
[4339] | 26 | parallel=mpi_omp |
---|
[4268] | 27 | export fcm_arch parallel xios |
---|
| 28 | full_flag="" |
---|
| 29 | |
---|
[4278] | 30 | #### Read arguments |
---|
[4268] | 31 | # Loop over all arguments to modify default set up |
---|
| 32 | while (($# > 0)) ; do |
---|
[4278] | 33 | case $1 in |
---|
| 34 | "-h") cat <<fin |
---|
[4268] | 35 | |
---|
| 36 | ######################################################################## |
---|
[4278] | 37 | # Usage of the script compile_icolmdzor.sh |
---|
[4268] | 38 | # |
---|
| 39 | ######################################################################## |
---|
| 40 | |
---|
| 41 | ./compile_config [Options] |
---|
| 42 | |
---|
[4278] | 43 | Options: -full, -regular_latlon |
---|
[4268] | 44 | |
---|
[4278] | 45 | Example 1: Default compilation of DYNAMICO-LMDZ-ORCHIDEE with XIOS and IOIPSL |
---|
| 46 | ./compile_icolmdzor.sh |
---|
[4268] | 47 | |
---|
[4278] | 48 | Example 2: Default compilation with full recompilation of all components |
---|
| 49 | ./compile_icolmdzor.sh -full |
---|
[4268] | 50 | |
---|
[4278] | 51 | Example 3: Compilation of LMDZ in regular lat-lon for dimension 144x142x79. |
---|
| 52 | The dimension can be changed to any other 3d dimension. DYNAMICO is also compiled as default. |
---|
| 53 | ./compile_icolmdzor.sh -regular_latlon 144x142x79 |
---|
[4268] | 54 | |
---|
[4278] | 55 | fin |
---|
| 56 | exit;; |
---|
[4268] | 57 | |
---|
[4278] | 58 | "-parallel") |
---|
| 59 | parallel=$2 ; shift ; shift ;; |
---|
| 60 | |
---|
| 61 | "-arch") |
---|
| 62 | fcm_arch="$2" ; shift ; shift ;; |
---|
| 63 | |
---|
| 64 | "-xios") |
---|
| 65 | xios="$2" ; shift ; shift ;; |
---|
| 66 | |
---|
| 67 | "-optmode") |
---|
| 68 | optmode=$2 ; shift ; shift ;; |
---|
| 69 | |
---|
| 70 | "-regular_latlon") |
---|
| 71 | regular_latlon=yes ; |
---|
| 72 | resol_atm_3d=$2 ; shift ; shift ;; |
---|
| 73 | |
---|
| 74 | "-full") |
---|
| 75 | full_flag="-full"; shift ;; |
---|
| 76 | |
---|
| 77 | *) |
---|
| 78 | echo "unknown option "$2" , exiting..." |
---|
| 79 | exit |
---|
| 80 | esac |
---|
| 81 | done |
---|
[4268] | 82 | |
---|
| 83 | |
---|
[4278] | 84 | ### Read host dependent default values |
---|
| 85 | ### These variables will not be changed if they were set as argument |
---|
[4268] | 86 | ###./host.sh $host |
---|
| 87 | # Later : Following lines should be set in host.sh file |
---|
| 88 | # begin host.sh |
---|
| 89 | if [ $fcm_arch == default ] ; then |
---|
[4278] | 90 | # Find out current host and source specific paths and commands for the host |
---|
| 91 | case $( hostname -s ) in |
---|
| 92 | ada*) |
---|
| 93 | fcm_arch=X64_ADA;; |
---|
| 94 | irene*) |
---|
| 95 | fcm_arch=X64_IRENE; |
---|
[4337] | 96 | source ARCH/arch-${fcm_arch}.env ;; |
---|
[4278] | 97 | asterix*|obelix*) |
---|
| 98 | fcm_arch=ifort_LSCE;; |
---|
| 99 | *) |
---|
| 100 | echo Current host is not known. You must use option -fcm_arch to specify which architecuture files to use. |
---|
| 101 | echo Exit now. |
---|
| 102 | exit |
---|
| 103 | esac |
---|
[4268] | 104 | fi |
---|
| 105 | |
---|
| 106 | ##### End host.sh |
---|
| 107 | echo |
---|
[4278] | 108 | echo "Following arguments are set in current compiling:" |
---|
[4329] | 109 | echo " optmode = $optmode, parallel = $parallel, fcm_arch = $fcm_arch, full_flag=$full_flag regular_latlon=$regular_latlon" |
---|
[4268] | 110 | |
---|
| 111 | #### 2 Do the compilation |
---|
| 112 | ## 2.1 Compile ioipsl |
---|
| 113 | cd $modipsl/modeles/IOIPSL |
---|
[4278] | 114 | echo; echo "NOW COMPILE IOIPSL" |
---|
[4268] | 115 | echo ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag |
---|
| 116 | ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag |
---|
| 117 | # Test if compiling succeded |
---|
| 118 | if [[ $? != 0 ]] ; then |
---|
[4278] | 119 | echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP" |
---|
| 120 | exit |
---|
[4268] | 121 | fi |
---|
| 122 | |
---|
| 123 | ## 2.2 Compile xios |
---|
| 124 | cd $modipsl/modeles/XIOS |
---|
[4278] | 125 | echo; echo "NOW COMPILE XIOS" |
---|
[4326] | 126 | echo ./make_xios --$optmode --arch $fcm_arch --arch_path $arch_path --job 4 $full_flag |
---|
| 127 | ./make_xios --$optmode --arch $fcm_arch --arch_path $arch_path --job 4 $full_flag |
---|
[4268] | 128 | # Test if compiling succeded |
---|
| 129 | if [[ $? != 0 ]] ; then |
---|
[4278] | 130 | echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP" |
---|
| 131 | exit |
---|
[4268] | 132 | fi |
---|
| 133 | |
---|
| 134 | ## 2.3 Compile orchidee |
---|
| 135 | cd $modipsl/modeles/ORCHIDEE |
---|
[4278] | 136 | echo; echo "NOW COMPILE ORCHIDEE" |
---|
[4326] | 137 | echo ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} $full_flag |
---|
| 138 | ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} $full_flag |
---|
[4268] | 139 | # Test if compiling finished |
---|
| 140 | if [[ $? != 0 ]] ; then |
---|
| 141 | echo "THERE IS A PROBLEM IN ORCHIDEE COMPILATION - STOP" |
---|
| 142 | exit |
---|
| 143 | fi |
---|
| 144 | |
---|
[4278] | 145 | ## 2.4 Compile lmdz |
---|
[4268] | 146 | cd $modipsl/modeles/LMDZ |
---|
[4278] | 147 | # Compile LMDZ as library to couple to DYNAMICO |
---|
| 148 | echo; echo "NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO" |
---|
| 149 | echo ./makelmdz_fcm -p lmd -rrtm true -$optmode -mem -parallel $parallel -libphy -v orchidee2.1 -io xios -arch $fcm_arch -j 8 $full_flag |
---|
| 150 | ./makelmdz_fcm -p lmd -rrtm true -$optmode -mem -parallel $parallel -libphy -v orchidee2.1 -io xios -arch $fcm_arch -j 8 $full_flag |
---|
[4268] | 151 | # Test if compiling finished |
---|
| 152 | if [[ $? != 0 ]] ; then |
---|
[4278] | 153 | echo "THERE IS A PROBLEM IN LMDZ PHYSICS COMPILATION - STOP" |
---|
[4268] | 154 | exit |
---|
| 155 | fi |
---|
| 156 | |
---|
[4278] | 157 | |
---|
| 158 | ## 2.5 Compile DYNAMICO |
---|
| 159 | echo; echo "NOW COMPILE DYNAMICO " |
---|
[4268] | 160 | cd $modipsl/modeles/DYNAMICO |
---|
| 161 | echo ./make_icosa -$optmode -parallel $parallel -external_ioipsl -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_flag |
---|
| 162 | ./make_icosa -$optmode -parallel $parallel -external_ioipsl -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_flag |
---|
| 163 | # Test if compiling finished |
---|
| 164 | if [[ $? != 0 ]] ; then |
---|
[4278] | 165 | echo "THERE IS A PROBLEM IN DYNAMICO COMPILATION - STOP" |
---|
| 166 | exit |
---|
[4268] | 167 | fi |
---|
| 168 | |
---|
[4278] | 169 | ## 2.6 Compile interface ICOSA_LMDZ |
---|
| 170 | echo; echo "NOW COMPILE ICOSA_LMDZ " |
---|
[4268] | 171 | cd $modipsl/modeles/ICOSA_LMDZ |
---|
[4270] | 172 | echo ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel -with_orchidee -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_flag |
---|
[4268] | 173 | |
---|
[4270] | 174 | ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel -with_orchidee -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_flag |
---|
[4268] | 175 | # Test if compiling finished |
---|
| 176 | if [[ $? != 0 ]] ; then |
---|
[4278] | 177 | echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION - STOP" |
---|
| 178 | exit |
---|
[4268] | 179 | fi |
---|
| 180 | |
---|
| 181 | |
---|
[4278] | 182 | ## 2.7 Compile LMDZ for regular latlon configuration |
---|
| 183 | if [ $regular_latlon = yes ] ; then |
---|
[4268] | 184 | |
---|
[4278] | 185 | cd $modipsl/modeles/LMDZ |
---|
| 186 | # Compile LMDZ regular lat-lon exectuable |
---|
| 187 | echo; echo "NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm_3d}" |
---|
| 188 | echo ./makelmdz_fcm -d ${resol_atm_3d} -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -j 8 $full_flag gcm |
---|
| 189 | ./makelmdz_fcm -d ${resol_atm_3d} -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -j 8 $full_flag gcm |
---|
| 190 | # Test if compiling finished |
---|
| 191 | if [[ $? != 0 ]] ; then |
---|
| 192 | echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP" |
---|
| 193 | exit |
---|
| 194 | fi |
---|
| 195 | |
---|
| 196 | # Compile ce0l initialization program for LMDZ regular lat-lon exectuable |
---|
| 197 | echo; echo "NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm_3d}" |
---|
| 198 | echo ./makelmdz_fcm -d ${resol_atm_3d} -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -j 8 $full_flag ce0l |
---|
| 199 | ./makelmdz_fcm -d ${resol_atm_3d} -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -j 8 $full_flag ce0l |
---|
| 200 | # Test if compiling finished |
---|
| 201 | if [[ $? != 0 ]] ; then |
---|
| 202 | echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP" |
---|
| 203 | exit |
---|
| 204 | fi |
---|
| 205 | |
---|
| 206 | # Find executable suffix |
---|
| 207 | if [ $parallel == seq ] || [ $parallel == none ] ; then |
---|
| 208 | suffix=_${resol_atm_3d}_phylmd_seq_orch |
---|
| 209 | else |
---|
| 210 | suffix=_${resol_atm_3d}_phylmd_para_mem_orch |
---|
| 211 | fi |
---|
| 212 | echo suffix = $suffix |
---|
[4268] | 213 | |
---|
[4278] | 214 | # Move executables to modipsl/bin folder |
---|
| 215 | echo "Move gcm.e and ce0l executable to modipsl/bin" |
---|
| 216 | if [ $modipsl/modeles/LMDZ/bin/gcm${suffix}.e ] ; then mv $modipsl/modeles/LMDZ/bin/gcm${suffix}.e $modipsl/bin/gcm_${resol_atm_3d}.e ; fi |
---|
| 217 | if [ $modipsl/modeles/LMDZ/bin/ce0l${suffix}.e ] ; then mv $modipsl/modeles/LMDZ/bin/ce0l${suffix}.e $modipsl/bin/ce0l_${resol_atm_3d}.e ; fi |
---|
[4268] | 218 | |
---|
| 219 | # Write .resol file |
---|
| 220 | cd $submitdir |
---|
[4278] | 221 | resol2D=$( echo ${resol_atm_3d} | awk '-Fx' '{print $1}' )$( echo ${resol_atm_3d} | awk '-Fx' '{print $2}' ) |
---|
[4268] | 222 | echo "noORCAxLMD$resol2D" >.resol |
---|
[4278] | 223 | echo "RESOL_ATM_3D=${resol_atm_3d}" >>.resol |
---|
[4268] | 224 | fi |
---|
| 225 | |
---|
[4278] | 226 | |
---|
| 227 | ## Move executables to modipsl/bin folder |
---|
| 228 | echo "Move executables to modipsl/bin" |
---|
| 229 | if [ $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe ] ; then mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/. ; fi |
---|
| 230 | if [ $modipsl/modeles/XIOS/bin/xios_server.exe ] ; then mv $modipsl/modeles/XIOS/bin/xios_server.exe $modipsl/bin/. ; fi |
---|
| 231 | |
---|
| 232 | |
---|
[4268] | 233 | echo |
---|
[4278] | 234 | echo "ALL COMPILING FINISHED" |
---|
[4268] | 235 | echo |
---|
[4278] | 236 | |
---|
[4268] | 237 | exit |
---|
| 238 | |
---|
| 239 | |
---|