Tuesday, December 10, 2013

Finding Optimal Litecoin Mining Settings

Tuning your Litecoin mining system to get ideal performance can be a royal pain in the rear -- this I know from personal experience. Settings that work great for one person can end up being terrible for another individual. So if you've just bought a shiny new Radeon R9 290 or R9 290X (or any other GPU for that matter) and you're trying to get better hash rates, here's the general plan of attack for getting optimal mining performance from your system:
  1. Ideally you want to mine at intensity 20, as that will result in the fastest performance, but the system will not really be usable for other work.
  2. Start at reasonable settings and then start increasing GPU clocks and memory clocks until your system becomes unstable.
  3. You'll probably need to play with fan speeds and/or voltages in the process of tuning.
  4. Once you've found the clocks that your GPU will handle, start looking for the optimal thread concurrency setting.
Needless to say, dialing things in can take days if not weeks, and every crash and restart can be maddening. I'm trying to build a set of batch files to automate things under Windows. Here's what I have so far, for finding an optimal thread concurrency setting. You need to put the two batch files in your CGminer folder, without any active cgminer.conf file.

@echo off
set threadconcurrency=18000
echo Current TC is %threadconcurrency%
start /wait "MinerThread" miner-tc.bat %threadconcurrency%
<nul set /p =%threadconcurrency%:  >> AvgHashrateTC.txt
type %threadconcurrency%.txt  | find /i "average hashrate" >> AvgHashrateTC.txt
set /a threadconcurrency=threadconcurrency+64
goto :startloop
@echo off
set threadconcurrency=%1
cgminer --scrypt -o stratum+tcp://coinotron.com:3334 --shares 5  -u trogdorjw73.tester -p tester -w 256 -v 1 -I 20 -g 1 -T --gpu-engine 965 --gpu-fan 70 --gpu-memclock 1550 --gpu-vddc 1.075 --temp-target 85 --temp-overheat 95 --temp-cutoff 99 --thread-concurrency %threadconcurrency% > %threadconcurrency%.txt
Place those two files into your cgminer folder and then run ThreadConcurrency.bat (tweaking as needed for your mining pool, temps, etc.) and walk away. Your PC will run through five shares at each thread concurrency setting and spit out the result to a file called "AvgHashrateTC.txt", and you can look at that in the morning after running the batch file all night (or in the evening after running it all day if you prefer).

There's a catch, of course: I set the above to do five shares, and sometimes you'll get lucky or unlucky so hash rates can be higher/lower. Setting the shares value higher (like 20 or 30) would take longer to get through a sequence but it would be more accurate. When you're fine tuning that's worth a look, and maybe you could even change the increment from "+64" to "+32" or "+16" -- or even "+1" if you think that might help.

You can use the same approach for clock speeds as well, but you'll probably want a maximum clock (or just let it go until your PC reboots). I'll post some batch files for that tomorrow. Also note that on the R9 290/290X cards under Windows, when cgminer exits it often causes a BSOD -- no fun! I'm not sure if that's drivers or cgminer 3.7.2; I need to try poking around a bit, but it's a real irritant. Closing the window with the X in the corner avoids the problem, but that doesn't work with CGWatcher or my batch files above.

If you find this useful, go ahead and run the files as above and I'll get a few mining shares during your testing. Optionally, feel free to donate to my blogging efforts by shopping online or via LTC donations. Or win some for free and give me a commission.

LTC: LXpEZcNJtikd263z7Ha3vrdYDcLU7hiKWv


  1. Interesting! Can this same method be applied to other settings like --gpu-engine? I am still fiddling with finding the optimal value, and am running individual bat files and logging manually. Seems like every time I run it I get a different hash rate though.

  2. I've just bought 3 Scrypt mining Rigs and wanted to ask you what you think about it?

    Corsair 8GB (2 x 4GB) Vengeance DDR3 1600 Incl. Tax: AUD $135.95

    AMD FX 4130 3.80GHz u Incl.Tax: AUD $139.95

    Asrock 970 EXTREME4 AMD 970 Incl. Tax: AUD $154.95

    Kingston SSDNOW V300 60GB Incl. Tax: AUD $89.00

    Antec 1300W 80 PLUS Platinum Certified PSU Incl. Tax: AUD $459.00

    SAPPHIRE AMD Radeon R9 280X TOXIC 3GB x4 Incl. Tax: AUD $499.95 x4 = 2000.-

    1x to 16x Riser Incl. Tax: AUD $19.00

    TRIPLE PACK - PCI-E 16x to 16x Incl. Tax: AUD $56.95

    Total: AUD $3084 = 2697 $USD

    So it is almost 700 USD more expensive as the rigs you recommended. But I think it should be stable hardware and a good cooling with the Toxic.
    I have a few questions regarding the rig and may you could help me:

    Regarding to the aluminium case would you recon to place the GPU's as on following foto: goo.gl/UeNARL
    Or would you rather place them as you at various diffrent rigs such as: goo.gl/xiNxTl
    Does it matter if I use 3 x PCI 16x and 1x PCI 1.0 or should I go for 2 x PCI 16 and 2x PCI 1?

    Also what do you think about undervoltung those 280x GPUs to 1.100V with modified BIOS?

    Thank you in advance

    1. So putting one GPU on a riser and two on the mobo is actually a nice way to save on PCIe riser costs, though it does look a bit odd perhaps. I suppose you can try both ways and see if one is better?

      For the case, I'm actually considering trying to build wooden frames instead of using aluminum tubing -- because wood, hammer, nails, and a saw are all fairly easy to come by. Plus, wood is non-conducting, so less chance for a short (maybe?).

      Finally, as to the cost you're looking at $700 more but getting 290X instead of 280X. Over hear, 290X is about $210 more per GPU than 280X, so it's actually a reasonable price you're paying. If you can undervolt and get 900KHash per 290X, it's a fair trade -- probably even better than going with 280X as more hashing power for the total system is always nice. Enjoy!

    2. Ok, thank you for the input.
      I think you saw something wrong, there are 280x not 290x, the price ist just way higher than in US. Thats way 4 280x Toxic costs me a 2000 AUD.
      What i wanted to ask is if it matters to use 3x PCI 16x and 1x 16x or if i it is necessary to go for 2x PCI 16x and 2x PCI 1.0x ?

    3. Oops, you're right -- I somehow read the Toxic 280X as a 290X! Hahaha... so yeah, it hurts that you have to pay quite a bit more, but at least it's still profitable. :-)

      For the risers, basically you want as many as possible on x16 risers/slots; if you run out of those, you can try to get x1 to x16 powered risers to work, which tends to be a bit more difficult than straight x16 to x16 converters. But it should still be possible with the right riser, unless the motherboard is really weird.