Results 1 to 2 of 2

Thread: Unittesting Image Read an write

  1. #1
    Senior Member
    Join Date
    Oct 2012

    Unittesting Image Read an write

    Hi there,

    i'm not really shure if my assumption is correct so maybe some can clearify it.
    I'm Writing unittests for an OpenCL Abstraction layer including alle the basics. I Wont to test if reading and writing vor images and buffers works fine. For that i do the following (in pseudocode)
    Code :
    float fData[8];
    fData[0] = 1.f;
    fData[7] = 1.f;
    createBuffer();//Create the buffer in correct size
    writeData(fData);//Write the Data to OpenCL
    memset(fData,0,8*4);//Clear the host mem
    readData(fData);//Read back the data from OpenCL

    I'm asking myself if the Data will be transported to CL without any usage of that buffer. If I remember correctly, the data doesn't have to be pushed to the openCl device until its used. So will that code really test the memory transfer? Or does it only copies the values in host memory address space?


  2. #2
    Senior Member
    Join Date
    Dec 2011

    Re: Unittesting Image Read an write

    Hard to tell from pseudocode!

    In particular, is writeData using a blocking write? If so, you should be good. If not, you will likely be clearing the buffer in the next line before the transfer happens.

    readData also needs to be blocking.

    For a unit test, I'd recommend using a different buffer for the readback, so when you compare values you'll be sure that they really came from the GPU and not "left over" in memory.

Similar Threads

  1. OpenCL Image Read/Write problem
    By Xor in forum OpenCL
    Replies: 2
    Last Post: 03-27-2012, 11:51 PM
  2. Replies: 1
    Last Post: 09-30-2011, 05:46 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
Proudly hosted by Digital Ocean