CUDA capable device ordering

In a Linux box (CentOS 6.3 x86_64) I have two Tesla K20Cs and a single GeForce 8400.
Running CUDA 5.0 with nvidia driver 304.54.

The deviceQuery utility found in the 1_Utilities Samples folder lists the three devices in the following order:

CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 3 CUDA Capable device(s)

Device 0: “Tesla K20c”
Device 1: “GeForce 8400”
Device 2: “Tesla K20c”

Is there a way that I can get the Tesla to be enumerated one after the other, without having the GeForce break the numbering sequence?

For example I would like device 0 and 1 to be the Teslas and device 2 to be the GeForce.


I found the answer by searching the forum, set the environment variable CUDA_VISIBLE_DEVICES=“0,2”, and after that the results are:

Device 0: “Tesla K20c”
Device 1: "Tesla K20c

Nice work. The other (perhaps obvious and maybe not desirable or achievable solution depending on case space) is to actually switch the motherboard slots the GPU’s are in.