Skip to content

Commit 56a3b84

Browse files
authored
Create libmnn-linux.yml
1 parent 39ed5b3 commit 56a3b84

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

.github/workflows/libmnn-linux.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: MNN for Linux
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
include:
12+
- image: ubuntu:20.04
13+
sysname: ubuntu20
14+
cuda: "11.0.3"
15+
- image: ubuntu:20.04
16+
sysname: ubuntu20
17+
cuda: "11.8.0"
18+
- image: ubuntu:20.04
19+
sysname: ubuntu20
20+
cuda: "12.2.0"
21+
- image: ubuntu:20.04
22+
sysname: ubuntu20
23+
cuda: "12.8.1"
24+
- image: ubuntu:22.04
25+
sysname: ubuntu22
26+
cuda: "11.8.0"
27+
- image: ubuntu:22.04
28+
sysname: ubuntu22
29+
cuda: "12.3.2"
30+
- image: ubuntu:22.04
31+
sysname: ubuntu22
32+
cuda: "12.8.1"
33+
# - image: ubuntu:24.04
34+
# sysname: ubuntu24
35+
# cuda: "11.8.0"
36+
# # Failed to verify gcc version.
37+
# - image: ubuntu:24.04
38+
# sysname: ubuntu24
39+
# cuda: '12.3.2'
40+
# # Failed in build mnncuda.
41+
- image: ubuntu:24.04
42+
sysname: ubuntu24
43+
cuda: "12.6.3"
44+
# - image: ubuntu:latest
45+
# sysname: ubuntu
46+
# cuda: '12.9.0'
47+
# # Failed in setup cuda
48+
# - image: debian:bullseye
49+
# sysname: debian
50+
# cuda: "10.2.89"
51+
# # Failed to verify gcc version.
52+
- image: debian:bullseye
53+
sysname: debian
54+
cuda: "12.2.0"
55+
56+
container:
57+
image: ${{ matrix.image }}
58+
59+
steps:
60+
- name: Checkout code
61+
uses: actions/checkout@v4
62+
63+
- name: Install build dependencies (Debian/Ubuntu)
64+
env:
65+
DEBIAN_FRONTEND: noninteractive
66+
run: |
67+
apt-get update
68+
apt-get install -y --no-install-recommends ca-certificates sudo
69+
update-ca-certificates
70+
apt-get install -y --no-install-recommends build-essential unzip cmake git wget libopencv-dev ocl-icd-opencl-dev clinfo libvulkan-dev vulkan-tools
71+
72+
- name: Clone 3rdparty
73+
run: |
74+
git clone https://github.com/webmproject/libwebp --depth 1
75+
git clone https://github.com/alibaba/MNN --depth 1
76+
# wget https://github.com/alibaba/MNN/releases/download/3.1.0/mnn_3.1.0_linux_x64_cpu_opencl.zip; unzip mnn_3.1.0_linux_x64_cpu_opencl.zip ; mv mnn_3.1.0_linux_x64_cpu_opencl mnn_linux_x64;
77+
# cp MNN/include mnn_linux_x64/
78+
# wget -nv https://github.com/Tencent/ncnn/releases/download/20250503/ncnn-20250503-ubuntu-2404-shared.zip; unzip ncnn-20250503-ubuntu-2404-shared.zip ; mv ncnn-20250503-ubuntu-2404-shared ncnn-ubuntu-shared
79+
working-directory: 3rdparty
80+
81+
# - name: Modify CMakeLists.txt for RPATH
82+
# run: |
83+
# echo "Modifying CMakeLists.txt to add RPATH settings..."
84+
# sed -i.bak '/target_link_libraries(MNN PUBLIC -pthread dl)/a \
85+
# set_target_properties(MNN PROPERTIES\
86+
# BUILD_RPATH "$ORIGIN/lib"\
87+
# )
88+
# ' CMakeLists.txt
89+
# echo "--- Verification: Content after modification ---"
90+
# grep -C 5 "target_link_libraries(MNN PUBLIC -pthread dl)" CMakeLists.txt
91+
# working-directory: 3rdparty/MNN
92+
93+
- name: Verify the System
94+
run: |
95+
gcc --version
96+
sudo whoami
97+
echo cpu $(nproc)
98+
pwd
99+
100+
- name: Set up CUDA ${{ matrix.cuda }}
101+
id: cuda
102+
uses: Jimver/cuda-toolkit@v0.2.25
103+
with:
104+
cuda: ${{ matrix.cuda }}
105+
use-github-cache: false
106+
use-local-cache: false
107+
log-file-suffix: '${{ matrix.sysname }}-cuda${{ matrix.cuda }}.txt'
108+
109+
- name: build mnn
110+
id: mnn
111+
run: |
112+
mkdir build ;cd build; cmake .. -DCMAKE_BUILD_TYPE=Release -DMNN_TENSORRT=OFF -DMNN_OPENGL=OFF -DMNN_OPENCL=ON -DMNN_VULKAN=ON -DMNN_CUDA=ON -DMNN_SEP_BUILD=OFF && make -j$(nproc)
113+
mkdir ../libmnn-${{ matrix.sysname }}-cuda${{ matrix.cuda }}-opencl-vulkan-cpu; cd ../libmnn-${{ matrix.sysname }}-cuda${{ matrix.cuda }}-opencl-vulkan-cpu
114+
cp ../build/*.so ./ ; ls -lh
115+
working-directory: 3rdparty/MNN
116+
117+
- name: Upload build artifacts
118+
uses: actions/upload-artifact@v4
119+
with:
120+
name: libmnn-${{ matrix.sysname }}-cuda${{ matrix.cuda }}-opencl-vulkan-cpu
121+
path: 3rdparty/MNN/libmnn-${{ matrix.sysname }}-cuda${{ matrix.cuda }}-opencl-vulkan-cpu
122+
retention-days: 90
123+

0 commit comments

Comments
 (0)