Build your own Litecoin Mining Rig, part 4: Optimization

cgminer with optimized settings

My optimized rig: nearly 2 Mh/sec @ only 680 watts of power.

This fourth installment of our litecoin mining guide will focus on getting the most out of your hardware—finding the sweet spot between maximum performance and acceptable power usage (and noise/heat generation!).

The tweaks that I outline in this article are applicable whether you’re using Linux or Windows. If you’re using the hardware that was recommended in the first part of this guide (or very similar hardware), you should expect to see a performance increase of 10% or more in your litecoin mining hashrate, compared to the baseline cgminer settings that were given in our Linux and Windows setup guides.

In addition to increasing your mining speed, I’ll also show you how to set up a backup mining pool to automatically failover to in case your primary pool becomes unavailable. There is nothing worse than having your mining rig(s) sit idle because your pool went down!

Click “read more” for our mining performance optimization guide!

 Build a Litecoin Mining Rig, part 4: Optimization

I want to preface this guide with a strong recommendation that anyone following it have access to a Kill-A-Watt (or similar device). Many of the tweaks outlined in this article will change the amount of power that your mining computer uses, and without the ability to measure power consumption, you have no way of making an informed decision about whether or not each change actually helps your bottom line. Electricity isn’t free (for most of us, anyway), and a small increase in hashing performance that costs an extra 150 watts may actually ending up costing you in the long run. Amazon sells kill-a-watts for ~$17, which is cheaper than I’ve seen them anywhere else, and the device will likely pay for itself many times over.

With that said, if you don’t have a kill-a-watt, but you do have the same hardware that I recommend in the first part of this mining guide, then you can be relatively confident that all of the tweaks below will result in positive monetary gains for you (at current litecoin prices and mining difficulty, anyway).

Overclock your GPU(s)

Overclocking your video cards will likely result in the largest overall mining gains, and it can be done right from within cgminer in most cases. Some cards are more overclockable than others (the MSI 7950 that I recommend is one of the best), but most should yield at least some gain by tweaking clock speeds upward.

Disclaimer: overclocking beyond factory default settings may cause system instability, harm your hardware, and/or invalidate your warranty. The author assumes no responsibility if you fry your computer.

The best way to find your ideal clock speeds is to start cgminer, and press “G” while it is running to open the (G)PU menu. From there, press “C” to (C)hange settings (and then press “0” to select your first GPU if you have more than one).

cgminer GPU settings

cgminer GPU settings: use the (E)ngine and (M)emory options to change your video card’s core and memory clock speeds, respectively.

You should be looking at a screen similar to the one shown above. From here, use the “E” and “M” keys to slowly push your GPU core and memory clock speeds upwards. I recommend increments of about 25Mhz at a time, with a 1-2 minute pause after each change to observe the effect on hashrate performance and stability. Don’t forget to check your kill-a-watt for changes in power consumption, too. For best results, keep your memory clocked about a third higher than your core speed.

You’ll know you’ve gone too high when one of the following occurs:

  • Your GPU (or computer) simply crashes or hangs. You may require a system reboot at this point (a cold boot is best).
  • You start to see hardware errors (watch the “HW” column next to the GPU that you’re overclocking—if it’s higher than zero, you’re probably too high).
  • Your last clock speed increment brought only very small (or no) hashrate gains compared to the previous increases.

When any of these things happens, drop the clock speeds back down a bit and try to find the sweet spot where your system is stable and hashrates are highest. When you’ve found settings that you’re happy with, add them to your cgminer startup script (mine_litecoins.sh in Linux, or mine_litecoins.bat in Windows) with these switches:

--gpu-engine [YOUR CORE CLOCK SPEED] --gpu-memclock [YOUR MEMORY CLOCK SPEED]

If you’re using the recommended hardware, then 1050 core / 1250 memory should give you excellent results while still allowing you to undervolt significantly. If you’re using Windows and MSI Afterburner, you should set your Afterburner clock and memory speeds to match your new cgminer settings.

 Tweak cgminer settings for performance and noise management

