As an Amazon Associate I earn money from qualifying purchases.
Showing posts with label thread concurrency. Show all posts
Showing posts with label thread concurrency. Show all posts

Tuesday, February 4, 2014

Vertcoin Settings, Optimal Thread Concurrency, and HW Errors

Not surprisingly, given the current prices [which I predicted about ten days ago!] people are starting to pull their hair out when trying to tune their configuration files to work with Vertcoin (VTC). In fact, I have been one of those people, so naturally I decided it would be best to adapt my previous work to get things running with the new version of cgminer.exe. This round, I have two different versions of the batch file to run, one for Radeon R9 290 and R9 290X, and one for earlier GPUs.

You can download my test scripts from Dropbox.

The key items to change before running are all in the two following files. Note that I'm using the custom version of cgminer found here, as opposed to the slightly different version of cgminer named vertminer found here. I don't know if there's really much of a difference, but I started tuning on the first version (linked from Vertcoin.com) before hearing about Vertminer (linked from Vertcoin.org -- go figure). It sounds like some people are getting fewer HW errors with Vertminer, but at least initially I lost about 50 KHash on my 3x7950 rig so I'm staying with the first miner for now. Anyway, the main files to look at are:
thread-concurrency-test.bat
thread-concurrency-test-r9version.bat
As you can hopefully guess, the r9version is for R9 290/290X (it's not necessary on R9 270/280X as those are basically just rebranded 7000-series hardware); technically this version should work for any GPU, but I've found it can be a bit... flaky. Basically every few restarts of cgminer.exe, one or more GPUs will stop working properly and you'll need to reboot the PC. So hopefully we can get a fixed EXE for R9 systems sooner rather than later (and if you have such an EXE, please email me).

Here's the short list of settings to change, and below I'll have some recommendations based on running these scripts on my own hardware. All of the settings below are for both versions, except "roundtime" which comes from the non-R9 version, and "shares" which comes from the non-R9 batch file:
Starting thread concurrency. Note that if file "CURRENTTC.TXT" exists, that will override this value!
set threadconcurrency=6000

GPU engine and core clock(s). If you want to set different clocks, use commas with quotation marks around the set (e.g. gpuclock="1000,975,950" for three GPUs)
set gpuclock=900
set memclock=1450


GPU fan speed range (can use multiple sets with quotes as above if needed)
set gpufan=50-95

GPU voltage tends to only work on older GPUs (5000 and 6000 series, and some 7000)
set gpuvolt=1.071

PowerTune setting can specify for multiple GPUs with quotes; only supported on 6000 and newer GPUs.
set gpupowertune=10

Intensity setting for mining
set intensity=18

Number of GPU threads
set gputhreads=1

Number of shares to mine on each TC setting before moving on. If you have a high share difficulty, lower values may be useful.
set shares=60

How much to increment thread concurrency each round -- for Vertcoin mining, I've found steps of as small as 1 to be potentially useful!
set threadincrement=4

Number of seconds to mine on each round.
set roundtime=300

Number of GPUs being used -- the output includes performance from each GPU on a separate line, hence the need for this setting.
set numgpus=3
The instructions for using the batch files are pretty simple: extract the above files into your cgminer-vertcoin folder, then edit the appropriate batch file and change the above settings as appropriate. In general, that means you should tweaks the GPU clocks, the starting thread concurrency, and potentially the intensity and gputhreads settings. The number of shares and/or roundtime can be adjusted; I'd generally recommend increasing these values rather than going any lower, as the more time you spend hashing at each TC the better the overall estimate will be.

There are just a few disclaimers before I wrap up. First, I take no responsibility if any of these files mess up your PC or kill your GPU. They should be safe, but you never know. Second, the R9 version seems to be a bit less stable, and it seems to cause the GPU drivers to crash, especially in multi-GPU systems. You might have better luck than I did, of course. Finally, every system is different, so what works really well on one PC may not work well at all on another -- and I've found in general that it's very difficult to find a setting where you get optimal hash rates without getting any HW errors; mostly, I just try to keep HW errors below 1%.

Donations as always are (very!) welcome. I'd appreciate just an hour or so of your mining time if you don't mine, or you can donate to any of the following addresses:

VTC:  VaNuRCj73JVAwR1YMnt8CXaqoiPgykiMTk
BTC:  153qS9Ze32hnV3fwirZLWNka4wBAowc21E
LTC:  LfCLyykrNFftzpdWejR73hf478ZtBzQ9jE
DOGE: DD9iTWf8diPkvKdB8roPJepTyp6BGVQtct

Here are settings that I have found to be stable with the noted hash rates. I'm still trying to nail down optimal settings on many of the systems, as well as finding something that works well for R9 290/290X. I'll update my list as appropriate.

Radeon HD 7970 (R9 280X) (using vertminer.exe):
GPU clock: 1050-1140
RAM clock: 1500-1800
Thread Concurrency: 8192
GPU Threads: 1
Intensity: 13
Hash Rate: 290-320 KHash/sec

Radeon HD 7950:
GPU clock: 950-1000
RAM clock: 1425-1500
Thread Concurrency: 16040
GPU Threads: 1
Intensity: 19
Hash Rate: 270-290 KHash/sec

Radeon HD 6970:
GPU clock: 925
RAM clock: 1400
Thread Concurrency: 8000
GPU Threads: 1
Intensity: 18
Hash Rate: 230-250 KHash/sec

Radeon HD 6950:
GPU clock: 875
RAM clock: 1250
Thread Concurrency: 6000
GPU Threads: 1
Intensity: 18
Hash Rate: 210-230 KHash/sec

Radeon HD 5870:
GPU clock: 925
RAM clock: 1150
Thread Concurrency: 5688
GPU Threads: 1
Intensity: 18
Hash Rate: 200-220 KHash/sec

Radeon HD 5850:
GPU clock: 850-900
RAM clock: 1050-1100
Thread Concurrency: 5120
GPU Threads: 1
Intensity: 18
Hash Rate: 170-190 KHash/sec

Again, donations are very much appreciated. And if you have some other coin you'd prefer to send, let me know!

VTC:  VaNuRCj73JVAwR1YMnt8CXaqoiPgykiMTk
BTC:  153qS9Ze32hnV3fwirZLWNka4wBAowc21E
LTC:  LfCLyykrNFftzpdWejR73hf478ZtBzQ9jE
DOGE: DD9iTWf8diPkvKdB8roPJepTyp6BGVQtct

Tuesday, December 10, 2013

CGMiner Optimal Thread Concurrency for R9 290/290X

Continuing from my previous post, I've now created a batch file to help find the optimal Thread Concurrency setting for R9 290/290X systems. The difficulty with doing this stems from the fact that normally exiting CGMiner on Windows with the new GPUs will cause a BSOD on most (all?) systems, so you can't use my other batch files. They work great on HD 7970/R9 280X and earlier systems, though, and last night I managed to increase my HD 7950 test system by 20KHash/sec per GPU. So how do we deal with R9 290/290X? We tweak things a bit and end up with some new batch files, which you can download via my Dropbox.

Instructions:

Extract the contents of that Zip file to your CGMiner folder (Windows only right now). There are five files inside, including three EXE files, but nothing dangerous; here's the quick summary of the EXE files.

Sleep.exe is a program that can be used in batch files to pause for a set amount of time (e.g. 300 seconds = "sleep 300").

Grep.exe is a common Unix program that allows you to search through files for matching strings; you can use "find" on Windows, but the output of CGMiner messes find up because it includes special characters.

Tail.exe is the last executable and it's also a port from Unix; it allows you to output the last few lines from a file (or a command); so "tail -1" gives the last line from a file or command.

I use the above three files in the batch files to help with creating a useful summary of the mining results for each thread concurrency. The two batch files are similar to before, but with some tweaks. Here's what they contain if you don't want to download:

thread-concurrency-test-r9version.bat
@echo off
set threadconcurrency=18000
set gpuclock=900
set memclock=1400
set gpufan=50-75
set gpuvolt=1.100
set gpupowertune=50

if exist currenttc.txt (
  for /F %%x in (currenttc.txt) do set threadconcurrency=%%x
)

:startloop
echo Current TC is %threadconcurrency%
echo %threadconcurrency%> currenttc.txt
start "MinerThread" miner-tc-r9version.bat %threadconcurrency% %gpuclock% %memclock% %gpufan% %gpuvolt% %gpupowertune%
sleep 300
taskkill /im cgminer.exe /f
<nul set /p =%threadconcurrency%: >> AvgHashrateTC.txt
grep -i "(avg)" %threadconcurrency%.txt | tail -1 >> AvgHashrateTC.txt
set /a threadconcurrency=threadconcurrency+64

goto :startloop
miner-tc-r9version.bat
@echo off
set threadconcurrency=%1
set gpuclock=%2
set memclock=%3
set gpufan=%4
set gpuvolt=%5
set gpupowertune=%6
cgminer --scrypt -o stratum+tcp://coinotron.com:3334 -u trogdorjw73.tester -p tester -w 256 -v 1 -I 20 -g 1 -T --gpu-engine %gpuclock% --gpu-memclock %memclock% --gpu-fan %gpufan% --gpu-vddc %gpuvolt% -- --temp-target 80 --temp-overheat 95 --temp-cutoff 99 --thread-concurrency %threadconcurrency% > %threadconcurrency%.txt
exit
The first files starts with some variables you can modify for clock speeds, starting thread concurrency, voltage, fan speed, and powertune. It the calls the second file (passing the variables along), which actually starts CGMiner running. Because we can't let CGMiner exit gracefully without a BSOD, the first file waits 300 seconds after starting the second file and then kills the CGMiner.exe process, at which point it uses the output from the mining results and grabs the last average hash rate, which ends up in a text file called AvgHashrateTC.txt.

So to use this, you first need to delete (or at least rename) your cgminer.conf file in your CGMiner folder, then extract the Zip file to the directory and just run thread-concurrency-test-r9version.bat and walk away (though you might want to tweak the clocks or other settings first). Come back in a day or so and look at your averages and you'll see something like the following:
18000: (29s):1.398M (avg):1.569Mh/s | A:640   R:0    HW:627  WU:616.8/m
18064: (29s):1.368M (avg):1.565Mh/s | A:1600  R:0    HW:710  WU:610.6/m
18128: (29s):1.264M (avg):1.585Mh/s | A:1600  R:0    HW:537  WU:608.4/m
18192: (29s):1.330M (avg):1.536Mh/s | A:1600  R:0    HW:600  WU:685.5/m
18256: (29s):1.409M (avg):1.575Mh/s | A:1920  R:320  HW:347  WU:707.8/m
18320: (29s):1.339M (avg):1.544Mh/s | A:2240  R:0    HW:467  WU:626.2/m
18384: (29s):537.3K (avg):1.357Mh/s | A:640   R:0    HW:384  WU:681.4/m
....
If all goes well, you will have a lot more lines than the above, but it's possible your system will crash during the testing. To get around that, the currently tested TC is spit out to a file which gets read when the first batch file starts. If you create a shortcut to thread-concurrency-test-r9version.bat and put that in your Startup folder, even after a crash/reboot the testing will pick up where it left off.

In the meantime, based on more experience with the GPUs, I'm recommending the Radeon R9 290 over the R9 290X for Windows users -- you can probably get closer to 1000KHash/sec on the 290X with Linux, but on Windows it can be rather difficult. Also, the default voltage used on your GPU will affect your ability to hit higher clocks and hash rates -- lower voltages being better.

Donations gladly accepted if this helps you out:
LTC: LXpEZcNJtikd263z7Ha3vrdYDcLU7hiKWv
Go win some LTC!

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.

ThreadConcurrency.bat:
@echo off
set threadconcurrency=18000
:startloop
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
miner-tc.bat:
@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
exit
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