cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCL

Highlighted
Adept II
Adept II

Transfer between CPU & GPU... optimization ?

Hi,

I have the following code :

int updateDataSet = MustUpdateDataSet(...);

if (updateDataSet)
    kernel->setArg(i++, *dataSet);

What I would like is to avoid to send each time the 'dataset' to the GPU because it has already been sent !

So, my question is... can I do this this ? or I MUST ALWAYS set the argument ?

But if I must always use 'setArgs' ... how can I avoid to re-transfer each time the huge (a same) set of datas ?

0 Kudos
Reply
4 Replies
Highlighted
Exemplar
Exemplar

Transfer between CPU & GPU... optimization ?

kernel remeber kernel arguments between invocations. so you need set args only once.

second even if you set arg you do not send that dataset to the card if they are on the card allready. buffers are sended at kernel launch.

0 Kudos
Reply
Highlighted
Adept II
Adept II

Transfer between CPU & GPU... optimization ?

Thanks,

Ok, but then... if I change the content of my buffer... how I FORCE the memory transfer ?

 

You say 'buffers are sended at kernel launch'... you mean 'at the first launch' because I call several time the same kernel.

0 Kudos
Reply
Highlighted
Exemplar
Exemplar

Transfer between CPU & GPU... optimization ?

if you enqueue write into buffer then it must send over buffer over PCIe. use events to get proper synchronization.

0 Kudos
Reply
Highlighted
Adept II
Adept II

Transfer between CPU & GPU... optimization ?

I don't understand :-P sorry...

If I modify something in a char buffer

charbuffer[52] = '*';

How can I force an update ?

Thanks

0 Kudos
Reply