Hi,
You can call directly the cudaDeviceSynchronize() method as is done by the python code here.
cudaDeviceSynchronize()