SCRYPT-README 9.5 KB

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