Wideband autonomous SDR analysis engine forked from sdr-visual-suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 line
1.9KB

  1. $ErrorActionPreference = 'Stop'
  2. $nvcc = (Get-Command nvcc -ErrorAction SilentlyContinue).Path
  3. if (-not $nvcc) {
  4. $nvcc = 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.2\bin\nvcc.exe'
  5. }
  6. if (-not (Test-Path $nvcc)) {
  7. Write-Host 'nvcc not found — skipping kernel build' -ForegroundColor Yellow
  8. exit 0
  9. }
  10. $mingwRoot = 'C:\msys64\mingw64\bin'
  11. $mingwGpp = Join-Path $mingwRoot 'g++.exe'
  12. $ar = Join-Path $mingwRoot 'ar.exe'
  13. if (-not (Test-Path $mingwGpp)) {
  14. throw 'MinGW g++ not found'
  15. }
  16. if (-not (Test-Path $ar)) {
  17. throw 'MinGW ar not found'
  18. }
  19. $kernelSrc = Join-Path $PSScriptRoot '..\internal\demod\gpudemod\kernels.cu'
  20. $buildDir = Join-Path $PSScriptRoot '..\internal\demod\gpudemod\build'
  21. if (-not (Test-Path $buildDir)) { New-Item -ItemType Directory -Path $buildDir | Out-Null }
  22. $objFile = Join-Path $buildDir 'kernels.o'
  23. $libFile = Join-Path $buildDir 'libgpudemod_kernels.a'
  24. $legacyLib = Join-Path $buildDir 'gpudemod_kernels.lib'
  25. if (Test-Path $objFile) { Remove-Item $objFile -Force }
  26. if (Test-Path $libFile) { Remove-Item $libFile -Force }
  27. if (Test-Path $legacyLib) { Remove-Item $legacyLib -Force }
  28. Write-Host 'Compiling CUDA kernels with MinGW host...' -ForegroundColor Cyan
  29. & $nvcc -ccbin $mingwGpp -c $kernelSrc -o $objFile `
  30. --compiler-options=-fno-exceptions `
  31. -arch=sm_75 `
  32. -gencode arch=compute_75,code=sm_75 `
  33. -gencode arch=compute_80,code=sm_80 `
  34. -gencode arch=compute_86,code=sm_86 `
  35. -gencode arch=compute_87,code=sm_87 `
  36. -gencode arch=compute_88,code=sm_88 `
  37. -gencode arch=compute_89,code=sm_89 `
  38. -gencode arch=compute_90,code=sm_90
  39. if ($LASTEXITCODE -ne 0) { throw 'nvcc compilation failed' }
  40. Write-Host 'Archiving GNU-compatible CUDA kernel library...' -ForegroundColor Cyan
  41. & $ar rcs $libFile $objFile
  42. if ($LASTEXITCODE -ne 0) { throw 'ar archive failed' }
  43. Write-Host "Kernel object: $objFile" -ForegroundColor Green
  44. Write-Host "Kernel library: $libFile" -ForegroundColor Green