49 CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex() {};
50 CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex(
float a,
float b) : r(a), i(b) {}
51 CUDA_CALLABLE_MEMBER_DEVICE
float magnitude2(
void) {
return r * r + i * i; }
52 CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex operator*(
const GPU_Complex& a)
55 return GPU_Complex(__fmul_rn(r, a.r) - __fmul_rn(i, a.i), __fmul_rn(i, a.r) + __fmul_rn(r, a.i));
57 return GPU_Complex(r * a.r - i * a.i, i * a.r + r * a.i);
60 CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex operator+(
const GPU_Complex& a)
62 return GPU_Complex(r + a.r, i + a.i);
64 CUDA_CALLABLE_MEMBER_DEVICE
void operator+=(
const GPU_Complex& a)
69 CUDA_CALLABLE_MEMBER_DEVICE
void multiply_acc(
const GPU_Complex& a,
const GPU_Complex& b)
75 r = __fmaf_rn(a.r, b.r, r);
76 r = __fmaf_rn(-a.i, b.i, r);
78 i = __fmaf_rn(a.i, b.r, i);
79 i = __fmaf_rn(a.r, b.i, i);
81 r = (a.r * b.r - a.i * b.i) + r;
82 i = (a.i * b.r - a.r * b.i) + i;
88struct GPU_Complex_Short
92 CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex_Short(
short int a,
short int b) : r(a), i(b) {}
93 CUDA_CALLABLE_MEMBER_DEVICE
float magnitude2(
void)
97 CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex_Short operator*(
const GPU_Complex_Short& a)
99 return GPU_Complex_Short(r * a.r - i * a.i, i * a.r + r * a.i);
101 CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex_Short operator+(
const GPU_Complex_Short& a)
103 return GPU_Complex_Short(r + a.r, i + a.i);
111class cuda_multicorrelator
114 cuda_multicorrelator();
115 bool init_cuda_integrated_resampler(
116 int signal_length_samples,
117 int code_length_chips,
119 bool set_local_code_and_taps(
120 int code_length_chips,
121 const std::complex<float>* local_codes_in,
124 bool set_input_output_vectors(
125 std::complex<float>* corr_out,
126 std::complex<float>* sig_in);
129 bool Carrier_wipeoff_multicorrelator_resampler_cuda(
130 float rem_carrier_phase_in_rad,
131 float phase_step_rad,
132 float code_phase_step_chips,
133 float rem_code_phase_chips,
134 int signal_length_samples,
138 cudaStream_t stream1;
148 std::complex<float>* d_sig_in_cpu;
149 std::complex<float>* d_corr_out_cpu;
151 float* d_shifts_chips;
152 int* d_shifts_samples;
153 int d_code_length_chips;
155 int selected_gps_device;