cuda 4.0, __constant__ and multipe GPUs with multiple host threads How to use conststants and textur

I am developing on a linux box with two GPU cards. I initially used two host threads (using pthread) to manage the two cards respectively when I started with cuda 3.2, which worked fine. I have some constant and texture variables defined in the cu file.

Now I am going to move to cuda 4.0 and haved read that cuda 4.0 has changed the way how host threads use multiple GPUs. It looks like that constants and textures still have to be declared statically in the file scope in cuda 4.0. What’s the right way to make use of them and multiple GPUs by using multiple host threads? Any suggestions and examples will be appreciated.

One cuda context per thread.

Enter context (push) on thread start, leave context on thread end (pop).

Once the thread is inside the cuda context it should be able to call driver api functions just fine and acquire pointer to constant symbols, then it should be possible to do a memcpy to the pointer, this last part has not yet been tried by me, by the first parts should be fine External Image