How to use AMD GPU for fastai/pytorch?

Mohanned ElSayed picture Mohanned ElSayed · Jul 21, 2020 · Viewed 19.7k times · Source

I'm using a laptop which has Intel Corporation HD Graphics 5500 (rev 09), and AMD Radeon r5 m255 graphics card.

Does anyone know how to it set up for Deep Learning, specifically fastai/Pytorch?

Answer

Rika picture Rika · Jul 21, 2020

Update :

As of Pytorch 1.8 (March 04, 2021), AMD ROCm versions are made available from Pytorch's official website. You can now easily install them on Linux and Mac, the same way you used to install the CUDA/CPU versions.

Currently, the pip packages are being provided only. Also, the Mac and Windows platforms are still not supported (I haven't tested with WSL2 though!)

Old answer:

You need to install the ROCm version. The official AMD instructions on building Pytorch is here.

There was previously a wheel package for rocm, but it seems AMD doesn't distribute that anymore, and instead, you need to build PyTorch from the source as the guide which I linked to explains.

However, you may consult this page, to build the latest PyTorch version: The unofficial page of ROCm/PyTorch.