21 #ifndef GNSS_SDR_CUDA_MULTICORRELATOR_H 22 #define GNSS_SDR_CUDA_MULTICORRELATOR_H 26 #define CUDA_CALLABLE_MEMBER_GLOBAL __global__ 27 #define CUDA_CALLABLE_MEMBER_DEVICE __device__ 29 #define CUDA_CALLABLE_MEMBER_GLOBAL 30 #define CUDA_CALLABLE_MEMBER_DEVICE 35 #include <cuda_runtime.h> 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; }
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);
64 CUDA_CALLABLE_MEMBER_DEVICE
void operator+=(
const GPU_Complex& a)
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;
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)
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;
166 #endif // GNSS_SDR_CUDA_MULTICORRELATOR_H Class that implements carrier wipe-off and correlators using NVIDIA CUDA GPU accelerators.