source: dynamico_lmdz/aquaplanet/ICOSA_LMDZ/make_icosa_lmdz @ 3931

Last change on this file since 3931 was 3931, checked in by dubos, 9 years ago

small improvements to make_icosa_lmdz

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