forked from sophgo/tpu-mlir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release_pip.sh
executable file
·89 lines (78 loc) · 5.22 KB
/
release_pip.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
#!/bin/bash
set -e
source envsetup.sh
rm -rf ${INSTALL_PATH}
rm -rf ${PROJECT_ROOT}/regression/regression_out
# source build.sh RELEASE
# export mlir_version="$(grep MLIR_VERSION ${BUILD_PATH}/CMakeCache.txt | cut -d "=" -f2)"
export mlir_version="v0.3"
release_archive="./tpu_mlir"
rm -rf ${release_archive}
mkdir -p ${release_archive}
# cp -rf ${INSTALL_PATH}/* ${release_archive}
cp -rf ${PROJECT_ROOT}/regression ${release_archive}
rm -rf ${release_archive}/regression/model
cp -rf ${PROJECT_ROOT}/third_party/customlayer ${release_archive}
mkdir -p ${release_archive}/python/
cp -rf /usr/local/python_packages/caffe/ ${release_archive}/python/caffe/
cp ${PROJECT_ROOT}/release_tools/{__init__.py,entryconfig.py} ${release_archive}
cp ${PROJECT_ROOT}/release_tools/{setup.py,MANIFEST.in} ${PROJECT_ROOT}
touch ${release_archive}/__version__
echo ${mlir_version} > ${release_archive}/__version__
# # collect_caffe_dependence
# mkdir -p ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.74.0 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.74.0 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libboost_regex.so.1.74.0 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libglog.so.0 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libgflags.so.2.2 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libprotobuf.so.23 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libm.so.6 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libboost_python310.so.1.74.0 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libgomp.so.1 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libz.so.1 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libicui18n.so.70 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libicuuc.so.70 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libunwind.so.8 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libpthread.so.0 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libgfortran.so.5 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/liblzma.so.5 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libquadmath.so.0 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libopenblas.so.0 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libicudata.so.70 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libc.so.6 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libomp.so.5 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libomp.so.5 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libGL.so.1 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libGLdispatch.so.0 ${release_archive}/lib/third_party/
# cp /usr/lib/x86_64-linux-gnu/libGLX.so.0 ${release_archive}/lib/third_party/
# # collect_oneDNN_dependence
# cp /usr/local/lib/libdnnl.so ${release_archive}/lib/third_party/
# cp /usr/local/lib/libdnnl.so.3 ${release_archive}/lib/third_party/
# cp /usr/local/lib/libdnnl.so.3.1 ${release_archive}/lib/third_party/
# # collect_capi_dependence
# cp -rf ${PROJECT_ROOT}/capi/lib/* ${release_archive}/lib/third_party/
# # automic entries gen for entry.py and set for setup.py
# python ${release_archive}/entryconfig.py bin/ python/tools/ python/samples/
# # set rpath
# pushd ${release_archive}
# find ./lib/ -maxdepth 1 -type f -exec sh -c 'patchelf --force-rpath --set-rpath "\$ORIGIN/./:\$ORIGIN/./third_party/" "$0"' {} \;
# find ./lib/third_party/ -maxdepth 1 -type f -exec sh -c 'patchelf --force-rpath --set-rpath "\$ORIGIN/../:\$ORIGIN/./" "$0"' {} \;
# find ./bin/ -maxdepth 1 -type f -exec sh -c 'patchelf --set-rpath "\$ORIGIN/../lib/:\$ORIGIN/../lib/third_party/" "$0"' {} \;
# find ./python/ -maxdepth 1 -type f -exec sh -c 'patchelf --force-rpath --set-rpath "\$ORIGIN/../lib/:\$ORIGIN/../lib/third_party/" "$0"' {} \;
# patchelf --set-rpath '$ORIGIN/../../../lib/:$ORIGIN/../../../lib/third_party/' ./python/mlir/_mlir_libs/libTPUMLIRPythonCAPI.so.18git
# patchelf --set-rpath '$ORIGIN/../../../lib/:$ORIGIN/../../../lib/third_party/:$ORIGIN/' ./python/mlir/_mlir_libs/_mlir.cpython-310-x86_64-linux-gnu.so
# patchelf --set-rpath '$ORIGIN/../../../lib/:$ORIGIN/../../../lib/third_party/:$ORIGIN/' ./python/mlir/_mlir_libs/_mlirDialectsQuant.cpython-310-x86_64-linux-gnu.so
# patchelf --set-rpath '$ORIGIN/../../../lib/:$ORIGIN/../../../lib/third_party/:$ORIGIN/' ./python/mlir/_mlir_libs/_mlirRegisterEverything.cpython-310-x86_64-linux-gnu.so
# popd
# build pip package
python -m build
# clean files
# rm dist/*.tar.gz
rm -rf ${release_archive} && rm -rf ${release_archive}.egg-info
rm setup.py && rm MANIFEST.in