Skip to content

Commit ed507a8

Browse files
author
peng li
committed
githubaction:cuda
1 parent ead9a33 commit ed507a8

3 files changed

Lines changed: 80 additions & 0 deletions

File tree

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: op/cuda-linux Build
2+
on:
3+
push:
4+
paths:
5+
- 'executor/mem-cuda/**'
6+
pull_request:
7+
paths:
8+
- 'executor/mem-cuda/**'
9+
env:
10+
CUDA_VERSION: "12.9.1"
11+
CUDA_MAJOR_VERSION: "12"
12+
CUDNN_VERSION: "8.9.7.29"
13+
CUTLASS_VERSION: "3.4.1"
14+
15+
jobs:
16+
build:
17+
strategy:
18+
matrix:
19+
os: [ubuntu-22.04]
20+
backend: [cuda]
21+
runs-on: ${{ matrix.os }}
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
# 使用NVIDIA官方Docker镜像,避免依赖安装问题
29+
- name: Set up Docker
30+
uses: docker/setup-buildx-action@v2
31+
32+
# 使用预装CUDA和工具的NVIDIA容器
33+
- name: Build and Test in Docker Container
34+
run: |
35+
docker run --rm -v ${{ github.workspace }}:/workspace \
36+
-w /workspace \
37+
nvidia/cuda:${{ CUDA_VERSION }}-devel-ubuntu24.04 \
38+
/bin/bash -c "
39+
# 安装系统依赖
40+
apt-get update && \
41+
DEBIAN_FRONTEND=noninteractive apt-get install -y \
42+
build-essential \
43+
cmake \
44+
libyaml-cpp-dev \
45+
libgtest-dev \
46+
clang \
47+
git \
48+
ninja-build \
49+
ccache \
50+
wget \
51+
&& \
52+
53+
# 安装 cuDNN - 使用更新的下载链接格式
54+
wget https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-${CUDNN_VERSION}_cuda${CUDA_MAJOR_VERSION}-archive.tar.xz && \
55+
tar -xf cudnn-linux-x86_64-${CUDNN_VERSION}_cuda${CUDA_MAJOR_VERSION}-archive.tar.xz -C /usr/local && \
56+
57+
# 安装 CUTLASS - 仅安装头文件而不是共享库
58+
git clone --depth 1 --branch v${CUTLASS_VERSION} https://github.com/NVIDIA/cutlass.git && \
59+
cd cutlass && \
60+
# 直接复制头文件到系统目录
61+
cp -r include/* /usr/local/include/ && \
62+
cd /workspace && \
63+
64+
# 构建 common 库
65+
cd executor/cpp-common && \
66+
mkdir -p build && cd build && \
67+
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -GNinja .. && \
68+
ninja && \
69+
70+
# 构建 CUDA 执行器
71+
cd ../../mem-cuda && \
72+
mkdir -p build && cd build && \
73+
cmake -DCMAKE_BUILD_TYPE=Release \
74+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
75+
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda \
76+
-DCMAKE_CUDA_ARCHITECTURES=\"60;70;75;80;86\" \
77+
-DCUTLASS_DIR=/usr/local \
78+
-GNinja .. && \
79+
ninja
80+
"
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)