Skip to content

Commit

Permalink
add linux/windows build workflow (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvhan028 authored Nov 7, 2024
1 parent 00561f0 commit 0c9d0c7
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 11 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/linux-x64-gpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: linux-x64-gpu
on:
push:
paths:
- '.github/workflows/linux-x64-gpu.yml'
- 'src/**'
- 'CMakeLists.txt'
pull_request:
paths:
- '.github/workflows/linux-x64-gpu.yml'
- 'src/**'
- 'CMakeLists.txt'
concurrency:
group: linux-x64-gpu-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read

jobs:
build:
strategy:
matrix:
cudaver: [11.8, 12.1]
name: cuda-${{ matrix.cudaver }}
runs-on: ubuntu-latest
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
# This might remove tools that are actually needed, if set to "true" but frees about 6 GB
tool-cache: false
docker-images: false
# All of these default to true, but feel free to set to "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: false
- name: Checkout repository
uses: actions/checkout@v3
- name: Build
uses: addnab/docker-run-action@v3
with:
image: openmmlab/lmdeploy-builder:cuda${{ matrix.cudaver }}
options: -v ${{ github.workspace }}:/work
run: |
cd /work
source /opt/conda/bin/activate
conda activate py38
mkdir build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_INSTALL_PREFIX=./install \
-DCMAKE_CUDA_FLAGS="-lineinfo" \
-DUSE_NVTX=ON \
-DBUILD_TEST=ON
make -j$(nproc) && make install
cd ..
rm -rf build
python setup.py bdist_wheel --plat-name manylinux2014_x86_64 -d /tmp
57 changes: 57 additions & 0 deletions .github/workflows/windows-x64-gpu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: windows-x64-gpu
on:
push:
paths:
- '.github/workflows/windows-x64-gpu.yml'
- 'src/**'
- 'CMakeLists.txt'
pull_request:
paths:
- '.github/workflows/windows-x64-gpu.yml'
- 'src/**'
- 'CMakeLists.txt'
concurrency:
group: windows-x64-gpu-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read

jobs:
build:
strategy:
matrix:
cudaver: [11.8.0, 12.1.0]
name: cuda-${{ matrix.cudaver }}
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install python packages
run: |
pip install -r requirements/build.txt
pip install wheel
- name: Setup CUDA Toolkit
id: cuda-toolkit
shell: pwsh
run: ./builder/windows/setup_cuda.ps1
env:
INPUT_CUDA_VERSION: ${{ matrix.cudaver }}
- name: Build wheel
run: |
$env:BUILD_TEST="ON"
mkdir build
cd build
..\builder\windows\generate.ps1
cmake --build . --config Release -- /m /v:q
if (-Not $?) {
echo "build failed"
exit 1
}
cmake --install . --config Release
cd ..
rm build -Force -Recurse
python setup.py bdist_wheel -d build/wheel
7 changes: 1 addition & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
cmake_minimum_required(VERSION 3.11 FATAL_ERROR)
project(TurboMind LANGUAGES CXX CUDA)

find_package(CUDA 11.4 REQUIRED)


set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)

option(BUILD_TEST "Build tests" OFF)

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


list(APPEND CMAKE_MODULE_PATH ${CUDA_PATH}/lib64)

# profiling
option(USE_NVTX "Whether or not to use nvtx" ON)
if(USE_NVTX)
Expand Down
7 changes: 2 additions & 5 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ fi
cmake ${builder} .. \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCMAKE_INSTALL_PREFIX=${WORKSPACE_PATH}/install \
-DCMAKE_CUDA_FLAGS="-lineinfo" \
-DUSE_NVTX=ON \
-DBUILD_TEST=ON \
-DFETCHCONTENT_UPDATES_DISCONNECTED=ON \
-DLMDEPLOY_ASAN_ENABLE=OFF \
-DLMDEPLOY_UBSAN_ENABLE=OFF \
-DCMAKE_CUDA_ARCHITECTURES="80-real"
-DBUILD_TEST=OFF
1 change: 1 addition & 0 deletions src/turbomind/api/python/linear.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "src/turbomind/kernels/gemm/gemm.h"
#include "src/turbomind/kernels/gemm/types.h"
#include "src/turbomind/utils/cuda_utils.h"
#include "src/turbomind/utils/macro.h"
#include <cuda_fp16.h>
#include <cuda_runtime.h>
#include <fstream>
Expand Down

0 comments on commit 0c9d0c7

Please sign in to comment.