-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_fftw.sh
More file actions
77 lines (60 loc) · 1.85 KB
/
build_fftw.sh
File metadata and controls
77 lines (60 loc) · 1.85 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
#!/bin/bash -e
show_help() {
echo "usage: source $(basename "$BASH_SOURCE") [OPTION]"
echo "options:"
echo " --help: help message"
return 1
}
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PARENT_DIR=$(dirname $(dirname "${SCRIPT_DIR}"))
LIB_DIR="$PARENT_DIR/lib"
mkdir -p "$LIB_DIR"
FFTW_SOURCE_DIR="$LIB_DIR/fftw-3.3.10"
FFTW_INSTALL_DIR="$LIB_DIR/fftw-3.3.10/install_fftw"
FFTW_BUILD_DIR="$LIB_DIR/fftw-3.3.10/build_fftw"
if [ ! -d "$FFTW_SOURCE_DIR" ]; then
echo "fftw doesn't exist in '$LIB_DIR', downloading fftw..."
wget -P "$LIB_DIR" "http://www.fftw.org/fftw-3.3.10.tar.gz"
tar -C "$LIB_DIR" -zxvf "$LIB_DIR/fftw-3.3.10.tar.gz"
else
echo "fftw exists in '$LIB_DIR', skipping download..."
fi
if [ -d "$FFTW_INSTALL_DIR" ]; then
echo "fftw already installed, delete $FFTW_INSTALL_DIR and $FFTW_BUILD_DIR"
return 0
fi
config_options=(
CFLAGS='-O3 -DNDEBUG -fPIC'
--prefix=${FFTW_INSTALL_DIR}
--enable-mpi
--enable-threads
--enable-openmp
#--enable-avx
#--enable-avx2
#--enable-avx512
)
# have to mkdir/cd because their configure doesn't provide build_dir
current_dir=$(pwd)
mkdir -p "$FFTW_BUILD_DIR"
cd "$FFTW_BUILD_DIR"
# double precision configure
"$FFTW_SOURCE_DIR/configure" "${config_options[@]}"
echo "building double precision fftw..."
make -C "$FFTW_BUILD_DIR" -j"$num_jobs"
echo "installing double precision fftw..."
make -C "$FFTW_BUILD_DIR" install
# cleanup before installing single precision
make distclean
# single precision option
config_options+=(
--enable-float
)
# single precision configure
"$FFTW_SOURCE_DIR/configure" "${config_options[@]}"
echo "building single precision fftw..."
make -C "$FFTW_BUILD_DIR" -j"$num_jobs"
echo "installing single precision fftw..."
make -C "$FFTW_BUILD_DIR" install
make distclean
cd "$current_dir"
echo "fftw installation complete"