cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

shingoxlf
Journeyman III

how to create and init gpu memory buff to be all 0s

Hi all, to create a GPU buffer and init it to be all 0s, what I am doing right now is:

clCreateBuffer

then

clEnqueueWriteBuffer()

copy an array of 0s to the buff


I am wondering if there is anyway to create a GPU buffer and init it to be all 0s without calling clEnqueueWriteBuffer() ?


Thanks!

0 Likes
1 Solution
himanshu_gautam
Grandmaster

Check clEnqueueFillBuffer() API. It can fill up patterns within an OpenCL buffer object.

I think this API is available from OpenCL 1.1 and above.

If you are using OpenCL 1.0, you may not have this function.

Good luck!

View solution in original post

0 Likes
1 Reply
himanshu_gautam
Grandmaster

Check clEnqueueFillBuffer() API. It can fill up patterns within an OpenCL buffer object.

I think this API is available from OpenCL 1.1 and above.

If you are using OpenCL 1.0, you may not have this function.

Good luck!

0 Likes