try cuda image #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Python Wheels (Linux CUDA) | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| pull_request: | |
| branches: | |
| - main | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| build-cuda-wheels: | |
| name: Build CUDA Wheels (Linux) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| show-progress: true | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v3.1.0 | |
| env: | |
| CIBW_BUILD: "cp311-*linux*" | |
| # Use CUDA-enabled manylinux image from https://github.com/ameli/manylinux-cuda | |
| # Available images: sameli/manylinux_2_34_x86_64_cuda_12.9, sameli/manylinux_2_28_x86_64_cuda_12.6, etc. | |
| CIBW_MANYLINUX_X86_64_IMAGE: "sameli/manylinux_2_34_x86_64_cuda_12.9" | |
| CIBW_BEFORE_BUILD: | | |
| # Verify CUDA is available (should be pre-installed in the image) | |
| echo "Verifying CUDA installation..." | |
| if command -v nvcc &> /dev/null; then | |
| echo "CUDA compiler version:" | |
| nvcc --version | |
| echo "CUDA_HOME: ${CUDA_HOME:-/usr/local/cuda}" | |
| else | |
| echo "Error: CUDA compiler (nvcc) not found!" | |
| exit 1 | |
| fi | |
| # Environment variables are already set in the manylinux-cuda image | |
| # CUDA_HOME=/usr/local/cuda, PATH, and LD_LIBRARY_PATH are configured | |
| CIBW_CONFIG_SETTINGS: "wheel.build-tag=${{ github.run_number }}" | |
| with: | |
| output-dir: wheelhouse | |
| package-dir: linux-cuda | |
| - name: List built wheels | |
| shell: bash | |
| run: | | |
| echo "Built CUDA wheels:" | |
| ls -lh wheelhouse/*.whl || echo "No wheels found" | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheelhouse-linux-cuda | |
| path: wheelhouse/*.whl | |