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

This entry was posted in Linux. Bookmark the permalink.

22 Responses to Mining on an R9 290 in Linux

  1. chancelonestar says:

    so nerd
    such cred
    very tech

  2. Patrick says:

    Wow you finally put an end to days of driver problems etc with my 290′s. Thank you so much.

  3. tdavis says:

    Yeah it was a nightmare for me too until I figured it all out. Cheers.

  4. Hi says:

    It would be super helpful if you actually mentioned your OS. What version of Ubuntu?

  5. tdavis says:

    ubuntu 13.10 x64 bit

  6. sammy says:

    Dude you are awesome! Just saved my time, I already lost 2 days. Why you are thinking that it’s too hot? Isn’t 85-95 ok? I red that these cards are designed to go this temperature? Maybe I am missing something….

    Gigabyte R9 290.

    GPU 0: 76.0C 4855RPM | 865.4K/866.5Kh/s | A:4581 R:0 HW:0 WU: 833.8/m I:20
    GPU 1: 74.0C 4677RPM | 866.5K/869.9Kh/s | A:4888 R:0 HW:0 WU: 777.2/m I:20

    1000 clock, 1500 Mhz, powertune 20

  7. Nilux says:

    Do you have any problems with the 2 PSUs? Does the bios detect all GPUs?

  8. tdavis says:

    Sammy I’ve read those cards can take 90C but I’m not sure I believe it. I’d rather err on the side of caution. You look to be getting good safe temps out of them though so I think you are fine.
    Nilux I haven’t had any issues with dual psus, I originally powered the second one by shorting the cable but I have since updated to a proper dual psu cable–I would recommend buying one or making one it makes it a much cleaner setup. The bios on my rig will NOT recognize the R9 cards, so the primary card had to be something else — in my case a 7950. But if you follow the directions above Ubuntu should recognize the R9 cards regardless of the Bios.

  9. Henri says:

    Hi!

    I have have also problems with installing my second 3x Sapphire R9 290 rig.
    Strange errors, aticonfig doesn’t work well, think driver issues :|

    So i only have to install Xubuntu 13.10, AMD catalyst 13.12 (64 bit) and after that install your the compiled version of cg miner ?

    No need to installatie the SDK 2.9 version, do sudo aticonfig –lsa, sudo aticonfig –adapter=all etcetc ?

    Put all 3 GPU at once on the motherboard, or 1 by 1 ?

    My first rig with linux 13.10 with 3x r9 290 / catalyst / sdk / cgm 3.7.2 is stable now for 1 month at 3x 830kH. But i don’t know exactly how i did it. Will not tune it anymore. I’m glad it is working right now!

    I was hoping could do this for second time, but after 2 day/nights of sadness, i can’t get it to work.

    Hope you can help me!

  10. squarism says:

    I’m sending you 0.25LTC (a beer) for posting this. You saved my rig. I was unable to find 290 specifics until your blog. Thank you, thank you, thank you.

  11. Max Fedorov says:

    Anybody has problems running > 3 R9 290 cards on BAMT 1.2? I followed this guide to upgrade Catalyst which was already up-to-date and recompiled cgminer, but no changes. 3 cards mine at 900kh each, but once you put forth, I get black screen after BAMT is initialized. I have 40 same cards, tried everything…
    On Windows 8.1 Pro, 6 cards no issues…
    Any ideas?

  12. Surveyor98 says:

    Thank you for taking the time to post the 3.7.2 patch. My system is running 1 290x and 2 7950′s at the moment. All was running fine until I added an Arctic Accelero Xtreme cooling unit on the 290x. The OS recognizes the GPU’s when I use the aticonfig –initial command. CGMiner recognizes the cards when I use the cgminer -n command. However when I run cgminer from scrpyt (the same scrypt that has always worked), the terminal window goes blank, and becomes unresponsive. I’ve tried both versions of CGMiner 3.7.2, so I don’t think that’s the issue. Any ideas are appreciated.

  13. tdavis says:

    Squarism: Thanks for the beer!
    Henri: You will likely need to fix the 13.12 drivers either by patching them or using a patched version, the links listed above show you how to either patch them or download a pre-compiled ubuntu version (13.125). The adapters will likely also need to be initialized with aticonfig as normal since X usually needs to see them for cgminer to use them.
    Max: I haven’t tried >3 R9′s so I don’t have any input on that one.
    Surveyor: Are you sure you tried the re-compiled version of cgminer with the overdrive fix posted above? (Its a 3.7.0 derivative, be sure to verify the md5sum before opening) Your issue sounds eerily similar to what I faced prior to fixing cgminer….. also don’t forget
    export DISPLAY=:0
    export GPU_USE_SYNC_OBJECTS=1
    export GPU_MAX_ALLOC_PERCENT=100

  14. akmodi says:

    Hi

    Thank you for resolving my nightmare.

    Umpteen install and remove to no avail.

    As I understand, the steps are as follows:

    1. Install Ubuntu 13.10.
    2. Install latest AMD catalyst drivers: amd-catalyst-13.11-betaV9.95-linux-x86.x86_64
    3. file you have provided.
    4. Mine away

    Let me know if I have got it wrong.

    Thanks

  15. Henri says:

    My second rig is running 3x R9 290, 3x 880-890 KH/s.

    Xubuntu 13.10
    Catalyst 13.11 beta v9.4
    CGMiner 3.7.2

    Catalyst 13.11-beta V.9.95 didn’t work for me.

  16. Geyslan says:

    Hi, I’m using 2 x r9 290 in arch linux. The driver is 13.12 downloaed from AUR. Unhappily it’s reaching in avearage 600kh/s each.

    I perceived that cgmine 3.7.2 hasn’t the -gpu-memclock, -gpu-engine and -gpu-powertune options.

    What have I mistake?

  17. Tsar_wars says:

    Thanks for the great post! So far your cgminer 3.7 compile is running great with catalyst 13.11 beta V9.4 x64 drivers. 3 Gigabyte R9 290 BF4, WC loop, 2.7Mh/s @ 75C.

  18. r109 says:

    I am new to mining and I can’t for the life of me get the R9′s to be recognized in ubuntu. I referenced highoncoins tutorial and a few others which lead me to this post. I am particularly confused about which binaries to use (.deb) in the link provided in the second paragraph and the necessary steps walk through. If anyone is interested is revising the walk through doc or helping me I’d send btc your way. Thanks.

  19. long says:

    hi,

    can you provide instruction as to how to start cgminer? what steps/code do we have to put in?

  20. r109 says:

    I hate my life right now. I think it maybe the motherboard unable to support 3-4 gpu’s at once. I have a ASUS P8 Z77-V LK – I can’t get PCIe1x_1 to work with the first 2 PCeX16′s and if I have PCIe1x_2 plugged in both PCEeX16′s won’t work (or even the third). I’ve been tinkering with the bio’s but I can’t for the life of me figure out why the other slots won’t work. I can do 2x R9 290x on both the first two PCE3X16 slots but the 1X and third X16 hates me.

    Anyone with R9′s have a mobo to recommend? I think I’ll feed this mobo to a dogecoin rig and buy a more suitable mobo for 4xR9′s and LTC.

  21. Tommie says:

    Cheers! Been trying to tune my 290s for a few days now. These settings got me from 740k/s to 870k/s per card ;)

  22. Ian says:

    Hiya, nice post, could you clear something up for me?
    You say you have a “couple [of] R9 290s”? But show 5 GPUs in the cgminer output.
    @sammy says he has _A_ R9 290, but lists GPU 0 & 1?
    So how many GPU’s should a R9 290 show up, surly one (GPU 0) only?

    Also, @Henri/anyone got config for getting +770kh/s from a Gigabyte R9 290?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>