Mining on an R9 290 in Linux

Picked up a couple of the newer R9 290s to add to my mining rig recently and encountered a number of problems with the latest AMD/ATI drivers as well as cgminer. It seems to be fairly common for the latest drivers to cause issues on both Linux and Windows .

The fact that cgminer no longer supports GPU’s compounds the issue, but it is a fixable problem. The latest beta drivers (13.12)need to be patched to keep them from crashing and failing entirely. More information on such can be found here. Someone was also nice enough to provide binaries for Ubuntu.

If you can get that far, you’ll quickly find that cgminer will crash upon exit (use version 3.7 and earlier if you want GPU support as its been dropped), and lock the GPU resource (fans will continue running for example) until reboot.

With their Hawaii architecture, AMD updated some things for the R9 290/290X. Specifically, they’ve updated their Overdrive engine from version 5 to 6

This means cgminer isn’t capable of handling the latest series of graphics cards. The solution involves compiling cgminer from scratch and fixing the adl calls or just disabling anything related to temperature and fan control — a bad idea considering how hard mining is on video cards. Its critical to monitor and control temps or risk destroying very expensive GPUs. So based on information attained here I went ahead and recompiled cgminer with the latest and greatest SDK and AMD drivers — it works perfectly now. No more crashes on exit.

In the adl.c file around line 472, just before the ADL_Overdrive5_FanSpeed_Get call, add a line above: ga->DefFanSpeedValue.iSpeedType=ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;

However I had some issues when I actually installed the SDK and compiled cgminer, it adds a number of things to /usr/include and /usr/lib and they ended up causing hardware recognition issues for me on Ubuntu 13.10. In the latest versions of AMD/ATI drivers, the SDK is ‘included’, however in practice cgminer won’t find it without specifically pointing to it. The solution was to fix adl.c in cgminer, and point to local user space copies of the latest SDK for ADL and openCL recognition/compatibility, without actually installing them. This provided access to all 5 GPUs from userspace, without even needing sudo. I highly recommend NOT installing the 6.0 ADL if you are in a similar situation, I encountered endless issues with such, since the drivers technically already include the SDK.

Depending on where you unpack the 2.9 SDK you can use the following line to successfully build cgminer with proper temp and fan control support, without having to actually install (and risk ruining your ability for cgminer to find your GPUs) the SDK:

CFLAGS=”-O2 -Wall -march=native -I/location/to/SDK/AMD-APP-SDK-v2.9-RC-lnx64/include/” LDFLAGS=”-L/location/to/SDK/AMD-APP-SDK-v2.9-RC-lnx64/lib/x86_64″ ./configure –enable-opencl –enable-scrypt

Last but not least here are some good settings for a PowerColor AXR9 290 4GBD5-MDH/OC Radeon R9 290. I’m getting about 875 Kh/s out of these particular cards with this setup. This seems to be near the top of the list for similar setups.

./cgminer –scrypt -o yourpool.com:port -u user.worker -p password -I 20 -g 1 -w 256 –auto-fan –lookup-gap 2 –thread-concurrency 24550 –gpu-memclock 1500 –gpu-engine 1000 –gpu-powertune 20 -v 1

scrypt-r9-290-settings

But thats running one of the cards fairly hot. Personally I like them to run a little cooler so I had to adjust my cooling a bit to make up for the difference. Lowering the intensity down to 19 and the powertune down to 10 yielded me lower temps but still respectable hash rates (840khash).

If you are having issues compiling, I went ahead and compiled a verison of cgminer with the adl fixes and the latest and greatest sdk. It should work on most 64 bit ubuntu systems with the latest AMD/ATI drivers. You can download it here.

I am unfamiliar with this particular hosting site, but it was free so I posted it, please double check the md5sum before opening. If it hasn’t been tampered with it should be:

md5sum cgminer-3.7.0-amd-r9-fix.tar.gz
7caacb590eb419c380b7d223797dc959

Latest mining rig:

2013-12-22(2) - Copy

LTC: LTjmMFrxm4mnRWM4wvH5WQdJPnw3fUmYiz