Hi all,
i wrote the following code to fill a matrix phi_hat_x:
define K 6
#define c 2
#define PI 3.1415
#define BLOCK_SIZE 16
intt cuSizeF=sizeof(float);
device float phi_hat_window (float x)
{
float value;
float temp=K*K-x*x;
if (temp>0) {
temp=sqrtf(temp);
value=(1./PI)*sinhf(ALPHA*temp)/temp;
}
else if (temp<0) {
temp=sqrtf(-temp);
value=(1/PI)*sinf(ALPHA*temp)/temp;
}
else value=(1/PI)*ALPHA;
return value;
}
global void phi_window_gen (float *phi_xy, size_t pitch, int N1, int N2)
{
float ans;
int index,index_row,index_col;
index_col= blockIdx.x*BLOCK_SIZE+threadIdx.x;
index_row= blockIdx.y*BLOCK_SIZE+threadIdx.y;
index=index_row*pitch/cuSizeF+index_col;
ans=phi_window(2*PI*(index_col-N1/2)/(c*N1))*phi_window(2*PI*(index_row-N2/2)/(c*N2));
phi_xy[index]=ans;
}
void main {
…
dim3 dimGrid_phi_hat(M,1);
dim3 dimBlock_phi_hat(2*K+1,1)
phi_hat_window_gen<<<dimGrid_phi_hat, dimBlock_phi_hat>>>(phi_hat_x, pitch_phi_hat_x,x,mu_x_d,M);
…
cufftResult result = cufftPlan2d(&plan, cN1,cN2, CUFFT_C2C);
result=cufftExecC2C(plan, u_buffer, u_fft, CUFFT_FORWARD);
…
}
the software is correctly executed in emulation mode, but when actually executed on GPU it results in the following error:
cufft: ERROR: /root/cuda-stuff/sw/rel/gpgpu/toolkit/r2.1/cufft/src/execute.cu, line 1070
cufft: ERROR: CUFFT_EXEC_FAILED
cufft: ERROR: /root/cuda-stuff/sw/rel/gpgpu/toolkit/r2.1/cufft/src/execute.cu, line 316
cufft: ERROR: CUFFT_EXEC_FAILED
cufft: ERROR: /root/cuda-stuff/sw/rel/gpgpu/toolkit/r2.1/cufft/src/cufft.cu, line 151
cufft: ERROR: CUFFT_EXEC_FAILED
Segmentation fault
this error is due to an error in the call to phi_hat_window_generation. Infact, if I comment the line “//phi_hat_window_gen<<<dimGrid_phi_hat, dimBlock_phi_hat>>>(phi_hat_x, pitch_phi_hat_x,x,mu_x_d,M);” no error presents in the FFT. And also in another topic I’ve red that this kind of error in FFT could happen if there is an error in a previous CUDA function call.
The question is that where is the error? And why does it work in emulation mode?
I’m getting crazy, pls help me.
Thank you…