Memory buffer retaining or re-creating

Discussion created by Raistmer on Jan 21, 2010
Latest reply on Feb 12, 2010 by nou
what effective?

My app use some buffer on GPU ~4MB size
its size always the same but time to time new data from host memory should be uploaded then it will used few times in kernels before next update from host memory.
The question is:
what course of action is better:

1)delete and recreate buffer each time when update from host needed via clCreateBuffer(context, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR,..


2)allocate buffer for lifetime of app and do updates via mapping it to host adress space when needed


And additional question about case 2.
Can I update GPU buffer in this case directly, that is, write results of CPU computations in buffer one by one or still will need to write results in some addiional host memory based buffer and only after completion of host buffer update upload it completely to GPU buffer? What way of actions would give better performance?