README.scrypt.txt 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. If you wish to donate to the author of scrypt support, Con Kolivas, for his past
  2. work (he no longer maintains this), please send your donations to:
  3. 15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ
  4. ---
  5. Scrypt mining for GPU is completely different to sha256 used for bitcoin
  6. mining. It has very different requirements to bitcoin mining and is a
  7. lot more complicated to get working well. Note that it is a ram dependent
  8. workload, and requires you to have enough system ram as well as fast enough
  9. GPU ram.
  10. Since scrypt ASICs are widely available, GPUs are not used by default. If you
  11. want to use them, use the -S opencl:auto option. Note that scrypt ASICs are
  12. documented in README.ASIC rather than this file, which only deals with GPU
  13. mining.
  14. There are 5 main parameters to tuning scrypt, all of which are optional for
  15. further fine tuning. When you start scrypt mining with the --scrypt option,
  16. BFGMiner will fail IN RANDOM WAYS. They are all due to parameters being outside
  17. what the GPU can cope with.
  18. NOTE that if it does not fail at startup, the presence of hardware errors (HW)
  19. are a sure sign that you have set the parameters too high.
  20. DRIVERS AND OPENCL SDK
  21. The choice of driver version for your GPU is critical, as some are known to
  22. break scrypt mining entirely while others give poor hashrates. As for the
  23. OpenCL SDK installed, for AMD it must be version 2.6 or later.
  24. Step 1 on Linux:
  25. export GPU_MAX_ALLOC_PERCENT=100
  26. If you do not do this, you may find it impossible to scrypt mine. You may find
  27. a value of 40 is enough and increasing this further has little effect.
  28. export GPU_USE_SYNC_OBJECTS=1
  29. may help CPU usage a little as well.
  30. On windows the same commands can be passed via a batch file if the following
  31. lines are in the .bat before starting BFGMiner:
  32. setx GPU_MAX_ALLOC_PERCENT 100
  33. setx GPU_USE_SYNC_OBJECTS 1
  34. intensity=XX
  35. Just like in Bitcoin mining, scrypt mining takes an intensity, however the
  36. scale goes from 0 to 31.
  37. The reason this is crucial is that too high an intensity can actually be
  38. disastrous with scrypt because it CAN run out of ram. High intensities
  39. start writing over the same ram and it is highly dependent on the GPU, but they
  40. can start actually DECREASING your hashrate, or even worse, start producing
  41. garbage with HW errors skyrocketing. Note that if you do NOT specify an
  42. intensity, BFGMiner uses dynamic mode which is designed to minimise the harm
  43. to a running desktop and performance WILL be poor. The lower limit to intensity
  44. with scrypt is usually 8 and BFGMiner will prevent it going too low.
  45. SUMMARY: Setting this for reasonable hashrates is mandatory.
  46. shaders=XXX
  47. is a new option where you tell BFGMiner how many shaders your GPU has. This
  48. helps BFGMiner try to choose some meaningful baseline parameters. Use this table
  49. below to determine how many shaders your GPU has, and note that there are some
  50. variants of these cards, and Nvidia shaders are much much lower and virtually
  51. pointless trying to mine on. If this is not set, BFGMiner will query the
  52. device for how much memory it supports and will try to set a value based on
  53. that instead.
  54. SUMMARY: This will get you started but fine tuning for optimal performance is
  55. required.
  56. GPU Shaders
  57. 7750 512
  58. 7770 640
  59. 7850 1024
  60. 7870 1280
  61. 7950 1792
  62. 7970 2048
  63. 6850 960
  64. 6870 1120
  65. 6950 1408
  66. 6970 1536
  67. 6990 (6970x2)
  68. 6570 480
  69. 6670 480
  70. 6790 800
  71. 6450 160
  72. 5670 400
  73. 5750 720
  74. 5770 800
  75. 5830 1120
  76. 5850 1440
  77. 5870 1600
  78. 5970 (5870x2)
  79. These are only used as a rough guide for BFGMiner, and it is rare that this is
  80. all you will need to set.
  81. Optional parameters to tune:
  82. kernel, threads, thread-concurrency, lookup-gap
  83. kernel:
  84. This selects the OpenCL code to use. By default, the kernel named "scrypt" will
  85. be used. BFGMiner also includes optimised versions from Zuikkis and Pavel
  86. Semjanov, which you can specify by filename:
  87. --set-device OCL:kernel=zuikkis
  88. --set-device OCL:kernel=psw
  89. Note that Zuikkis' version requires the default lookup-gap of 2.
  90. thread-concurrency:
  91. This tunes the optimal size of work that scrypt can do. It is internally tuned
  92. by BFGMiner to be the highest reasonable multiple of shaders that it can
  93. allocate on your GPU. Ideally it should be a multiple of your shader count.
  94. vliw5 architecture (R5XXX) would be best at 5x shaders, while VLIW4 (R6xxx and
  95. R7xxx) are best at 4x. Setting thread concurrency overrides anything you put
  96. into the shaders config and is ultimately a BETTER way to tune performance.
  97. SUMMARY: Spend lots of time finding the highest value that your device likes
  98. and increases hashrate.
  99. threads:
  100. Once you have found the optimal shaders and intensity, you can start increasing
  101. the threads value till BFGMiner fails to start. This is really only of value if
  102. you want to run low intensities as you will be unable to run more than 1.
  103. SUMMARY: Don't touch this.
  104. lookup-gap:
  105. This tunes a compromise between ram usage and performance. Performance peaks
  106. at a gap of 2, but increasing the gap can save you some GPU ram, but almost
  107. always at the cost of significant loss of hashrate. Setting lookup gap
  108. overrides the default of 2, but BFGMiner will use the provided shaders value to
  109. choose a thread-concurrency if you haven't chosen one.
  110. SUMMARY: Don't touch this.
  111. Related parameters:
  112. work_size=XX
  113. Has a minor effect, should be a multiple of 64 up to 256 maximum.
  114. SUMMARY: Worth playing with once everything else has been tried but will
  115. probably do nothing.
  116. vectors=XX
  117. Vectors are NOT used by scrypt mining kernels.
  118. SUMMARY: Does nothing.
  119. Overclocking for scrypt mining:
  120. First of all, do not underclock your memory initially. Scrypt mining requires
  121. memory speed and on most, but not all, GPUs, lowering memory speed lowers
  122. mining performance.
  123. Second, absolute engine clock speeds do NOT correlate with hashrate. The ratio
  124. of engine clock speed to memory matters, so if you set your memory to the
  125. default value, and then start overclocking as you are running it, you should
  126. find a sweet spot where the hashrate peaks and then it might actually drop if
  127. you increase the engine clock speed further.
  128. Third, the combination of motherboard, CPU and system ram ALSO makes a
  129. difference, so values that work for a GPU on one system may not work for the
  130. same GPU on a different system. A decent amount of system ram is actually
  131. required for scrypt mining, and 4GB is suggested.
  132. Finally, the power consumption while mining at high engine clocks, very high
  133. memory clocks can be far in excess of what you might imagine.
  134. For example, a 7970 running with the following settings:
  135. --set-device OCL:thread-concurrency=22392 --set-device OCL:clock=1135
  136. --set-device OCL:memclock=1890
  137. was using 305W!
  138. ---
  139. TUNING AN AMD RADEON 7970
  140. Example tuning a 7970 for Scrypt mining:
  141. On Linux run this command:
  142. export GPU_MAX_ALLOC_PERCENT=100
  143. or on Windows this:
  144. setx GPU_MAX_ALLOC_PERCENT 100
  145. in the same console/bash/dos prompt/bat file/whatever you want to call it,
  146. before running BFGMiner.
  147. First, find the highest thread concurrency that you can start it at. They should
  148. all start at 8192 but some will go up to 3 times that. Don't go too high on the
  149. intensity while testing and don't change gpu threads. If you cannot go above
  150. 8192, don't fret as you can still get a high hashrate.
  151. Delete any .bin files so you're starting from scratch and see what bins get
  152. generated.
  153. First try without any thread concurrency or even shaders, as BFGMiner will try to
  154. find an optimal value:
  155. bfgminer --set-device OCL:intensity=13
  156. If that starts mining, see what bin was generated, it is likely the largest
  157. meaningful TC you can set.
  158. Starting it on mine I get:
  159. scrypt130302Tahitiglg2tc22392w64l8.bin
  160. Note that tc22392 tells you what thread concurrency it was. It should start
  161. without TC parameters, but you never know. So if it doesn't, start with
  162. --set-device OCL:thread-concurrency=8192 and add 2048 to it at a time till you
  163. find the highest value it will start successfully at.
  164. If you wish to get a little extra from your hardware, you may also try
  165. overclocking. Do note that this will damage your GPUs and void your warranty,
  166. so unless you are willing to take that risk, skip the clock and memclock
  167. parameters!
  168. Then start overclocking the eyeballs off your memory, as 7970s are exquisitely
  169. sensitive to memory speed and amazingly overclockable but please make sure it
  170. keeps adequately cooled with --auto-fan! Do it while it's running from the GPU
  171. menu. Go up by 25 at a time every 30 seconds or so until your GPU crashes. Then
  172. reboot and start it 25 lower as a rough start. One example runs stable at 1900
  173. memory without overvolting.
  174. Then once you find the maximum memory clock speed, you need to find the sweet
  175. spot engine clock speed that matches it. It's a fine line where one more MHz
  176. will make the hashrate drop by 20%. It's somewhere in the .57 - 0.6 ratio range.
  177. Start your engine clock speed at half your memory clock speed and then increase
  178. it by 5 at a time. The hashrate should climb a little each rise in engine speed
  179. and then suddenly drop above a certain value. Decrease it by 1 then until you
  180. find it climbs dramatically. If your engine clock speed cannot get that high
  181. without crashing the GPU, you will have to use a lower memclock.
  182. Then, and only then, bother trying to increase intensity further.
  183. My final settings were:
  184. --set-device OCL:clock=1141 --set-device OCL:memclock=1875 --set-device OCL:intensity=20
  185. for a hashrate of 745kH.
  186. Note I did not bother setting a thread concurrency. Once you have the magic
  187. endpoint, look at what tc was chosen by the bin file generated and then hard
  188. code that in next time (eg --set-device OCL:thread-concurrency=22392) as slight
  189. changes in thread concurrency will happen every time if you don't specify one,
  190. and the tc to clock ratios are critical!
  191. Your numbers will be your numbers depending on your hardware combination and OS,
  192. so don't expect to get exactly the same results!