Asking a gpu how busy it is?

Two devs are working against a Linux server with two 260GTX cards.
Can the code ask the GPUs “Are you busy?”, so that neither devs needs care if the other is currently running something?

No. but you can use nvidia-smi to put the cards into “compute exclusive” mode, which will make the driver handle GPU allocation and prevent more than a single process acquiring context of any given GPU.

Thanks :)

Another solution I realised is that each dev can set an enviroment variable that the program reads. That’s much better than the current hardcoded setDevice(x) that always needs changing.

But how do you make sure that each developer sets the environment variable differently? The compute-exlusive solution is much simpler. It lets you delete the ‘cudaSetDevice’ call entirely.