go-opencl icon indicating copy to clipboard operation
go-opencl copied to clipboard

Is there a way to read from a portion of a buffer?

Open Nv7-GitHub opened this issue 5 years ago • 1 comments

I wrote a buffer using queue.EnqueueWriteBufferFloat32. Is there a way for me to read/write to an index of the buffer without copying the whole buffer into and out of RAM? Thank you!

Nv7-GitHub avatar Nov 30 '20 17:11 Nv7-GitHub

I tried using something like this

buffMap, _, err := queue.EnqueueMapBuffer(out, true, cl.MapFlagRead, 177*8, 8, nil)
handle(err)

fmt.Println(buffMap.ByteSlice())

_, err = queue.EnqueueUnmapMemObject(out, buffMap, nil)
handle(err)

The 177th Element was 0.42806938, and this returned [131 255 48 62 91 253 26 60]. Is there a correlation in between these? Is there a way to convert between them?

Nv7-GitHub avatar Nov 30 '20 17:11 Nv7-GitHub