build_with_parallel_support.sh
3.15 KB
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
#!/bin/bash
#
if [ -z "${1}" ]; then
echo "Usage : ${0} INSTALL_DIR"
exit 1
else
INSTALL_DIR=${1}
fi;
ZLIB_ARCHIVE_NAME="zlib-1.2.8"
ZLIB_ARCHIVE_PATH="../zlib/"$ZLIB_ARCHIVE_NAME".tar.gz"
MPICH_ARCHIVE_NAME="mpich-3.1.4"
MPICH_ARCHIVE_PATH="../mpich/"$MPICH_ARCHIVE_NAME".tar.gz"
HDF5_ARCHIVE_NAME="hdf5-1.8.15"
HDF5_ARCHIVE_PATH="../hdf5/"$HDF5_ARCHIVE_NAME".tar"
NETCDF_ARCHIVE_NAME="netcdf-4.3.3.1"
NETCDF_ARCHIVE_PATH="./"$NETCDF_ARCHIVE_NAME".tar.gz"
SCRIPT_DIR=`pwd`
TMP_DIR=$SCRIPT_DIR"/tmp"
mkdir -p $TMP_DIR
mkdir -p $INSTALL_DIR
echo "--------";
echo "| ZLIB |";
echo "--------";
tar xzf $ZLIB_ARCHIVE_PATH -C $TMP_DIR
if [[ $? != 0 ]]; then echo "[ERROR] Cannot decompress zlib archive"; exit $?; fi
cd $TMP_DIR"/"$ZLIB_ARCHIVE_NAME
./configure --prefix=$INSTALL_DIR
if [[ $? != 0 ]]; then echo "[ERROR] Cannot configure zlib"; exit $?; fi
make
if [[ $? != 0 ]]; then echo "[ERROR] Cannot compile zlib"; exit $?; fi
make install
if [[ $? != 0 ]]; then echo "[ERROR] Cannot install zlib"; exit $?; fi
echo "---------";
echo "| MPICH |";
echo "---------";
cd $SCRIPT_DIR
tar xzf $MPICH_ARCHIVE_PATH -C $TMP_DIR
if [[ $? != 0 ]]; then echo "[ERROR] Cannot decompress MPICH archive"; exit $?; fi
cd $TMP_DIR"/"$MPICH_ARCHIVE_NAME
./configure CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" --disable-fortran --prefix=$INSTALL_DIR |& tee c.txt
if [[ $? != 0 ]]; then echo "[ERROR] Cannot configure MPICH"; exit $?; fi
make 2>&1 | tee m.txt
if [[ $? != 0 ]]; then echo "[ERROR] Cannot compile MPICH"; exit $?; fi
make install |& tee mi.txt
if [[ $? != 0 ]]; then echo "[ERROR] Cannot install MPICH"; exit $?; fi
export PATH=$INSTALL_DIR"/bin":$PATH
export LD_LIBRARY_PATH=$INSTALL_DIR"/lib":$LD_LIBRARY_PATH
echo "------------------------------";
echo "| HDF5 with parallel support |";
echo "------------------------------";
cd $SCRIPT_DIR
tar xf $HDF5_ARCHIVE_PATH -C $TMP_DIR
if [[ $? != 0 ]]; then echo "[ERROR] Cannot decompress HDF5 archive"; exit $?; fi
cd $TMP_DIR"/"$HDF5_ARCHIVE_NAME
CC=$INSTALL_DIR/bin/mpicc ./configure --prefix=$INSTALL_DIR --enable-parallel --disable-fortran --with-zlib=$INSTALL_DIR
if [[ $? != 0 ]]; then echo "[ERROR] Cannot configure HDF5"; exit $?; fi
make
if [[ $? != 0 ]]; then echo "[ERROR] Cannot compile HDF5"; exit $?; fi
make check
if [[ $? != 0 ]]; then echo "[ERROR] Check error with HDF5"; exit $?; fi
make install
if [[ $? != 0 ]]; then echo "[ERROR] Cannot install HDF5"; exit $?; fi
echo "--------------------------------";
echo "| NetCDF with parallel support |";
echo "--------------------------------";
cd $SCRIPT_DIR
tar xzf $NETCDF_ARCHIVE_PATH -C $TMP_DIR
if [[ $? != 0 ]]; then echo "[ERROR] Cannot decompress NetCDF archive"; exit $?; fi
cd $TMP_DIR"/"$NETCDF_ARCHIVE_NAME
CPPFLAGS=-I$INSTALL_DIR/include LDFLAGS=-L$INSTALL_DIR/lib ./configure --prefix=$INSTALL_DIR
if [[ $? != 0 ]]; then echo "[ERROR] Cannot configure NetCDF"; exit $?; fi
make
if [[ $? != 0 ]]; then echo "[ERROR] Cannot compile NetCDF"; exit $?; fi
make check
if [[ $? != 0 ]]; then echo "[ERROR] Check error with NetCDF"; exit $?; fi
make install
if [[ $? != 0 ]]; then echo "[ERROR] Cannot install NetCDF"; exit $?; fi
echo "[DONE]"