24 #ifndef GNSS_SDR_CUDA_MULTICORRELATOR_H 25 #define GNSS_SDR_CUDA_MULTICORRELATOR_H 29 #define CUDA_CALLABLE_MEMBER_GLOBAL __global__ 30 #define CUDA_CALLABLE_MEMBER_DEVICE __device__ 32 #define CUDA_CALLABLE_MEMBER_GLOBAL 33 #define CUDA_CALLABLE_MEMBER_DEVICE 38 #include <cuda_runtime.h> 47 CUDA_CALLABLE_MEMBER_DEVICE
GPU_Complex(
float a,
float b) : r(a), i(b) {}
48 CUDA_CALLABLE_MEMBER_DEVICE
float magnitude2(
void) {
return r * r + i * i; }
52 return GPU_Complex(__fmul_rn(r, a.r) - __fmul_rn(i, a.i), __fmul_rn(i, a.r) + __fmul_rn(r, a.i));
54 return GPU_Complex(r * a.r - i * a.i, i * a.r + r * a.i);
61 CUDA_CALLABLE_MEMBER_DEVICE
void operator+=(
const GPU_Complex& a)
72 r = __fmaf_rn(a.r, b.r, r);
73 r = __fmaf_rn(-a.i, b.i, r);
75 i = __fmaf_rn(a.i, b.r, i);
76 i = __fmaf_rn(a.r, b.i, i);
78 r = (a.r * b.r - a.i * b.i) + r;
79 i = (a.i * b.r - a.r * b.i) + i;
89 CUDA_CALLABLE_MEMBER_DEVICE
GPU_Complex_Short(
short int a,
short int b) : r(a), i(b) {}
90 CUDA_CALLABLE_MEMBER_DEVICE
float magnitude2(
void)
112 bool init_cuda_integrated_resampler(
113 int signal_length_samples,
114 int code_length_chips,
116 bool set_local_code_and_taps(
117 int code_length_chips,
118 const std::complex<float>* local_codes_in,
121 bool set_input_output_vectors(
122 std::complex<float>* corr_out,
123 std::complex<float>* sig_in);
126 bool Carrier_wipeoff_multicorrelator_resampler_cuda(
127 float rem_carrier_phase_in_rad,
128 float phase_step_rad,
129 float code_phase_step_chips,
130 float rem_code_phase_chips,
131 int signal_length_samples,
135 cudaStream_t stream1;
145 std::complex<float>* d_sig_in_cpu;
146 std::complex<float>* d_corr_out_cpu;
148 float* d_shifts_chips;
149 int* d_shifts_samples;
150 int d_code_length_chips;
152 int selected_gps_device;
161 #endif // GNSS_SDR_CUDA_MULTICORRELATOR_H Class that implements carrier wipe-off and correlators using NVIDIA CUDA GPU accelerators.