46 #ifndef __ophTriMesh_GPU_h 47 #define __ophTriMesh_GPU_h 53 #include <cuda_runtime_api.h> 56 #include <math_constants.h> 59 static void HandleError(cudaError_t err,
62 if (err != cudaSuccess) {
63 printf(
"%s in %s at line %d\n", cudaGetErrorString(err),
68 #define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ )) 71 #define HANDLE_NULL( a ) {if (a == NULL) { \ 72 printf( "Host memory failed in %s at line %d\n", __FILE__, __LINE__ ); \ 73 exit( EXIT_FAILURE );}} 75 #define CUDA_CALL(x) { if((x)!=cudaSuccess) { \ 76 printf("Error at %s:%d\n",__FILE__,__LINE__);\ 77 exit( EXIT_FAILURE ); }} 78 #define CURAND_CALL(x) { if((x)!=CURAND_STATUS_SUCCESS) { \ 79 printf("Error at %s:%d\n",__FILE__,__LINE__);\ 80 exit( EXIT_FAILURE ); }} 100 const ivec2& pixel_number,
101 const vec2& pixel_pitch,
107 this->pn_X = pixel_number[
_X];
108 this->pn_Y = pixel_number[
_Y];
111 this->pp_X = pixel_pitch[
_X];
112 this->pp_Y = pixel_pitch[
_Y];
116 this->dfx = (1.0 / this->
pp_X) / this->pn_X;
117 this->dfy = (1.0 / this->
pp_Y) / this->pn_Y;
134 const int& nBlocks,
const int& nThreads, cufftDoubleComplex* output,
136 double carrierWaveX,
double carrierWaveY,
double carrierWaveZ, CUstream_st* stream
140 const int& nBlocks,
const int& nThreads, cufftDoubleComplex* output,
142 double carrierWaveX,
double carrierWaveY,
double carrierWaveZ, CUstream_st* stream
145 void call_fftGPU(
int nx,
int ny, cufftDoubleComplex* input, cufftDoubleComplex* output, CUstream_st* streamTriMesh);
146 void call_fftGPUf(
int nx,
int ny, cuFloatComplex* input, cuFloatComplex* output, CUstream_st* streamTriMesh);
void call_fftGPUf(int nx, int ny, cuFloatComplex *input, cuFloatComplex *output, CUstream_st *streamTriMesh)
unsigned int shading_flag
Pixel pitch of SLM in y direction.
void call_fftGPU(int nx, int ny, cufftDoubleComplex *input, cufftDoubleComplex *output, CUstream_st *streamTriMesh)
void cudaMesh_Continuous(const int &nBlocks, const int &nThreads, cufftDoubleComplex *output, const MeshKernelConfig *config, const geometric *geom, double av0, double av1, double av2, double carrierWaveX, double carrierWaveY, double carrierWaveZ, CUstream_st *stream)
structure for 2-dimensional integer vector and its arithmetic.
struct MeshKernelConfig MeshKernelConfig
MeshKernelConfig(const ivec2 &pixel_number, const vec2 &pixel_pitch, const Real &lambda, const uint &shading_flag)
double pp_X
Number of pixel of SLM in y direction.
void cudaMesh_Flat(const int &nBlocks, const int &nThreads, cufftDoubleComplex *output, const MeshKernelConfig *config, double shading_factor, const geometric *geom, double carrierWaveX, double carrierWaveY, double carrierWaveZ, CUstream_st *stream)
int pn_Y
Number of pixel of SLM in x direction.
structure for 2-dimensional Real type vector and its arithmetic.
double pp_Y
Pixel pitch of SLM in x direction.