# Out of tree OpenCL backend now easy to install

**URL:** <https://discuss.pytorch.org/t/out-of-tree-opencl-backend-now-easy-to-install/164521>\
**Category:** projects\
**Created:** [October 27, 2022, 8:00am UTC](https://discuss.pytorch.org/t/out-of-tree-opencl-backend-now-easy-to-install/164521 "2022-10-27T08:00:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![artyom-beilis](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/artyom-beilis/32/40634_2.png) [@artyom-beilis](https://discuss.pytorch.org/u/artyom-beilis)\
**Post date:** [October 27, 2022, 8:00am UTC](https://discuss.pytorch.org/t/out-of-tree-opencl-backend-now-easy-to-install/164521/1 "2022-10-27T08:00:20Z")

</div>

I started working on [OpenCL out of tree backend](https://github.com/artyom-beilis/pytorch_dlprim/tree/true_out_of_tree_support) for pytoch about 1/2 a year ago. As a backbone I used [dlprimitives](https://github.com/artyom-beilis/dlprimitives) for computations - many efficient deep learning operations, including efficient GEMM, efficient convolution algorithms using integrated gemm with image access, winograd convolution for 3x3 and depthwise separable convolution.

It gives good performance: around 60% of CUDA/CUDNN performance for resnet18 for training and around 80% for inference. It tested on various nVidia, AMD and Intel embedded GPUs.

Now recently many improvements for out-of-tree backend support were added to pytorch nightly and now I don’t need to use custom pytorch version and just use pytorch that is installed using pip.

Using nightly pytorch build the [installation procedure is very simple](https://github.com/artyom-beilis/pytorch_dlprim/blob/true_out_of_tree_support/README.md#build) you only need OpenCL API installed and optional (but recommended) SQLite library development files installed - for kernel caching.

Of course the project is still in early stages and there are likely many operators not implemented yet and probably some bugs running around `:-)`

---

<div class="post-metadata">

**Author:** ![artyom-beilis](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/artyom-beilis/32/40634_2.png) [@artyom-beilis](https://discuss.pytorch.org/u/artyom-beilis)\
**Post date:** [October 27, 2022, 6:09pm UTC](https://discuss.pytorch.org/t/out-of-tree-opencl-backend-now-easy-to-install/164521/2 "2022-10-27T18:09:38Z")

</div>

I also checked against torch 1.13 and it is compatible as well but instead of using device name like `ocl` you need to use `privateuseone` and it works.

In nightly version you can call

```
torch.utils.rename_privateuse1_backend('ocl')

```

And use ‘ocl:0’ as more readable device name
