source: dynamico_lmdz/aquaplanet/ICOSA_LMDZ/make_icosa_lmdz @ 3864

Last change on this file since 3864 was 3864, checked in by ymipsl, 9 years ago

Add full recompilation for configuration

YM

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