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 | arch_defined="FALSE" |
---|
16 | parallel_defined="FALSE" |
---|
17 | arch_path="arch" |
---|
18 | parallel="none" |
---|
19 | physics="none" |
---|
20 | CPP_KEY="CPP_NONE" |
---|
21 | ICOSA_LIB="" |
---|
22 | |
---|
23 | while (($# > 0)) |
---|
24 | do |
---|
25 | case $1 in |
---|
26 | "-h") cat <<fin |
---|
27 | Usage : |
---|
28 | makegcm [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 |
---|
32 | fin |
---|
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 |
---|
65 | done |
---|
66 | |
---|
67 | rm -f .void_file |
---|
68 | echo > .void_file |
---|
69 | rm -rf .void_dir |
---|
70 | mkdir .void_dir |
---|
71 | |
---|
72 | if [[ "$arch_defined" == "TRUE" ]] |
---|
73 | then |
---|
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 |
---|
87 | else |
---|
88 | echo "Veuillez definir une architecture cible" |
---|
89 | exit 1 |
---|
90 | fi |
---|
91 | |
---|
92 | LD_FLAGS="%BASE_LD" |
---|
93 | |
---|
94 | if [[ "$compil_mode" == "prod" ]] |
---|
95 | then |
---|
96 | COMPIL_FFLAGS="%PROD_FFLAGS" |
---|
97 | elif [[ "$compil_mode" == "dev" ]] |
---|
98 | then |
---|
99 | COMPIL_FFLAGS="%DEV_FFLAGS" |
---|
100 | elif [[ "$compil_mode" == "debug" ]] |
---|
101 | then |
---|
102 | COMPIL_FFLAGS="%DEBUG_FFLAGS" |
---|
103 | fi |
---|
104 | |
---|
105 | if [[ "$parallel" == "mpi" ]] |
---|
106 | then |
---|
107 | CPP_KEY="$CPP_KEY CPP_USING_MPI" |
---|
108 | elif [[ "$parallel" == "omp" ]] |
---|
109 | then |
---|
110 | CPP_KEY="$CPP_KEY CPP_USING_OMP" |
---|
111 | COMPIL_FFLAGS="$COMPIL_FFLAGS %OMP_FFLAGS" |
---|
112 | LD_FLAGS="$LD_FLAGS %OMP_LD" |
---|
113 | elif [[ "$parallel" == "mpi_omp" ]] |
---|
114 | then |
---|
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" |
---|
118 | elif [[ "$parallel" == "none" ]] |
---|
119 | then |
---|
120 | parallel="none" |
---|
121 | else |
---|
122 | echo "-parallel value $parallel is invalid, only permited <none>, <mpi>, <omp> or <mpi_omp>" |
---|
123 | exit 1 |
---|
124 | fi |
---|
125 | |
---|
126 | |
---|
127 | if [[ "$with_xios_defined" == "TRUE" ]] |
---|
128 | then |
---|
129 | CPP_KEY="$CPP_KEY CPP_USING_XIOS" |
---|
130 | COMPIL_FFLAGS="$COMPIL_FFLAGS $XIOS_INCDIR" |
---|
131 | ICOSA_LIB="$ICOSA_LIB $XIOS_LIBDIR $XIOS_LIB" |
---|
132 | fi |
---|
133 | |
---|
134 | ICOSA_LIB="$ICOSA_LIB $NETCDF_LIBDIR $NETCDF_LIB $HDF5_LIBDIR $HDF5_LIB" |
---|
135 | |
---|
136 | |
---|
137 | rm bin/* |
---|
138 | |
---|
139 | cd ../IOIPSL/src |
---|
140 | make |
---|
141 | |
---|
142 | cd - |
---|
143 | |
---|
144 | cd ../XIOS |
---|
145 | #make_xios --$compil_mode --arch $arch --job $job |
---|
146 | |
---|
147 | cd - |
---|
148 | |
---|
149 | cd ../LMDZ5 |
---|
150 | makelmdz_fcm toto -$compil_mode -mem -parallel $parallel -nodyn -io xios -arch $arch -j $job |
---|
151 | |
---|
152 | cd - |
---|
153 | |
---|
154 | cd ../ICOSAGCM |
---|
155 | make_icosa -$compil_mode -parallel $parallel -external_ioipsl -with_xios -arch $arch -job $job |
---|
156 | |
---|
157 | cd - |
---|
158 | |
---|
159 | rm -f config.fcm |
---|
160 | |
---|
161 | echo "%COMPIL_FFLAGS $COMPIL_FFLAGS $NETCDF_INCDIR" >> config.fcm |
---|
162 | echo "%LD_FLAGS $LD_FLAGS" >> config.fcm |
---|
163 | echo "%CPP_KEY $CPP_KEY" >> config.fcm |
---|
164 | echo "%LIB $ICOSA_LIB">> config.fcm |
---|
165 | |
---|
166 | if [[ "$full_defined" == "TRUE" ]] |
---|
167 | then |
---|
168 | ./build --job $job --full |
---|
169 | else |
---|
170 | ./build --job $job |
---|
171 | fi |
---|