# Question of using DeviceGuard regarding the exclusive use of a device

**URL:** <https://dev-discuss.pytorch.org/t/question-of-using-deviceguard-regarding-the-exclusive-use-of-a-device/2701>\
**Category:** hardware-backends\
**Created:** [December 20, 2024, 6:03am UTC](https://dev-discuss.pytorch.org/t/question-of-using-deviceguard-regarding-the-exclusive-use-of-a-device/2701 "2024-12-20T06:03:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![minwook.ahn](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/minwook.ahn/32/2469_2.png) [@minwook.ahn](https://dev-discuss.pytorch.org/u/minwook.ahn)\
**Post date:** [December 20, 2024, 6:03am UTC](https://dev-discuss.pytorch.org/t/question-of-using-deviceguard-regarding-the-exclusive-use-of-a-device/2701/1 "2024-12-20T06:03:03Z")

</div>

Dear folks

We am trying to make a custom device support in PyTorch.

One question is regarding DeviceGuard.  
We found that DeviceGuard is a useful tool to make it sure that  
what the current device is currently used. Also it gives an intuitive  
way of returning to the original device before DeviceGuard is set.

However, we cannot find any mechanism to ensure that the use  
of DeviceGuard guarantees the exclusive use of a device inside  
PyTorch like using mutex while the selected device is being used.

So it would be great if you share your opinion of DeviceGuard and  
its design regarding exclusiveness.

Cheers
