Skip to content

Commit 0c9d0c7

Browse files
authored
add linux/windows build workflow (#10)
1 parent 00561f0 commit 0c9d0c7

File tree

5 files changed

+122
-11
lines changed

5 files changed

+122
-11
lines changed

.github/workflows/linux-x64-gpu.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: linux-x64-gpu
2+
on:
3+
push:
4+
paths:
5+
- '.github/workflows/linux-x64-gpu.yml'
6+
- 'src/**'
7+
- 'CMakeLists.txt'
8+
pull_request:
9+
paths:
10+
- '.github/workflows/linux-x64-gpu.yml'
11+
- 'src/**'
12+
- 'CMakeLists.txt'
13+
concurrency:
14+
group: linux-x64-gpu-${{ github.ref }}
15+
cancel-in-progress: true
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
build:
21+
strategy:
22+
matrix:
23+
cudaver: [11.8, 12.1]
24+
name: cuda-${{ matrix.cudaver }}
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Free disk space
28+
uses: jlumbroso/free-disk-space@main
29+
with:
30+
# This might remove tools that are actually needed, if set to "true" but frees about 6 GB
31+
tool-cache: false
32+
docker-images: false
33+
# All of these default to true, but feel free to set to "false" if necessary for your workflow
34+
android: true
35+
dotnet: true
36+
haskell: true
37+
large-packages: true
38+
swap-storage: false
39+
- name: Checkout repository
40+
uses: actions/checkout@v3
41+
- name: Build
42+
uses: addnab/docker-run-action@v3
43+
with:
44+
image: openmmlab/lmdeploy-builder:cuda${{ matrix.cudaver }}
45+
options: -v ${{ github.workspace }}:/work
46+
run: |
47+
cd /work
48+
source /opt/conda/bin/activate
49+
conda activate py38
50+
mkdir build && cd build
51+
cmake .. \
52+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
53+
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
54+
-DCMAKE_INSTALL_PREFIX=./install \
55+
-DCMAKE_CUDA_FLAGS="-lineinfo" \
56+
-DUSE_NVTX=ON \
57+
-DBUILD_TEST=ON
58+
make -j$(nproc) && make install
59+
cd ..
60+
rm -rf build
61+
python setup.py bdist_wheel --plat-name manylinux2014_x86_64 -d /tmp

.github/workflows/windows-x64-gpu.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: windows-x64-gpu
2+
on:
3+
push:
4+
paths:
5+
- '.github/workflows/windows-x64-gpu.yml'
6+
- 'src/**'
7+
- 'CMakeLists.txt'
8+
pull_request:
9+
paths:
10+
- '.github/workflows/windows-x64-gpu.yml'
11+
- 'src/**'
12+
- 'CMakeLists.txt'
13+
concurrency:
14+
group: windows-x64-gpu-${{ github.ref }}
15+
cancel-in-progress: true
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
build:
21+
strategy:
22+
matrix:
23+
cudaver: [11.8.0, 12.1.0]
24+
name: cuda-${{ matrix.cudaver }}
25+
runs-on: windows-latest
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v3
29+
- name: Set up python
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: '3.8'
33+
- name: Install python packages
34+
run: |
35+
pip install -r requirements/build.txt
36+
pip install wheel
37+
- name: Setup CUDA Toolkit
38+
id: cuda-toolkit
39+
shell: pwsh
40+
run: ./builder/windows/setup_cuda.ps1
41+
env:
42+
INPUT_CUDA_VERSION: ${{ matrix.cudaver }}
43+
- name: Build wheel
44+
run: |
45+
$env:BUILD_TEST="ON"
46+
mkdir build
47+
cd build
48+
..\builder\windows\generate.ps1
49+
cmake --build . --config Release -- /m /v:q
50+
if (-Not $?) {
51+
echo "build failed"
52+
exit 1
53+
}
54+
cmake --install . --config Release
55+
cd ..
56+
rm build -Force -Recurse
57+
python setup.py bdist_wheel -d build/wheel

CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
15+
cmake_minimum_required(VERSION 3.11 FATAL_ERROR)
1616
project(TurboMind LANGUAGES CXX CUDA)
1717

1818
find_package(CUDA 11.4 REQUIRED)
1919

20-
21-
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
22-
2320
option(BUILD_TEST "Build tests" OFF)
2421

2522
include(FetchContent)
@@ -51,8 +48,6 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold")
5148
set(CUDA_PATH ${CUDA_TOOLKIT_ROOT_DIR})
5249

5350

54-
list(APPEND CMAKE_MODULE_PATH ${CUDA_PATH}/lib64)
55-
5651
# profiling
5752
option(USE_NVTX "Whether or not to use nvtx" ON)
5853
if(USE_NVTX)

generate.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ fi
1010
cmake ${builder} .. \
1111
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
1212
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
13+
-DCMAKE_INSTALL_PREFIX=${WORKSPACE_PATH}/install \
1314
-DCMAKE_CUDA_FLAGS="-lineinfo" \
1415
-DUSE_NVTX=ON \
15-
-DBUILD_TEST=ON \
16-
-DFETCHCONTENT_UPDATES_DISCONNECTED=ON \
17-
-DLMDEPLOY_ASAN_ENABLE=OFF \
18-
-DLMDEPLOY_UBSAN_ENABLE=OFF \
19-
-DCMAKE_CUDA_ARCHITECTURES="80-real"
16+
-DBUILD_TEST=OFF

src/turbomind/api/python/linear.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "src/turbomind/kernels/gemm/gemm.h"
66
#include "src/turbomind/kernels/gemm/types.h"
77
#include "src/turbomind/utils/cuda_utils.h"
8+
#include "src/turbomind/utils/macro.h"
89
#include <cuda_fp16.h>
910
#include <cuda_runtime.h>
1011
#include <fstream>

0 commit comments

Comments
 (0)