Another easy way to increase hashrates is to modify your cgminer settings. The easiest and most obvious setting to change is the intensity, which controls how aggressively your GPUs are scanned by cgminer. If you’re using 7950 GPUs, go ahead and increase this to the maximum of 20 (on other GPUs, 20 may result in lower hashrates, or errors). You can do that by simply changing the -- I 19 in your cgminer startup script to -- I 20. Again, monitor cgminer’s output for awhile with the new setting in place to make sure that your hashrate moved in the right direction, and everything is stable.

If you don’t have the luxury of being able to tuck your mining rig someplace where it is out of earshot, you may have noticed that the fans are quite loud at default settings. To help control the noise, add these settings to your startup script:

--temp-target 80 --auto-fan

This tells cgminer to automatically control all of your GPU fans, and that 80C is the target temperature. The fans should work at about half speed or less whenever your GPUs are below your target, which should make them quite a bit less noisy. Using these settings, the recommended hardware, and the plastic crate build I described in part 1 of this guide, my GPUs hover around 78C at fans speeds of 30-40% (the ambient room temperature is kept at 72F). The rig is certainly audible, but it’s a far cry from the jet engine that it sounds like if the GPU driver is allowed to manage the fans.

Set up a failover / backup mining pool

Nothing will kill your mining performance faster than an unavailable pool. It doesn’t matter what your potential hashrate is if your miner isn’t constantly being fed work to do!

I highly recommend signing up at a second mining pool so that you can use it as an automatic failover whenever your primary pool isn’t reachable. I’m currently using give-me-ltc as my primary pool, and Coinotron as my backup, and that combination has resulted in no gaps in my mining time in over two weeks. Whatever you do, just stay away from notroll.in and do your research on the pool(s) that you choose!

To tell cgminer about your backup pool, simply add this to your startup script, at the end (substitute the pool URL/port and your credentials!):

--failover-only -o stratum+tcp://backup-pool.com:3333 -u user -p password

Now you’re covered if your primary pool goes down for whatever reason. Whenever it does come back up, cgminer will switch back to it automatically.

You can actually add as many backup pools as you want by simply listing more pools after the “–failover-only” switch; cgminer will use them in the order that they’re listed.

My cgminer startup settings

If you’re using the same hardware as me, and just want to copy & paste my cgminer settings (remember to substitute your pools & login credentials, though!), here they are:

cgminer --scrypt -I 20 -g 1 -w 256 --thread-concurrency 24000 --gpu-engine 1050 --gpu-memclock 1250 --gpu-vddc 1.087 --temp-target 80 --auto-fan -o stratum+tcp://stratum.give-me-ltc.com:3333 -u [YOUR USERNAME] -p [YOUR PASSWORD] --failover-only -o stratum+tcp://coinotron.com:3334 -u [YOUR USERNAME] -p [YOUR PASSWORD]

The “–gpu-vddc 1.087” switch tells cgminer to attempt to undervolt all GPUs to 1087 mV, but whether or not it actually works depends on your card’s BIOS and driver. In Windows, using MSI Afterburner gives you a much better chance of successfully controlling GPU voltage, but unfortunately in Linux you’re probably out of luck if cgminer can’t do it (update 10/2013: undervolting is now possible in linux as well).

With these settings and the hardware I recommended, you should get at least 1940 kH/sec in cgminer. Power consumption should be around 720 watts in Windows (after undervolting), and slightly over 800 watts in Linux. Individual results will vary a little bit, but those are realistic expectations.

Some cards (including the MSI that I recommend) can definitely be pushed more than these clock settings, especially at stock voltage settings (you may also want to check my FAQ for settings for some other popular mining cards). Whether or not the extra heat/noise/power consumption makes the corresponding hashrate increase worthwhile is up to you to determine. Which brings us to:

Analyzing the cost/benefit of different setups

