Hi,I’m a newbie in cuda programming and I want to allocate and process a structure of array; in the structure there are two 2D array representing an image in its real and imaginary part. I’ve tried this but it doesn’t work (segmentation fault :ph34r: ):
size_t size1, size2;
int BLOCK_SIZE;
int GRID_SIZE;
BLOCK_SIZE=512;
GRID_SIZE=8;
fcomplex *rcDev;
fftw_complex *tfftwDev;
size1 = nvp*nazft* sizeof(fcomplex);
size2 = nazft* sizeof(fftw_complex);
cudaMalloc((void**)&rcDev,size1);
cudaMalloc((void**)&tfftwDev,size2);
cudaMemcpy(rcDev, rc, size1, cudaMemcpyHostToDevice);
cudaMemcpy( tfftwDev, tfftw, size2, cudaMemcpyHostToDevice );
kernelForwardAzFFT_2 <<< dimGrid, dimBlock >>>( rcDev, tfftwDev , i, nazft);
cudaMemcpy(rc,rcDev,size1,cudaMemcpyDeviceToHost);
cudaFree(rcDev);
cudaFree(tfftwDev);
where “i” nvp and nazft are fixed, the kernel i used is:
global void kernelForwardAzFFT_2(fcomplex* rcDev, fftw_complex* tfftwDev, int i, int nazft)
{
int j=blockIdx.x * blockDim.x+threadIdx.x;
rcDev[i*nazft+j].re = tfftwDev[j].re;
rcDev[i*nazft+j].im = tfftwDev[j].im;
}
I think it may be a trivial question, please help me.