-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_xios
executable file
·205 lines (177 loc) · 6.55 KB
/
make_xios
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#!/bin/bash
install_dir=$PWD
compil_full="false"
use_oasis="false"
oasis="oasis3_mct"
use_memtrack="false"
job="1"
netcdf_lib="netcdf4_par"
compil_mode="prod"
# Traitement de la ligne de commande
while (($# > 0))
do
case $1 in
"-h"|"--help"|"-help")
echo "make_xios - installs XIOS on your architecture"
echo "make_xios [options]"
echo "options :"
echo " [--prod] : compilation in production mode (default)"
echo " [--dev] : compilation in development mode"
echo " [--debug] : compilation in debug mode"
echo " --arch arch : to choose target architecture"
echo " [--avail] : to know available target architectures "
echo " [--full] : to generate dependencies and recompile from scratch"
echo " [--use_oasis 'oasis3' 'oasis3_mct' : default oasis3_mct] : to use Oasis coupler"
echo " [--doc] : to generate Doxygen documentation (not available yet)"
echo " [--job ntasks] : to use parallel compilation with ntasks"
echo " [--netcdf_lib 'netcdf4_par'/'netcdf4_seq'/'netcdf4_internal' : default netcdf4_par] : choice of netcdf library"
echo " [--memtrack] : tracking memory leak - developper only"
echo "Example : ./make_xios --prod --arch PW6_VARGAS"
echo "Example : ./make_xios --avail"
exit;;
"--prod") compil_mode="prod" ; shift ;;
"--dev") compil_mode="dev" ; shift ;;
"--debug") compil_mode="debug" ; shift ;;
"--arch") arch=$2 ; shift ; shift ;;
"--avail") ls arch/*.fcm | cut -d"-" -f2 | cut -d"." -f1 ; exit ;;
"--full") compil_full="true" ; shift ;;
"--use_oasis") use_oasis="true" oasis=$2 ; shift ; shift ;;
"--doc") doc="true" ; shift ;;
"--job") job=$2 ; shift ; shift ;;
"--netcdf_lib") netcdf_lib=$2 ; shift ; shift ;;
"--memtrack") use_memtrack="true" ; shift ;;
*) code="$1" ; shift ;;
esac
done
# Installation des sources
nb_files_gz=`ls $install_dir/tools/archive | grep tar.gz | wc -l`
if [ ${nb_files_gz} -ne 0 ]
then
echo -e "- uncompress archives ..."
for tarname in `ls $install_dir/tools/archive/*.tar.gz` ; do
gunzip -f "$tarname"
tar -xf ${tarname%.gz}
done
fi
# Vérification de la présence d'un identifiant d'architecture.
###############################################################
# lecture des chemins propres a l'architecture de la machine #
# et configuration de l'environnement #
###############################################################
rm -f .void_file
echo > .void_file
rm -rf .void_dir
mkdir .void_dir
if [[ !(-z $arch) ]]
then
rm -f $install_dir/arch.path
rm -f $install_dir/arch.fcm
rm -f $install_dir/arch.env
ln -s $install_dir/arch/arch-${arch}.path $install_dir/arch.path
ln -s $install_dir/arch/arch-${arch}.fcm $install_dir/arch.fcm
if test -f $install_dir/arch/arch-${arch}.env
then
ln -s $install_dir/arch/arch-${arch}.env arch.env
else
ln -s $install_dir/.void_file arch.env
fi
source $install_dir/arch.env
source $install_dir/arch.path
else
echo "Please choose a target achitecture --> list all available architecture using make_xios --avail!"
exit 1
fi
# Vérification de la présence d'un mode de compilation.
if [[ "$compil_mode" == "prod" ]]
then
COMPIL_CFLAGS="%PROD_CFLAGS"
COMPIL_FFLAGS="%PROD_FFLAGS"
elif [[ "$compil_mode" == "dev" ]]
then
COMPIL_CFLAGS="%DEV_CFLAGS"
COMPIL_FFLAGS="%DEV_FFLAGS"
elif [[ "$compil_mode" == "debug" ]]
then
COMPIL_CFLAGS="%DEBUG_CFLAGS"
COMPIL_FFLAGS="%DEBUG_FFLAGS"
fi
rm -r $PWD/extern/netcdf4
if [[ "$netcdf_lib" == "netcdf4_par" ]]
then
ln -s $PWD/.void_dir $PWD/extern/netcdf4
XMLIO_CPPKEY="$XMLIO_CPPKEY USING_NETCDF_PAR"
elif [[ "$netcdf_lib" == "netcdf4_seq" ]]
then
ln -s $PWD/.void_dir $PWD/extern/netcdf4
elif [[ "$netcdf_lib" == "netcdf4_internal" ]]
then
ln -s $PWD/extern/src_netcdf4 $PWD/extern/netcdf4
XMLIO_CPPKEY="$XMLIO_CPPKEY USING_NETCDF_PAR USING_NETCDF_INTERNAL"
export NETCDF_INCDIR="-I${PWD}/extern/netcdf4"
export NETCDF_LIBDIR=""
export NETCDF_LIB=""
else
echo "Bad choice for --netcdf_lib argument : choose between 'netcdf4_par','netcdf4_seq' or 'netcdf4_internal'"
exit
fi
if [[ "$use_oasis" == "true" ]]
then
if [[ "$oasis" == "oasis3_mct" ]]
then
XMLIO_CPPKEY="$XMLIO_CPPKEY USE_OMCT"
elif [[ "$oasis" == "oasis3" ]]
then
XMLIO_CPPKEY="$XMLIO_CPPKEY USE_OASIS"
OASIS_INCDIR="-I$PWD/../../prism/X64/build/lib/psmile.MPI1"
OASIS_LIBDIR="-L$PWD/../../prism/X64/lib"
OASIS_LIB="-lpsmile.MPI1 -lmpp_io"
else
echo "Bad choice for --use_oasis argument : choose between 'oasis3','oasis3_mct'"
exit
fi
NETCDF_LIB="-lnetcdff -lnetcdf"
XMLIO_FINCDIR="$OASIS_INCDIR $XMLIO_FINCDIR"
XMLIO_LIB="$OASIS_LIBDIR $OASIS_LIB $XMLIO_LIB"
fi
if [[ "$use_memtrack" == "true" ]]
then
XMLIO_LIB="$ADDR2LINE_LIBDIR $ADDR2LINE_LIB $XMLIO_LIB"
XMLIO_CPPKEY="$XMLIO_CPPKEY XIOS_MEMTRACK"
fi
XMLIO_CINCDIR="$NETCDF_INCDIR $HDF5_INCDIR $MPI_INCDIR"
XMLIO_FINCDIR="$XMLIO_FINCDIR $MPI_INCDIR"
XMLIO_LIB="$XMLIO_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB"
rm -f config.fcm
echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> config.fcm
echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm
echo "%CPP_KEY $XMLIO_CPPKEY" >> config.fcm
echo "%CBASE_INC $XMLIO_CINCDIR" >> config.fcm
echo "%FBASE_INC $XMLIO_FINCDIR" >> config.fcm
echo "%ARCH_LD $XMLIO_LIB" >> config.fcm
echo "=> Using "$compil_mode" mode for compiling under architecture \""$arch"\" !"
# Création de la documentation doxygen.
if [[ !(-z $doc) ]]
then
echo -e "- Create Doxygen documentation (disabled)..."
#doxygen -s
fi
make_dir=$PWD
export PATH=$PWD/tools/FCM/bin:$PATH
#$make_dir/tools/preprocess_cpp $make_dir/src/xmlio/iface/interface.cpp $make_dir/src/xmlio/iface/interface.cpp.in
#$make_dir/tools/preprocess_f03 $make_dir/src/xmlio/fortran/ixmlioserver.f90 $make_dir/src/xmlio/fortran/ixmlioserver.f03.in
if [[ "$compil_full" == "true" ]]
then
fcm build --clean --ignore-lock
fcm build -f --ignore-lock -j $job
else
fcm build --ignore-lock -j $job
fi
build_exit_status=$?
if [[ $build_exit_status == 0 ]]
then
set nothing
# cd $WORKDIR/XMLIO_NEMO_COUPLE/modeles/NEMO/WORK
# cd $WORKDIR/XMLIO_NEMO/modeles/NEMO/WORK
# make
fi
exit $build_exit_status