transactions between the CPU & GPU through PCIe. How to know whether the CPU or the GPU initiate

Hi,

I wrote a simple hello world program which will allocate some memory on the gpu, pass two parameters (say src and dest) to the kernel, copy src string i.e. Hello world to dest string and get the dest string from gpu to the host.

Well, in transferring the data back and forth between the CPU and CPU, there can be four possibilities

  1. CPU to GPU
    a) CPU writes to GPU
    b) GPU reads form CPU

  2. GPU to CPU
    a) GPU writes to the CPU
    b) CPU reads from GPU

After looking through few links which just had some bits and pieces of information, I got to know that the GPU can initiate the transactions as well. so I guess all these four transactions should be possible.

So how should I be able to know which of them actually initiated the transaction?
Can someone please explain me this… Are there any routines which can give me the info about who initiated the transaction? Also if there are routines using which I can force either the GPU or the CPU to initiate the transaction.

Thanks.