Hi everybody, i am new to CUDA and i am working on fire forest diffusion simulation. I need to define a struct as follows
struct image
{
int width; //to hold the number of rows of the grid
int height; //to hold the number of columns of the grid
int *gridCellState;
};
image *img,*img_d;
I allocated memory for both variables as follows
img = (image *)malloc(size_image);
cudaMalloc((void**)(img->gridCellState),size);
cudaMalloc(&img_d,size_image);
I dont know whether this allocation is correct or no and the next problem is how to initialize img->gridCellState and how to move it to the device and then back again from device to host.
I would like to thanks you for your help previously.