View Single Post
Old 2022-02-26, 21:32   #1
masser
 
masser's Avatar
 
Jul 2003
Behind BB

192710 Posts
Default Make me smart: Mfakto; Ubuntu; AMD RX470

I bought a used AMD RX 470 on ebay and struggled to get it working with mfakto.

I will record here what ultimately worked, but I suspect the collective wisdom of the forum will be able to help me improve these steps.

1. Create a USB stick Ubuntu installer by following Ernst' instructions here. In order to make progress with subsequent software (both mfakto and gpuowl attempted) installs, I chose the Ubuntu 20.04.4 LTS (Focal Fossa) Server Install image. With the desktop Ubuntu image, some issue with AMD Polaris GPUs and ubuntu made it difficult to get working screen output.

2. Continue following Ernst' instructions to install some of the basic software development tools, plus rocm-dev.
Quote:
1 sudo passwd root
2 sudo apt update
3 sudo apt install -y build-essential clinfo git libgmp-dev libncurses5 libnuma-dev python ssh openssh-server
11 echo 'deb [arch=amd64] https://repo.radeon.com/rocm/apt/debian/ xenial main' | sudo tee /etc/apt/sources.list.d/rocm.list
12 sudo apt update && sudo apt install rocm-dev
3. Long story short, AMD only "partially supports" Polaris GPUs now (470/480/570/580/590), so things get hairy at this point. I found the following post, describing how to get OpenCL working in Ubuntu 20.04 with an RX570 and followed the instructions.

3a. Install ROCm 4.5.2
Quote:
17 sudo apt list --installed | grep wget gnupg2
18 sudo apt-get update
19 sudo apt-get install wget gnupg2
20 sudo usermod -a -G video $LOGNAME
21 sudo usermod -a -G render $LOGNAME
24 wget -q -O - https://repo.radeon.com/rocm/rocm.gpg.key | sudo apt-key add -
25 echo 'deb [arch=amd64] https://repo.radeon.com/amdgpu/21.40.2/ubuntu focal main' | sudo tee /etc/apt/sources.list.d/amdgpu.list
26 sudo apt-get update
27 sudo apt install amdgpu-dkms
28 sudo reboot
29 echo 'deb [arch=amd64] https://repo.radeon.com/rocm/apt/4.5.2/ ubuntu main' | sudo tee /etc/apt/sources.list.d/rocm.list
30 sudo apt-get update
32 sudo apt install rocm-hip-sdk rocm-opencl-sdk
The opencl-sdk seemed necessary here; wasn't sure about the hip sdk.

3b. After the steps here (as proposed in the link above), clinfo finally gave sensible results.
Quote:
35 tar -xvf amdgpu-pro-21.10-1247438-ubuntu-20.04.tar.xz
36 mkdir extractions
37 dpkg -x amdgpu-pro-21.10-1247438-ubuntu-20.04/opencl-orca-amdgpu-pro-icd_21.10-1247438_amd64.deb extractions
38 dpkg -x amdgpu-pro-21.10-1247438-ubuntu-20.04/ocl-icd-libopencl1-amdgpu-pro_21.10-1247438_amd64.deb extractions
44 sudo mkdir /opt/myopencl
45 sudo mkdir /opt/myopencl/lib
47 sudo mv extractions/opt/amdgpu-pro/lib/x86_64-linux-gnu/libamdocl12cl64.so /opt/myopencl/lib/
48 sudo mv extractions/opt/amdgpu-pro/lib/x86_64-linux-gnu/libamdocl-orca64.so /opt/myopencl/lib/
49 sudo mv extractions/opt/amdgpu-pro/lib/x86_64-linux-gnu/libOpenCL.so.1.2 /opt/myopencl/lib/
50 sudo mv extractions/opt/amdgpu-pro/lib/x86_64-linux-gnu/libOpenCL.so.1 /opt/myopencl/lib/
52 sudo vim /etc/OpenCL/vendors/myopencl.icd
53 cat /etc/OpenCL/vendors/myopencl.icd
56 /opt/rocm-4.5.2/opencl/bin/clinfo
57 /opt/rocm-4.5.2/bin/rocminfo
I then did another reboot and checked that clinfo still worked.

4. Compile and try mfakto v.0.15-pre7.

Quote:
66 mkdir mfakto
67 cd mfakto/
68 mv ~/mfakto-0.15pre7-src.zip .
70 sudo apt install unzip
71 unzip mfakto-0.15pre7-src.zip
72 cd mfakto-master/
73 cd src/
79 vim Makefile [COMMENT: edit this line: AMD_APP_DIR = /opt/rocm-4.5.2/opencl]
80 make [COMMENT: still didn't work, use the link below]
81 ld -lOpenCL --verbose
82 ls /opt/rocm-4.5.2/opencl/lib/
83 sudo ln -s /opt/rocm-4.5.2/opencl/lib/libOpenCL.so.1.2 /usr/lib/libOpenCL.so
84 make [SUCCESS!]
86 cd ../
87 ./mfakto [SUCCESS, but need work!]
88 vim worktodo.txt
89 ./mfakto [SUCCESS!]
All of the above seems particularly onerous. Any suggestions for improvement?
masser is online now   Reply With Quote