Selecting GPU from cuda but how to exectute normal program through the selected GPU?:(

Hi everyone.
I am wondering how to execute program through the specific GPU. I am selecting the GPU using
Selecting GPU from cuda but how to exectute normal program through the selected GPU??

Suppose there are 3 GPUs,
how to know which one i s free??
I am confused whether cudaGetDeviceCount() will gives the count of only free GPUs or all the available GPUS??
If it gives the condition of all the GPUs then how can we know which one is free?

Hope to get idea from you guys…
have good time!!