Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use AMD GPU for fastai/pytorch?

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?

like image 888
Mohanned ElSayed Avatar asked Jul 21 '20 05:07

Mohanned ElSayed


People also ask

Can you use AMD GPU with PyTorch?

Single-Node Server Requirements Before you can run an AMD machine learning framework container, your Docker environment must support AMD GPUs. Note: The AMD PyTorch framework container assumes that the server contains the required x86-64 CPU(s) and at least one of the listed AMD GPUs.

How do I know if PyTorch is using AMD GPU?

The easiest way to check if you have access to GPUs is to call torch. cuda. is_available(). If it returns True, it means the system has the Nvidia driver correctly installed.

Can I use AMD GPU for deep learning?

Why Are Amd Gpus Not Used For Deep Learning? It would be unreasonable to use an AMD Radeon graphics card if deep learning depended on the processing power. The reason for this is a lack of development for deep learning software and drivers on the Radeon GPU.


2 Answers

Update 2:

Microsoft has release Pytorch_DML a few hours ago.
You can now install it (in windows or WSL) using pypi package:
pytorch-directml 1.8.0a0.dev211021

pip install pytorch-directml

So if you are on windows or using WSL, you can hop in and give this a try!

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.

like image 81
Hossein Avatar answered Oct 19 '22 21:10

Hossein


Update: In March 2021, Pytorch added support for AMD GPUs, you can just install it and configure it like every other CUDA based GPU. Here is the link

Don't know about PyTorch but, Even though Keras is now integrated with TF, you can use Keras on an AMD GPU using a library PlaidML link! made by Intel. It's pretty cool and easy to set up plus it's pretty handy to switch the Keras backends for different projects

like image 22
Prhyme Avatar answered Oct 19 '22 20:10

Prhyme