# Private use opencl device

**URL:** <https://dev-discuss.pytorch.org/t/private-use-opencl-device/731>\
**Category:** hardware-backends\
**Created:** [August 18, 2022, 7:31pm UTC](https://dev-discuss.pytorch.org/t/private-use-opencl-device/731 "2022-08-18T19:31:24Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![artyom-beilis](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/artyom-beilis/32/207_2.png) [@artyom-beilis](https://dev-discuss.pytorch.org/u/artyom-beilis)\
**Post date:** [August 18, 2022, 7:31pm UTC](https://dev-discuss.pytorch.org/t/private-use-opencl-device/731/1 "2022-08-18T19:31:24Z")

</div>

Following this discussion [https://github.com/pytorch/pytorch/issues/488#issuecomment-1209498491](https://github.com/pytorch/pytorch/issues/488#issuecomment-1209498491)

I have two questions:

1. Does private use device is implemented in latest version or in nightly only

2. regarding:

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![albanD](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/alband/32/9_2.png) [@albanD](https://dev-discuss.pytorch.org/u/albanD)\
**Post date:** [August 18, 2022, 11:17pm UTC](https://dev-discuss.pytorch.org/t/private-use-opencl-device/731/2 "2022-08-18T23:17:52Z")

</div>

Hey!

Here is the full example I was talking about there: [GitHub - bdhirsh/pytorch\_open\_registration\_example: Example of using pytorch's open device registration API](https://github.com/bdhirsh/pytorch_open_registration_example)

This should clarify 2) and your other questions in that issue.

For 1) I think that everything is already there in 1.12.1 yes.  
cc @bdhirsh was there any super recent bug fix that is required?

---

<div class="post-metadata">

**Author:** ![bdhirsh](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/bdhirsh/32/575_2.png) [@bdhirsh](https://dev-discuss.pytorch.org/u/bdhirsh)\
**Post date:** [August 19, 2022, 2:53am UTC](https://dev-discuss.pytorch.org/t/private-use-opencl-device/731/3 "2022-08-19T02:53:52Z")

</div>

Nope, I think everything you need should be in the 1.12.1 branch.

---

<div class="post-metadata">

**Author:** ![artyom-beilis](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/artyom-beilis/32/207_2.png) [@artyom-beilis](https://dev-discuss.pytorch.org/u/artyom-beilis)\
**Post date:** [October 26, 2022, 3:35am UTC](https://dev-discuss.pytorch.org/t/private-use-opencl-device/731/4 "2022-10-26T03:35:12Z")

</div>

Hi I saw this line in the example - something relatively new:

`torch.register_privateuse1_backend('foo')`

Can you please elaborate what it does?

Edit: now I see it is `torch.utils.rename_privateuse1_backend` and looks it does what I thought it does allows to use custom device name 🙂 neat!

Looks like it is what I was looking for. When is it going to stable/released?

---

<div class="post-metadata">

**Author:** ![albanD](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/alband/32/9_2.png) [@albanD](https://dev-discuss.pytorch.org/u/albanD)\
**Post date:** [November 11, 2022, 7:46pm UTC](https://dev-discuss.pytorch.org/t/private-use-opencl-device/731/5 "2022-11-11T19:46:25Z")

</div>

I’m afraid it will only be on the next release and didn’t make it to 1.13 😕

---

<div class="post-metadata">

**Author:** ![artyom-beilis](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/artyom-beilis/32/207_2.png) [@artyom-beilis](https://dev-discuss.pytorch.org/u/artyom-beilis)\
**Post date:** [November 11, 2022, 9:23pm UTC](https://dev-discuss.pytorch.org/t/private-use-opencl-device/731/6 "2022-11-11T21:23:31Z")

</div>

It is very nice to have feature, but does not limit the functionality, I currently work well without it. Just rename ocl-\>privateuseone at parameters level `:-)`

---

<div class="post-metadata">

**Author:** ![albanD](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/alband/32/9_2.png) [@albanD](https://dev-discuss.pytorch.org/u/albanD)\
**Post date:** [November 11, 2022, 9:36pm UTC](https://dev-discuss.pytorch.org/t/private-use-opencl-device/731/7 "2022-11-11T21:36:43Z")

</div>

Awesome!  
Feel free to add something like

```python
if hasattr(torch.utils, "rename_privateuse1_backend"):
  torch.utils.rename_privateuse1_backend("ocl")

```

so that recent users have it but you can shit it for any version of PT.

---

<div class="post-metadata">

**Author:** ![artyom-beilis](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/artyom-beilis/32/207_2.png) [@artyom-beilis](https://dev-discuss.pytorch.org/u/artyom-beilis)\
**Post date:** [November 11, 2022, 9:38pm UTC](https://dev-discuss.pytorch.org/t/private-use-opencl-device/731/8 "2022-11-11T21:38:36Z")

</div>

Yep, I do something similar, also hasattr is better:

> <https://github.com/artyom-beilis/pytorch_dlprim/blob/master/mnist.py#L122>
