How to make Cuda work with a second GPU (Ubuntu 16.04) ?


I have two GPUs set up in my motherboard, a NVS 315 and a newly installed Quadro P400. I keep using the NVS 315 for the display, but I would like to setup Cuda so that it leverages the P400 GPU.
I installed the drivers before integrating this new GPU, so they adequately fit the NVS 315.

When I execute nvidia-smi on the command line, I get the following output.

What should I do to make Deep Learning libraries (like Caffe2 for instance) work while leveraging Cuda and the capabilities of the newly installed GPU ?

Thanks for your help and advices !

You can specify which GPU to use in Caffe by supplying a GPU id:

You can do a quick term search for GPU ID on this page and see an example,

Similarly with any CUDA code: