A: 

Maybe a thread safety issue. Since you are using static memory, you should be locking the object, or using some other synchronization option unless you are absolutely sure that it is single threaded.

Mike
A: 

I am not sure even you can do a simple pInvoke on CUDA Functions as they are not running on the main processor. Best option to directly use native CUDA API might be to use C++/CLI. And nVidia just released a support package for that. Other simpler options include using OPENCL which has the .Net library available called OpenTK which provides Managed wrappers for most uses.

Bhuvan
CUDA is just an extension of C (with support for some C++ functionality), and can definitely be called from pInvoke. I only know this because it worked, haha! So at least it's a proof of concept. If I was using C++ or C and calling CUDA, you could still say that the code isn't running on the main processor. What's the difference between calling code from C# that runs C code that calls CUDA, and calling the C code directly that runs CUDA? I wouldn't know the technical answer, but I guess philosophically, I believe they're the same.
Paul