-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sh
executable file
·202 lines (175 loc) · 5.89 KB
/
build.sh
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
#!/bin/bash
#
# This script is used to build the Texel distribution.
# It needs an environment where several cross compilers are available.
#
# To compile Texel for your computer, do not run this script.
# Instead follow the instructions in readme.txt in the section "Compiling".
#
rm -rf build bin
# Native Release build
mkdir -p build/Release
(cd build/Release &&
cmake ../.. -DCMAKE_BUILD_TYPE=Release \
-DUSE_AVX2=on \
-DUSE_BMI2=on \
-DUSE_CTZ=on \
-DUSE_LARGE_PAGES=on \
-DUSE_NUMA=on \
-DUSE_POPCNT=on \
-DUSE_PREFETCH=on
) &
# Windows 64-bit for "old" CPU/OS
mkdir -p build/win64_old
(cd build/win64_old &&
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchains/win64_clang.cmake \
-DUSE_CTZ=on \
-DUSE_PREFETCH=on
) &
# Windows 64-bit, SSSE3
mkdir -p build/win64_ssse3
(cd build/win64_ssse3 &&
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchains/win64_clang.cmake \
-DUSE_WIN7=off \
-DUSE_SSSE3=on \
-DUSE_CTZ=on \
-DUSE_LARGE_PAGES=on \
-DUSE_NUMA=on \
-DUSE_POPCNT=off \
-DUSE_PREFETCH=on
) &
# Windows 64-bit, AVX2
mkdir -p build/win64_avx2
(cd build/win64_avx2 &&
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchains/win64_clang.cmake \
-DUSE_WIN7=on \
-DUSE_AVX2=on \
-DUSE_CTZ=on \
-DUSE_LARGE_PAGES=on \
-DUSE_NUMA=on \
-DUSE_POPCNT=off \
-DUSE_PREFETCH=on
) &
# Windows 64-bit, AVX2 + POPCNT
mkdir -p build/win64
(cd build/win64 &&
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchains/win64_clang.cmake \
-DUSE_WIN7=on \
-DUSE_AVX2=on \
-DUSE_CTZ=on \
-DUSE_LARGE_PAGES=on \
-DUSE_NUMA=on \
-DUSE_POPCNT=on \
-DUSE_PREFETCH=on
) &
# Windows 64-bit with AVX2 + POPCNT + BMI2
mkdir -p build/win64_bmi
(cd build/win64_bmi &&
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchains/win64_clang.cmake \
-DUSE_WIN7=on \
-DUSE_AVX2=on \
-DUSE_BMI2=on \
-DUSE_CTZ=on \
-DUSE_LARGE_PAGES=on \
-DUSE_NUMA=on \
-DUSE_POPCNT=on \
-DUSE_PREFETCH=on
) &
# Windows 64-bit with AVX512 + POPCNT + BMI2
mkdir -p build/win64_avx512
(cd build/win64_avx512 &&
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchains/win64_clang.cmake \
-DUSE_WIN7=on \
-DUSE_AVX512=on \
-DUSE_BMI2=on \
-DUSE_CTZ=on \
-DUSE_LARGE_PAGES=on \
-DUSE_NUMA=on \
-DUSE_POPCNT=on \
-DUSE_PREFETCH=on
) &
# Windows 64-bit with cluster support
mkdir -p build/win64cl
(cd build/win64cl &&
cmake ../.. -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchains/win64_clang.cmake \
-DUSE_WIN7=on \
-DUSE_AVX2=on \
-DUSE_CLUSTER=on \
-DUSE_CTZ=on \
-DUSE_LARGE_PAGES=on \
-DUSE_NUMA=on \
-DUSE_POPCNT=on \
-DUSE_PREFETCH=on
) &
# Android 64-bit with NEON
mkdir -p build/android64
(cd build/android64 &&
cmake -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-21 ../.. \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_CTZ=on \
-DUSE_PREFETCH=on \
-DUSE_NEON=on
) &
# Android 64-bit with NEON and dot product
mkdir -p build/android64_dot
(cd build/android64_dot &&
cmake -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-21 ../.. \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_CTZ=on \
-DUSE_PREFETCH=on \
-DUSE_NEON_DOT=on
) &
wait
# Build all
para=16
cmake --build build/Release -j ${para} || exit 2
cmake --build build/win64_old -j ${para} || exit 2
cmake --build build/win64_ssse3 -j ${para} || exit 2
cmake --build build/win64_avx2 -j ${para} || exit 2
cmake --build build/win64 -j ${para} || exit 2
cmake --build build/win64_bmi -j ${para} || exit 2
cmake --build build/win64_avx512 -j ${para} || exit 2
cmake --build build/win64cl -j ${para} || exit 2
cmake --build build/android64 -j ${para} || exit 2
cmake --build build/android64_dot -j ${para} || exit 2
make -C doc
# Copy to bin and strip executables
mkdir -p bin
cp build/Release/texel bin/texel64
strip bin/texel64
cp build/win64_old/texel.exe bin/texel64-old.exe
x86_64-w64-mingw32-strip bin/texel64-old.exe
cp build/win64_ssse3/texel.exe bin/texel64-ssse3.exe
x86_64-w64-mingw32-strip bin/texel64-ssse3.exe
cp build/win64_avx2/texel.exe bin/texel64-avx2.exe
x86_64-w64-mingw32-strip bin/texel64-avx2.exe
cp build/win64/texel.exe bin/texel64-avx2-pop.exe
x86_64-w64-mingw32-strip bin/texel64-avx2-pop.exe
cp build/win64/runcmd.exe bin/runcmd.exe
x86_64-w64-mingw32-strip bin/runcmd.exe
cp build/win64/texelutil.exe bin/texelutil.exe
x86_64-w64-mingw32-strip bin/texelutil.exe
cp build/win64_bmi/texel.exe bin/texel64-avx2-bmi.exe
x86_64-w64-mingw32-strip bin/texel64-avx2-bmi.exe
cp build/win64_avx512/texel.exe bin/texel64-avx512.exe
x86_64-w64-mingw32-strip bin/texel64-avx512.exe
cp build/win64cl/texel.exe bin/texel64cl.exe
x86_64-w64-mingw32-strip bin/texel64cl.exe
cp build/android64/texel bin/texel-arm64
aarch64-linux-android-strip bin/texel-arm64
cp build/android64_dot/texel bin/texel-arm64-dot
aarch64-linux-android-strip bin/texel-arm64-dot
# Create archive
VER=$(echo -e 'uci\nquit' | bin/texel64 | grep 'id name' | awk '{print $4}' | tr -d .)
rm -rf texel${VER}.7z texel${VER}
mkdir texel${VER}
cp --parents -r \
CMakeLists.txt build.sh app bin cmake lib test \
COPYING readme.txt doc texelbook.bin nndata.tbin.compr \
texel${VER}/
rm texel${VER}/doc/.gitignore
chmod -R ug+w texel${VER}
7za a texel${VER}.7z texel${VER}
rm -rf texel${VER}