Can I do these kind of simultaneous things in gpu's..?

Hi All,
Can I have this kind of functionality in gpu’s…? The functionality is when gpu is executing the kernel, cpu changes the value and it is reflected in the gpu kernel and also when gpu writes a value in the kernel it is reflected in the cpu(while kernel is still executing). For example a kernel code and cpu code is given here

global void func(A) /kernel function/
{
while(A[0] == 4);/loop if value is 4…breaks when cpu changes the value to 3/

A[0] = 1;

while(A[0] == 1);/loop if value is 1…breaks when cpu changes the value to 5/
}

func(A);

A[0] = 3;

while(A[0] == 3); /loop if value is 3…break when gpu changes the value to 1/

A[0] = 5;

By asynchronous memory copy or host alloc or some things can I achieve this kind of functionality…?
Can you please tell me whether I can do this kind of thing in gpu or not. If yes can you please point me to the right sources.

Regards,
M. Kiran Kumar.

http://developer.download.nvidia.com/compute/cuda/4_0/toolkit/docs/CUDA_C_Programming_Guide.pdf

http://developer.download.nvidia.com/compute/cuda/4_0/toolkit/docs/CUDA_Toolkit_Reference_Manual.pdf

Thanks, RTFM boy! Superhero of manuals, you truly saved the day. Where’s RTFM girl today?

She’s at home, reading the FM (emphasis on the “F”. See http://xkcd.com/90/ for further details)

:)