process many images the same time?

Hello , I have a code which creates one image and process it.

My problem is that I want to create at the same time many images (of the same dimension) but I can’t find a way to implement the number of the images in my code.

Right now the code is:

int bx = blockIdx.x , by = blockIdx.y;
int tx = threadIdx.x , ty = threadIdx.y;

int RowIdx = ty + by * TILE_WIDTH;
int ColIdx = tx + bx * TILE_WIDTH;

if ( RowIdx >= Rows || ColIdx >= Cols ) return;

ScanIdx = RowIdx * Cols + ColIdx;


dim3 dimGrid(  Cols / TILE_WIDTH  , Rows / TILE_WIDTH );
dim3 dimBlock( TILE_WIDTH , TILE_WIDTH );

I am creating the data in a c file and filling a matrix.
Now,for creating many images I added an extra loop ,let’s say with NumberImag.

Then , in cu file I am accessing the data as:

*(myinput + ScanIdx)

If I have 1 image everything is ok.But with 2 images for example?
I can’t find a way to read the data.The matrix contains now twice data.
I don’t want to use a 3rd dimension since I want to create many images.

So , I can’t add to cu code the NumberImag.

Could You give Your full kernel code?


Unfortunately it is very big and I can’t ‘publish’ it,sorry.

A simple example that does a trivial operation on images would work if you don’t want to publish the entire source.