Results 1 to 3 of 3

Thread: Is it possible to batch a 2d portion of a grid?

  1. #1

    Is it possible to batch a 2d portion of a grid?

    I am trying to overlay a grid (grid1) onto another grid (grid2) in parallel, and edit grid2 based on the values in grid1. Here is my kernel in pseudo

    Code :
    _kernel void simple(
    	global const float* grid2,
    	global float* output,
    	constant float* grid1)
    {
    	int index = get_local_id(0);
     
    	for(int i = 0; i < grid1.width; i++)
    	{
    		for(int j = 0; j < grid1.height; j++)
    		{
    			value += grid1[i][j] * grid2[index.x+i, index.y+j];
    		}
    	}
     
    	output[index] = value;
    }

    The algorithm I have works, but is it possible to increase the performance of this by batching the portion of grid2 that I am using into private memory? If so, how would I batch it without writing a for loop that makes the same amount of calls to global memory?

    Thanks,
    Gaming

  2. #2

    Re: Is it possible to batch a 2d portion of a grid?

    Or maybe my problem is here. This is the call that I am executing in c++.

    Code :
    clEnqueueNDRangeKernel(queue, kernel, 1, NULL, &sizeIn, NULL, 0, NULL, NULL);
    My problem is that I have a Quadro 135M GPU, and an integrated dual-core CPU, but the GPU takes twice as long so compute the function than the CPU, and if I am right this shouldnt be possible because the GPU has 8 cores.

  3. #3
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: Is it possible to batch a 2d portion of a grid?

    and if I am right this shouldnt be possible because the GPU has 8 cores
    In spite of what the marketers try to sell us, performance cannot be measured in "cores".

    If you are computing a convolution as it seems like you are doing, you can benefit from using local memory. See the examples in AMD's or NVidia's SDK for details on how to do it.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

Similar Threads

  1. Converting CUDA grid to OpenCL
    By jml in forum OpenCL
    Replies: 1
    Last Post: 04-19-2010, 01:22 PM
  2. glDrawTex - each call = 1 new batch?
    By raicuandi in forum OpenGL ES general technical discussions
    Replies: 2
    Last Post: 01-14-2008, 05:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •