__constant__ and multiple GPUs

I currently have only one GPU available but would like to prepare my code to scale on multiple GPUs.

I make heavy use of constant memory.

I’m curious about how multiple GPUs controlled by multiple threads (each GPU controlled by one thread) and constant declarations work together.
There is no real allocation and the programming guide states “device and constant variables are only allowed at file scope.”

Would cudaGetSymbolAddress() simply return a different address for the same variable in different CUDA contexts?
But it’s still only one pointer how could it have different values.

I’m really confused here. Would be great if someone could enlighten me.
Thanks in advance,

Sebastian

I expect GetSymbolAddress will give you the correct address for that CPU context (thread). Have you tried it? Please post here if it doesn’t work.

Paulius

Hi,

I do this in the multi-GPU Coulomb potential code in VMD, have a look at copyatomstoconstbuf() at line 201 of this source file:

http://www.ks.uiuc.edu/Research/vmd/doxyge…8cu-source.html

Cheers,

John Stone

Thanks for the information paulius and tachyon_john. As soon as I have a system with 2 GPUs available I will test the code and let you know what I found out.
However from what I understand in your code tachyon_john it should work as I thought it would.

So I was finally able to put together a system with 2 GPUs. 2 8800 Ultras to be precise. Worked like a charm, speedup is good too!

The pointers to constant memory indeed seem to be different when being used in different CUDA contexts.

Glad you found the examples etc helpful.

Cheers,
John