Update README.md #42
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 Mastermind | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| release: | |
| types: [ published ] | |
| jobs: | |
| build-linux: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Free up disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf "/usr/local/share/boost" | |
| sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
| df -h | |
| - name: Install build dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential | |
| - name: CUDA installation | |
| id: cuda_install | |
| continue-on-error: true | |
| timeout-minutes: 10 | |
| run: | | |
| # Install CUDA toolkit | |
| wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run | |
| sudo sh cuda_11.8.0_520.61.05_linux.run --silent --toolkit --no-opengl-libs --no-drm | |
| echo "CUDA_INSTALLED=true" >> $GITHUB_OUTPUT | |
| - name: Set CUDA paths (if installed) | |
| if: steps.cuda_install.outcome == 'success' | |
| run: | | |
| echo "/usr/local/cuda/bin" >> $GITHUB_PATH | |
| echo "LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
| - name: Compile CUDA program | |
| if: steps.cuda_install.outcome == 'success' | |
| run: | | |
| nvcc -o mastermind_cuda_linux kernel.cu | |
| - name: Compile C++ programs | |
| run: | | |
| g++ -o treeGenFixedWeights_linux treeGenFixedWeights.cpp -std=c++17 -O3 | |
| g++ -o treeGenStageWeights_linux treeGenStageWeights.cpp -std=c++17 -O3 | |
| - name: Upload Linux binaries | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mastermind-linux | |
| path: | | |
| mastermind_cuda_linux | |
| treeGenFixedWeights_linux | |
| treeGenStageWeights_linux | |
| build-windows: | |
| runs-on: windows-2022 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup MSVC | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Setup MSVC environment | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Install CUDA 12.4.0 (powershell) | |
| shell: powershell | |
| run: | | |
| # PowerShell 7 syntax; works on GHA windows-2022 | |
| Invoke-WebRequest -Uri ` | |
| "https://developer.download.nvidia.com/compute/cuda/12.4.0/network_installers/cuda_12.4.0_windows_network.exe" ` | |
| -OutFile cuda.exe | |
| Start-Process -Wait -FilePath .\cuda.exe -ArgumentList ` | |
| "-s nvcc_12.4 cudart_12.4 curand_dev_12.4 cublas_dev_12.4 cusparse_dev_12.4" | |
| echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Check CUDA install | |
| run: | | |
| echo CUDA_PATH is: $Env:CUDA_PATH | |
| nvcc --version | |
| - name: Compile CUDA program | |
| shell: cmd | |
| run: | | |
| nvcc -allow-unsupported-compiler -arch=sm_52 ^ | |
| -I "%CUDA_PATH%\include" ^ | |
| -o mastermind_cuda_windows.exe ^ | |
| kernel.cu | |
| - name: Compile C++ programs | |
| run: | | |
| cl /EHsc /std:c++17 /O2 treeGenFixedWeights.cpp /Fe:treeGenFixedWeights_windows.exe | |
| cl /EHsc /std:c++17 /O2 treeGenStageWeights.cpp /Fe:treeGenStageWeights_windows.exe | |
| - name: Upload Windows binaries | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mastermind-windows | |
| path: | | |
| mastermind_cuda_windows.exe | |
| treeGenFixedWeights_windows.exe | |
| treeGenStageWeights_windows.exe | |
| release: | |
| needs: [build-linux, build-windows] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' | |
| steps: | |
| - name: Download Linux artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: mastermind-linux | |
| path: ./linux/ | |
| - name: Download Windows artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: mastermind-windows | |
| path: ./windows/ | |
| - name: Create release archives | |
| run: | | |
| cd linux && tar -czf ../mastermind-linux.tar.gz * && cd .. | |
| cd windows && zip -r ../mastermind-windows.zip * && cd .. | |
| - name: Upload release assets | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| mastermind-linux.tar.gz | |
| mastermind-windows.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |