# Asking a gpu how busy it is?

**URL:** <https://forums.developer.nvidia.com/t/asking-a-gpu-how-busy-it-is/11851>\
**Category:** CUDA Programming and Performance\
**Created:** [August 28, 2009, 3:18pm UTC](https://forums.developer.nvidia.com/t/asking-a-gpu-how-busy-it-is/11851 "2009-08-28T15:18:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Letharion](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Letharion](https://forums.developer.nvidia.com/u/Letharion)\
**Post date:** [August 28, 2009, 3:18pm UTC](https://forums.developer.nvidia.com/t/asking-a-gpu-how-busy-it-is/11851/1 "2009-08-28T15:18:16Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![avidday](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/avidday/32/59219_2.png) [@avidday](https://forums.developer.nvidia.com/u/avidday)\
**Post date:** [August 28, 2009, 3:25pm UTC](https://forums.developer.nvidia.com/t/asking-a-gpu-how-busy-it-is/11851/2 "2009-08-28T15:25:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Letharion](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Letharion](https://forums.developer.nvidia.com/u/Letharion)\
**Post date:** [September 3, 2009, 1:48pm UTC](https://forums.developer.nvidia.com/t/asking-a-gpu-how-busy-it-is/11851/3 "2009-09-03T13:48:24Z")

</div>

> [@](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![YDD](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@YDD](https://forums.developer.nvidia.com/u/YDD)\
**Post date:** [September 3, 2009, 2:09pm UTC](https://forums.developer.nvidia.com/t/asking-a-gpu-how-busy-it-is/11851/4 "2009-09-03T14:09:07Z")

</div>

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.
