source: codes/icosagcm/trunk/make_icosa

Last change on this file was 1056, checked in by aclsce, 4 years ago

Added handling of the use of oasis coupler (to be used in ocean-atmopshere mode).

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