add cuda #2
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*" | |
| CIBW_MANYLINUX_X86_64_IMAGE: "quay.io/pypa/manylinux_2_28_x86_64:latest" | |
| CIBW_BEFORE_BUILD: | | |
| # Install CUDA toolkit for manylinux containers | |
| # Note: CUDA installation in manylinux containers is complex | |
| # Consider using a CUDA-enabled base image or pre-installing CUDA | |
| echo "Setting up CUDA environment..." | |
| # Try to find existing CUDA installation | |
| if [ -d "/usr/local/cuda" ]; then | |
| export CUDA_HOME=/usr/local/cuda | |
| elif [ -d "/opt/cuda" ]; then | |
| export CUDA_HOME=/opt/cuda | |
| else | |
| # Try to install CUDA via package manager | |
| if command -v yum &> /dev/null; then | |
| # For RHEL/CentOS/AlmaLinux - try to add CUDA repo and install | |
| echo "Attempting to install CUDA via yum..." | |
| yum install -y wget || true | |
| # Note: This may require manual setup of CUDA repository | |
| # For production, consider using a CUDA-enabled Docker image | |
| fi | |
| # Default CUDA_HOME if installation fails | |
| export CUDA_HOME=/usr/local/cuda | |
| mkdir -p $CUDA_HOME/bin $CUDA_HOME/lib64 || true | |
| fi | |
| # Set CUDA environment variables | |
| export PATH=$PATH:$CUDA_HOME/bin | |
| export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH | |
| # Verify CUDA if available | |
| if command -v nvcc &> /dev/null; then | |
| echo "CUDA compiler found:" | |
| nvcc --version | |
| else | |
| echo "Warning: CUDA compiler (nvcc) not found" | |
| echo "CUDA_HOME: $CUDA_HOME" | |
| echo "You may need to install CUDA manually or use a CUDA-enabled base image" | |
| fi | |
| CIBW_ENVIRONMENT: "CUDA_HOME=/usr/local/cuda PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH" | |
| 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 | |