source: CONFIG/publications/ICOLMDZORINCA_CO2_Transport_GMD_2023/DYNAMICO/make_icosa @ 6612

Last change on this file since 6612 was 6612, checked in by acosce, 10 months ago

DYNAMICO used for ICOLMDZORINCA_CO2_Transport_GMD_2023

File size: 5.0 KB
RevLine 
[6612]1#!/bin/bash
2
3cd -P $(dirname $0)
4
5export PATH=$PWD/tools/FCM/bin:$PATH
6
7echo ./make_icosa $* > rebuild
8chmod a+x rebuild
9
10compil_mode_defined="FALSE"
11compil_mode="prod"
12
13job=1
14full_defined="FALSE"
15with_xios_defined="FALSE"
16with_oasis_defined="FALSE"
17arch_defined="FALSE"
18parallel_defined="FALSE"
19arch_default_path="arch"
20arch_path="arch"
21parallel="none"
22physics="none"
23external_ioipsl="FALSE"
24external_physics="FALSE"
25no_io_defined="FALSE"
26
27CPP_KEY="CPP_NONE" 
28ICOSA_LIB=""
29
30while (($# > 0))
31  do
32  case $1 in
33      "-h") cat <<fin
34Usage :
35makegcm [options] -m arch exec
36[-h]                       : help
37[-prod / -dev / -debug]    : compilation en mode production (default) / developpement / debug .
38 -arch nom_arch            : nom de l\'architecture cible
39fin
40          exit;;
41
42      "-prod")
43          compil_mode="prod" ; shift ;;
44
45      "-dev")
46          compil_mode="dev" ; shift ;;
47
48      "-debug")
49          compil_mode="debug" ; shift ;;
50
51      "-arch")
52          arch=$2 ; arch_defined="TRUE"; shift ; shift ;;
53 
54      "-arch_path")
55          arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;;
56
57      "-parallel")
58          parallel=$2 ; parallel_defined="TRUE"; shift ; shift ;;
59
60      "-physics")
61          physics=$2 ; physics_defined="TRUE"; shift ; shift ;;
62
63      "-job")
64          job=$2 ; shift ; shift;;
65
66      "-full")
67          full_defined="TRUE" ; shift ;;
68
69      "-with_xios")
70          with_xios_defined="TRUE" ; shift ;;
71
72      "-with_oasis")
73      with_oasis_defined="TRUE" ; shift ;;
74 
75        "-no_io")
76          no_io_defined="TRUE" ; shift ;;
77 
78      "-external_ioipsl")
79          external_ioipsl="TRUE" ; shift ;;
80
81      "-external_physics")
82          external_physics="TRUE" ; shift ;;
83
84      *)
85          code="$1" ; shift ;;
86  esac
87done
88
89rm -f .void_file
90echo > .void_file
91rm -rf .void_dir
92mkdir .void_dir
93
94if [[ "$arch_defined" == "TRUE" ]]
95then
96  rm -f arch.path
97  rm -f arch.fcm
98  rm -f arch.env
99
100  if test -f $arch_path/arch-${arch}.path
101  then
102    ln -s $arch_path/arch-${arch}.path arch.path
103  elif test -f $arch_default_path/arch-${arch}.path
104  then
105    ln -s $arch_default_path/arch-${arch}.path arch.path
106  fi
107       
108  if test -f $arch_path/arch-${arch}.fcm
109  then
110    ln -s $arch_path/arch-${arch}.fcm arch.fcm
111  elif test -f $arch_default_path/arch-${arch}.fcm
112  then
113    ln -s $arch_default_path/arch-${arch}.fcm arch.fcm
114  fi
115
116  if test -f $arch_path/arch-${arch}.env
117  then
118    ln -s $arch_path/arch-${arch}.env arch.env
119  elif test -f $arch_default_path/arch-${arch}.env
120  then
121    ln -s $arch_default_path/arch-${arch}.env arch.env
122  else
123    ln -s .void_file arch.env
124  fi
125  source arch.env
126  source arch.path
127else
128    echo "Veuillez definir une architecture cible avec l'option -arch XXX." 
129    echo "Please define a target architecture with option -arch XXX."
130    echo "Valeurs possibles de XXX / possible values for XXX :"
131    cd arch
132    ls *.env | cut -c 6- | sed 's/....$//' 
133  exit 1
134fi
135
136LD_FLAGS="%BASE_LD"
137
138if [[ "$compil_mode" == "prod" ]]
139then
140  COMPIL_FFLAGS="%PROD_FFLAGS"
141elif [[ "$compil_mode" == "dev" ]]
142then
143  COMPIL_FFLAGS="%DEV_FFLAGS"
144elif [[ "$compil_mode" == "debug" ]]
145then
146  COMPIL_FFLAGS="%DEBUG_FFLAGS"
147fi
148
149if [[ "$parallel" == "mpi" ]]
150then
151  CPP_KEY="$CPP_KEY CPP_USING_MPI"
152elif [[ "$parallel" == "omp" ]]
153then
154  CPP_KEY="$CPP_KEY CPP_USING_OMP"
155  COMPIL_FFLAGS="$COMPIL_FFLAGS %OMP_FFLAGS"
156  LD_FLAGS="$LD_FLAGS %OMP_LD"
157elif [[ "$parallel" == "mpi_omp" ]]
158then
159  CPP_KEY="$CPP_KEY CPP_USING_MPI CPP_USING_OMP"
160  COMPIL_FFLAGS="$COMPIL_FFLAGS %OMP_FFLAGS"
161  LD_FLAGS="$LD_FLAGS %OMP_LD"
162elif [[ "$parallel" == "none" ]]
163then
164  parallel="none"
165else
166  echo "-parallel value $parallel is invalid, only permited <none>, <mpi>, <omp> or <mpi_omp>"
167  exit 1
168fi
169
170if [[ "$physics" == "lmdz_generic" ]]
171then
172  CPP_KEY="$CPP_KEY CPP_PHYSICS_LMDZ_GENERIC"
173  COMPIL_FFLAGS="$COMPIL_FFLAGS $PHYSICS_INCDIR"
174  ICOSA_LIB="$ICOSA_LIB $PHYSICS_LIBDIR $PHYSICS_LIB"
175fi
176
177if [[ "$no_io_defined" == "TRUE" ]]
178then
179  CPP_KEY="$CPP_KEY CPP_NO_IO"
180  with_xios_defined="FALSE"
181fi 
182
183if [[ "$with_xios_defined" == "TRUE" ]]
184then
185  CPP_KEY="$CPP_KEY CPP_USING_XIOS"
186  COMPIL_FFLAGS="$COMPIL_FFLAGS $XIOS_INCDIR"
187  ICOSA_LIB="$ICOSA_LIB $XIOS_LIBDIR $XIOS_LIB"
188fi 
189
190if [[ "$with_oasis_defined" == "TRUE" ]]
191then
192  ICOSA_LIB="$ICOSA_LIB $OASIS_LIBDIR $OASIS_LIB"
193fi
194
195
196if [[ "$external_ioipsl" == "TRUE" ]]
197then
198  ioipsl_path=".void_dir"
199  use_ioipsl="use::ioipsl"
200  COMPIL_FFLAGS="$COMPIL_FFLAGS $IOIPSL_INCDIR"
201  ICOSA_LIB="$ICOSA_LIB $IOIPSL_LIBDIR $IOIPSL_LIB"
202else
203  ioipsl_path="tools/ioipsl"
204  use_ioipsl=""
205fi 
206
207if [[ "$external_physics" == "TRUE" ]]
208then
209  CPP_KEY="$CPP_KEY CPP_USING_EXTERNAL_PHYSICS"
210fi
211
212if [[ "$no_io_defined" == "FALSE" ]]
213then
214  ICOSA_LIB="$ICOSA_LIB $NETCDF_LIBDIR $NETCDF_LIB $HDF5_LIBDIR $HDF5_LIB"
215  COMPIL_FFLAGS="$COMPIL_FFLAGS $NETCDF_INCDIR"
216fi
217
218rm -f config.fcm
219
220echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm
221echo "%LD_FLAGS $LD_FLAGS" >> config.fcm
222echo "%CPP_KEY $CPP_KEY" >> config.fcm
223echo "%LIB $ICOSA_LIB">> config.fcm
224echo "%IOIPSL_PATH $ioipsl_path">> config.fcm
225echo "%USE_IOIPSL $use_ioipsl">> config.fcm
226
227if [[ "$full_defined" == "TRUE" ]]
228then
229  ./build --job $job --full
230else
231  ./build --job $job
232fi
Note: See TracBrowser for help on using the repository browser.