Linux version of Cast XMR - CryptoNight (Monero/Bytecoin/Loki/BitTube/Aeon) miner for RX Vega GPUs

Cast XMR is now available for Ubuntu Linux.

Updated on November 9th, 2018 to version 1.6.0

Requirements

  • Ubuntu 16.04 or 18.04
  • AMD Radeon RX Vega 56/64 or RX 470/RX 480/RX 560/RX 570/RX 580 GPU
  • AMD GPU Pro Driver version 18.30 (or later) with installed OpenCL support
Download Cast XMR 1.6.0 for Ubuntu

How to mine CryptoNight on Ubuntu Linux with RX Vega 56/64 GPUs

Performance under Linux

GPU CryptoNightV7
Hashes/s*
CryptoNightV8
Hashes/s*
* 10 min average, AMD GPU Pro 18.30 driver
RX Vega 64
Headless, default settings
1770 1670
RX Vega 64
Headless, intensity 10, 1025 MemClk
1900 1760
RX Vega 64
Headless, 1025 MemClk, 180W limit
1850
RX Vega 56
Headless, default settings
1710 1600
RX Vega 56
Headless, 945 MemClk
1950 1810
RX Vega 56
Headless, 945 MemClk, 120W limit
1850

Install the AMD GPU Pro Driver

Make sure all previous AMD drivers are uninstalled. To do so check if there is an amdgpu-uninstall or amdgpu-pro-uninstall command available to run. If yes, run it if you are not sure if the correct drivers are already installed.

Get the latest driver (at least 18.30) for your distro and installed it with following options, depending if you are using Vega or Polaris based GPUs, for Vegas it is:

./amdgpu-pro-install -y --opencl=pal

For Polaris based GPUs (RX 470 to RX 580) the ‘legacy’ OpenCL stack has to be installed instead:

./amdgpu-pro-install -y --opencl=legacy

An unsolved problem seems to be that one can not use Vega and Polaris GPUs at the same time under Linux, as either ‘pal’ or ‘legacy’ OpenCL stack can be enabled.

In case you don’t need OpenGL or an accelerated desktop add the –headless option, like:

./amdgpu-pro-install -y --opencl=pal --headless

Headless?

The headless mode is that the GPU is running dedicated for mining or compute jobs. No other work like OpenGL, Mesa or Vulkan is done on the GPU. Headless mode can be achieved by:

  • Operating the machine through SSH (without any user logged into the desktop)

  • Operating the machine in console mode while no user is logged into the desktop (Ctrl-Alt-F1)

  • Not running a desktop on the GPU by running it as a secondary GPU

  • Installing the AMD Pro driver with the headless option

The headless mode achieves higher and more stable hash rates and allows higher intensity settings.

Startup Cast XMR

There is a example shell script run.sh included for an easy configuration, just edit it and change to your prefered pool -S, your coin address -u, specify the needed algo with --algo and select with the -G switch which GPUs Cast XMR should mine. E.g. to mine on the first 4 GPUs use -G 0,1,2,3.

For a complete list of configuration options run:

cast_xmr-vega --help

For an further documentation of Cast XMR command line options have a look here.

Enabling Overclocking and Low Level Control of AMD RX Vega GPUs under Linux

With AMD GPU driver 18.30 there is an documented Linux interface to access the low level configuration of AMD GPUs like clock speed, fan control and power limits. The offical documentation of the Linux DRM AMD GPU driver can be found here.

To enable overclocking and modification of the settings a kernel boot parameter has to be set. The easiest way to do this is to add the parameter amdgpu.ppfeaturemask=0xffffffff to default GRUB configuration, to do so:

sudo nano /etc/default/grub

change the following line to include the amdgpu.ppfeaturemask parameter.

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash amdgpu.ppfeaturemask=0xffffffff"

after saving the changed file, run

sudo update-grub

to update the grub configuration.

A reboot is necessary to activate the kernel parameter.

GPU to card mapping

For all GPU low level settings the card number is needed to address the device.

Note: the cards are ordered by their PCI slot order, which does not necessarily match the OpenCL GPU device order!

Therefore on startup Cast XMR prints the determined card number for each GPU:

cast xmr ubuntu card number

Use the number stated in (card[number]) for each GPU as CARD_NUMBER for all following operations.

For example to output the current GPU state use:

sudo cat /sys/kernel/debug/dri/0/amdgpu_pm_info

Replace the 0 with the corresponding CARD_NUMBER of the GPU.

Note: All following operations can crash your computer and potential damage your hardware if used improper. Use carefully and on your own risk!

Fan control for proper cooling

Before overclocking the cooling has to be monitored and should not exceed a certain temperature. For Vega GPUs if the temperature of the GPU reaches more then 75° the GPU will throttle substantial, if the temperature of a GPU exceeds 85° the computer will do a hard reset.

Therefore a temperature below 70° should be maintained.

Unfortunately there is no target temperature control like on AMD Wattman settings for Windows. For the current driver version (18.30) the target temperature when in auto fan mode seems to be set fixed to 75°! (Which is in IMHO to high)

For overclocking the fan can only be set to a fix speed. The fan speed should be high enough that also in changing temperature condition stays below the desired target temperature, so add a little headroom.

Cast XMR includes a script to set the fan speed:

./set_amd_gpu_fan.sh CARD_NUMBER FAN_SPEED

FAN_SPEED can be set in rage 0 to 255.

Warning: a good starting point is 180. It can get quite loud. Don’t set it below 50 to prevent sudden heat death!

Overclocking

For CryptoNight mining the memory clock is the bottle neck and increasing it will result in instant higher hash values. CPU clock can be kept at moderate values. Cast XMR includes a simple script to do so, for Vega based GPUs it is:

./set_vega_mem_clock.sh CARD_NUMBER MEM_CLOCK VDDC

for Polaris basd GPUs it is:

./set_polaris_mem_clock.sh CARD_NUMBER MEM_CLOCK VDDC

It sets the memory clock and voltage and pins the memory clock to the maximum setting by disabling dynamic memory clock switching.

MEM_CLOCK is in MHz in the range 167 - 1500.

VDDC is the corresponing memory voltage in mV in the range 800 - 1200. A safe value is 950, higher clocks may run stable with a higher VDCC setting.

Warning: a wrong setting of VDDC can result in an instant crash
Warning: to high clock settings can result in an instant crash

Lowering Power Consumption

There is a simple way to limit power consumption by setting the power limit control.

A lower power limit also reduces the produced heat and can allow to lower the needed fan speed.

Default the power limit is set to maximum, so only lowering the power limit is possible.

./set_amd_gpu_power_limit.sh CARD_NUMBER POWER_LIMIT

The POWER_LIMIT is set in Watts. The range for the power limit is 1 to 220 Watts for Vega 64 and 1 to 165 Watts for Vega 56.

Find your own trade off of power consumption, fan loudness and hash rate.

Reseting to default settings

To reset the memory clock and fan speed to the default settings following script can be executed:

./reset_amd_gpu_to_defaults.sh CARD_NUMBER

Gandalph3000

Gandalph3000
Casting software for high performance, massive parallel computing and machine learning.