calvintam236 / docker_xmrig-amd

Obsolete. Check out the link for newer version.
https://github.com/calvintam236/docker_xmrig
2 stars 1 forks source link

No AMD device found #1

Closed bendwyer closed 6 years ago

bendwyer commented 6 years ago

Hi,

I'm receiving the following message when I run the docker container. I'm using Xubuntu 16.04.

 * VERSIONS:     XMRig/2.4.3-beta2 libuv/1.8.0 OpenCL/2.0 gcc/5.4.0
 * CPU:          Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz x64 AES-NI
 * ALGO:         cryptonight, donate=1%
 * POOL #1:      pool.supportxmr.com:7777
 * COMMANDS:     hashrate, pause, resume
[2017-11-21 15:18:39] compiling code and initializing GPUs. This will take a while...
[2017-11-21 15:18:39] found AMD platform index: 0, name: Advanced Micro Devices, Inc.
[2017-11-21 15:18:39] No AMD device found.
[2017-11-21 15:18:39] Failed to start threads

I have an RX 580 installed.

$ lspci | grep -i AMD

83:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/580] (rev e7)
83:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 580]

$ lspci -nn | grep -E 'VGA|Display'
08:03.0 VGA compatible controller [0300]: Matrox Electronics Systems Ltd. MGA G200eW WPCM450 [102b:0532] (rev 0a)
83:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/580] [1002:67df] (rev e7)

I'm using the latest AMDGPU-PRO drivers with the optional ROCm component installed, per the instructions here: http://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Install.aspx

$ dpkg -l amdgpu-pro

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                              Version               Architecture          Description
+++-=================================-=====================-=====================-=======================================================================
ii  amdgpu-pro                        17.40-492261          amd64                 Meta package to install amdgpu Pro components.

Basically I am putting all the commands for the container in a bash script, monero-gpu.sh...

#!/bin/bash

minername0=rx580
algorithm=cryptonight
pool=pool.supportxmr.com:7777
wallet=<wallet address>
email=<email address>
percent=1

docker run --restart unless-stopped -itd --device /dev/kfd --device /dev/dri --name $minername0 calvintam236/xmrig-amd:amd -a $algorithm -o $pool -u $wallet -p $minername0:$email --donate-level=$percent

...and then making it executable and running it.

sudo chmod u+x monero-gpu.sh
sudo bash monero-gpu.sh

All I can figure is that I messed up the driver install or the --device arguments need to be altered in some way. Any help you can provide is greatly appreciated.

calvintam236 commented 6 years ago

can you run /opt/amdgpu-pro/bin/clinfo? If you don't see your card, please do the following.

Configure 
Ensure that your user account is a member of the "video" group prior to using the vulkan driver. You can find which groups you are a member of with the following command:

groups

To add yourself to the video group you will need the sudo password and can use the following command:

sudo usermod -a -G video $LOGNAME 

If you are not in that video group, I don't think you can see any opencl platform.

bendwyer commented 6 years ago

Results below.

$ /opt/amdgpu-pro/bin/clinfo

Number of platforms:                             1
  Platform Profile:                              FULL_PROFILE
  Platform Version:                              OpenCL 2.0 AMD-APP (2482.3)
  Platform Name:                                 AMD Accelerated Parallel Processing
  Platform Vendor:                               Advanced Micro Devices, Inc.
  Platform Extensions:                           cl_khr_icd cl_amd_event_callback cl_amd_offline_devices

  Platform Name:                                 AMD Accelerated Parallel Processing
