diff --git a/.github/workflows/cuda-build.yml b/.github/workflows/cuda-build.yml new file mode 100644 index 000000000..add7dc7f8 --- /dev/null +++ b/.github/workflows/cuda-build.yml @@ -0,0 +1,24 @@ +name: CUDA CI + +on: + pull_request: + branches: + - master # 你可以根据需要调整分支 + +jobs: + build: + runs-on: ubuntu-latest + container: + image: nvidia/cuda:11.2.2-devel-ubuntu20.04 # 使用适合你的CUDA版本的官方NVIDIA容器 + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install dependencies + run: | + apt-get update + apt-get install -y build-essential + + - name: Build with Make + run: cd src && make diff --git a/.github/workflows/cuda_build_windows.yml b/.github/workflows/cuda_build_windows.yml new file mode 100644 index 000000000..23edaeffe --- /dev/null +++ b/.github/workflows/cuda_build_windows.yml @@ -0,0 +1,32 @@ +name: CUDA CI on Windows + +on: + pull_request: + branches: + - master + +jobs: + build: + runs-on: windows-2019 + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up MSVC environment + uses: ilammy/msvc-dev-cmd@v1.13.0 + with: + arch: x64 + vsversion: "2019" + + - name: Install CUDA + run: | + choco install cuda --version=11.2.2.46133 + + - name: Build project + shell: cmd + run: | + set PATH=%PATH%;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin + nvcc --version + cd src && make + diff --git a/src/makefile b/src/makefile index 66917ba26..4c389ed84 100644 --- a/src/makefile +++ b/src/makefile @@ -16,10 +16,11 @@ # some flags ########################################################### CC = nvcc +CUDA_ARCH=-arch=sm_60 ifdef OS # For Windows with the cl.exe compiler -CFLAGS = -O3 -arch=sm_60 -Xcompiler "/wd 4819" +CFLAGS = -O3 $(CUDA_ARCH) -Xcompiler "/wd 4819" else # For linux -CFLAGS = -std=c++14 -O3 -arch=sm_60 +CFLAGS = -std=c++14 -O3 $(CUDA_ARCH) endif INC = -I./ LDFLAGS =