Question on async/wait


I think I understand, how async-wait-pairs may synchronize GPU and CPU.

I’d like to have a better understanding how different async-tasks on GPU interfere:

!$acc kernel async(1)
   ... long computational task ...
!$acc end kernel 

  ... CPU-computation with somedata
!$acc update device (somedata)
  ... CPU-computation with somedata

!$acc wait(1)

What des happens here?
*“update device” and the CPU-computation executes asynchron with the firtst acc-kernel.

  • The GPU is busy. Therefore “update device” has to wait for the kernel to finish


Hi Benedikt,

The kernel execution will run asynchronously from the CPU/device update. The GPU can service multiple streams, and given the kernel and update will be on different streams, the update can proceed while the kernel executes.

Hope this helps,

Hope this helps,
As always … :-)