-
Notifications
You must be signed in to change notification settings - Fork 130
124 lines (104 loc) · 4.01 KB
/
build_tflite_2.9.yml
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
name: TFLite-2.9
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: check envirionment
run: |
env
cmake --version
bazel --version
pip3 install numpy
sudo apt install libgles2-mesa-dev
sudo apt install libdrm-dev
# -------------------------------------------------------
# build Tensorflow-lite library.
# -------------------------------------------------------
- name: Checkout Tensorflow
uses: actions/checkout@v2
with:
fetch-depth: 1
repository: tensorflow/tensorflow
ref: r2.9
path: tensorflow
- name: Configure Tensorflow
run: |
cd $GITHUB_WORKSPACE/tensorflow
git branch
export PYTHON_BIN_PATH=/usr/bin/python3
export USE_DEFAULT_PYTHON_LIB_PATH=1
export TF_NEED_ROCM=false
export TF_NEED_CUDA=false
export TF_DOWNLOAD_CLANG=false
export TF_SET_ANDROID_WORKSPACE=false
export CC_OPT_FLAGS=-Wno-sign-compare
./configure
- name: Build libtensorflowlite.so
run: |
cd $GITHUB_WORKSPACE/tensorflow
bazel build -s -c opt //tensorflow/lite:libtensorflowlite.so
- name: Build libtensorflowlite_gpu_delegate.so
run: |
cd $GITHUB_WORKSPACE/tensorflow
bazel build -s -c opt --copt="-DMESA_EGL_NO_X11_HEADERS" --copt="-DEGL_NO_X11" tensorflow/lite/delegates/gpu:libtensorflowlite_gpu_delegate.so
- name: Check Build products
run: |
cd $GITHUB_WORKSPACE/tensorflow
ls -l bazel-bin/tensorflow/lite/
ls -l bazel-bin/tensorflow/lite/delegates/gpu/
- name: Copy libralies
run: |
cd $GITHUB_WORKSPACE/tensorflow
mkdir $GITHUB_WORKSPACE/lib
cp bazel-bin/tensorflow/lite/libtensorflowlite.so $GITHUB_WORKSPACE/lib/
cp bazel-bin/tensorflow/lite/delegates/gpu/libtensorflowlite_gpu_delegate.so $GITHUB_WORKSPACE/lib/
ls -l $GITHUB_WORKSPACE/lib
# -------------------------------------------------------
# download all the build dependencies for tflite-app.
# -------------------------------------------------------
- name: Download all the build dependencies for tflite-app.
run: |
cd $GITHUB_WORKSPACE/tensorflow
mkdir external
cd external
cmake ../tensorflow/lite -DCMAKE_FIND_DEBUG_MODE=1
# -------------------------------------------------------
# link include/library path for compatibility.
# $HOME/lib <-- $GITHUB_WORKSPACE/lib
# $HOME/work/tensorflow <-- $GITHUB_WORKSPACE/tensorflow
# -------------------------------------------------------
- name: Link include/library path
run: |
cd $HOME
ln -s $GITHUB_WORKSPACE/lib .
mkdir -p work
cd work
ln -s $GITHUB_WORKSPACE/tensorflow .
ls -lF $HOME
ls -lF $HOME/work
# -------------------------------------------------------
# build applications.
# -------------------------------------------------------
- name: Checkout tflite_gles_app
uses: actions/checkout@v2
with:
fetch-depth: 1
repository: terryky/tflite_gles_app
path: tflite_gles_app
- name: Build applications
run: |
cd $GITHUB_WORKSPACE/tflite_gles_app
make -j