Преглед изворни кода

build: add CUDA demod kernel build helper

master
Jan Svabenik пре 2 дана
родитељ
комит
2f286aec75
3 измењених фајлова са 29 додато и 0 уклоњено
  1. +1
    -0
      internal/demod/gpudemod/README.md
  2. +1
    -0
      internal/demod/gpudemod/gpudemod.go
  3. +27
    -0
      tools/build-gpudemod-kernel.ps1

+ 1
- 0
internal/demod/gpudemod/README.md Прегледај датотеку

@@ -21,6 +21,7 @@ This is **not compiled automatically yet** in the current environment because th
On a CUDA-capable dev machine with toolchain installed: On a CUDA-capable dev machine with toolchain installed:


1. Compile `kernels.cu` into an object file 1. Compile `kernels.cu` into an object file
- helper script: `tools/build-gpudemod-kernel.ps1`
2. Link it into the `cufft` build 2. Link it into the `cufft` build
3. Replace `gpud_launch_freq_shift(...)` stub body with the real kernel launch 3. Replace `gpud_launch_freq_shift(...)` stub body with the real kernel launch
4. Validate copied-back shifted IQ against `dsp.FreqShift` 4. Validate copied-back shifted IQ against `dsp.FreqShift`


+ 1
- 0
internal/demod/gpudemod/gpudemod.go Прегледај датотеку

@@ -4,6 +4,7 @@ package gpudemod


/* /*
#cgo windows LDFLAGS: -lcufft64_12 -lcudart64_13 #cgo windows LDFLAGS: -lcufft64_12 -lcudart64_13
#cgo windows CFLAGS: -I"C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v13.2/include"
#include <cuda_runtime.h> #include <cuda_runtime.h>
#include <cufft.h> #include <cufft.h>




+ 27
- 0
tools/build-gpudemod-kernel.ps1 Прегледај датотеку

@@ -0,0 +1,27 @@
param(
[string]$CudaRoot = 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.2',
[string]$Source = 'internal/demod/gpudemod/kernels.cu',
[string]$OutDir = 'internal/demod/gpudemod/build'
)

$ErrorActionPreference = 'Stop'
$repo = Split-Path -Parent $PSScriptRoot
Set-Location $repo

$nvcc = Join-Path $CudaRoot 'bin\nvcc.exe'
if (!(Test-Path $nvcc)) {
throw "nvcc not found at $nvcc"
}

New-Item -ItemType Directory -Force -Path $OutDir | Out-Null
$outObj = Join-Path $OutDir 'kernels.obj'

Write-Host "Using nvcc: $nvcc"
Write-Host "Building $Source -> $outObj"

& $nvcc -c $Source -o $outObj -I (Join-Path $CudaRoot 'include') -Xcompiler "/EHsc"
if ($LASTEXITCODE -ne 0) {
throw "nvcc failed with exit code $LASTEXITCODE"
}

Write-Host "Built: $outObj"

Loading…
Откажи
Сачувај