52 #define __DEBUG_LOG_GPU_SPEC_ 54 #include <cuda_runtime.h> 57 #define __CUDA_INTERNAL_COMPILATION__ //for CUDA Math Module 58 #include <math_constants.h> 59 #include <math_functions.h> 60 #include <math_functions_dbl_ptx3.h> 61 #include <vector_functions.h> 62 #undef __CUDA_INTERNAL_COMPILATION__ 64 static void HandleError(cudaError_t err,
67 if (err != cudaSuccess) {
68 printf(
"%s in %s at line %d\n", cudaGetErrorString(err),
73 #define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ )) 76 #define HANDLE_NULL( a ) {if (a == NULL) { \ 77 printf( "Host memory failed in %s at line %d\n", \ 78 __FILE__, __LINE__ ); \ 79 exit( EXIT_FAILURE );}} 113 const ivec2 &pixel_number,
114 const vec2 &pixel_pitch,
116 const Real propagation_distance,
117 const Real depth_max,
120 const bool &random_phase,
121 const int &index_amplitude
131 this->pn_X = pixel_number[
_X];
132 this->pn_Y = pixel_number[
_Y];
135 this->pp_X = pixel_pitch[
_X];
136 this->pp_Y = pixel_pitch[
_Y];
139 this->wrp_d = wrp_dis;
140 this->propa_d = propagation_distance;
141 this->zmax = depth_max;
149 this->bRandomPhase = random_phase;
152 this->iAmplitude = index_amplitude;
154 this->pi2 =
M_PI * 2;
158 this->det_tx =
tx / sqrt(1 -
tx *
tx);
159 this->det_ty =
ty / sqrt(1 -
ty *
ty);
170 const int &nBlocks,
const int &nBlocks2,
const int &nThreads,
const int &nx,
const int &ny,
171 cuDoubleComplex *src, cuDoubleComplex *dst, cufftDoubleComplex *fftsrc, cufftDoubleComplex *fftdst,
175 const int &nBlocks,
const int &nThreads,
const int &n_pts_per_stream,
176 Real* cuda_pc_data,
Real* cuda_amp_data,
177 cuDoubleComplex* cuda_dst,
const WRPGpuConst* cuda_config);
bool bRandomPhase
wave length = lambda;
Real lambda
Wave Number = (2 * PI) / lambda;.
void cudaGenWRP(const int &nBlocks, const int &nThreads, const int &n_pts_per_stream, Real *cuda_pc_data, Real *cuda_amp_data, cuDoubleComplex *cuda_dst, const WRPGpuConst *cuda_config)
double pp_Y
Pixel pitch of SLM in x direction.
Real wrp_d
number of streams
double pp_X
Number of pixel of SLM in y direction.
Real zmax
wave length = lambda;
int n_streams
number of colors per point cloud
int pn_X
Offset value of point cloud in z direction.
KernelConst(const int &n_points, const int &n_colors, const int &n_streams, const ivec2 &pixel_number, const vec2 &pixel_pitch, const Real wrp_dis, const Real propagation_distance, const Real depth_max, const Real &k, const Real &lambda, const bool &random_phase, const int &index_amplitude)
int n_colors
number of point cloud
int pn_Y
Number of pixel of SLM in x direction.
void cudaFresnelPropagationWRP(const int &nBlocks, const int &nBlocks2, const int &nThreads, const int &nx, const int &ny, cuDoubleComplex *src, cuDoubleComplex *dst, cufftDoubleComplex *fftsrc, cufftDoubleComplex *fftdst, const WRPGpuConst *cuda_config)
struct KernelConst WRPGpuConst
Real k
Pixel pitch of SLM in y direction.