修复RTPC算法的切片错误
parent
7bf440dc70
commit
798e02352f
|
@ -26,13 +26,14 @@
|
||||||
#define MATPLOTDRAWIMAGE
|
#define MATPLOTDRAWIMAGE
|
||||||
|
|
||||||
|
|
||||||
#define PI_180 180/3.141592653589793238462643383279
|
#define r2d 180/3.141592653589793238462643383279
|
||||||
#define T180_PI 3.141592653589793238462643383279/180
|
#define d2r 3.141592653589793238462643383279/180
|
||||||
#define LIGHTSPEED 299792458
|
#define LIGHTSPEED 299792458
|
||||||
#define PRECISIONTOLERANCE 1e-9
|
#define PRECISIONTOLERANCE 1e-9
|
||||||
#define Radians2Degrees(Radians) Radians*PI_180
|
#define Radians2Degrees(Radians) Radians*PI_180
|
||||||
#define Degrees2Radians(Degrees) Degrees*T180_PI
|
#define Degrees2Radians(Degrees) Degrees*T180_PI
|
||||||
#define EARTHWE 0.000072292115
|
#define EARTHWE 0.000072292115
|
||||||
|
#define PI 3.141592653589793238462643383279
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,11 +44,10 @@
|
||||||
|
|
||||||
const std::complex<double> imagI(0, 1);
|
const std::complex<double> imagI(0, 1);
|
||||||
|
|
||||||
const double PI = 3.141592653589793238462643383279;
|
|
||||||
const double epsilon = 0.000000000000001;
|
const double epsilon = 0.000000000000001;
|
||||||
const double pi = 3.14159265358979323846;
|
const double pi = 3.14159265358979323846;
|
||||||
const double d2r = pi / 180;
|
|
||||||
const double r2d = 180 / pi;
|
|
||||||
|
|
||||||
const double a = 6378137.0; //椭球长半轴
|
const double a = 6378137.0; //椭球长半轴
|
||||||
const double ae = 6378137.0; //椭球长半轴
|
const double ae = 6378137.0; //椭球长半轴
|
||||||
|
|
222
GPUTool.cu
222
GPUTool.cu
|
@ -138,7 +138,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
__device__ cuComplex GPU_calculationEcho(float sigma0, float TransAnt, float ReciveAnt,
|
__device__ cuComplex GPU_calculationEcho(float sigma0, float TransAnt, float ReciveAnt,
|
||||||
float localangle, float R, float slopeangle, float Pt, float lamda) {
|
float localangle, float R, float slopeangle, float Pt, float lamda) {
|
||||||
float r = R;
|
float r = R;
|
||||||
|
@ -236,41 +235,6 @@ __global__ void CUDA_SatelliteAntDirectNormal(float* RstX,float* RstY,float* Rst
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
__global__ void CUDA_calculationEcho(float* sigma0, float* TransAnt, float* ReciveAnt,
|
|
||||||
float* localangle, float* R,float* slopeangle,
|
|
||||||
float nearRange, float Fs,float Pt,float lamda,long FreqIDmax,
|
|
||||||
cuComplex* echoArr , long* FreqID,
|
|
||||||
long len) {
|
|
||||||
long idx = blockIdx.x * blockDim.x + threadIdx.x;
|
|
||||||
if (idx < len) {
|
|
||||||
float r = R[idx];
|
|
||||||
float amp = Pt * TransAnt[idx] * ReciveAnt[idx];
|
|
||||||
amp= amp * sigma0[idx];
|
|
||||||
amp = amp / (powf(4* LAMP_CUDA_PI,2)*powf(r,4)); // 反射强度
|
|
||||||
|
|
||||||
// 处理相位
|
|
||||||
float phi = (-4 * LAMP_CUDA_PI / lamda) * r;
|
|
||||||
cuComplex echophi = make_cuComplex(0, phi) ;
|
|
||||||
cuComplex echophiexp = cuCexpf(echophi);
|
|
||||||
|
|
||||||
float timeR = 2 * (r - nearRange) / LIGHTSPEED * Fs;
|
|
||||||
long timeID = floorf(timeR);
|
|
||||||
if (timeID < 0 || timeID >= FreqIDmax) {
|
|
||||||
timeID = 0;
|
|
||||||
amp = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
cuComplex echo;
|
|
||||||
echo.x = echophiexp.x * amp;
|
|
||||||
echo.y = echophiexp.y * amp;
|
|
||||||
|
|
||||||
|
|
||||||
echoArr[idx] = echo;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
__global__ void CUDA_BillerInterpAntPattern(float* antpattern,
|
__global__ void CUDA_BillerInterpAntPattern(float* antpattern,
|
||||||
float starttheta, float startphi, float dtheta, float dphi,
|
float starttheta, float startphi, float dtheta, float dphi,
|
||||||
long thetapoints, long phipoints,
|
long thetapoints, long phipoints,
|
||||||
|
@ -324,31 +288,36 @@ __global__ void CUDA_BillerInterpAntPattern(float* antpattern,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__global__ void CUDA_Test_HelloWorld(float a, long len) {
|
||||||
|
long idx = blockIdx.x * blockDim.x + threadIdx.x;
|
||||||
|
printf("\nidx:\t %d %d \n", idx, len);
|
||||||
|
}
|
||||||
|
|
||||||
__global__ void CUDA_RTPC_Kernel(
|
|
||||||
|
__global__ void CUDA_RTPC(
|
||||||
float antPx, float antPy, float antPz,// 天线坐标
|
float antPx, float antPy, float antPz,// 天线坐标
|
||||||
float antXaxisX, float antXaxisY, float antXaxisZ, // 天线坐标系
|
float antXaxisX, float antXaxisY, float antXaxisZ,
|
||||||
float antYaxisX, float antYaxisY, float antYaxisZ, //
|
float antYaxisX, float antYaxisY, float antYaxisZ,
|
||||||
float antZaxisX, float antZaxisY, float antZaxisZ,
|
float antZaxisX, float antZaxisY, float antZaxisZ,
|
||||||
float antDirectX, float antDirectY, float antDirectZ,// 天线指向
|
float antDirectX, float antDirectY, float antDirectZ,
|
||||||
float* demx, float* demy, float* demz, long* demcls, // 地面坐标
|
float* demx, float* demy, float* demz, long* demcls,
|
||||||
float* demslopex, float* demslopey, float* demslopez, float* demslopeangle,// 地面坡度
|
float* demslopex, float* demslopey, float* demslopez, float* demslopeangle,
|
||||||
float* Tantpattern, float Tstarttheta, float Tstartphi, float Tdtheta, float Tdphi, long Tthetapoints, long Tphipoints,// 天线方向图相关
|
float* Tantpattern, float Tstarttheta, float Tstartphi, float Tdtheta, float Tdphi, long Tthetapoints, long Tphipoints,
|
||||||
float* Rantpattern, float Rstarttheta, float Rstartphi, float Rdtheta, float Rdphi, long Rthetapoints, long Rphipoints,// 天线方向图相关
|
float* Rantpattern, float Rstarttheta, float Rstartphi, float Rdtheta, float Rdphi, long Rthetapoints, long Rphipoints,
|
||||||
float lamda, float fs, float nearrange, float Pt, long Freqnumbers, // 参数
|
float lamda, float fs, float nearrange, float Pt, long Freqnumbers, // 参数
|
||||||
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen,// 地表覆盖类型-sigma插值对应函数-ulaby
|
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen,// 地表覆盖类型-sigma插值对应函数-ulaby
|
||||||
cuComplex* outecho, long* d_echoAmpFID,
|
cuComplex* outecho, int* d_echoAmpFID,
|
||||||
long len
|
int linecount,int plusepoint) {
|
||||||
) {
|
int idx = blockIdx.x * blockDim.x + threadIdx.x;
|
||||||
long idx = blockIdx.x * blockDim.x + threadIdx.x;
|
//printf("\nidx:\t %d %d %d\n", idx, linecount, plusepoint);
|
||||||
if (idx < len) {
|
if (idx < linecount* plusepoint) {
|
||||||
long clsid = demcls[idx];
|
long clsid = demcls[idx];
|
||||||
CUDAVector Rs{ antPx,antPy,antPz };
|
CUDAVector Rs{ antPx,antPy,antPz };
|
||||||
CUDAVector Rt{ demx[idx],demy[idx],demz[idx] };
|
CUDAVector Rt{ demx[idx],demy[idx],demz[idx] };
|
||||||
CUDAVector Rst{ Rs.x - Rt.x,Rs.y - Rt.y,Rs.z - Rt.z };
|
CUDAVector Rst{ Rs.x - Rt.x,Rs.y - Rt.y,Rs.z - Rt.z };
|
||||||
CUDAVector Vslope{ demslopex[idx],demslopey[idx],demslopez[idx] };
|
CUDAVector Vslope{ demslopex[idx],demslopey[idx],demslopez[idx] };
|
||||||
float R = GPU_VectorNorm2(Rst); // 斜距
|
float R = GPU_VectorNorm2(Rst); // 斜距
|
||||||
|
float slopeangle = demslopeangle[idx];
|
||||||
CUDAVectorEllipsoidal Rtanttheta = GPU_SatelliteAntDirectNormal( // 地面目标在天线的位置
|
CUDAVectorEllipsoidal Rtanttheta = GPU_SatelliteAntDirectNormal( // 地面目标在天线的位置
|
||||||
Rst.x, Rst.y, Rst.z,
|
Rst.x, Rst.y, Rst.z,
|
||||||
antXaxisX, antXaxisY, antXaxisZ,
|
antXaxisX, antXaxisY, antXaxisZ,
|
||||||
|
@ -357,20 +326,22 @@ __global__ void CUDA_RTPC_Kernel(
|
||||||
antDirectX, antDirectY, antDirectZ);
|
antDirectX, antDirectY, antDirectZ);
|
||||||
|
|
||||||
float localangle = GPU_CosAngle_VectorA_VectorB(Rst, Vslope); // 距地入射角
|
float localangle = GPU_CosAngle_VectorA_VectorB(Rst, Vslope); // 距地入射角
|
||||||
float sigma = GPU_getSigma0dB(sigma0Paramslist[clsid], localangle);
|
float sigma = GPU_getSigma0dB(sigma0Paramslist[clsid], localangle * r2d);
|
||||||
sigma = powf(10.0, sigma / 10.0);// 后向散射系数
|
sigma = powf(10.0, sigma / 10.0);// 后向散射系数
|
||||||
|
//printf("\ntheta: %f\t,%f ,%f ,%f ,%f ,%f ,%f \n", localangle * r2d, sigma0Paramslist[clsid].p1, sigma0Paramslist[clsid].p2, sigma0Paramslist[clsid].p3,
|
||||||
|
// sigma0Paramslist[clsid].p4, sigma0Paramslist[clsid].p5, sigma0Paramslist[clsid].p6);
|
||||||
// 发射方向图
|
// 发射方向图
|
||||||
float transPattern = GPU_BillerInterpAntPattern(Tantpattern,
|
float transPattern = GPU_BillerInterpAntPattern(Tantpattern,
|
||||||
Tstarttheta, Tstartphi, Tdtheta, Tdphi, Tthetapoints, Tphipoints,
|
Tstarttheta, Tstartphi, Tdtheta, Tdphi, Tthetapoints, Tphipoints,
|
||||||
Rtanttheta.theta, Rtanttheta.phi);
|
Rtanttheta.theta, Rtanttheta.phi) * r2d;
|
||||||
|
|
||||||
// 接收方向图
|
// 接收方向图
|
||||||
float receivePattern = GPU_BillerInterpAntPattern(Rantpattern,
|
float receivePattern = GPU_BillerInterpAntPattern(Rantpattern,
|
||||||
Rstarttheta, Rstartphi, Rdtheta, Rdphi, Rthetapoints, Rphipoints,
|
Rstarttheta, Rstartphi, Rdtheta, Rdphi, Rthetapoints, Rphipoints,
|
||||||
Rtanttheta.theta, Rtanttheta.phi);
|
Rtanttheta.theta, Rtanttheta.phi) * r2d;
|
||||||
// 计算振幅、相位
|
// 计算振幅、相位
|
||||||
float amp = Pt * transPattern * receivePattern * sigma / (powf(4 * LAMP_CUDA_PI, 2) * powf(R, 4));
|
float amp = Pt * transPattern * receivePattern * sigma * (1 / cos(slopeangle) * sin(localangle));
|
||||||
|
amp = amp / (powf(4 * LAMP_CUDA_PI, 2) * powf(R, 4));
|
||||||
float phi = (-4 * LAMP_CUDA_PI / lamda) * R;
|
float phi = (-4 * LAMP_CUDA_PI / lamda) * R;
|
||||||
|
|
||||||
// 构建回波
|
// 构建回波
|
||||||
|
@ -391,6 +362,8 @@ __global__ void CUDA_RTPC_Kernel(
|
||||||
outecho[idx] = echo;
|
outecho[idx] = echo;
|
||||||
d_echoAmpFID[idx] = timeID;
|
d_echoAmpFID[idx] = timeID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -407,36 +380,99 @@ void checkCudaError(cudaError_t err, const char* msg) {
|
||||||
extern "C" void* mallocCUDAHost(long memsize) {
|
extern "C" void* mallocCUDAHost(long memsize) {
|
||||||
void* ptr;
|
void* ptr;
|
||||||
cudaMallocHost(&ptr, memsize);
|
cudaMallocHost(&ptr, memsize);
|
||||||
|
#ifdef __CUDADEBUG__
|
||||||
|
cudaError_t err = cudaGetLastError();
|
||||||
|
if (err != cudaSuccess) {
|
||||||
|
printf("mallocCUDAHost CUDA Error: %s\n", cudaGetErrorString(err));
|
||||||
|
// Possibly: exit(-1) if program cannot continue....
|
||||||
|
}
|
||||||
|
#endif // __CUDADEBUG__
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 主机参数内存释放
|
// 主机参数内存释放
|
||||||
extern "C" void FreeCUDAHost(void* ptr) {
|
extern "C" void FreeCUDAHost(void* ptr) {
|
||||||
cudaFreeHost(ptr);
|
cudaFreeHost(ptr);
|
||||||
|
#ifdef __CUDADEBUG__
|
||||||
|
cudaError_t err = cudaGetLastError();
|
||||||
|
if (err != cudaSuccess) {
|
||||||
|
printf("FreeCUDAHost CUDA Error: %s\n", cudaGetErrorString(err));
|
||||||
|
// Possibly: exit(-1) if program cannot continue....
|
||||||
|
}
|
||||||
|
#endif // __CUDADEBUG__
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GPU参数内存声明
|
// GPU参数内存声明
|
||||||
extern "C" void* mallocCUDADevice(long memsize) {
|
extern "C" void* mallocCUDADevice(long memsize) {
|
||||||
void* ptr;
|
void* ptr;
|
||||||
cudaMalloc(&ptr, memsize);
|
cudaMalloc(&ptr, memsize);
|
||||||
|
#ifdef __CUDADEBUG__
|
||||||
|
cudaError_t err = cudaGetLastError();
|
||||||
|
if (err != cudaSuccess) {
|
||||||
|
printf("mallocCUDADevice CUDA Error: %s\n", cudaGetErrorString(err));
|
||||||
|
// Possibly: exit(-1) if program cannot continue....
|
||||||
|
}
|
||||||
|
#endif // __CUDADEBUG__
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GPU参数内存释放
|
// GPU参数内存释放
|
||||||
extern "C" void FreeCUDADevice(void* ptr) {
|
extern "C" void FreeCUDADevice(void* ptr) {
|
||||||
cudaFree(ptr);
|
cudaFree(ptr);
|
||||||
|
#ifdef __CUDADEBUG__
|
||||||
|
cudaError_t err = cudaGetLastError();
|
||||||
|
if (err != cudaSuccess) {
|
||||||
|
printf("FreeCUDADevice CUDA Error: %s\n", cudaGetErrorString(err));
|
||||||
|
// Possibly: exit(-1) if program cannot continue....
|
||||||
|
}
|
||||||
|
#endif // __CUDADEBUG__
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GPU 内存数据转移
|
// GPU 内存数据转移
|
||||||
extern "C" void HostToDevice(void* hostptr, void* deviceptr, long memsize) {
|
extern "C" void HostToDevice(void* hostptr, void* deviceptr, long memsize) {
|
||||||
cudaMemcpy(deviceptr, hostptr, memsize, cudaMemcpyHostToDevice);
|
cudaMemcpy(deviceptr, hostptr, memsize, cudaMemcpyHostToDevice);
|
||||||
|
|
||||||
|
#ifdef __CUDADEBUG__
|
||||||
|
cudaError_t err = cudaGetLastError();
|
||||||
|
if (err != cudaSuccess) {
|
||||||
|
printf("HostToDevice CUDA Error: %s\n", cudaGetErrorString(err));
|
||||||
|
// Possibly: exit(-1) if program cannot continue....
|
||||||
|
}
|
||||||
|
#endif // __CUDADEBUG__
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void DeviceToHost(void* hostptr, void* deviceptr, long memsize) {
|
extern "C" void DeviceToHost(void* hostptr, void* deviceptr, long memsize) {
|
||||||
cudaMemcpy(hostptr, deviceptr, memsize, cudaMemcpyDeviceToHost);
|
cudaMemcpy(hostptr, deviceptr, memsize, cudaMemcpyDeviceToHost);
|
||||||
|
#ifdef __CUDADEBUG__
|
||||||
|
cudaError_t err = cudaGetLastError();
|
||||||
|
if (err != cudaSuccess) {
|
||||||
|
printf("DeviceToHost CUDA Error: %s\n", cudaGetErrorString(err));
|
||||||
|
// Possibly: exit(-1) if program cannot continue....
|
||||||
|
}
|
||||||
|
#endif // __CUDADEBUG__
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void CUDATestHelloWorld(float a,long len) {
|
||||||
|
// 设置 CUDA 核函数的网格和块的尺寸
|
||||||
|
int blockSize = 256; // 每个块的线程数
|
||||||
|
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
|
||||||
|
// 调用 CUDA 核函数
|
||||||
|
CUDA_Test_HelloWorld << <blockSize, numBlocks >> > (a, len);
|
||||||
|
#ifdef __CUDADEBUG__
|
||||||
|
cudaError_t err = cudaGetLastError();
|
||||||
|
if (err != cudaSuccess) {
|
||||||
|
printf("FreeCUDADevice CUDA Error: %s\n", cudaGetErrorString(err));
|
||||||
|
// Possibly: exit(-1) if program cannot continue....
|
||||||
|
}
|
||||||
|
#endif // __CUDADEBUG__
|
||||||
|
cudaDeviceSynchronize();
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void distanceAB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* R, long len) {
|
extern "C" void distanceAB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* R, long len) {
|
||||||
// 设置 CUDA 核函数的网格和块的尺寸
|
// 设置 CUDA 核函数的网格和块的尺寸
|
||||||
|
@ -504,21 +540,20 @@ extern "C" void SatelliteAntDirectNormal(float* RstX, float* RstY, float* RstZ,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void CUDARTPCPRF(float antPx, long len) {
|
||||||
extern "C" void calculationEcho(float* sigma0,float* TransAnt,float* ReciveAnt,
|
|
||||||
float* localangle,float* R, float* slopeangle,
|
|
||||||
float nearRange,float Fs, float pt, float lamda, long FreqIDmax,
|
|
||||||
cuComplex* echoAmp,long* FreqID,
|
|
||||||
long len)
|
|
||||||
{
|
|
||||||
int blockSize = 256; // 每个块的线程数
|
int blockSize = 256; // 每个块的线程数
|
||||||
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
|
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
|
||||||
// 调用 CUDA 核函数
|
printf("\nCUDA_RTPC_SiglePRF blockSize:%d ,numBlock:%d\n", blockSize, numBlocks);
|
||||||
CUDA_calculationEcho << <blockSize, numBlocks >> > ( sigma0, TransAnt,ReciveAnt,
|
CUDA_Test_HelloWorld << <blockSize, numBlocks >> > (antPx, len);
|
||||||
localangle, R, slopeangle,
|
|
||||||
nearRange, Fs, pt, lamda, FreqIDmax,
|
|
||||||
echoAmp, FreqID,
|
#ifdef __CUDADEBUG__
|
||||||
len);
|
cudaError_t err = cudaGetLastError();
|
||||||
|
if (err != cudaSuccess) {
|
||||||
|
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
|
||||||
|
// Possibly: exit(-1) if program cannot continue....
|
||||||
|
}
|
||||||
|
#endif // __CUDADEBUG__
|
||||||
cudaDeviceSynchronize();
|
cudaDeviceSynchronize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,39 +562,50 @@ extern "C" void calculationEcho(float* sigma0,float* TransAnt,float* ReciveAnt,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" void CUDA_RTPC_SiglePRF(
|
extern "C" void CUDA_RTPC_SiglePRF(
|
||||||
float antPx, float antPy, float antPZ,// 天线坐标
|
float antPx, float antPy, float antPZ,
|
||||||
float antXaxisX, float antXaxisY, float antXaxisZ, // 天线坐标系
|
float antXaxisX, float antXaxisY, float antXaxisZ,
|
||||||
float antYaxisX, float antYaxisY, float antYaxisZ, //
|
float antYaxisX, float antYaxisY, float antYaxisZ,
|
||||||
float antZaxisX, float antZaxisY, float antZaxisZ,
|
float antZaxisX, float antZaxisY, float antZaxisZ,
|
||||||
float antDirectX, float antDirectY, float antDirectZ,// 天线指向
|
float antDirectX, float antDirectY, float antDirectZ,
|
||||||
float* demx, float* demy, float* demz, long* demcls, // 地面坐标
|
float* demx, float* demy, float* demz, long* demcls,
|
||||||
float* demslopex, float* demslopey, float* demslopez, float* demslopeangle,// 地面坡度
|
float* demslopex, float* demslopey, float* demslopez, float* demslopeangle,
|
||||||
float* Tantpattern, float Tstarttheta, float Tstartphi, float Tdtheta, float Tdphi, long Tthetapoints, long Tphipoints,// 天线方向图相关
|
float* Tantpattern, float Tstarttheta, float Tstartphi, float Tdtheta, float Tdphi, int Tthetapoints, int Tphipoints,
|
||||||
float* Rantpattern, float Rstarttheta, float Rstartphi, float Rdtheta, float Rdphi, long Rthetapoints, long Rphipoints,// 天线方向图相关
|
float* Rantpattern, float Rstarttheta, float Rstartphi, float Rdtheta, float Rdphi, int Rthetapoints, int Rphipoints,
|
||||||
float lamda, float fs, float nearrange, float Pt, long Freqnumbers, // 参数
|
float lamda, float fs, float nearrange, float Pt, int Freqnumbers,
|
||||||
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen,// 地表覆盖类型-sigma插值对应函数-ulaby
|
CUDASigmaParam* sigma0Paramslist, int sigmaparamslistlen,
|
||||||
cuComplex* outecho, long* d_echoAmpFID,
|
cuComplex* outecho, int* d_echoAmpFID,
|
||||||
long len
|
int linecount,int colcount) {
|
||||||
) {
|
|
||||||
int blockSize = 256; // 每个块的线程数
|
int blockSize = 256; // 每个块的线程数
|
||||||
int numBlocks = (len + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
|
int numBlocks = (linecount* colcount + blockSize - 1) / blockSize; // 根据 pixelcount 计算网格大小
|
||||||
// 调用 CUDA 核函数
|
//printf("\nCUDA_RTPC_SiglePRF blockSize:%d ,numBlock:%d\n",blockSize,numBlocks);
|
||||||
CUDA_RTPC_Kernel<<<blockSize,numBlocks>>>(
|
// 调用 CUDA 核函数 CUDA_RTPC_Kernel
|
||||||
|
|
||||||
|
CUDA_RTPC << <numBlocks, blockSize >> > (
|
||||||
antPx, antPy, antPZ,// 天线坐标
|
antPx, antPy, antPZ,// 天线坐标
|
||||||
antXaxisX, antXaxisY, antXaxisZ, // 天线坐标系
|
antXaxisX, antXaxisY, antXaxisZ, // 天线坐标系
|
||||||
antYaxisX, antYaxisY, antYaxisZ, //
|
antYaxisX, antYaxisY, antYaxisZ, //
|
||||||
antZaxisX, antZaxisY, antZaxisZ,
|
antZaxisX, antZaxisY, antZaxisZ,
|
||||||
antDirectX, antDirectY, antDirectZ,// 天线指向
|
antDirectX, antDirectY, antDirectZ,// 天线指向
|
||||||
demx, demy, demz, demcls, // 地面坐标
|
demx, demy, demz,
|
||||||
|
demcls, // 地面坐标
|
||||||
demslopex, demslopey, demslopez, demslopeangle,// 地面坡度
|
demslopex, demslopey, demslopez, demslopeangle,// 地面坡度
|
||||||
Tantpattern, Tstarttheta, Tstartphi, Tdtheta, Tdphi, Tthetapoints, Tphipoints,// 天线方向图相关
|
Tantpattern, Tstarttheta, Tstartphi, Tdtheta, Tdphi, Tthetapoints, Tphipoints,// 天线方向图相关
|
||||||
Rantpattern, Rstarttheta, Rstartphi, Rdtheta, Rdphi, Rthetapoints, Rphipoints,// 天线方向图相关
|
Rantpattern, Rstarttheta, Rstartphi, Rdtheta, Rdphi, Rthetapoints, Rphipoints,// 天线方向图相关
|
||||||
lamda, fs, nearrange, Pt, Freqnumbers, // 参数
|
lamda, fs, nearrange, Pt, Freqnumbers, // 参数
|
||||||
sigma0Paramslist, sigmaparamslistlen,// 地表覆盖类型-sigma插值对应函数-ulaby
|
sigma0Paramslist, sigmaparamslistlen,// 地表覆盖类型-sigma插值对应函数-ulaby
|
||||||
outecho, d_echoAmpFID,
|
outecho, d_echoAmpFID,
|
||||||
len
|
linecount, colcount
|
||||||
);
|
);
|
||||||
|
#ifdef __CUDADEBUG__
|
||||||
|
cudaError_t err = cudaGetLastError();
|
||||||
|
if (err != cudaSuccess) {
|
||||||
|
printf("CUDA_RTPC_SiglePRF CUDA Error: %s\n", cudaGetErrorString(err));
|
||||||
|
// Possibly: exit(-1) if program cannot continue....
|
||||||
|
}
|
||||||
|
#endif // __CUDADEBUG__
|
||||||
cudaDeviceSynchronize();
|
cudaDeviceSynchronize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,3 +614,5 @@ extern "C" void CUDA_RTPC_SiglePRF(
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
31
GPUTool.cuh
31
GPUTool.cuh
|
@ -7,6 +7,8 @@
|
||||||
#include <cublas_v2.h>
|
#include <cublas_v2.h>
|
||||||
#include <cuComplex.h>
|
#include <cuComplex.h>
|
||||||
|
|
||||||
|
#define __CUDADEBUG__
|
||||||
|
|
||||||
// ĬÈÏÏÔ´æ·Ö²¼
|
// ĬÈÏÏÔ´æ·Ö²¼
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,25 +58,28 @@ extern "C" void make_VectorA_B(float sX, float sY, float sZ, float* tX, float* t
|
||||||
extern "C" void Norm_Vector(float* Vx, float* Vy, float* Vz, float* R, long member);
|
extern "C" void Norm_Vector(float* Vx, float* Vy, float* Vz, float* R, long member);
|
||||||
extern "C" void cosAngle_VA_AB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* anglecos, long len);
|
extern "C" void cosAngle_VA_AB(float* Ax, float* Ay, float* Az, float* Bx, float* By, float* Bz, float* anglecos, long len);
|
||||||
extern "C" void SatelliteAntDirectNormal(float* RstX, float* RstY, float* RstZ, float antXaxisX, float antXaxisY, float antXaxisZ, float antYaxisX, float antYaxisY, float antYaxisZ, float antZaxisX, float antZaxisY, float antZaxisZ, float antDirectX, float antDirectY, float antDirectZ, float* thetaAnt, float* phiAnt, long len);
|
extern "C" void SatelliteAntDirectNormal(float* RstX, float* RstY, float* RstZ, float antXaxisX, float antXaxisY, float antXaxisZ, float antYaxisX, float antYaxisY, float antYaxisZ, float antZaxisX, float antZaxisY, float antZaxisZ, float antDirectX, float antDirectY, float antDirectZ, float* thetaAnt, float* phiAnt, long len);
|
||||||
extern "C" void calculationEcho(float* sigma0, float* TransAnt, float* ReciveAnt,float* localangle, float* R, float* slopeangle,float nearRange, float Fs, float pt, float lamda, long FreqIDmax,cuComplex* echoAmp, long* FreqID, long len);
|
|
||||||
extern "C" void CUDA_RTPC_SiglePRF(
|
extern "C" void CUDA_RTPC_SiglePRF(
|
||||||
float antPx, float antPy, float antPZ,// 天线坐标
|
float antPx, float antPy, float antPZ,
|
||||||
float antXaxisX, float antXaxisY, float antXaxisZ, // 天线坐标系
|
float antXaxisX, float antXaxisY, float antXaxisZ,
|
||||||
float antYaxisX, float antYaxisY, float antYaxisZ, //
|
float antYaxisX, float antYaxisY, float antYaxisZ,
|
||||||
float antZaxisX, float antZaxisY, float antZaxisZ,
|
float antZaxisX, float antZaxisY, float antZaxisZ,
|
||||||
float antDirectX, float antDirectY, float antDirectZ,// 天线指向
|
float antDirectX, float antDirectY, float antDirectZ,
|
||||||
float* demx, float* demy, float* demz,long* demcls, // 地面坐标
|
float* demx, float* demy, float* demz, long* demcls,
|
||||||
float* demslopex, float* demslopey, float* demslopez, float* demslopeangle,// 地面坡度
|
float* demslopex, float* demslopey, float* demslopez, float* demslopeangle,
|
||||||
float* Tantpattern, float Tstarttheta, float Tstartphi, float Tdtheta, float Tdphi, long Tthetapoints, long Tphipoints,// 天线方向图相关
|
float* Tantpattern, float Tstarttheta, float Tstartphi, float Tdtheta, float Tdphi, int Tthetapoints, int Tphipoints,
|
||||||
float* Rantpattern, float Rstarttheta, float Rstartphi, float Rdtheta, float Rdphi, long Rthetapoints, long Rphipoints,// 天线方向图相关
|
float* Rantpattern, float Rstarttheta, float Rstartphi, float Rdtheta, float Rdphi, int Rthetapoints, int Rphipoints,
|
||||||
float lamda, float fs, float nearrange, float Pt, long Freqnumbers, // 参数
|
float lamda, float fs, float nearrange, float Pt, int Freqnumbers,
|
||||||
CUDASigmaParam* sigma0Paramslist, long sigmaparamslistlen,// 地表覆盖类型-sigma插值对应函数-ulaby
|
CUDASigmaParam* sigma0Paramslist, int sigmaparamslistlen,
|
||||||
cuComplex* outecho,long* d_echoAmpFID,
|
cuComplex* outecho, int* d_echoAmpFID,
|
||||||
long len
|
int linecount, int colcount
|
||||||
);
|
);
|
||||||
|
|
||||||
|
extern "C" void CUDARTPCPRF(float antPx, long len);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" void CUDATestHelloWorld(float a, long len);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue