Results 1 to 2 of 2

Thread: Memory Access

  1. #1
    lcnepo
    Guest

    Memory Access

    Following kernel:
    Code :
    __kernel void Euler
    (__global float * field1,
     const int iteration)
    { ... }

    I call it in a Loop and every time a different kernel Argument is set...
    Code :
    for(int i = 0; i < 1000; i++) {
       clSetKernelArg(1, i); // set argument iteration to current iteration
       clEnqueueNDRange();
       clFinish();
    }

    Can somebody explain, why it is faster to set an integer Argument (constant) than set
    a memory object (global)? I think it has to do with the architecture of the graphic card
    and the different memorys (global, const) or the communication bus from host to device (PCIe, DMA).

    Thanks

  2. #2
    Member
    Join Date
    Oct 2010
    Location
    Vancouver, Canada
    Posts
    65

    Re: Memory Access

    Memory objects need to be processed because the object handle on the host side has to be translated into a device pointer on the kernel side. Furthermore, the memory object's contents may need to be transferred across the PCIe bus (and possibly back).

    A value argument (like an int) is just copied into a buffer and sent as a collection of bytes to the device.

Similar Threads

  1. Memory access pattern
    By nachovall in forum OpenCL
    Replies: 2
    Last Post: 10-13-2011, 04:20 PM

Posting Permissions

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