2024-12-24 07:27:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
#include <cmath>
|
|
|
|
|
|
#include <complex>
|
|
|
|
|
|
#include <device_launch_parameters.h>
|
|
|
|
|
|
#include <cuda_runtime.h>
|
|
|
|
|
|
#include <cublas_v2.h>
|
|
|
|
|
|
#include <cuComplex.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "BaseConstVariable.h"
|
2025-01-02 10:53:33 +00:00
|
|
|
|
#include "GPURFPC.cuh"
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
|
|
|
|
|
#ifdef __CUDANVCC___
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-02 10:53:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
__device__ double GPU_getSigma0dB(CUDASigmaParam param, double theta) {//<2F><><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
|
double sigma = param.p1 + param.p2 * exp(-param.p3 * theta) + param.p4 * cos(param.p5 * theta + param.p6);
|
2024-12-24 07:27:09 +00:00
|
|
|
|
return sigma;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-02 10:53:33 +00:00
|
|
|
|
__device__ CUDAVectorEllipsoidal GPU_SatelliteAntDirectNormal(
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double RstX, double RstY, double RstZ,
|
|
|
|
|
|
double antXaxisX, double antXaxisY, double antXaxisZ,
|
|
|
|
|
|
double antYaxisX, double antYaxisY, double antYaxisZ,
|
|
|
|
|
|
double antZaxisX, double antZaxisY, double antZaxisZ,
|
|
|
|
|
|
double antDirectX, double antDirectY, double antDirectZ
|
2024-12-24 07:27:09 +00:00
|
|
|
|
) {
|
|
|
|
|
|
CUDAVectorEllipsoidal result{ 0,0,-1 };
|
2025-01-02 10:53:33 +00:00
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double Xst = -1 * RstX; // <20><><EFBFBD><EFBFBD> --> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
double Yst = -1 * RstY;
|
|
|
|
|
|
double Zst = -1 * RstZ;
|
|
|
|
|
|
double AntXaxisX = antXaxisX;
|
|
|
|
|
|
double AntXaxisY = antXaxisY;
|
|
|
|
|
|
double AntXaxisZ = antXaxisZ;
|
|
|
|
|
|
double AntYaxisX = antYaxisX;
|
|
|
|
|
|
double AntYaxisY = antYaxisY;
|
|
|
|
|
|
double AntYaxisZ = antYaxisZ;
|
|
|
|
|
|
double AntZaxisX = antZaxisX;
|
|
|
|
|
|
double AntZaxisY = antZaxisY;
|
|
|
|
|
|
double AntZaxisZ = antZaxisZ;
|
2025-01-02 10:53:33 +00:00
|
|
|
|
|
|
|
|
|
|
// <20><>һ<EFBFBD><D2BB>
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double RstNorm = sqrtf(Xst * Xst + Yst * Yst + Zst * Zst);
|
|
|
|
|
|
double AntXaxisNorm = sqrtf(AntXaxisX * AntXaxisX + AntXaxisY * AntXaxisY + AntXaxisZ * AntXaxisZ);
|
|
|
|
|
|
double AntYaxisNorm = sqrtf(AntYaxisX * AntYaxisX + AntYaxisY * AntYaxisY + AntYaxisZ * AntYaxisZ);
|
|
|
|
|
|
double AntZaxisNorm = sqrtf(AntZaxisX * AntZaxisX + AntZaxisY * AntZaxisY + AntZaxisZ * AntZaxisZ);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double Rx = Xst / RstNorm;
|
|
|
|
|
|
double Ry = Yst / RstNorm;
|
|
|
|
|
|
double Rz = Zst / RstNorm;
|
|
|
|
|
|
double Xx = AntXaxisX / AntXaxisNorm;
|
|
|
|
|
|
double Xy = AntXaxisY / AntXaxisNorm;
|
|
|
|
|
|
double Xz = AntXaxisZ / AntXaxisNorm;
|
|
|
|
|
|
double Yx = AntYaxisX / AntYaxisNorm;
|
|
|
|
|
|
double Yy = AntYaxisY / AntYaxisNorm;
|
|
|
|
|
|
double Yz = AntYaxisZ / AntYaxisNorm;
|
|
|
|
|
|
double Zx = AntZaxisX / AntZaxisNorm;
|
|
|
|
|
|
double Zy = AntZaxisY / AntZaxisNorm;
|
|
|
|
|
|
double Zz = AntZaxisZ / AntZaxisNorm;
|
|
|
|
|
|
|
|
|
|
|
|
double Xant = (Rx * Yy * Zz - Rx * Yz * Zy - Ry * Yx * Zz + Ry * Yz * Zx + Rz * Yx * Zy - Rz * Yy * Zx) / (Xx * Yy * Zz - Xx * Yz * Zy - Xy * Yx * Zz + Xy * Yz * Zx + Xz * Yx * Zy - Xz * Yy * Zx);
|
|
|
|
|
|
double Yant = -(Rx * Xy * Zz - Rx * Xz * Zy - Ry * Xx * Zz + Ry * Xz * Zx + Rz * Xx * Zy - Rz * Xy * Zx) / (Xx * Yy * Zz - Xx * Yz * Zy - Xy * Yx * Zz + Xy * Yz * Zx + Xz * Yx * Zy - Xz * Yy * Zx);
|
|
|
|
|
|
double Zant = (Rx * Xy * Yz - Rx * Xz * Yy - Ry * Xx * Yz + Ry * Xz * Yx + Rz * Xx * Yy - Rz * Xy * Yx) / (Xx * Yy * Zz - Xx * Yz * Zy - Xy * Yx * Zz + Xy * Yz * Zx + Xz * Yx * Zy - Xz * Yy * Zx);
|
2025-01-02 10:53:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
2024-12-24 07:27:09 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD>theta <20><> phi
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double Norm = sqrtf(Xant * Xant + Yant * Yant + Zant * Zant); // <20><><EFBFBD><EFBFBD> pho
|
|
|
|
|
|
double ThetaAnt = acosf(Zant / Norm); // theta <20><> Z<><5A><EFBFBD>ļн<C4BC>
|
|
|
|
|
|
double PhiAnt = atanf(Yant / Xant); // -pi/2 ~pi/2
|
2025-01-02 10:53:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (abs(Yant) < PRECISIONTOLERANCE) { // X<><58><EFBFBD><EFBFBD>
|
|
|
|
|
|
PhiAnt = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (abs(Xant) < PRECISIONTOLERANCE) { // Y<><59><EFBFBD>ϣ<EFBFBD>ԭ<EFBFBD><D4AD>
|
|
|
|
|
|
if (Yant > 0) {
|
|
|
|
|
|
PhiAnt = PI / 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
PhiAnt = -PI / 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Xant < 0) {
|
|
|
|
|
|
if (Yant > 0) {
|
|
|
|
|
|
PhiAnt = PI + PhiAnt;
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
PhiAnt = -PI + PhiAnt;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else { // Xant>0 X <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isnan(PhiAnt)) {
|
|
|
|
|
|
printf("V=[%f,%f,%f];norm=%f;thetaAnt=%f;phiAnt=%f;\n", Xant, Yant, Zant, Norm, ThetaAnt, PhiAnt);
|
|
|
|
|
|
}
|
2025-01-02 16:15:08 +00:00
|
|
|
|
|
2025-01-02 10:53:33 +00:00
|
|
|
|
|
2024-12-24 07:27:09 +00:00
|
|
|
|
result.theta = ThetaAnt;
|
|
|
|
|
|
result.phi = PhiAnt;
|
2025-01-02 10:53:33 +00:00
|
|
|
|
result.Rho = Norm;
|
2024-12-24 07:27:09 +00:00
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
__device__ double GPU_BillerInterpAntPattern(double* antpattern,
|
|
|
|
|
|
double starttheta, double startphi, double dtheta, double dphi,
|
2024-12-24 07:27:09 +00:00
|
|
|
|
long thetapoints, long phipoints,
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double searththeta, double searchphi) {
|
|
|
|
|
|
double stheta = searththeta;
|
|
|
|
|
|
double sphi = searchphi;
|
2024-12-24 07:27:09 +00:00
|
|
|
|
if (stheta > 90) {
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else {}
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double pthetaid = (stheta - starttheta) / dtheta;//
|
|
|
|
|
|
double pphiid = (sphi - startphi) / dphi;
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
|
|
|
|
|
long lasttheta = floorf(pthetaid);
|
|
|
|
|
|
long nextTheta = lasttheta + 1;
|
|
|
|
|
|
long lastphi = floorf(pphiid);
|
|
|
|
|
|
long nextPhi = lastphi + 1;
|
2025-01-02 16:15:08 +00:00
|
|
|
|
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
|
|
|
|
|
if (lasttheta < 0 || nextTheta < 0 || lastphi < 0 || nextPhi < 0 ||
|
|
|
|
|
|
lasttheta >= thetapoints || nextTheta >= thetapoints || lastphi >= phipoints || nextPhi >= phipoints)
|
|
|
|
|
|
{
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double x = stheta;
|
|
|
|
|
|
double y = sphi;
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double x1 = lasttheta * dtheta + starttheta;
|
|
|
|
|
|
double x2 = nextTheta * dtheta + starttheta;
|
|
|
|
|
|
double y1 = lastphi * dphi + startphi;
|
|
|
|
|
|
double y2 = nextPhi * dphi + startphi;
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double z11 = antpattern[lasttheta * phipoints + lastphi];
|
|
|
|
|
|
double z12 = antpattern[lasttheta * phipoints + nextPhi];
|
|
|
|
|
|
double z21 = antpattern[nextTheta * phipoints + lastphi];
|
|
|
|
|
|
double z22 = antpattern[nextTheta * phipoints + nextPhi];
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//z11 = powf(10, z11 / 10); // dB-> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
//z12 = powf(10, z12 / 10);
|
|
|
|
|
|
//z21 = powf(10, z21 / 10);
|
|
|
|
|
|
//z22 = powf(10, z22 / 10);
|
|
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double GainValue = (z11 * (x2 - x) * (y2 - y)
|
2024-12-24 07:27:09 +00:00
|
|
|
|
+ z21 * (x - x1) * (y2 - y)
|
|
|
|
|
|
+ z12 * (x2 - x) * (y - y1)
|
|
|
|
|
|
+ z22 * (x - x1) * (y - y1));
|
|
|
|
|
|
GainValue = GainValue / ((x2 - x1) * (y2 - y1));
|
|
|
|
|
|
return GainValue;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
__device__ cuComplex GPU_calculationEcho(double sigma0, double TransAnt, double ReciveAnt,
|
|
|
|
|
|
double localangle, double R, double slopeangle, double Pt, double lamda) {
|
|
|
|
|
|
double amp = Pt * TransAnt * ReciveAnt;
|
2024-12-24 07:27:09 +00:00
|
|
|
|
amp = amp * sigma0;
|
2024-12-27 17:08:08 +00:00
|
|
|
|
amp = amp / (powf(4 * LAMP_CUDA_PI, 2) * powf(R, 4)); // <20><><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double phi = (-4 * LAMP_CUDA_PI / lamda) * R;
|
2024-12-24 07:27:09 +00:00
|
|
|
|
cuComplex echophi = make_cuComplex(0, phi);
|
|
|
|
|
|
cuComplex echophiexp = cuCexpf(echophi);
|
2025-01-02 16:15:08 +00:00
|
|
|
|
cuComplex echo = make_cuComplex(echophiexp.x * amp, echophiexp.y * amp);
|
2024-12-24 07:27:09 +00:00
|
|
|
|
return echo;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
__global__ void CUDA_SatelliteAntDirectNormal(double* RstX, double* RstY, double* RstZ,
|
|
|
|
|
|
double antXaxisX, double antXaxisY, double antXaxisZ,
|
|
|
|
|
|
double antYaxisX, double antYaxisY, double antYaxisZ,
|
|
|
|
|
|
double antZaxisX, double antZaxisY, double antZaxisZ,
|
|
|
|
|
|
double antDirectX, double antDirectY, double antDirectZ,
|
|
|
|
|
|
double* thetaAnt, double* phiAnt
|
2024-12-24 07:27:09 +00:00
|
|
|
|
, long len) {
|
|
|
|
|
|
long idx = blockIdx.x * blockDim.x + threadIdx.x;
|
|
|
|
|
|
if (idx < len) {
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double Xst = -1 * RstX[idx]; // <20><><EFBFBD><EFBFBD> --> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
double Yst = -1 * RstY[idx];
|
|
|
|
|
|
double Zst = -1 * RstZ[idx];
|
|
|
|
|
|
double AntXaxisX = antXaxisX;
|
|
|
|
|
|
double AntXaxisY = antXaxisY;
|
|
|
|
|
|
double AntXaxisZ = antXaxisZ;
|
|
|
|
|
|
double AntYaxisX = antYaxisX;
|
|
|
|
|
|
double AntYaxisY = antYaxisY;
|
|
|
|
|
|
double AntYaxisZ = antYaxisZ;
|
|
|
|
|
|
double AntZaxisX = antZaxisX;
|
|
|
|
|
|
double AntZaxisY = antZaxisY;
|
|
|
|
|
|
double AntZaxisZ = antZaxisZ;
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
|
|
|
|
|
// <20><>һ<EFBFBD><D2BB>
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double RstNorm = sqrtf(Xst * Xst + Yst * Yst + Zst * Zst);
|
|
|
|
|
|
double AntXaxisNorm = sqrtf(AntXaxisX * AntXaxisX + AntXaxisY * AntXaxisY + AntXaxisZ * AntXaxisZ);
|
|
|
|
|
|
double AntYaxisNorm = sqrtf(AntYaxisX * AntYaxisX + AntYaxisY * AntYaxisY + AntYaxisZ * AntYaxisZ);
|
|
|
|
|
|
double AntZaxisNorm = sqrtf(AntZaxisX * AntZaxisX + AntZaxisY * AntZaxisY + AntZaxisZ * AntZaxisZ);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double Rx = Xst / RstNorm;
|
|
|
|
|
|
double Ry = Yst / RstNorm;
|
|
|
|
|
|
double Rz = Zst / RstNorm;
|
|
|
|
|
|
double Xx = AntXaxisX / AntXaxisNorm;
|
|
|
|
|
|
double Xy = AntXaxisY / AntXaxisNorm;
|
|
|
|
|
|
double Xz = AntXaxisZ / AntXaxisNorm;
|
|
|
|
|
|
double Yx = AntYaxisX / AntYaxisNorm;
|
|
|
|
|
|
double Yy = AntYaxisY / AntYaxisNorm;
|
|
|
|
|
|
double Yz = AntYaxisZ / AntYaxisNorm;
|
|
|
|
|
|
double Zx = AntZaxisX / AntZaxisNorm;
|
|
|
|
|
|
double Zy = AntZaxisY / AntZaxisNorm;
|
|
|
|
|
|
double Zz = AntZaxisZ / AntZaxisNorm;
|
|
|
|
|
|
|
|
|
|
|
|
double Xant = (Rx * Yy * Zz - Rx * Yz * Zy - Ry * Yx * Zz + Ry * Yz * Zx + Rz * Yx * Zy - Rz * Yy * Zx) / (Xx * Yy * Zz - Xx * Yz * Zy - Xy * Yx * Zz + Xy * Yz * Zx + Xz * Yx * Zy - Xz * Yy * Zx);
|
|
|
|
|
|
double Yant = -(Rx * Xy * Zz - Rx * Xz * Zy - Ry * Xx * Zz + Ry * Xz * Zx + Rz * Xx * Zy - Rz * Xy * Zx) / (Xx * Yy * Zz - Xx * Yz * Zy - Xy * Yx * Zz + Xy * Yz * Zx + Xz * Yx * Zy - Xz * Yy * Zx);
|
|
|
|
|
|
double Zant = (Rx * Xy * Yz - Rx * Xz * Yy - Ry * Xx * Yz + Ry * Xz * Yx + Rz * Xx * Yy - Rz * Xy * Yx) / (Xx * Yy * Zz - Xx * Yz * Zy - Xy * Yx * Zz + Xy * Yz * Zx + Xz * Yx * Zy - Xz * Yy * Zx);
|
2025-01-02 16:15:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
2024-12-24 07:27:09 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD>theta <20><> phi
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double Norm = sqrtf(Xant * Xant + Yant * Yant + Zant * Zant); // <20><><EFBFBD><EFBFBD> pho
|
|
|
|
|
|
double ThetaAnt = acosf(Zant / Norm); // theta <20><> Z<><5A><EFBFBD>ļн<C4BC>
|
|
|
|
|
|
double PhiAnt = atanf(Yant / Xant); // -pi/2 ~pi/2
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (abs(Yant) < PRECISIONTOLERANCE) { // X<><58><EFBFBD><EFBFBD>
|
|
|
|
|
|
PhiAnt = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (abs(Xant) < PRECISIONTOLERANCE) { // Y<><59><EFBFBD>ϣ<EFBFBD>ԭ<EFBFBD><D4AD>
|
|
|
|
|
|
if (Yant > 0) {
|
|
|
|
|
|
PhiAnt = PI / 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
PhiAnt = -PI / 2;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Xant < 0) {
|
|
|
|
|
|
if (Yant > 0) {
|
|
|
|
|
|
PhiAnt = PI + PhiAnt;
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
2025-01-02 16:15:08 +00:00
|
|
|
|
PhiAnt = -PI + PhiAnt;
|
2024-12-24 07:27:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else { // Xant>0 X <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isnan(PhiAnt)) {
|
2025-01-02 16:15:08 +00:00
|
|
|
|
printf("V=[%f,%f,%f];norm=%f;thetaAnt=%f;phiAnt=%f;\n", Xant, Yant, Zant, Norm, ThetaAnt, PhiAnt);
|
2024-12-24 07:27:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//if (abs(ThetaAnt - 0) < PRECISIONTOLERANCE) {
|
|
|
|
|
|
// PhiAnt = 0;
|
|
|
|
|
|
//}
|
|
|
|
|
|
//else {}
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-02 16:15:08 +00:00
|
|
|
|
thetaAnt[idx] = ThetaAnt * r2d;
|
|
|
|
|
|
phiAnt[idx] = PhiAnt * r2d;
|
2024-12-24 07:27:09 +00:00
|
|
|
|
//printf("Rst=[%f,%f,%f];AntXaxis = [%f, %f, %f];AntYaxis=[%f,%f,%f];AntZaxis=[%f,%f,%f];phiAnt=%f;thetaAnt=%f;\n", Xst, Yst, Zst
|
|
|
|
|
|
// , AntXaxisX, AntXaxisY, AntXaxisZ
|
|
|
|
|
|
// , AntYaxisX, AntYaxisY, AntYaxisZ
|
|
|
|
|
|
// , AntZaxisX, AntZaxisY, AntZaxisZ
|
|
|
|
|
|
// , phiAnt[idx]
|
|
|
|
|
|
// , thetaAnt[idx]
|
|
|
|
|
|
//);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
__global__ void CUDA_BillerInterpAntPattern(double* antpattern,
|
|
|
|
|
|
double starttheta, double startphi, double dtheta, double dphi,
|
2024-12-24 07:27:09 +00:00
|
|
|
|
long thetapoints, long phipoints,
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double* searththeta, double* searchphi, double* searchantpattern,
|
2024-12-24 07:27:09 +00:00
|
|
|
|
long len) {
|
|
|
|
|
|
long idx = blockIdx.x * blockDim.x + threadIdx.x;
|
|
|
|
|
|
if (idx < len) {
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double stheta = searththeta[idx];
|
|
|
|
|
|
double sphi = searchphi[idx];
|
|
|
|
|
|
double pthetaid = (stheta - starttheta) / dtheta;//
|
|
|
|
|
|
double pphiid = (sphi - startphi) / dphi;
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
|
|
|
|
|
long lasttheta = floorf(pthetaid);
|
|
|
|
|
|
long nextTheta = lasttheta + 1;
|
|
|
|
|
|
long lastphi = floorf(pphiid);
|
|
|
|
|
|
long nextPhi = lastphi + 1;
|
|
|
|
|
|
|
|
|
|
|
|
if (lasttheta < 0 || nextTheta < 0 || lastphi < 0 || nextPhi < 0 ||
|
|
|
|
|
|
lasttheta >= thetapoints || nextTheta >= thetapoints || lastphi >= phipoints || nextPhi >= phipoints)
|
|
|
|
|
|
{
|
|
|
|
|
|
searchantpattern[idx] = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double x = stheta;
|
|
|
|
|
|
double y = sphi;
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double x1 = lasttheta * dtheta + starttheta;
|
|
|
|
|
|
double x2 = nextTheta * dtheta + starttheta;
|
|
|
|
|
|
double y1 = lastphi * dphi + startphi;
|
|
|
|
|
|
double y2 = nextPhi * dphi + startphi;
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double z11 = antpattern[lasttheta * phipoints + lastphi];
|
|
|
|
|
|
double z12 = antpattern[lasttheta * phipoints + nextPhi];
|
|
|
|
|
|
double z21 = antpattern[nextTheta * phipoints + lastphi];
|
|
|
|
|
|
double z22 = antpattern[nextTheta * phipoints + nextPhi];
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
z11 = powf(10, z11 / 10);
|
|
|
|
|
|
z12 = powf(10, z12 / 10);
|
|
|
|
|
|
z21 = powf(10, z21 / 10);
|
|
|
|
|
|
z22 = powf(10, z22 / 10);
|
|
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double GainValue = (z11 * (x2 - x) * (y2 - y)
|
2024-12-24 07:27:09 +00:00
|
|
|
|
+ z21 * (x - x1) * (y2 - y)
|
|
|
|
|
|
+ z12 * (x2 - x) * (y - y1)
|
|
|
|
|
|
+ z22 * (x - x1) * (y - y1));
|
|
|
|
|
|
GainValue = GainValue / ((x2 - x1) * (y2 - y1));
|
|
|
|
|
|
searchantpattern[idx] = GainValue;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
__global__ void CUDA_calculationEcho(double* sigma0, double* TransAnt, double* ReciveAnt,
|
|
|
|
|
|
double* localangle, double* R, double* slopeangle,
|
|
|
|
|
|
double nearRange, double Fs, double Pt, double lamda, long FreqIDmax,
|
2024-12-24 07:27:09 +00:00
|
|
|
|
cuComplex* echoArr, long* FreqID,
|
|
|
|
|
|
long len) {
|
|
|
|
|
|
long idx = blockIdx.x * blockDim.x + threadIdx.x;
|
|
|
|
|
|
if (idx < len) {
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double r = R[idx];
|
|
|
|
|
|
double amp = Pt * TransAnt[idx] * ReciveAnt[idx];
|
2024-12-24 07:27:09 +00:00
|
|
|
|
amp = amp * sigma0[idx];
|
|
|
|
|
|
amp = amp / (powf(4 * LAMP_CUDA_PI, 2) * powf(r, 4)); // <20><><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double phi = (-4 * LAMP_CUDA_PI / lamda) * r;
|
2024-12-24 07:27:09 +00:00
|
|
|
|
cuComplex echophi = make_cuComplex(0, phi);
|
|
|
|
|
|
cuComplex echophiexp = cuCexpf(echophi);
|
|
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double timeR = 2 * (r - nearRange) / LIGHTSPEED * Fs;
|
2024-12-24 07:27:09 +00:00
|
|
|
|
long timeID = floorf(timeR);
|
2024-12-27 17:08:08 +00:00
|
|
|
|
//if (timeID < 0 || timeID >= FreqIDmax) {
|
|
|
|
|
|
// timeID = 0;
|
|
|
|
|
|
// amp = 0;
|
|
|
|
|
|
//}
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
2025-01-02 16:15:08 +00:00
|
|
|
|
cuComplex echo = make_cuComplex(echophiexp.x, echophiexp.y);
|
2024-12-24 07:27:09 +00:00
|
|
|
|
echoArr[idx] = echo;
|
|
|
|
|
|
FreqID[idx] = timeID;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
__global__ void CUDA_AntPatternInterpGain(double* anttheta, double* antphi, double* gain,
|
|
|
|
|
|
double* antpattern, double starttheta, double startphi, double dtheta, double dphi, int thetapoints, int phipoints, long len) {
|
2024-12-24 07:27:09 +00:00
|
|
|
|
int idx = blockIdx.x * blockDim.x + threadIdx.x;
|
2025-01-02 16:15:08 +00:00
|
|
|
|
|
2024-12-24 07:27:09 +00:00
|
|
|
|
if (idx < len) {
|
|
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double temptheta = anttheta[idx];
|
|
|
|
|
|
double tempphi = antphi[idx];
|
|
|
|
|
|
double antPatternGain = GPU_BillerInterpAntPattern(antpattern,
|
2024-12-24 07:27:09 +00:00
|
|
|
|
starttheta, startphi, dtheta, dphi, thetapoints, phipoints,
|
2025-01-02 16:15:08 +00:00
|
|
|
|
temptheta, tempphi);
|
2024-12-24 07:27:09 +00:00
|
|
|
|
gain[idx] = antPatternGain;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__global__ void CUDA_InterpSigma(
|
2025-01-14 01:25:23 +00:00
|
|
|
|
long* demcls, double* sigmaAmp, double* localanglearr, long len,
|
2024-12-24 07:27:09 +00:00
|
|
|
|
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen) {
|
|
|
|
|
|
long idx = blockIdx.x * blockDim.x + threadIdx.x;
|
|
|
|
|
|
if (idx < len) {
|
|
|
|
|
|
long clsid = demcls[idx];
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double localangle = localanglearr[idx];
|
2024-12-24 07:27:09 +00:00
|
|
|
|
CUDASigmaParam tempsigma = sigma0Paramslist[clsid];
|
2025-01-02 16:15:08 +00:00
|
|
|
|
if (localangle < 0 || localangle >= LAMP_CUDA_PI / 2) {
|
2024-12-24 07:27:09 +00:00
|
|
|
|
sigmaAmp[idx] = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else {}
|
|
|
|
|
|
|
2025-01-02 16:15:08 +00:00
|
|
|
|
if (abs(tempsigma.p1) < PRECISIONTOLERANCE &&
|
2024-12-24 07:27:09 +00:00
|
|
|
|
abs(tempsigma.p2) < PRECISIONTOLERANCE &&
|
|
|
|
|
|
abs(tempsigma.p3) < PRECISIONTOLERANCE &&
|
2025-01-02 16:15:08 +00:00
|
|
|
|
abs(tempsigma.p4) < PRECISIONTOLERANCE &&
|
|
|
|
|
|
abs(tempsigma.p5) < PRECISIONTOLERANCE &&
|
2024-12-24 07:27:09 +00:00
|
|
|
|
abs(tempsigma.p6) < PRECISIONTOLERANCE
|
|
|
|
|
|
) {
|
|
|
|
|
|
sigmaAmp[idx] = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double sigma = GPU_getSigma0dB(tempsigma, localangle);
|
2024-12-24 07:27:09 +00:00
|
|
|
|
sigma = powf(10.0, sigma / 10.0);// <20><><EFBFBD><EFBFBD>ɢ<EFBFBD><C9A2>ϵ<EFBFBD><CFB5>
|
|
|
|
|
|
//printf("cls:%d;localangle=%f;sigma0=%f;\n", clsid, localangle, sigma);
|
|
|
|
|
|
sigmaAmp[idx] = sigma;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-27 17:08:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-02 10:53:33 +00:00
|
|
|
|
__global__ void CUDAKernel_RFPC_Caluation_R_Gain(
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double antX, double antY, double antZ, // <20><><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
double* targetX, double* targetY, double* targetZ, long len, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-01-02 16:15:08 +00:00
|
|
|
|
long* demCls,
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double* demSlopeX, double* demSlopeY, double* demSlopeZ, // <20>ر<EFBFBD><D8B1>¶<EFBFBD>ʸ<EFBFBD><CAB8>
|
|
|
|
|
|
double antXaxisX, double antXaxisY, double antXaxisZ, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>X<EFBFBD><58>
|
|
|
|
|
|
double antYaxisX, double antYaxisY, double antYaxisZ,// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>Y<EFBFBD><59>
|
|
|
|
|
|
double antZaxisX, double antZaxisY, double antZaxisZ,// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>Z<EFBFBD><5A>
|
|
|
|
|
|
double antDirectX, double antDirectY, double antDirectZ,// <20><><EFBFBD>ߵ<EFBFBD>ָ<EFBFBD><D6B8>
|
|
|
|
|
|
double Pt,// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-01-06 11:56:45 +00:00
|
|
|
|
double refPhaseRange,
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double* TransAntpattern, double Transtarttheta, double Transstartphi, double Transdtheta, double Transdphi, int Transthetapoints, int Transphipoints, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ͼ
|
|
|
|
|
|
double* ReceiveAntpattern, double Receivestarttheta, double Receivestartphi, double Receivedtheta, double Receivedphi, int Receivethetapoints, int Receivephipoints,//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ͼ
|
|
|
|
|
|
double NearR, double FarR, // <20><><EFBFBD>뷶Χ
|
2025-01-02 16:15:08 +00:00
|
|
|
|
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen,// <20><>ֵͼ
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double* factorj, long freqnum,
|
2025-01-06 04:03:14 +00:00
|
|
|
|
double* outR, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-01-14 01:25:23 +00:00
|
|
|
|
//double* outAmp // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-01-08 05:50:02 +00:00
|
|
|
|
double* PRFEcho_real, double* PRFEcho_imag, long prfid
|
2025-01-02 16:15:08 +00:00
|
|
|
|
) {
|
2025-01-02 10:53:33 +00:00
|
|
|
|
long idx = blockIdx.x * blockDim.x + threadIdx.x;
|
|
|
|
|
|
if (idx < len) {
|
2025-01-06 04:03:14 +00:00
|
|
|
|
double tx = targetX[idx];
|
|
|
|
|
|
double ty = targetY[idx];
|
|
|
|
|
|
double tz = targetZ[idx];
|
|
|
|
|
|
double RstX = antX - tx; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8>
|
|
|
|
|
|
double RstY = antY - ty;
|
|
|
|
|
|
double RstZ = antZ - tz;
|
|
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double slopeX = demSlopeX[idx];
|
|
|
|
|
|
double slopeY = demSlopeY[idx];
|
|
|
|
|
|
double slopeZ = demSlopeZ[idx];
|
2025-01-06 04:03:14 +00:00
|
|
|
|
|
|
|
|
|
|
double RstR2 = RstX * RstX + RstY * RstY + RstZ * RstZ;
|
|
|
|
|
|
double RstR = sqrt(RstR2); // ʸ<><CAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
//printf("antX=%f;antY=%f;antZ=%f;targetX=%f;targetY=%f;targetZ=%f;RstR=%.6f;diffR=%.6f;\n",antX,antY,antZ,targetX,targetY,targetZ,RstR, RstR - 9.010858499003178e+05);
|
2025-01-02 10:53:33 +00:00
|
|
|
|
|
|
|
|
|
|
if (RstR<NearR || RstR>FarR) {
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double slopR = sqrtf(slopeX * slopeX + slopeY * slopeY + slopeZ * slopeZ); //
|
|
|
|
|
|
double dotAB = RstX * slopeX + RstY * slopeY + RstZ * slopeZ;
|
|
|
|
|
|
double localangle = acosf(dotAB / (RstR * slopR)); // <20>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
double ampGain = 0;
|
2025-01-02 10:53:33 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ͼָ<CDBC><D6B8>
|
|
|
|
|
|
CUDAVectorEllipsoidal antVector = GPU_SatelliteAntDirectNormal(
|
|
|
|
|
|
RstX, RstY, RstZ,
|
|
|
|
|
|
antXaxisX, antXaxisY, antXaxisZ,
|
|
|
|
|
|
antYaxisX, antYaxisY, antYaxisZ,
|
|
|
|
|
|
antZaxisX, antZaxisY, antZaxisZ,
|
|
|
|
|
|
antDirectX, antDirectY, antDirectZ
|
|
|
|
|
|
);
|
|
|
|
|
|
if (antVector.Rho > 0) {
|
|
|
|
|
|
// <20><><EFBFBD>䷽<EFBFBD><E4B7BD>ͼ
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double temptheta = antVector.theta * r2d;
|
|
|
|
|
|
double tempphi = antVector.phi * r2d;
|
|
|
|
|
|
double TansantPatternGain =
|
2025-01-02 10:53:33 +00:00
|
|
|
|
GPU_BillerInterpAntPattern(
|
|
|
|
|
|
TransAntpattern,
|
|
|
|
|
|
Transtarttheta, Transstartphi, Transdtheta, Transdphi, Transthetapoints, Transphipoints,
|
|
|
|
|
|
temptheta, tempphi);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>շ<EFBFBD><D5B7><EFBFBD>ͼ
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double antPatternGain = GPU_BillerInterpAntPattern(
|
2025-01-02 10:53:33 +00:00
|
|
|
|
ReceiveAntpattern,
|
|
|
|
|
|
Receivestarttheta, Receivestartphi, Receivedtheta, Receivedphi, Receivethetapoints, Receivephipoints,
|
|
|
|
|
|
temptheta, tempphi);
|
|
|
|
|
|
|
2025-01-02 16:15:08 +00:00
|
|
|
|
// <20><><EFBFBD><EFBFBD>
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double sigma0 = 0;
|
2025-01-02 16:15:08 +00:00
|
|
|
|
{
|
|
|
|
|
|
long clsid = demCls[idx];
|
2025-01-06 04:03:14 +00:00
|
|
|
|
//printf("clsid=%d\n", clsid);
|
2025-01-02 16:15:08 +00:00
|
|
|
|
CUDASigmaParam tempsigma = sigma0Paramslist[clsid];
|
|
|
|
|
|
if (localangle < 0 || localangle >= LAMP_CUDA_PI / 2) {
|
|
|
|
|
|
sigma0 = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else {}
|
|
|
|
|
|
|
|
|
|
|
|
if (abs(tempsigma.p1) < PRECISIONTOLERANCE &&
|
|
|
|
|
|
abs(tempsigma.p2) < PRECISIONTOLERANCE &&
|
|
|
|
|
|
abs(tempsigma.p3) < PRECISIONTOLERANCE &&
|
|
|
|
|
|
abs(tempsigma.p4) < PRECISIONTOLERANCE &&
|
|
|
|
|
|
abs(tempsigma.p5) < PRECISIONTOLERANCE &&
|
|
|
|
|
|
abs(tempsigma.p6) < PRECISIONTOLERANCE
|
|
|
|
|
|
) {
|
|
|
|
|
|
sigma0 = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double sigma = GPU_getSigma0dB(tempsigma, localangle);
|
2025-01-02 16:15:08 +00:00
|
|
|
|
sigma0 = powf(10.0, sigma / 10.0);// <20><><EFBFBD><EFBFBD>ɢ<EFBFBD><C9A2>ϵ<EFBFBD><CFB5>
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-02 10:53:33 +00:00
|
|
|
|
ampGain = TansantPatternGain * antPatternGain;
|
|
|
|
|
|
ampGain = ampGain / (powf(4 * LAMP_CUDA_PI, 2) * powf(RstR, 4)); // <20><><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF>
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double outAmp_temp = ampGain * Pt * sigma0;
|
|
|
|
|
|
double tempR = RstR- refPhaseRange;
|
|
|
|
|
|
outR[idx] = RstR ;
|
|
|
|
|
|
|
2025-01-06 11:56:45 +00:00
|
|
|
|
for (long ii = 0; ii < freqnum; ii++) {
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double phi= tempR * factorj[ii]; // <20><>λ
|
2025-01-08 05:50:02 +00:00
|
|
|
|
// Eular; exp(ix)=cos(x)+isin(x)
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double real = outAmp_temp * cos(phi); // ʵ<><CAB5>
|
|
|
|
|
|
double imag = outAmp_temp * sin(phi); // <20>鲿
|
2025-01-08 05:50:02 +00:00
|
|
|
|
atomicAdd(&PRFEcho_real[prfid * freqnum+ ii], real);
|
|
|
|
|
|
atomicAdd(&PRFEcho_imag[prfid * freqnum+ ii], imag);
|
2025-01-06 11:56:45 +00:00
|
|
|
|
}
|
2025-01-02 10:53:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-02 17:05:04 +00:00
|
|
|
|
__global__ void CUDAKernel_PRF_CalFreqEcho(
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double* Rarr, double* ampArr, long pixelcount,
|
|
|
|
|
|
double* factorj, long freqnum,
|
2025-01-06 04:03:14 +00:00
|
|
|
|
double dx, double nearR,
|
2025-01-02 17:05:04 +00:00
|
|
|
|
cuComplex* PRFEcho, long prfid) {
|
|
|
|
|
|
long idx = blockIdx.x * blockDim.x + threadIdx.x;
|
|
|
|
|
|
if (idx < freqnum) {
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double fatorj = factorj[idx];
|
|
|
|
|
|
double phi = 0;
|
|
|
|
|
|
double amptemp = 0;
|
2025-01-06 04:03:14 +00:00
|
|
|
|
cuComplex tempfreqEcho = PRFEcho[prfid * freqnum + idx];
|
2025-01-02 17:05:04 +00:00
|
|
|
|
for (long i = 0; i < pixelcount; i++) { // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-01-06 04:03:14 +00:00
|
|
|
|
//phi = (R = R - (floor(R / lamda) - 1) * lamda)* fatorj; // <20><>λ
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double phi = Rarr[i] * factorj[idx]; // <20><>λ
|
2025-01-06 04:03:14 +00:00
|
|
|
|
amptemp = ampArr[i];
|
|
|
|
|
|
//printf("amp=%f\n", amptemp);
|
|
|
|
|
|
// Eular; exp(ix)=cos(x)+isin(x)
|
|
|
|
|
|
tempfreqEcho.x = tempfreqEcho.x + amptemp * cos(phi); // ʵ<><CAB5>
|
|
|
|
|
|
tempfreqEcho.y = tempfreqEcho.y + amptemp * sin(phi); // <20>鲿
|
2025-01-06 11:56:45 +00:00
|
|
|
|
//printf("freqid=%d;fatorj=%.12f;d_R=%.10f;phi=%.10f;echo=complex(%.5f,%.5f)\n", idx, fatorj, Rarr[i], phi, tempfreqEcho.x, tempfreqEcho.y);
|
2025-01-02 17:05:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
PRFEcho[prfid*freqnum+idx] = tempfreqEcho;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-01-02 10:53:33 +00:00
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
|
|
|
|
|
|
__global__ void CUDAKernel_PRF_GeneratorEcho(double* Rarr, double* ampArr, long blocknum, long pixelcount, double* factorj, long freqnum,
|
|
|
|
|
|
double nearR, double farR, double* echo_real, double* echo_imag, long prfid) //11
|
|
|
|
|
|
{
|
|
|
|
|
|
//// <20>ٶ<EFBFBD><D9B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>СΪ49152 byte
|
|
|
|
|
|
//// <20>ٶ<EFBFBD>ÿ<EFBFBD><C3BF>Block <20>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD>СΪ 256
|
|
|
|
|
|
__shared__ double s_R[GPU_SHARE_MEMORY]; // <20><><EFBFBD><EFBFBD> 256*12 * 8= 49.2kb
|
|
|
|
|
|
__shared__ double s_Amp[GPU_SHARE_MEMORY]; // <20><><EFBFBD><EFBFBD> 3072 * 8= 49.2kb 49.2*2 = 98.4 < 100 KB
|
|
|
|
|
|
|
|
|
|
|
|
const int bid = blockIdx.x; // <20><>ȡ grid<69><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
|
|
|
|
|
|
const int tid = threadIdx.x;// <20><>ȡ <20><><EFBFBD><EFBFBD> block <20>е<EFBFBD><D0B5>߳<EFBFBD>ID
|
|
|
|
|
|
|
|
|
|
|
|
const int startPIX = bid * GPU_SHARE_MEMORY;
|
|
|
|
|
|
int curthreadidx = 0;
|
|
|
|
|
|
for (long i = 0; i < GPU_SHARE_STEP; i++) {
|
|
|
|
|
|
curthreadidx = tid * GPU_SHARE_STEP + i;
|
|
|
|
|
|
s_R[curthreadidx] = (startPIX + curthreadidx) < pixelcount ? Rarr[startPIX + curthreadidx] : 0.0;
|
|
|
|
|
|
s_Amp[curthreadidx] = (startPIX + curthreadidx) < pixelcount ? ampArr[startPIX + curthreadidx] : 0.0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
__syncthreads(); // ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD><DDB6>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long freqnumblock = freqnum / 256 + 1; //16
|
|
|
|
|
|
|
|
|
|
|
|
//if (startPIX < pixelcount) { // <20><><EFBFBD>ڿ<EFBFBD><DABF>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
|
|
|
|
|
// double temp_real = 0;
|
|
|
|
|
|
// double temp_imag = 0;
|
|
|
|
|
|
// double factorjTemp = 0;
|
|
|
|
|
|
// double temp_phi = 0;
|
|
|
|
|
|
// double temp_amp = 0;
|
|
|
|
|
|
// curthreadidx = 0;
|
|
|
|
|
|
// for (long i = 0; i < freqnumblock; i++) {
|
|
|
|
|
|
// curthreadidx = tid * freqnumblock + i; // <20><>ȡ<EFBFBD><C8A1>ǰƵ<C7B0><C6B5>
|
|
|
|
|
|
// if (curthreadidx < freqnum) { // <20><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>
|
|
|
|
|
|
// factorjTemp = factorj[curthreadidx];
|
|
|
|
|
|
// for (long j = 0; j < GPU_SHARE_MEMORY; j++) {
|
|
|
|
|
|
// temp_phi = s_R[j] * factorjTemp;
|
|
|
|
|
|
// temp_amp = s_Amp[j];
|
|
|
|
|
|
|
|
|
|
|
|
// temp_real = temp_real + temp_amp * cos(temp_phi);
|
|
|
|
|
|
// temp_imag = temp_imag + temp_amp * sin(temp_phi);
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// //atomicAdd(&echo_real[prfid * freqnum + curthreadidx], temp_real); // <20><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
|
|
|
|
|
|
// //atomicAdd(&echo_imag[prfid * freqnum + curthreadidx], temp_imag); // <20><><EFBFBD><EFBFBD><EFBFBD>鲿
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-02 10:53:33 +00:00
|
|
|
|
/** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD>ӿ<EFBFBD> *******************************************************************************************************/
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
extern "C" void SatelliteAntDirectNormal(double* RstX, double* RstY, double* RstZ,
|
|
|
|
|
|
double antXaxisX, double antXaxisY, double antXaxisZ,
|
|
|
|
|
|
double antYaxisX, double antYaxisY, double antYaxisZ,
|
|
|
|
|
|
double antZaxisX, double antZaxisY, double antZaxisZ,
|
|
|
|
|
|
double antDirectX, double antDirectY, double antDirectZ,
|
|
|
|
|
|
double* thetaAnt, double* phiAnt,
|
2025-01-06 04:03:14 +00:00
|
|
|
|
long len) {
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
|
|
|
|
|
int blockSize = 256; // ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD>
|
|
|
|
|
|
int numBlocks = (len + blockSize - 1) / blockSize; // <20><><EFBFBD><EFBFBD> pixelcount <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> CUDA <20>˺<EFBFBD><CBBA><EFBFBD>
|
|
|
|
|
|
CUDA_SatelliteAntDirectNormal << <numBlocks, blockSize >> > (RstX, RstY, RstZ,
|
|
|
|
|
|
antXaxisX, antXaxisY, antXaxisZ,
|
|
|
|
|
|
antYaxisX, antYaxisY, antYaxisZ,
|
|
|
|
|
|
antZaxisX, antZaxisY, antZaxisZ,
|
|
|
|
|
|
antDirectX, antDirectY, antDirectZ,
|
|
|
|
|
|
thetaAnt, phiAnt
|
|
|
|
|
|
, len);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __CUDADEBUG__
|
|
|
|
|
|
cudaError_t err = cudaGetLastError();
|
|
|
|
|
|
if (err != cudaSuccess) {
|
2025-01-02 10:53:33 +00:00
|
|
|
|
printf("CUDA_RFPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
|
2024-12-24 07:27:09 +00:00
|
|
|
|
// Possibly: exit(-1) if program cannot continue....
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif // __CUDADEBUG__
|
|
|
|
|
|
cudaDeviceSynchronize();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
extern "C" void AntPatternInterpGain(double* anttheta, double* antphi, double* gain,
|
|
|
|
|
|
double* antpattern, double starttheta, double startphi, double dtheta, double dphi, int thetapoints, int phipoints, long len) {
|
2024-12-24 07:27:09 +00:00
|
|
|
|
int blockSize = 256; // ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD>
|
|
|
|
|
|
int numBlocks = (len + blockSize - 1) / blockSize; // <20><><EFBFBD><EFBFBD> pixelcount <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
2025-01-02 10:53:33 +00:00
|
|
|
|
//printf("\nCUDA_RFPC_SiglePRF blockSize:%d ,numBlock:%d\n", blockSize, numBlocks);
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
2025-01-02 16:15:08 +00:00
|
|
|
|
CUDA_AntPatternInterpGain << <numBlocks, blockSize >> > (anttheta, antphi, gain,
|
|
|
|
|
|
antpattern,
|
|
|
|
|
|
starttheta, startphi, dtheta, dphi, thetapoints, phipoints,
|
2024-12-24 07:27:09 +00:00
|
|
|
|
len);
|
|
|
|
|
|
#ifdef __CUDADEBUG__
|
|
|
|
|
|
cudaError_t err = cudaGetLastError();
|
|
|
|
|
|
if (err != cudaSuccess) {
|
2025-01-02 10:53:33 +00:00
|
|
|
|
printf("CUDA_RFPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
|
2024-12-24 07:27:09 +00:00
|
|
|
|
// Possibly: exit(-1) if program cannot continue....
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif // __CUDADEBUG__
|
|
|
|
|
|
cudaDeviceSynchronize();
|
|
|
|
|
|
}
|
2025-01-02 16:15:08 +00:00
|
|
|
|
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
extern "C" void calculationEcho(double* sigma0, double* TransAnt, double* ReciveAnt,
|
|
|
|
|
|
double* localangle, double* R, double* slopeangle,
|
|
|
|
|
|
double nearRange, double Fs, double pt, double lamda, long FreqIDmax,
|
2024-12-24 07:27:09 +00:00
|
|
|
|
cuComplex* echoAmp, long* FreqID,
|
|
|
|
|
|
long len)
|
|
|
|
|
|
{
|
|
|
|
|
|
int blockSize = 256; // ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD>
|
|
|
|
|
|
int numBlocks = (len + blockSize - 1) / blockSize; // <20><><EFBFBD><EFBFBD> pixelcount <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> CUDA <20>˺<EFBFBD><CBBA><EFBFBD>
|
|
|
|
|
|
CUDA_calculationEcho << <numBlocks, blockSize >> > (sigma0, TransAnt, ReciveAnt,
|
|
|
|
|
|
localangle, R, slopeangle,
|
|
|
|
|
|
nearRange, Fs, pt, lamda, FreqIDmax,
|
|
|
|
|
|
echoAmp, FreqID,
|
|
|
|
|
|
len);
|
|
|
|
|
|
#ifdef __CUDADEBUG__
|
|
|
|
|
|
cudaError_t err = cudaGetLastError();
|
|
|
|
|
|
if (err != cudaSuccess) {
|
2025-01-02 10:53:33 +00:00
|
|
|
|
printf("CUDA_RFPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
|
2024-12-24 07:27:09 +00:00
|
|
|
|
// Possibly: exit(-1) if program cannot continue....
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif // __CUDADEBUG__
|
|
|
|
|
|
cudaDeviceSynchronize();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-27 17:08:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
2024-12-24 07:27:09 +00:00
|
|
|
|
|
|
|
|
|
|
extern "C" void CUDAInterpSigma(
|
2025-01-14 01:25:23 +00:00
|
|
|
|
long* demcls, double* sigmaAmp, double* localanglearr, long len,
|
2024-12-24 07:27:09 +00:00
|
|
|
|
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen) {// <20>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-sigma<6D><61>ֵ<EFBFBD><D6B5>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>-ulaby
|
|
|
|
|
|
int blockSize = 256; // ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD>
|
|
|
|
|
|
int numBlocks = (len + blockSize - 1) / blockSize; // <20><><EFBFBD><EFBFBD> pixelcount <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> CUDA <20>˺<EFBFBD><CBBA><EFBFBD>
|
|
|
|
|
|
CUDA_InterpSigma << <numBlocks, blockSize >> > (
|
|
|
|
|
|
demcls, sigmaAmp, localanglearr, len,
|
|
|
|
|
|
sigma0Paramslist, sigmaparamslistlen
|
|
|
|
|
|
);
|
|
|
|
|
|
#ifdef __CUDADEBUG__
|
|
|
|
|
|
cudaError_t err = cudaGetLastError();
|
|
|
|
|
|
if (err != cudaSuccess) {
|
2025-01-02 10:53:33 +00:00
|
|
|
|
printf("CUDA_RFPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
|
2024-12-24 07:27:09 +00:00
|
|
|
|
// Possibly: exit(-1) if program cannot continue....
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif // __CUDADEBUG__
|
|
|
|
|
|
cudaDeviceSynchronize();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-02 16:15:08 +00:00
|
|
|
|
extern "C" void CUDARFPC_Caluation_R_Gain(
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double antX, double antY, double antZ, // <20><><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
double* targetX, double* targetY, double* targetZ, long TargetPixelNumber, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-01-02 16:15:08 +00:00
|
|
|
|
long* demCls,
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double* demSlopeX, double* demSlopeY, double* demSlopeZ, // <20>ر<EFBFBD><D8B1>¶<EFBFBD>ʸ<EFBFBD><CAB8>
|
|
|
|
|
|
double antXaxisX, double antXaxisY, double antXaxisZ, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>X<EFBFBD><58>
|
|
|
|
|
|
double antYaxisX, double antYaxisY, double antYaxisZ,// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>Y<EFBFBD><59>
|
|
|
|
|
|
double antZaxisX, double antZaxisY, double antZaxisZ,// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>Z<EFBFBD><5A>
|
|
|
|
|
|
double antDirectX, double antDirectY, double antDirectZ,// <20><><EFBFBD>ߵ<EFBFBD>ָ<EFBFBD><D6B8>
|
|
|
|
|
|
double Pt,// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-01-06 11:56:45 +00:00
|
|
|
|
double refPhaseRange,
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double* TransAntpattern, double Transtarttheta, double Transstartphi, double Transdtheta, double Transdphi, int Transthetapoints, int Transphipoints, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ͼ
|
|
|
|
|
|
double* ReceiveAntpattern, double Receivestarttheta, double Receivestartphi, double Receivedtheta, double Receivedphi, int Receivethetapoints, int Receivephipoints,//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD><DFB7><EFBFBD>ͼ
|
|
|
|
|
|
double NearR, double FarR, // <20><><EFBFBD>뷶Χ
|
2025-01-02 16:15:08 +00:00
|
|
|
|
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen,// <20><>ֵͼ
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double* factorj, long freqnum,
|
2025-01-06 04:03:14 +00:00
|
|
|
|
double* outR, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-01-14 01:25:23 +00:00
|
|
|
|
//double* outAmp // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-01-08 05:50:02 +00:00
|
|
|
|
double* PRFEcho_real, double* PRFEcho_imag, long prfid
|
2025-01-02 16:15:08 +00:00
|
|
|
|
)
|
2025-01-02 10:53:33 +00:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
int blockSize = 256; // ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD>
|
|
|
|
|
|
int numBlocks = (TargetPixelNumber + blockSize - 1) / blockSize; // <20><><EFBFBD><EFBFBD> pixelcount <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> CUDA <20>˺<EFBFBD><CBBA><EFBFBD>
|
|
|
|
|
|
CUDAKernel_RFPC_Caluation_R_Gain << <numBlocks, blockSize >> > (
|
2025-01-02 16:15:08 +00:00
|
|
|
|
antX, antY, antZ,
|
|
|
|
|
|
targetX, targetY, targetZ, TargetPixelNumber,
|
|
|
|
|
|
demCls,
|
2025-01-02 10:53:33 +00:00
|
|
|
|
demSlopeX, demSlopeY, demSlopeZ,
|
2025-01-02 16:15:08 +00:00
|
|
|
|
antXaxisX, antXaxisY, antXaxisZ,
|
|
|
|
|
|
antYaxisX, antYaxisY, antYaxisZ,
|
|
|
|
|
|
antZaxisX, antZaxisY, antZaxisZ,
|
|
|
|
|
|
antDirectX, antDirectY, antDirectZ,
|
|
|
|
|
|
Pt,
|
2025-01-06 11:56:45 +00:00
|
|
|
|
refPhaseRange,
|
2025-01-02 16:15:08 +00:00
|
|
|
|
TransAntpattern,
|
|
|
|
|
|
Transtarttheta, Transstartphi, Transdtheta, Transdphi, Transthetapoints, Transphipoints,
|
|
|
|
|
|
ReceiveAntpattern,
|
|
|
|
|
|
Receivestarttheta, Receivestartphi, Receivedtheta, Receivedphi, Receivethetapoints, Receivephipoints,
|
2025-01-02 10:53:33 +00:00
|
|
|
|
NearR, FarR,
|
2025-01-02 17:05:04 +00:00
|
|
|
|
sigma0Paramslist, sigmaparamslistlen,
|
2025-01-06 11:56:45 +00:00
|
|
|
|
factorj, freqnum,
|
2025-01-02 10:53:33 +00:00
|
|
|
|
outR,
|
2025-01-06 11:56:45 +00:00
|
|
|
|
//outAmp
|
|
|
|
|
|
PRFEcho_real, PRFEcho_imag, prfid
|
2025-01-02 10:53:33 +00:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __CUDADEBUG__
|
|
|
|
|
|
cudaError_t err = cudaGetLastError();
|
|
|
|
|
|
if (err != cudaSuccess) {
|
|
|
|
|
|
printf("CUDARFPC_Caluation_R_Gain CUDA Error: %s\n", cudaGetErrorString(err));
|
|
|
|
|
|
// Possibly: exit(-1) if program cannot continue....
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif // __CUDADEBUG__
|
|
|
|
|
|
cudaDeviceSynchronize();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-02 17:05:04 +00:00
|
|
|
|
extern "C" void CUDA_PRF_CalFreqEcho(
|
2025-01-14 01:25:23 +00:00
|
|
|
|
double* Rarr, double* ampArr, long pixelcount,
|
|
|
|
|
|
double* factorj, long freqnum,
|
2025-01-06 04:03:14 +00:00
|
|
|
|
double dx, double nearR,
|
2025-01-02 17:05:04 +00:00
|
|
|
|
cuComplex* PRFEcho, long prfid)
|
2025-01-02 10:53:33 +00:00
|
|
|
|
{
|
|
|
|
|
|
int blockSize = 256; // ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD>
|
2025-01-02 17:05:04 +00:00
|
|
|
|
int numBlocks = (freqnum + blockSize - 1) / blockSize; // <20><><EFBFBD><EFBFBD> pixelcount <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
2025-01-02 16:15:08 +00:00
|
|
|
|
|
2025-01-02 17:05:04 +00:00
|
|
|
|
CUDAKernel_PRF_CalFreqEcho << <numBlocks, blockSize >> > (
|
|
|
|
|
|
Rarr, ampArr, pixelcount,
|
2025-01-06 11:56:45 +00:00
|
|
|
|
factorj, freqnum,
|
2025-01-06 04:03:14 +00:00
|
|
|
|
dx,nearR,
|
2025-01-02 17:05:04 +00:00
|
|
|
|
PRFEcho, prfid
|
2025-01-02 13:25:16 +00:00
|
|
|
|
);
|
|
|
|
|
|
#ifdef __CUDADEBUG__
|
|
|
|
|
|
cudaError_t err = cudaGetLastError();
|
|
|
|
|
|
if (err != cudaSuccess) {
|
2025-01-02 17:05:04 +00:00
|
|
|
|
printf("CUDA_PRF_CalFreqEcho CUDA Error: %s\n", cudaGetErrorString(err));
|
2025-01-02 13:25:16 +00:00
|
|
|
|
// Possibly: exit(-1) if program cannot continue....
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif // __CUDADEBUG__
|
|
|
|
|
|
cudaDeviceSynchronize();
|
2025-01-02 10:53:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-01-14 01:25:23 +00:00
|
|
|
|
extern "C" void CUDA_PRF_GeneratorEcho(cublasHandle_t handle,double* Rarr, double* ampArr, long pixelcount, double* factorj, long freqnum, double nearR, double farR, double* echo_real, double* echo_imag, long prfid)
|
|
|
|
|
|
{
|
|
|
|
|
|
//cublasHandle_t handle;
|
|
|
|
|
|
//cublasStatus_t status = cublasCreate(&handle);
|
|
|
|
|
|
long blocknum = pixelcount / GPU_SHARE_MEMORY + 1;
|
|
|
|
|
|
|
|
|
|
|
|
int blockSize = 256; // ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD>
|
|
|
|
|
|
int numBlocks = (pixelcount + GPU_SHARE_MEMORY - 1) / GPU_SHARE_MEMORY; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
CUDAKernel_PRF_GeneratorEcho << <numBlocks, blockSize >> > (Rarr, ampArr, blocknum, pixelcount,
|
|
|
|
|
|
factorj, freqnum,
|
|
|
|
|
|
nearR, farR,
|
|
|
|
|
|
echo_real, echo_imag, prfid);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __CUDADEBUG__
|
|
|
|
|
|
cudaError_t err = cudaGetLastError();
|
|
|
|
|
|
if (err != cudaSuccess) {
|
|
|
|
|
|
printf("CUDA_PRF_GeneratorEcho CUDA Error: %s\n", cudaGetErrorString(err));
|
|
|
|
|
|
// Possibly: exit(-1) if program cannot continue....
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif // __CUDADEBUG__
|
|
|
|
|
|
cudaDeviceSynchronize();
|
|
|
|
|
|
//cublasDestroy(handle);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CUDA_RFPC_MainProgramm()
|
|
|
|
|
|
{
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> cuBLAS <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
cublasHandle_t handle;
|
|
|
|
|
|
cublasStatus_t status = cublasCreate(&handle);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cublasDestroy(handle);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-02 10:53:33 +00:00
|
|
|
|
|
2024-12-24 07:27:09 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|