PyTorch not detecting AMD GPU although ROCM installed on Ubuntu 20.04 LST

3.2k views Asked by At
  • OS Version: Ubuntu 20.04 LTS
  • PyTorch Version: 2.0
  • ROCm version: 5.0.2

I installed a fresh copy of Ubuntu 20.04 LTS on my desktop with AMD Radeon RX 5700 XT GPU. Both ROCM and PyTorch installed fine. However, PyTorch is not able to detect GPU. Any pointers here?

$ python -c "import torch; print(torch.__version__)"
2.0.0+cu117
$ apt show rocm-libs -a

Package: rocm-libs

Version: 5.0.2.50002-72

Priority: optional

Section: devel

Maintainer: ROCm Libs Support <[email protected]>

Installed-Size: 13.3 kB

Depends: hipblas, hipfft, hipsolver, hipsparse, miopen-hip, rccl, rocalution, rocblas, rocfft, rocrand, rocsolver, rocsparse, rocm-core, hipblas-dev, hipcub-dev, hipfft-dev, hipsolver-dev, hipsparse-dev, miopen-hip-dev, rccl-dev, rocalution-dev, rocblas-dev, rocfft-dev, rocprim-dev, rocrand-dev, rocsolver-dev, rocsparse-dev, rocthrust-dev

Homepage: https://github.com/RadeonOpenCompute/ROCm

Download-Size: 898 B

APT-Sources: https://repo.radeon.com/rocm/apt/5.0.2 ubuntu/main amd64 Packages

Description: Radeon Open Compute (ROCm) Runtime software stack
$ rocminfo | grep 'Name:'
  Name:                    Intel(R) Core(TM) i3-10100 CPU @ 3.60GHz
  Marketing Name:          Intel(R) Core(TM) i3-10100 CPU @ 3.60GHz
  Vendor Name:             CPU                                
  Name:                    gfx1010                            
  Marketing Name:          AMD Radeon RX 5700 XT              
  Vendor Name:             AMD                                
      Name:                    amdgcn-amd-amdhsa--gfx1010:xnack-
$ python3

Python 3.9.16 (main, Mar 8 2023, 14:00:05)

[GCC 11.2.0] :: Anaconda, Inc. on linux

Type "help", "copyright", "credits" or "license" for more information.

>>> import torch

>>> print("GPU available:", torch.cuda.is_available())

GPU available: False

I have also tried Ubuntu 22.04 LTS. But it does not work either.

1

There are 1 answers

0
Andrey Azazello Yaromenok On

2.0.0+cu117

cu117 means than you install version for NVidia CUDA 11.7 while you need a build for ROCm

Pytorch since version 1.8 available for ROCm from official site (but you need to pay attention to version of ROCm (current is 5.4.2) and version of you GPU(gfx1010)) https://pytorch.org/blog/pytorch-for-amd-rocm-platform-now-available-as-python-package/

AMD doc page for ROCm 5.x can be also helpful if you decide other options like build from sources https://docs.amd.com/bundle/ROCm-Deep-Learning-Guide-v5.0/page/Deep_Learning_Frameworks.html