Number of devices:                               1
  Device Type:                                   CL_DEVICE_TYPE_GPU
  Vendor ID:                                     1002h
  Board name:                                    Radeon RX 580 Series
  Device Topology:                               PCI[ B#131, D#0, F#0 ]
  Max compute units:                             36
  Max work items dimensions:                     3
    Max work items[0]:                           256
    Max work items[1]:                           256
    Max work items[2]:                           256
  Max work group size:                           256
  Preferred vector width char:                   4
  Preferred vector width short:                  2
  Preferred vector width int:                    1
  Preferred vector width long:                   1
  Preferred vector width float:                  1
  Preferred vector width double:                 1
  Native vector width char:                      4
  Native vector width short:                     2
  Native vector width int:                       1
  Native vector width long:                      1
  Native vector width float:                     1
  Native vector width double:                    1
  Max clock frequency:                           1405Mhz
  Address bits:                                  64
  Max memory allocation:                         4244635648
  Image support:                                 Yes
  Max number of images read arguments:           128
  Max number of images write arguments:          8
  Max image 2D width:                            16384
  Max image 2D height:                           16384
  Max image 3D width:                            2048
  Max image 3D height:                           2048
  Max image 3D depth:                            2048
  Max samplers within kernel:                    16
  Max size of kernel argument:                   1024
  Alignment (bits) of base address:              2048
  Minimum alignment (bytes) for any datatype:    128
  Single precision floating point capability
    Denorms:                                     No
    Quiet NaNs:                                  Yes
    Round to nearest even:                       Yes
    Round to zero:                               Yes
    Round to +ve and infinity:                   Yes
    IEEE754-2008 fused multiply-add:             Yes
  Cache type:                                    Read/Write
  Cache line size:                               64
  Cache size:                                    16384
  Global memory size:                            8582303744
  Constant buffer size:                          4244635648
  Max number of constant args:                   8
  Local memory type:                             Scratchpad
  Local memory size:                             32768
  Max pipe arguments:                            0
  Max pipe active reservations:                  0
  Max pipe packet size:                          0
  Max global variable size:                      0
  Max global variable preferred total size:      0
  Max read/write image args:                     0
  Max on device events:                          0
  Queue on device max size:                      0
  Max on device queues:                          0
  Queue on device preferred size:                0
  SVM capabilities:
    Coarse grain buffer:                         No
    Fine grain buffer:                           No
    Fine grain system:                           No
    Atomics:                                     No
  Preferred platform atomic alignment:           0
  Preferred global atomic alignment:             0
  Preferred local atomic alignment:              0
  Kernel Preferred work group size multiple:     64
  Error correction support:                      0
  Unified memory for Host and Device:            0
  Profiling timer resolution:                    1
  Device endianess:                              Little
  Available:                                     Yes
  Compiler available:                            Yes
  Execution capabilities:
    Execute OpenCL kernels:                      Yes
    Execute native function:                     No
  Queue on Host properties:
    Out-of-Order:                                No
    Profiling :                                  Yes
  Queue on Device properties:
    Out-of-Order:                                No
    Profiling :                                  No
  Platform ID:                                   0x7f261554d098
  Name:                                          Ellesmere
  Vendor:                                        Advanced Micro Devices, Inc.
  Device OpenCL C version:                       OpenCL C 1.2
  Driver version:                                2482.3
  Profile:                                       FULL_PROFILE
  Version:                                       OpenCL 1.2 AMD-APP (2482.3)
  Extensions:                                    cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_image2d_from_buffer cl_khr_spir cl_khr_gl_event
calvintam236 commented 6 years ago

Can you execute ./monero-gpu.sh (without sudo bash)? I don't think you need that according to here, and I don't know if that cause the problem to run as root?

bendwyer commented 6 years ago

I ran the script without sudo bash, instead using ./monero-gpu.sh, but it resulted in the same error, No AMD device found.

I also tried simply entering the build command in terminal, and it gave the No AMD device found. error as well.

docker run --restart unless-stopped -itd --device /dev/kfd --device /dev/dri --name rx580 calvintam236/xmrig-amd:amd -a cryptonight -o pool.supportxmr.com:7777 -u <username> -p <password> --donate-level=1
calvintam236 commented 6 years ago

My personal setup uses ROCm instead of AMDGPU-PRO because of its rocm-smi management interface. Last time I tried on this image on AMDGPU-PRO driver worked. Most likely the version you installed with an outdated kernel.

Have you tried this AMDGPU-Pro Beta version for mining or ROCm by AMD?

bendwyer commented 6 years ago

I had come across the beta mining drivers, but was unsure of their performance vs. the latest AMDGPU-PRO drivers. I haven't heard of ROCm, but did see it was an optional install bundled with the AMDGPU-PRO drivers.

I'll give both a try and report back.

bendwyer commented 6 years ago

None of the others worked (ROCm or beta mining driver) - all failed with No AMD device found.

I did come across a post in the xmrig repo that basically says it might be necessary to change the index from 0 to 1. I think my server's onboard video might be getting detected as index 0.

Looking at the container arguments, it might be possible to attach a customized .json file with that index option changed. Do you see an easier way?

calvintam236 commented 6 years ago

If you want to try another opencl platform, just add --opencl-platform=N (N=index #) into argument:

docker run --restart=unless-stopped -itd --device /dev/kfd --device /dev/dri --name rx580 calvintam236/xmrig-amd:amd -a cryptonight -o pool.supportxmr.com:7777 -u <username> -p <password> --donate-level=1 --opencl-platform=1

You can use all arguments listed here after docker run ...... calvintam236/xmrig-amd:amd.

To attach an config.json, run

docker run --volume HOST_FILEPATH:/root/config.json --restart=unless-stopped -itd --device /dev/kfd --device /dev/dri --name rx580 calvintam236/xmrig-amd:amd -c /root/config.json

I dislike this because I run individual instance for each GPU, then you understand how many json file I need to make, and how annoying to edit every one of them.

bendwyer commented 6 years ago

I haven't been able to get it to work, even using opencl-platform=1. On a whim I tried the new xmr-stak running bare-metal and targeting only the GPU, and it works just fine. I'm at a loss as to what's causing the card to not be detected under xmrig.

calvintam236 commented 6 years ago

Can you run docker run --device /dev/kfd --device /dev/dri -ti calvintam236/ubuntu:amd, then run /opt/rocm/opencl/bin/x86_64/clinfo? Which driver are you using right now?

bendwyer commented 6 years ago

Here is the result:

$ docker run --device /dev/kfd --device /dev/dri -ti calvintam236/ubuntu:amd

root@8776aaf24261:/tmp# /opt/rocm/opencl/bin/x86_64/clinfo
terminate called after throwing an instance of 'cl::Error'
  what():  clGetPlatformIDs
Aborted (core dumped)

I'm currently back on AMDGPU-PRO 17.40, but if desired I can switch to another set of drivers.

calvintam236 commented 6 years ago

This result clearly suggests the driver is not working in your setup. When you tried to switch driver, did you clean install the OS before install the driver? It is possible that the old driver did not clean.

When you install ROCm, did you install rocm-opencl as well?

wget -qO - http://repo.radeon.com/rocm/apt/debian/rocm.gpg.key | sudo apt-key add - \
&& echo "deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/rocm.list \
&& sudo apt-get update \
&& sudo apt-get -y --no-install-recommends install rocm rocm-opencl
bendwyer commented 6 years ago

I did do a fresh OS install before re-installing my AMDGPU-PRO drivers, and I did another fresh install to prep for ROCm.

Running /opt/rocm/opencl/bin/x86_64/clinfo on the physical host gives the following:

terminate called after throwing an instance of 'cl::Error'
  what():  clGetPlatformIDs
Aborted (core dumped)

Yet, running /opt/rocm/bin/rocm-smi -a does return the results of my graphics card.

====================    ROCm System Management Interface    ====================
================================================================================
GPU[0]      : GPU ID: 0x67df
================================================================================
================================================================================
GPU[0]      : Temperature: 45.0c
================================================================================
================================================================================
GPU[0]      : GPU Clock Level: 0 (300Mhz)
GPU[0]      : GPU Memory Clock Level: 2 (2000Mhz)
================================================================================
================================================================================
GPU[0]      : Fan Level: 86 (33.73)%
================================================================================
================================================================================
GPU[0]      : Current PowerPlay Level: auto
================================================================================
================================================================================
GPU[0]      : Current OverDrive value: 0%
================================================================================
================================================================================
GPU[0]      : Minimum SCLK: 1363MHz
GPU[0]      : Minimum MCLK: 0MHz
GPU[0]      : Activity threshold: 50%
GPU[0]      : Hysteresis Up: 0ms
GPU[0]      : Hysteresis Down: 5ms
================================================================================
================================================================================
GPU[0]      : Average GPU Power:    41.174 W
================================================================================
================================================================================
GPU[0]      : Supported GPU clock frequencies on GPU0
GPU[0]      : 0: 300Mhz *
GPU[0]      : 1: 600Mhz 
GPU[0]      : 2: 900Mhz 
GPU[0]      : 3: 1201Mhz 
GPU[0]      : 4: 1274Mhz 
GPU[0]      : 5: 1318Mhz 
GPU[0]      : 6: 1363Mhz 
GPU[0]      : 7: 1405Mhz 
GPU[0]      : 
GPU[0]      : Supported GPU Memory clock frequencies on GPU0
GPU[0]      : 0: 300Mhz 
GPU[0]      : 1: 1000Mhz 
GPU[0]      : 2: 2000Mhz *
GPU[0]      : 
================================================================================
====================           End of ROCm SMI Log          ====================

I've been hesitant to jump to ROCm because I have an older set of CPU's (dual E5-2650v1's) that ROCm states they do not support.

I'm at a loss here.

calvintam236 commented 6 years ago

This shows your setup could not run ROCm. The base image of this xmrig-amd using ROCm foundation. This is a workaround (using AMDGPU-PRO driver base image instead).

First, download these:

Second, Run the following commands.

Then, you can try again. Make sure you have the same version of the AMDGPU-PRO version in the Dockerfile listed.

bendwyer commented 6 years ago

Alright, I finally had a moment to sit down and give this a shot.

I altered the base Dockerfile to use AMDGPU-PRO 17.40 (instead of 17.30). That image built just fine. The xmrig-amd image, unfortunately, did not build properly. I didn't alter the xmrig-amd Dockerfile. I've included the output below.

docker build . --tag calvintam236/xmrig-amd:amd

Sending build context to Docker daemon   2.56kB
Step 1/7 : FROM calvintam236/ubuntu:amd
 ---> a2aad84417c5
Step 2/7 : MAINTAINER calvintam236 <calvintam236@users.noreply.github.com>
 ---> Running in d86174d74c64
 ---> 5d43a464f673
Removing intermediate container d86174d74c64
Step 3/7 : LABEL description "XMRig-AMD in Docker. Supports GPU mining."
 ---> Running in 204b6173bfa7
 ---> ba31f1e06d81
Removing intermediate container 204b6173bfa7
Step 4/7 : WORKDIR /tmp
 ---> aa664bb99588
Removing intermediate container 90f93d6ed00d
Step 5/7 : RUN apt-get update     && apt-get -y --no-install-recommends install ca-certificates git build-essential cmake libuv1-dev rocm-opencl-dev     && git clone https://github.com/xmrig/xmrig-amd.git     && cd xmrig-amd     && mkdir build     && cd build     && cmake .. -DOpenCL_INCLUDE_DIR=/opt/rocm/opencl/include -DOpenCL_LIBRARY=/opt/rocm/opencl/lib/x86_64/libamdocl64.so -DWITH_HTTPD=OFF     && make     && cd ../..     && mv xmrig-amd/build/xmrig-amd /usr/local/bin/xmrig-amd     && chmod a+x /usr/local/bin/xmrig-amd     && rm -r xmrig-amd     && apt-get -y remove ca-certificates git build-essential cmake libuv1-dev rocm-opencl-dev     && apt-get clean autoclean     && rm -rf /var/lib/{apt,dpkg,cache,log}
 ---> Running in 3ff3b09405e8
Get:1 file:/var/opt/amdgpu-pro-local ./ InRelease
Ign:1 file:/var/opt/amdgpu-pro-local ./ InRelease
Get:2 file:/var/opt/amdgpu-pro-local ./ Release [814 B]
Get:2 file:/var/opt/amdgpu-pro-local ./ Release [814 B]
Get:3 file:/var/opt/amdgpu-pro-local ./ Release.gpg
Ign:3 file:/var/opt/amdgpu-pro-local ./ Release.gpg
Hit:4 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:5 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:6 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:7 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package rocm-opencl-dev
The command '/bin/sh -c apt-get update     && apt-get -y --no-install-recommends install ca-certificates git build-essential cmake libuv1-dev rocm-opencl-dev     && git clone https://github.com/xmrig/xmrig-amd.git     && cd xmrig-amd     && mkdir build     && cd build     && cmake .. -DOpenCL_INCLUDE_DIR=/opt/rocm/opencl/include -DOpenCL_LIBRARY=/opt/rocm/opencl/lib/x86_64/libamdocl64.so -DWITH_HTTPD=OFF     && make     && cd ../..     && mv xmrig-amd/build/xmrig-amd /usr/local/bin/xmrig-amd     && chmod a+x /usr/local/bin/xmrig-amd     && rm -r xmrig-amd     && apt-get -y remove ca-certificates git build-essential cmake libuv1-dev rocm-opencl-dev     && apt-get clean autoclean     && rm -rf /var/lib/{apt,dpkg,cache,log}' returned a non-zero code: 100

Looking through the xmrig-amd Dockerfile, it looks like it's failing on the ROCm OpenCL step. I went back over the AMDGPU-PRO installation instructions, and there are a couple of steps that I'm not sure should be included in either of the Dockerfiles or not.

http://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Driver-for-Linux-Release-Notes.aspx

http://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Install.aspx

To set it permanently for all bash and other sh-like shell users, you can use the following command:

echo 'export LLVM_BIN=/opt/amdgpu-pro/bin' | sudo tee /etc/profile.d/amdgpu-pro.sh

To set it permanently for all csh users, you can use the following command:

echo 'setenv LLVM_BIN /opt/amdgpu-pro/bin' | sudo tee /etc/profile.d/amdgpu-pro.csh

calvintam236 commented 6 years ago

I forgot there is one dependency does not exists in this base image. Remove rocm-opencl-dev in the xmrig-amd Dockerfile.

I have never tried to build with rocm-amdgpu-pro in the AMDGPU-PRO base image, so I don't know if it will work.

bendwyer commented 6 years ago

Success! I'm not at all familiar with Docker, but after I made some edits to the Dockerfiles everything built with zero errors. Deploying the container didn't generate any errors either. In fact, I'm getting the same hashrate I was with the bare-metal install of xmr-stak. I've attached the Dockerfiles below if you have any use for them.

Thanks so much for your help and patience.

ubuntu:amd

FROM ubuntu:16.04

MAINTAINER calvintam236 <calvintam236@users.noreply.github.com>
LABEL description="Ubuntu with graphic driver installed in Docker."

WORKDIR /tmp

RUN dpkg --add-architecture i386 \
    && apt-get update \
    && apt-get -y dist-upgrade \
    && apt-get -y --no-install-recommends install ca-certificates curl xz-utils opencl-headers\
    && curl -L -O --referer https://support.amd.com https://www2.ati.com/drivers/linux/ubuntu/amdgpu-pro-17.40-492261.tar.xz \
    && tar -Jxvf amdgpu-pro-17.40-492261.tar.xz \
    && rm amdgpu-pro-17.40-492261.tar.xz \
    && ./amdgpu-pro-17.40-492261/amdgpu-pro-install -y \
    && apt-get -y install rocm-amdgpu-pro \
    && rm -r amdgpu-pro-17.40-492261 \
    && apt-get -y remove ca-certificates curl xz-utils \
    && apt-get -y autoremove \
    && apt-get clean autoclean \
    && rm -rf /var/lib/{apt,dpkg,cache,log} \
    && usermod -a -G video root \
    && echo 'export LLVM_BIN=/opt/amdgpu-pro/bin' | tee /etc/profile.d/amdgpu-pro.sh

CMD ["/bin/bash"]

xmrig-amd:amd

FROM calvintam236/ubuntu:amd

MAINTAINER calvintam236 <calvintam236@users.noreply.github.com>
LABEL description="XMRig-AMD in Docker. Supports GPU mining."

WORKDIR /tmp

RUN apt-get update \
    && apt-get -y --no-install-recommends install ca-certificates git build-essential cmake libuv1-dev \
    && git clone https://github.com/xmrig/xmrig-amd.git \
    && cd xmrig-amd \
    && mkdir build \
    && cd build \
    && cmake .. -DOpenCL_LIBRARY=/opt/amdgpu-pro/lib/x86_64-linux-gnu/libamdocl64.so -DWITH_HTTPD=OFF \
    && make \
    && cd ../.. \
    && mv xmrig-amd/build/xmrig-amd /usr/local/bin/xmrig-amd \
    && chmod a+x /usr/local/bin/xmrig-amd \
    && rm -r xmrig-amd \
    && apt-get -y remove ca-certificates git build-essential cmake libuv1-dev \
    && apt-get clean autoclean \
    && rm -rf /var/lib/{apt,dpkg,cache,log}

ENTRYPOINT ["xmrig-amd"]
CMD ["-h"]