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.

38 lines
1.2KB

  1. //go:build cufft && windows
  2. package gpudemod
  3. import "testing"
  4. func TestStreamingGPUNativePreparedComparableToCPUOracle(t *testing.T) {
  5. r := &BatchRunner{eng: &Engine{sampleRate: 4000000}, streamState: make(map[int64]*ExtractStreamState)}
  6. job := StreamingExtractJob{
  7. SignalID: 1,
  8. OffsetHz: 12500,
  9. Bandwidth: 20000,
  10. OutRate: 200000,
  11. NumTaps: 65,
  12. ConfigHash: 777,
  13. }
  14. iq := makeDeterministicIQ(16000)
  15. gpuRes, err := r.StreamingExtractGPU(iq, []StreamingExtractJob{job})
  16. if err != nil {
  17. t.Fatalf("unexpected native prepared GPU error: %v", err)
  18. }
  19. oracleRunner := NewCPUOracleRunner(4000000)
  20. oracleRes, err := oracleRunner.StreamingExtract(iq, []StreamingExtractJob{job})
  21. if err != nil {
  22. t.Fatalf("unexpected oracle error: %v", err)
  23. }
  24. if len(gpuRes) != 1 || len(oracleRes) != 1 {
  25. t.Fatalf("unexpected result sizes: gpu=%d oracle=%d", len(gpuRes), len(oracleRes))
  26. }
  27. metrics, stats := CompareOracleAndGPUHostOracle(oracleRes[0], gpuRes[0])
  28. if stats.Count == 0 {
  29. t.Fatalf("expected compare count > 0")
  30. }
  31. if metrics.RefMaxAbsErr > 1e-4 {
  32. t.Fatalf("native prepared path diverges too much from oracle: max abs err=%f", metrics.RefMaxAbsErr)
  33. }
  34. }