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