1 Reply Latest reply on Jun 23, 2011 5:14 PM by nou

    refferring/adressing global memory on the GPU from Host.

      global memory object


      Hi folks,

      I have a question about refferring/adressing global memory on the device side from Host. Assume I have an single input cl_mem object __global *cldata_in and I have several different kernels(i.e. k1,k2,k3...) need to access to different part of cldata_in memory (e.x. k1 need to access cldata_in[0..100], k2 need to access cldata_in[60..300]...). So is there anyway to refer to pointers to &cldata_in[0], &cldata_in[60]... from the host? Because I want to do something like this:


      clSetKernelArg( k1, arg_id1, sizeof(cl_mem), (void *)clmem_pt1);
      clSetKernelArg( k2, arg_id2, sizeof(cl_mem), (void *)&clmem_pt2);
      where clmem_pt1 and clmem_pt2 should "point" to &cldata_in[0], &cldata_in[60] respectively.
      If I cannot referr to different memory location on GPU from host so it likely I have to create separate buffers for each kernel which isn't quite efficient.
      Many thanks