4
votes

How do I use Thrust with multiple GPUs? Is it simply a matter of using cudaSetDevice(deviceId) and then running the relevant Thrust code?

1
Im having some trouble compiling my project at the moment and wanted to see if someone knows if that is the correct way to do it before I spend hours trying something that wont work. Have you tried it? - twerdster

1 Answers

6
votes

With CUDA 4.0 or later, cudaSetDevice(deviceId) followed by your thrust code should work.

Just keep in mind that you will need to create and operate on separate vectors on each device (unless you have devices that support peer-to-peer memory access and PCI-express bandwidth is sufficient for your task).