Results 1 to 3 of 3

Thread: Using CL_MEM_USE_HOST_PTR with clEnqueueReadBuffer

  1. #1

    Using CL_MEM_USE_HOST_PTR with clEnqueueReadBuffer

    Suppose I first create a buffer using CL_MEM_USE_HOST_PTR:

    mybuffer = clCreateBuffer(context, CL_MEM_READ_WRITE| CL_MEM_USE_HOST_PTR, sizeof(float)*n,myvec,&err);

    where myvec is a float array of length n.

    Next, some operations are performed in a kernel involving writing on array y.

    Next, read the results using:

    clEnqueueReadBuffer(queue, mybuffer, CL_TRUE, 0, sizeof(float)*n, myvec, 0, NULL, NULL);

    Is this defined? Is this valid?

  2. #2
    Senior Member
    Join Date
    Oct 2012

    Re: Using CL_MEM_USE_HOST_PTR with clEnqueueReadBuffer

    Yes, this is valid under the following requirements, as explained in the OpenCL specification document:

    • All commands that use this buffer object have finished execution before the read command begins execution.[/*:m:v56mx2ur]
    • The buffer object is not mapped.[/*:m:v56mx2ur]
    • The buffer object is not used by any command-queue until the read command has finished execution.[/*:m:v56mx2ur]

  3. #3

    Re: Using CL_MEM_USE_HOST_PTR with clEnqueueReadBuffer

    All right, thank you for the reply.

Similar Threads

  1. Clarify CL_MEM_USE_HOST_PTR
    By toastedcrumpets in forum OpenCL
    Replies: 5
    Last Post: 06-09-2011, 02:38 PM
  2. Replies: 2
    Last Post: 11-24-2009, 07:52 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