How to set which GPU as default ? GPU ID 0 only has 8x PCIE lanes, but ID 1/2 have 16x lanes

A computer I’m working on has 3 GPUs. In the bandwidth test, I found that when cudaSetDevice(0), the bandwidth is ~6.5GB / s. Meanwhile, on GPU 1/2, it’s ~13GB/s, which is the expected bandwidth for PCIE 3x16.

But GPU 0 is used as the default, so this setup would require me to add cudaSetDevice() or Python equivalent whenever I want to do something.

Is there any way to select which GPU to be used as GPU0 ?

Thanks

CUDA_VISIBLE_DEVICES="1,2,0" ./my_executable

You can also set it “more permanently” in your environment, using any of the methods available to set environment variables

1 Like

Thanks! It’s working now, but I’ll also try setting the default GPU in BIOS to see if it works