Reputation: 2471
I'm coping data in python using OpenCL onto my graphic card. There I've a kernel processing the data with n threads. After this step I copy the result back to python and in a new kernel. (The data is very big 900MB and the result is 100MB) With the result I need to calculate triangles which are about 200MB. All data exceed the memory on my graphic card.
I do not need the the first 900MB anymore after the first kernel finished it's work.
My question is, how can I delete the first dataset (stored in one array) from the graphic card?
Here some code:
#Write
self.gridBuf = cl.Buffer(self.context, cl.mem_flags.READ_ONLY | cl.mem_flags.COPY_HOST_PTR, hostbuf=self.grid)
#DO PART 1
...
#Read result
cl.enqueue_read_buffer(self.queue, self.indexBuf,index).wait()
Upvotes: 0
Views: 673
Reputation: 10896
You will need to call clReleaseMemObject with the mem object you created with the call to clCreateBuffer. If the reference count becomes zero with this call, the underlying device/shared memory is released by the implementation.
Upvotes: 1