diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index deda969da..5329657c8 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -39,13 +39,13 @@ jobs: - {os: macos-26, r: 'release', opencl: false} - {os: macos-15-intel, r: 'release', opencl: false} - {os: windows-latest, r: 'devel', opencl: false} - - {os: windows-latest, r: 'release', opencl: false} + - {os: windows-latest, r: 'release', opencl: true} - {os: windows-2022, r: '4.1', opencl: false} - {os: windows-latest, r: 'oldrel', opencl: false} - {os: ubuntu-latest, r: 'devel', opencl: false} - {os: ubuntu-latest, r: 'release', opencl: true} - {os: ubuntu-latest, r: 'oldrel', opencl: false} - - {os: windows-11-arm, r: 'release', opencl: false} + - {os: windows-11-arm, r: 'release', opencl: true} env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} @@ -118,6 +118,35 @@ jobs: } shell: Rscript {0} + - name: Install POCL on Windows Runners + if: ${{ runner.os == 'Windows' && matrix.config.opencl }} + id: msys2 + uses: msys2/setup-msys2@v2 + with: + msystem: ${{ runner.arch == 'ARM64' && 'CLANGARM64' || 'UCRT64' }} + update: true + pacboy: pocl:p + + - name: Configure OpenCL on Windows Runners + if: ${{ runner.os == 'Windows' && matrix.config.opencl }} + env: + MSYS2_LOCATION: ${{ steps.msys2.outputs.msys2-location }} + run: | + $prefix = "$env:MSYS2_LOCATION/$($env:MSYSTEM.ToLowerInvariant())" + # pocl.dll loads its own DLLs (LLVM, libstdc++) through PATH. The + # MSYS2 compilers in the same directory go unused: R and cmdstanr + # put Rtools first. + "$prefix/bin" >> $env:GITHUB_PATH + # Avoid mixing MSYS2 and Rtools runtime libraries via -L. + # Forward slashes: cmdstanr passes LDLIBS to R CMD SHLIB unquoted, + # and sh drops backslashes. + "LDLIBS_OPENCL='$($prefix.Replace('\', '/'))/lib/libOpenCL.dll.a'" >> $env:GITHUB_ENV + # Elevated runners ignore OCL_ICD_FILENAMES. + $vendors = 'HKLM:\SOFTWARE\Khronos\OpenCL\Vendors' + New-Item -Path $vendors -Force | Out-Null + New-ItemProperty -Path $vendors -Name "$prefix/bin/pocl.dll" -PropertyType DWord -Value 0 -Force | Out-Null + shell: pwsh + - name: Install POCL on Ubuntu Runners if: ${{ matrix.config.os == 'ubuntu-latest' && matrix.config.opencl }} run: |