Repository navigation
Expand file tree
/
Copy pathmake_whl.sh
More file actions
executable file
·95 lines (82 loc) · 2.39 KB
/
Copy pathmake_whl.sh
File metadata and controls
executable file
·95 lines (82 loc) · 2.39 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
#!/bin/bash
NIGHTLY=0
for arg in "$@"; do
case $arg in
--nightly)
NIGHTLY=1
shift
;;
esac
done
export FASTLLM_NIGHTLY=$NIGHTLY
folder="build-fastllm"
# 创建工作文件夹
rm -rf "$folder"
mkdir "$folder"
cd $folder
pick_cxx_compiler() {
if [ -n "${CXX:-}" ] && command -v "$CXX" >/dev/null 2>&1; then
command -v "$CXX"
return 0
fi
for compiler in /usr/bin/g++-11 /usr/bin/g++-10 g++ c++; do
if command -v "$compiler" >/dev/null 2>&1; then
command -v "$compiler"
return 0
fi
done
return 1
}
CXX_COMPILER="$(pick_cxx_compiler)"
if [ -z "$CXX_COMPILER" ]; then
echo "C++ compiler not found. Please install g++ or set CXX to a valid compiler path."
exit -1
fi
echo "Using C++ compiler: ${CXX_COMPILER}"
# cpu
rm -rf CMakeCache.txt CMakeFiles
cmake .. -DMAKE_WHL_X86=ON -DUSE_CUDA=OFF -DUSE_NUMAS=ON -DCMAKE_CXX_COMPILER="${CXX_COMPILER}"
make fastllm_tools -j30
if [ $? != 0 ]; then
exit -1
fi
cp tools/ftllm/libfastllm_tools.so tools/ftllm/libfastllm_tools-cpu.so
# cuda-10
#rm -rf CMakeCache.txt CMakeFiles
#cmake .. -DMAKE_WHL_X86=ON -DUSE_CUDA=ON -DCUDA_ARCH=70 -D CMAKE_CUDA_COMPILER=/usr/local/cuda-10.1/bin/nvcc
#make fastllm_tools -j30
#if [ $? != 0 ]; then
# exit -1
#fi
#cp tools/ftllm/libfastllm_tools.so tools/ftllm/libfastllm_tools-cu10.so
# cuda-12
rm -rf CMakeCache.txt CMakeFiles
CUDA_ARCH_LIST="70;75;80;89;90;100;120"
if [ -x /usr/local/cuda/bin/nvcc ]; then
CUDA_COMPILER=/usr/local/cuda/bin/nvcc
elif [ -x /usr/local/cuda-12.9/bin/nvcc ]; then
CUDA_COMPILER=/usr/local/cuda-12.9/bin/nvcc
elif [ -x /usr/local/cuda-12.1/bin/nvcc ]; then
CUDA_COMPILER=/usr/local/cuda-12.1/bin/nvcc
else
echo "nvcc not found in /usr/local/cuda*/bin"
exit -1
fi
cmake .. \
-DMAKE_WHL_X86=ON \
-DUSE_CUDA=ON \
-DUSE_NUMAS=ON \
-DCUDA_ARCH="${CUDA_ARCH_LIST}" \
-DCMAKE_CUDA_ARCHITECTURES="${CUDA_ARCH_LIST}" \
-DCMAKE_CXX_COMPILER="${CXX_COMPILER}" \
-DCMAKE_CUDA_HOST_COMPILER="${CXX_COMPILER}" \
-DCMAKE_CUDA_COMPILER="${CUDA_COMPILER}"
make fastllm_tools -j30
if [ $? != 0 ]; then
exit -1
fi
cd tools
ldd ftllm/libfastllm_tools.so | grep '=>' | awk '{print $3}' | grep 'libnuma' | xargs -I {} cp -n {} ftllm/.
python3 setup.py sdist build
python3 setup.py bdist_wheel --plat-name manylinux2014_$(uname -m)
#python3 setup.py install --all