[petsc-users] question about petsc and gpus

Alexander Grayver agrayver at gfz-potsdam.de
Wed May 4 05:23:47 CDT 2011

Hello Randall,

As far as I know, if you don't set particular device the device with 
index 0 in cuda device array will be used (at least tried to be).
Otherwise, you can use cudaSetDevice or cudaChooseDevice


On 03.05.2011 19:06, Randall Mackie wrote:
> I have access to a computer with a GPU, and I wanted to play around a 
> bit with petsc on this gpu.
> So I have compiled petsc-dev with cusp, thrust, and cuda to give GPU 
> support, and I am ready
> to run some examples.
> However, something is not clear to me: how does petsc know which gpu 
> to run something on?
> For example, this machine has two gpus: one for the display, and then 
> one compute gpu.
> So I see /dev/nvidia0 and /dev/nvidia1. If I just issue the command 
> from the petsc web page,
> will it run it on the right gpu?
> Also, what if a computer has two compute gpus? Does petsc use both of 
> them or only one?
> Thanks in advance,
> Randy

More information about the petsc-users mailing list