source: BOL/script_install_amaury/test_convergence.sh @ 5429

Last change on this file since 5429 was 5331, checked in by abarral, 6 weeks ago

Add strataer option to install_lmdz.sh
Improve test_convergence.sh

  • Property svn:executable set to *
File size: 2.7 KB
RevLine 
[5156]1#!/bin/bash
2
[5331]3# Quick tool to check convergence for a number of flags between two revs
4
[5156]5set -eu
6
7dim="32x32x39"
8base_args="-name LMDZ -netcdf 0 -arch_dir /home/abarral/PycharmProjects/installLMDZ/script_install/arch_local -arch local-gfortran-parallel_ -d $dim"  # those don't appear in the folder name (except dim)
9file_to_check="LMDZ/modipsl/modeles/LMDZ/BENCH$dim/restart.nc"
10base_path="/tmp/comp_bench/"
11local=$(pwd)
12
13function do_bench() {
14  local rev=$1
15  local path=$2
16  local install_args=$3
17  if [[ -f "$path/$file_to_check" ]]; then return; fi
18
19  rm -rf "$path"
20  mkdir -p "$path" && cd "$path"
21
22  cp "$local/install_lmdz.sh" .
23
24  local logf="comp.log"
25  local install_cmd="./install_lmdz.sh $base_args $install_args -r $rev"
26  echo "Running <$install_cmd> [log: $(pwd)/$logf]"
27  $install_cmd &> $logf
28}
29
30function comp_bench() {
31  local rev1=$1
32  local rev2=$2
33  local install_args=$3
34  local path1="$base_path/r${rev1}_d${dim}_${install_args// /_}"
35  local path2="$base_path/r${rev2}_d${dim}_${install_args// /_}"
36
37  do_bench "$rev1" "$path1" "$install_args"
38  do_bench "$rev2" "$path2" "$install_args"
39
40  if cmp "$path1/$file_to_check" "$path2/$file_to_check" &>/dev/null; then
41    echo "All good ! for r$rev1/r$rev2=$install_args"
42  else
43    echo ":( nope for r$rev1/r$rev2=$install_args"
44  fi
45}
46
47function comp_full() {
48  local rev1=$1
49  local rev2=$2
50
51  # Check all combinations
52  for rad in "oldrad" "rrtm" "ecrad"; do
53  for veget in "none" "CMIP6"; do
54  for para in "none" "mpi_omp"; do
55    comp_bench "$rev1" "$rev2" "-rad $rad -parallel $para -veget $veget -compilephysiq lmd"
56  done; done; done
57
58  # Check some additional params on sparse configs
[5331]59  comp_bench "$rev1" "$rev2" "-xios -rad oldrad -parallel mpi_omp -veget none -compilephysiq lmd"
[5156]60  for para in "none" "mpi_omp"; do
[5331]61    comp_bench "$rev1" "$rev2" "-cosp v1 -rad oldrad -parallel $para -veget none -compilephysiq lmd"  # cosp v1 (no 2 because broken atm)
[5156]62    comp_bench "$rev1" "$rev2" "-debug -rad oldrad -parallel $para -veget none -compilephysiq lmd"  # debug
63  done
[5331]64  comp_bench "$rev1" "$rev2" "-cosp v2 -xios -rad oldrad -parallel mpi_omp -veget none -compilephysiq lmd"  # cosp v1 (no 2 because broken atm)
[5156]65
[5180]66  local origdim="$dim"
[5156]67  # 1D
68  dim="79"
69  file_to_check="LMDZ/modipsl/modeles/LMDZ/BENCH$dim/restartphy.nc"
70  comp_bench "$rev1" "$rev2" "-rad oldrad -parallel none -veget none -compilephysiq lmd -d $dim"
71
72  # Iso
73  dim="48x36x39"
74  file_to_check="LMDZ/modipsl/modeles/LMDZ/BENCH$dim/restart.nc"
[5180]75  comp_bench "$rev1" "$rev2" "-rad oldrad -parallel none -veget none -compilephysiq lmdiso -d $dim"
76
77  dim="$origdim"
78  file_to_check="LMDZ/modipsl/modeles/LMDZ/BENCH$dim/restart.nc"
[5156]79}
80
[5331]81comp_full 5316 5217
82#comp_bench 5205 5205 "-rad oldrad -parallel none -veget CMIP6 -compilephysiq lmd -debug"
[5156]83
84
85
86
87
Note: See TracBrowser for help on using the repository browser.