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
RevLine 
[12]1#!/bin/bash
[14]2export PATH=$PWD/tools/FCM/bin:$PATH
[12]3
[279]4echo ./make_icosa $* > rebuild
5chmod a+x rebuild
6
[12]7compil_mode_defined="FALSE"
8compil_mode="prod"
9
[89]10job=1
11full_defined="FALSE"
[171]12with_xios_defined="FALSE"
[1056]13with_oasis_defined="FALSE"
[12]14arch_defined="FALSE"
[28]15parallel_defined="FALSE"
[497]16arch_default_path="arch"
[332]17arch_path="arch"
[28]18parallel="none"
[327]19physics="none"
[347]20external_ioipsl="FALSE"
21external_physics="FALSE"
[488]22no_io_defined="FALSE"
[347]23
[28]24CPP_KEY="CPP_NONE" 
[171]25ICOSA_LIB=""
[12]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 ;;
[332]50 
51      "-arch_path")
52          arch_path=$2 ; arch_path_defined="TRUE"; shift ; shift ;;
[12]53
[28]54      "-parallel")
55          parallel=$2 ; parallel_defined="TRUE"; shift ; shift ;;
56
[327]57      "-physics")
58          physics=$2 ; physics_defined="TRUE"; shift ; shift ;;
59
[89]60      "-job")
[103]61          job=$2 ; shift ; shift;;
[89]62
63      "-full")
[103]64          full_defined="TRUE" ; shift ;;
[89]65
[171]66      "-with_xios")
67          with_xios_defined="TRUE" ; shift ;;
[1056]68
69      "-with_oasis")
70      with_oasis_defined="TRUE" ; shift ;;
[488]71 
72        "-no_io")
73          no_io_defined="TRUE" ; shift ;;
74 
[347]75      "-external_ioipsl")
76          external_ioipsl="TRUE" ; shift ;;
77
78      "-external_physics")
79          external_physics="TRUE" ; shift ;;
80
[12]81      *)
82          code="$1" ; shift ;;
83  esac
84done
85
[28]86rm -f .void_file
87echo > .void_file
88rm -rf .void_dir
89mkdir .void_dir
90
[12]91if [[ "$arch_defined" == "TRUE" ]]
92then
93  rm -f arch.path
94  rm -f arch.fcm
[28]95  rm -f arch.env
[497]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
[332]113  if test -f $arch_path/arch-${arch}.env
[497]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
[28]122  source arch.env
[12]123  source arch.path
124else
125  echo "Veuillez definir une architecture cible"
126  exit 1
127fi
128
[152]129LD_FLAGS="%BASE_LD"
130
[12]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
[28]142if [[ "$parallel" == "mpi" ]]
143then
144  CPP_KEY="$CPP_KEY CPP_USING_MPI"
[152]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"
[189]153  COMPIL_FFLAGS="$COMPIL_FFLAGS %OMP_FFLAGS"
[152]154  LD_FLAGS="$LD_FLAGS %OMP_LD"
[28]155elif [[ "$parallel" == "none" ]]
156then
157  parallel="none"
158else
[152]159  echo "-parallel value $parallel is invalid, only permited <none>, <mpi>, <omp> or <mpi_omp>"
[28]160  exit 1
161fi
162
[327]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
[488]170if [[ "$no_io_defined" == "TRUE" ]]
171then
172  CPP_KEY="$CPP_KEY CPP_NO_IO"
173  with_xios_defined="FALSE"
174fi 
175
[171]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 
[28]182
[1056]183if [[ "$with_oasis_defined" == "TRUE" ]]
184then
185  ICOSA_LIB="$ICOSA_LIB $OASIS_LIBDIR $OASIS_LIB"
186fi
187
188
[347]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
[488]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
[171]210
[12]211rm -f config.fcm
212
[488]213echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm
[152]214echo "%LD_FLAGS $LD_FLAGS" >> config.fcm
[28]215echo "%CPP_KEY $CPP_KEY" >> config.fcm
216echo "%LIB $ICOSA_LIB">> config.fcm
[347]217echo "%IOIPSL_PATH $ioipsl_path">> config.fcm
218echo "%USE_IOIPSL $use_ioipsl">> config.fcm
[12]219
[89]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.