Perhaps you’ve found that you can push your particular 7950 to 1150Mhz core / 1575Mhz memory clock speeds, provided you leave the voltage at stock settings. This nets you an additional 30 kH/sec of hashing speed at a cost of ~50 additional watts. How can you decide whether or not that is a good trade-off?

There are a few handy online calculators that are built to answer exactly these kinds of questions. Here is the best one that I’ve come across. Simply plug in your information, and the calculator will tell you how much daily (or weekly, or monthly, etc) profit you can expect. Change the values to other configurations that you’re considering and watch the profit number go up or down.

In the next and final installment of the litecoin mining guide, I’ll post a mining FAQ and some other tidbits that didn’t fit anywhere else. Until then, thanks for reading, and feel free to leave questions or comments!

You can leave a response, or trackback from your own site.

300 Responses to “Build your own Litecoin Mining Rig, part 4: Optimization”

  1. Davin says:

    Hey CB–

    I’m using Gigabyte 7950 windforce cards and I am only getting about 350 kH/s overclocked on each card. Why is this? Thought it would be in the 500-600 range? Thanks again, you’re site is very helpful 🙂

  2. Paul says:

    Looking forward to any 280x optimizations, I had to go with them instead given the impossibility of getting 7950s at a reasonable price.

    • Chris says:

      I went with 6 280X’s.

      They came stock at 1100 system clock, but if you lower it to 1050 the hashrate jumps from about 580 to 700.

      Don’t know why, but this is a documented effect.

      Other than that, just use the Command line switches as outlined in the hardware wiki:

      -I 13 -g 2 -w 256 –shaders 2048

  3. Josh says:

    Hi, thank you for the great guide. I am up and mining but for some reason am not able to change the settings as you outline above.

    I have Sapphire HD 7950s

    When in CGM I press “G”, then “C” and then get the line Select GPU: and I press 0 and nothing happens. I do’t get the screen to do E & M. Running 3.7.2

    Thanks in advance for any assistance.

    • David Ray says:

      I had that problem too. I feel like it happened when I failed to do ‘export DISPLAY=:0’ (I am in Linux). Later when I had fixed up my script to include that it was working. Possibly it was something else… not sure. Just wanted to pass that one in case it was a clue.

      -D

    • Squirreljestr says:

      You need to press enter after you enter the device number, just like when you set your fan speed or core clocks.

  4. PeerMedia says:

    In regards to undervolting, what are the associated risk of damaging the hardware? Are we talking temporary issues where changing the settings can fix it or are we talking about permanently damage to the video cards or rigs?

  5. brad says:

    If you get:

    “There is no screen to be attached matching cgm.”
    run: “./miner_launcher.sh”
    Password: ” ”
    run: “cgm”

    or there’s a minor syntax error in your “miner_launcher.sh” file!

    If you get:

    gpu-memclock etc settings not passing through to cgminer?

    -might be loading cgminer.config file instead – delete it!
    desktop:~/.cgminer$ dir cgminer.conf

  6. Steve says:

    I know this is a old post, I came across it because I’m new to mining and was doing some research. With that being said I have a question.

    There is someone in my pool who is mining at 102,202 KH/s….. Any idea as to how….?

    • delsol7 says:

      Must be multi rigs.

    • Erebus says:

      4 x 280x running @ 3000kh/s (3mh/s) per machine * 34ish machines = 102,000kh/s (102mh/s).. Say each kh/s = 1$… Then if u have 102,000 usd to spend you will also have that capacity. Assuming of course you have a dedicated place for it with massive cooling.. Because residential places wont hack it for ventilation or for raw wattage. 1 machine (same example as above) depending on various setting for gpus etc will running say 125volts*12amps=1500w… 34 comps would suck back 51kw (where i live 50kw is the max draw anyyhing over and its a hard 7bucks per additional KW.. Now think that doesnt include any other things running a house.. Think lights, oven, tvs etc.. You’d be draeing so much power youd be paying 100$ per day in overages.. Plus the standard kw/h fee that can be anywhere between 5cents to 20cents depending where you live. So yeah.. Unless you have a warehouse built for servers that well ventilated.. Then it becomes feasible. … Unless you have dosens of properties each running a cluster of comps.. To stay within reasonable electric use per property and nice basements or dedicated rooms with excellent cooling.. Or high rise condos with central air muhahaha 😉

    • Erebus says:

      On a serious note.. If you have that capacity pool mining would be a waste. The downtime from pool maintenance, cyber attacks etc. smart prople that run that have that capacity would run solo. No interference, no sharing etc. so unless they actually own the pool and have funneled all their fees into buying and building new machines that individual (or group of people) arent being very bright. Or they could just a lazy.. If they have a master node and 33 slave nodes then if the master crashes then the wallet closes which would cripple all the other nodes relying on it. To avoid this each comp would need its own instance of the wallet.. So 34 wallets.. 34 addresse to manage and manually funnel coins wherever.. Can become tedious. So a pool would be a shortcut of sort as you can run them all as a single entity that then the pool will funnel/tranfers coin to a single address. To each his/her own i guess. As such pool mining does simplify alot of things but like all things, simplicity comes at a cost. All trade offs each of us has to weight and decide on. Hope this answers everything and more lol cheers bud.

  7. MiningJack says:

    Hello,
    any many thanks for this tutorial.

    I have running two XFX 7950 Black Editition.

    The first card runs on 560 kh/s, but the second cart only brings ~320 kh/s.

    my start script is as follow (running cgminer 3.7.2 x64):

    #!/bin/sh
    export DISPLAY=:0
    export GPU_MAX_ALLOC_PERCENT=100
    export GPU_USE_SYNC_OBJECTS=1
    cd /home/minerjoe/cgminer
    ./cgminer –scrypt -I 20 –thread-concurrency 100 -o stratum+tcp://ltc-eu.give-me-coins.com:3333 -u xxx -p xxx

    My MoBo MSI Z87-G45, My CPU i5 4670K, my ram 4GB DDR3 1833

    The first gpu runs in 84°C, the second on 66°C.

    I have one monitor connected to each card, waiting on my resistors.

    I have installed the latest beta catalyst, because i have seen that people getting very good values with the beta.

    Have you any ideas what could make this differents?

  8. paul says:

    Hey, I am using this guide but with 5xxx cards, everything is working fine, downloaded cgminer 3.7.2 to avoid the errors, only problem is when i edit my gpu mem eng and volts, in mine_litecoins.sh (using xubuntu) the commands do not affect the gpus, neather does manual changing whilst cgminer is running. Anyone have advice? i had 5830, 5850, 5870

  9. Dr. Frankenstein says:

    One of my three identical Sapphire 7950 just can’t be overclocked while the other 2 have successfully been overclocked.

    When I enter the new Engine Clock (1000MHz) in cgminer GPU settings and hit enter, the result is that my Engine Clock actually drops down to 850MHz (from the default 925MHz) from which state I cannot move it again. Same happens if I try to change Memory Clock or any other setting.

    That GPU also had, since the beginning, a higher Vddc than the others and run consistently 30kHash lower. It’s like its BIOS is different although I haven’t messed with it (yet).

    It’s a mystery to me. Any idea will do!

    • athgaurd says:

      Yeah that happened to me too several times.. then finally it just worked out of the blue… change your clock in your bat file so that it goes off that clock every time.. sometimes just getting out of gpu management and going back into it will sometimes change it back.

      • Dr. Frankenstein says:

        Thanks mate, I have already included it in the starting script (I run linux so no .bat for me) and hoping to get your luck. 😀

        I will tweak with it a bit more and update when something good happens.

      • Dr. Frankenstein says:

        Hey, I just found out that the PCI-e adapter of the cable that connects thas card with the PSU, partially melted in the PSU. I am not sure now if it melted because this card seemed to get a bit more voltage than the others (thought 1.164V is not much for the PSU) or it was because of this cable that the GPU acted weird.

        I will get a new cable and find out. The PSU was a new Corsair AX860 Platinum that I got 3 days ago, not one I found in some Chinese warehouse.

        Just letting you know to check you cables.

  10. Phil says:

    Hey

    Ive been lowering the engine clock speed on my 1 card and the hash rate is going up! clock speed is now at 825mhz and hash has gone up from 430 to 484?

    Strange or what, i will now adjust the memory clock.

  11. R_Noug says:

    Hi and thanks for the great guide. I just startet to work with linux so i strictly followed your guide. Hardware is installed, dummy plugs are fine, ubuntu and ssh work, all software is installed but i cant start cgm. Maybe someone can help me. After typing cgm, the result is
    “There is no screen to be attached matching cgm.”
    Any ideas anyone?

  12. R_Noug says:

    thanks for your help!
    i checked all files and controlled the text. but cgm won’t work. i am still a bit confused and don’t know how to fix the problem

    • corather says:

      you can start the session manually by typing:

      ./mine_litecoins.sh

      If that doesn’t work there’s more problems.

  13. Phil says:

    Crypto, after following the above guide apart from cgminer version 3.7.2 I cant get a higher hash rate than this????

    cgminer version 3.7.2 – Started: [2013-12-15 00:05:00]
    ——————————————————————————–
    (5s):1.009M (avg):1.000Mh/s | A:2717 R:0 HW:0 WU:937.8/m
    ST: 2 SS: 0 NB: 1 LW: 23 GF: 0 RF: 0
    Connected to world.wemineltc.com diff 155 with stratum as user phil.2
    Block: cd82d7df… Diff:2.93K Started: [00:05:00] Best share: 3.52K
    ——————————————————————————–
    [P]ool management [G]PU management [S]ettings [D]isplay options [Q]uit
    GPU 0: 68.0C 1325RPM | 506.4K/519.5Kh/s | A:1746 R:0 HW:0 WU:494.2/m I:20
    GPU 1: 59.0C 1289RPM | 506.5K/513.0Kh/s | A:1126 R:0 HW:0 WU:480.4/m I:20

    • Phil says:

      My cards are HIS 7970 ice x2 standard edition. You say above that 1900kh/s should be obtainable, not for me!

    • Dr. Frankenstein says:

      Firstly, you have 2 GPUs not 3, so 1900kHash is not something you are not going to experience.

      Secondly in order to push your kHashes you need to actually do the step you skipped and set overclock your cards. You should be glad if you get 700+ kHash per GPU.

      Check here settings and kHash for your GPUs
      https://litecoin.info/Mining_hardware_comparison

      • phil says:

        Thanks for reply , I didn’t explain properly though.

        I have 2 cards in my rig and the other in my main PC for the moment.

        They are getting 500~ kh/s each and I have followed All the guide.

        I tried to over clock them but the hash rate went down like a sack of spuds so I had to lower engine clock to 800 and memory to 1250 to get all I could?

        • phil says:

          My cards aren’t on that list

          HIS hd 7970 ice x2

          I should be getting more than 1900 for 3 if the guide states using 7950 GPUs

        • Dr. Frankenstein says:

          Yes, the site does not have all the GPUs but you can see what your GPU family common settings are to get a clue.

          I haven’t experienced anything like this so I cannot explicitly help you, but try fiddling with the intensity and thread concurrency also. Maybe if your intensity is too high (20) the overclocking is too hard on your card, I see many people keep it at -I 13 and still have high hashrates.

          I googled and not many ppl seem to have your card, but try it also, there are 3-4 threads about it. Consider posting on one of those forums also.

          • phil says:

            Will do many thanks.

            Btw is there a way to back up the system so it can be restored like in windows?

  14. Rob says:

    I’ve got an ASRock Extreme 3, which appears to have only 2 “large slots” for the MSI 7950 cards, and two “smaller slots” for some sort of other PCI-based hardware. I’m new to these slot-types, but can anyone tell if it’s possible to use an adapter to get 3 MSI 7950 cards into an ASRock Extreme 3 motherboard?

  15. phil says:

    Does anyone else have his HD 7970 iceq x2 cards in their rig? Can’t get them over 500 kh/s for love nor money!!

  16. phil says:

    In desperation I’m going to try and install different AMD drivers.

    How do I find out which versions I have?

    Thanks in advance.

    • bOB says:

      I have these cards and have the same problem. Not sure what the magic combination for these cards is please let me know if you improve your hash speed. I’m am going to look Into flashing the gpu bios.

      • Phil says:

        Ok mate will do. I did actually get it up to 560 by over clocking memory past safe safe range but it crashed.

        I’ve now installed whole system into another USB stick and trying to install SDK app 2.7 but that’s a job in itself!

        Why the fcuk did I use Linux!

  17. phil says:

    How are you getting on with cards mate? I can get one GPU up to about 560 kh/s but no more.

    If I then put other 2 to the same settings they all come down to about 510?

    It’s like their linked, optimising one effects all the others is this normal?

  18. Luiz says:

    Heya.

    I am having a problem. I have two gigabyte 7950’s on my rig. And when i start mining my GPU 0’s temperature starts to climb close 90 but my GPU 1’s temperature is 15 degrees lower. Why is this and is there way to fix it? The airflow aint problem. Im blowing fresh air from outside for my rig and i live in Finland and the outside temperature is ~0 C.

  19. Treponim says:

    Hey CB.

    I just wanted to say thank you very much for the amazing guides. You have been an exceptionally friendly player in the game of mining, which I think is something that everybody who has used your guide appreciates.

    Thank you kindly for the help, I look forward to donating you a beer once I have some litecoins coming in!

    Cheers!

  20. Hyacin says:

    Great guide! Thanks! Quick question –

    Any suggestions for the best/easiest/most accurate way to figure out the additional power consumed by GPU overclocking?

    Cheers!

  21. Anonymous says:

    Stuck at 500kh/s hell with GV-R928XOC-3GD rev1, how does anyone reach 700kh/s.

    As of now nothing will run past a few hours, even when the only custom setting is I 13, I think im going to start trying to lower my memclock down from 1500 because whenever it shuts off the screen gets pixelated.

    Anyway to anyone, Id avoid this card unless its the last possible choice, A lot of people are running into this and Ive read its because of a faulty bios.

    Anyone been successful with this?

    • phil says:

      I could only get my his HD 7970 iceq x2 up to 530 kh/s in the end. Left them alike in the end got fcuked off messing with it! I’m getting an asus r9 280x now for my desktop PC.

  22. […] The screenshot above shows 3x 7950 GPUs getting nearly 1.9 Mh/sec, which is pretty good. These cards are slightly overclocked (but still undervolted!)—I show you how to achieve even higher speeds in the next section of this guide. […]

  23. rayman says:

    Help…. argh… keep getting a -4 kernel fault… gpu’s 0-1-2 fault, disabling… pfff… tried other scrypts an fully updated amd 7950. Win32 though…. anyone? Id like to start mining…. 😉

  24. Vitalia says:

    I’m curious about the –auto-fan setting.

    In my cgminer parameters I have:
    –temp-target 79 –auto-fan

    The fan speed jumps around throughout the day.

    I’m wondering if this will wear my fans out more than just keeping it at one fan setting.

    My fan speeds are currently:
    85
    82 and
    60

    Thanks,

    Vi

  25. blufonac says:

    is it common issue that single card produce more khs while running alone than running together with one or two more cards in same setup?

    i have r9 280x giving 730khs while running alone, but when i power on other card in my rig, 7950, khs on 280x drops to 700-710, same goes for that 7950 which runs 630khs solo and 600-610 while ran together.

    what causes that issue? i’m running w7 sp1 64bit, 8gb ddr3, core i5, cgminer…

    thans

Leave a Reply