README 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. This is a multi-threaded multi-pool CPU and GPU miner for bitcoin and
  2. derivative coins.
  3. GIT TREE:
  4. https://github.com/ckolivas/cgminer
  5. Support thread:
  6. http://bitcointalk.org/index.php?topic=28402.0
  7. IRC Channel:
  8. irc://irc.freenode.net/cgminer
  9. License: GPLv2. See COPYING for details.
  10. Dependencies:
  11. curl dev library http://curl.haxx.se/libcurl/
  12. (libcurl4-openssl-dev)
  13. curses dev library
  14. (libncurses5-dev or libpdcurses on WIN32)
  15. pkg-config http://www.freedesktop.org/wiki/Software/pkg-config
  16. jansson http://www.digip.org/jansson/
  17. (jansson is included in-tree and not necessary)
  18. yasm 1.0.1+ http://yasm.tortall.net/
  19. (yasm is optional, gives assembly routines for CPU mining)
  20. Basic *nix build instructions:
  21. To build with GPU mining support:
  22. Install AMD APP sdk, latest version - there is no official place to
  23. install it so just keep track of where it is if you're not installing
  24. the include files and library files into the system directory.
  25. (Do NOT install the ati amd sdk if you are on nvidia)
  26. The easiest way to install the ATI AMD SPP sdk on linux is to actually put it
  27. into a system location. Then building will be simpler. Download the correct
  28. version for either 32 bit or 64 bit from here:
  29. http://developer.amd.com/sdks/AMDAPPSDK/downloads/Pages/default.aspx
  30. This will give you a file with a name like AMD-APP-SDK-v2.4-lnx64.tgz
  31. Then:
  32. sudo su
  33. cd /opt
  34. tar xf /path/to/AMD-APP-SDK-v2.4-lnx64.tgz
  35. cd /
  36. tar xf /opt/AMD-APP-SDK-v2.4-lnx64/icd-registration.tgz
  37. ln -s /opt/AMD-APP-SDK-v2.4-lnx64/include/CL /usr/include
  38. ln -s /opt/AMD-APP-SDK-v2.4-lnx64/lib/x86_64/* /usr/lib/
  39. ldconfig
  40. If you are on 32 bit, x86_64 in the 2nd last line should be x86
  41. To actually build:
  42. ./autogen.sh # only needed if building from git repo
  43. CFLAGS="-O2 -Wall -march=native" ./configure
  44. or if you haven't installed the ati files in system locations:
  45. CFLAGS="-O2 -Wall -march=native -I<path to AMD APP include>" LDFLAGS="-L<path to AMD APP lib/x86_64> ./configure
  46. make
  47. If it finds the opencl files it will inform you with
  48. "OpenCL: FOUND. GPU mining support enabled."
  49. Basic WIN32 build instructions (on Fedora 13; requires mingw32):
  50. ./autogen.sh # only needed if building from git repo
  51. rm -f mingw32-config.cache
  52. MINGW32_CFLAGS="-O2 -Wall -msse2" mingw32-configure
  53. make
  54. ./mknsis.sh
  55. Native WIN32 build instructions (on mingw32, on windows):
  56. Install the Microsoft platform SDK
  57. Install AMD APP sdk, latest version (only if you want GPU mining)
  58. (Do NOT install the ati amd sdk if you are on nvidia)
  59. Install mingw32
  60. Install libcurl, copy libcurl.m4 into /mingw/share/aclocal
  61. Install pkg-config, copy pkg.m4 into /mingw/share/aclocal
  62. Run:
  63. autoreconf -fvi
  64. CFLAGS="-O2 -msse2" ./configure
  65. make
  66. ---
  67. Usage instructions: Run "cgminer --help" to see options:
  68. Usage: ./cgminer [-atDdGCgIKklmpPQqrRsTouvwOchnV]
  69. Options for both config file and command line:
  70. --algo|-a <arg> Specify sha256 implementation for CPU mining:
  71. auto Benchmark at startup and pick fastest algorithm
  72. c Linux kernel sha256, implemented in C
  73. 4way tcatm's 4-way SSE2 implementation
  74. via VIA padlock implementation
  75. cryptopp Crypto++ C/C++ implementation
  76. sse2_64 SSE2 64 bit implementation for x86_64 machines
  77. sse4_64 SSE4.1 64 bit implementation for x86_64 machines (default: sse2_64)
  78. --cpu-threads|-t <arg> Number of miner CPU threads (default: 4)
  79. --debug|-D Enable debug output
  80. --device|-d <arg> Select device to use, (Use repeat -d for multiple devices, default: all)
  81. --disable-gpu|-G Disable GPU mining even if suitable devices exist
  82. --enable-cpu|-C Enable CPU mining with GPU mining (default: no CPU mining if suitable GPUs exist)
  83. --failover-only Don't leak work to backup pools when primary pool is lagging
  84. --gpu-threads|-g <arg> Number of threads per GPU (1 - 10) (default: 2)
  85. --intensity|-I <arg> Intensity of GPU scanning (-10 -> 10, default: dynamic to maintain desktop interactivity)
  86. --kernel-path|-K <arg> Specify a path to where the kernel .cl files are (default: "/usr/local/bin")
  87. --kernel|-k <arg> Select kernel to use (poclbm or phatk - default: auto)
  88. --load-balance Change multipool strategy from failover to even load balance
  89. --log|-l <arg> Interval in seconds between log output (default: 5)
  90. --monitor|-m <arg> Use custom pipe cmd for output messages
  91. --no-longpoll Disable X-Long-Polling support
  92. --no-restart Do not attempt to restart GPUs that hang
  93. --pass|-p <arg> Password for bitcoin JSON-RPC server
  94. --per-device-stats Force verbose mode and output per-device statistics
  95. --protocol-dump|-P Verbose dump of protocol-level activities
  96. --queue|-Q <arg> Minimum number of work items to have queued (0 - 10) (default: 1)
  97. --quiet|-q Disable logging output, display status and errors
  98. --real-quiet Disable all output
  99. --retries|-r <arg> Number of times to retry before giving up, if JSON-RPC call fails (-1 means never) (default: -1)
  100. --retry-pause|-R <arg> Number of seconds to pause, between retries (default: 5)
  101. --rotate <arg> Change multipool strategy from failover to regularly rotate at N minutes (default: 0)
  102. --round-robin Change multipool strategy from failover to round robin on failure
  103. --scan-time|-s <arg> Upper bound on time spent scanning current work, in seconds (default: 60)
  104. --sched-start <arg> Set a time of day in HH:MM to start mining (a once off without a stop time)
  105. --sched-stop <arg> Set a time of day in HH:MM to stop mining (will quit without a start time)
  106. --shares <arg> Quit after mining N shares (default: unlimited)
  107. --submit-stale Submit shares even if they would normally be considered stale
  108. --syslog Use system log for output messages (default: standard error)
  109. --text-only|-T Disable ncurses formatted screen output
  110. --url|-o <arg> URL for bitcoin JSON-RPC server
  111. --user|-u <arg> Username for bitcoin JSON-RPC server
  112. --vectors|-v <arg> Override detected optimal vector width (1, 2 or 4)
  113. --verbose Log verbose output to stderr as well as status output
  114. --worksize|-w <arg> Override detected optimal worksize (default: 0)
  115. --userpass|-O <arg> Username:Password pair for bitcoin JSON-RPC server
  116. Options for command line only:
  117. --config|-c <arg> Load a JSON-format configuration file
  118. See example-cfg.json for an example configuration.
  119. --help|-h Print this message
  120. --ndevs|-n Enumerate number of detected GPUs and exit
  121. --version|-V Display version and exit
  122. ---
  123. EXECUTIVE SUMMARY ON USAGE:
  124. Single pool, regular desktop:
  125. cgminer -o http://pool:port -u username -p password
  126. Single pool, dedicated miner:
  127. cgminer -o http://pool:port -u username -p password -I 9
  128. Multiple pool, dedicated miner:
  129. cgminer -o http://pool1:port -u pool1username -p pool1password -o http://pool2:port -u pool2usernmae -p pool2password -I 9
  130. ---
  131. WHILE RUNNING:
  132. The following options are available while running with a single keypress:
  133. [P]ool management [S]ettings [D]isplay options [Q]uit
  134. P gives you:
  135. Current pool management strategy: Failover
  136. [A]dd pool [R]emove pool [D]isable pool [E]nable pool
  137. [C]hange management strategy [S]witch pool [I]nformation
  138. S gives you:
  139. [D]ynamic mode: On
  140. [L]ongpoll: On
  141. [I]ntensity: Dynamic
  142. [Q]ueue: 0
  143. [S]cantime: 60
  144. [R]etries: -1
  145. [P]ause: 5
  146. D gives you:
  147. Toggle: [D]ebug [N]ormal [S]ilent [V]erbose [R]PC debug
  148. [L]og interval [C]lear
  149. and Q quits the application.
  150. ---
  151. Also many issues and FAQs are covered in the forum thread
  152. dedicated to this program,
  153. http://forum.bitcoin.org/index.php?topic=28402.0
  154. The output line shows the following:
  155. [(5s):204.4 (avg):203.1 Mh/s] [Q:56 A:51 R:4 HW:0 E:91% U:2.47/m]
  156. Each column is as follows:
  157. A 5 second exponentially decaying average hash rate
  158. An all time average hash rate
  159. The number of requested work items
  160. The number of accepted shares
  161. The number of rejected shares
  162. The number of hardware erorrs
  163. The efficiency defined as the accepted shares / requested work and can be >100
  164. The utility defines as the number of shares / minute
  165. The cgminer status line shows:
  166. TQ: 1 ST: 1 SS: 0 DW: 0 NB: 1 LW: 8 GF: 1 RF: 1 I: 2
  167. TQ is Total Queued work items.
  168. ST is STaged work items (ready to use).
  169. SS is Stale Shares discarded (detected and not submitted so don't count as rejects)
  170. DW is Discarded Work items (work from block no longer valid to work on)
  171. NB is New Blocks detected on the network
  172. LW is Locally generated Work items
  173. GF is Getwork Fail Occasions (server slow to provide work)
  174. RF is Remote Fail occasions (server slow to accept work)
  175. I is current Intensity (changes in dynamic mode).
  176. NOTE: Running intensities above 9 with current hardware is likely to only
  177. diminish return performance even if the hash rate might appear better. A good
  178. starting baseline intensity to try on dedicated miners is 9. Higher values are
  179. there to cope with future improvements in hardware.
  180. ---
  181. FAILOVER STRATEGIES WITH MULTIPOOL:
  182. A number of different strategies for dealing with multipool setups are
  183. available. Each has their advantages and disadvantages so multiple strategies
  184. are available by user choice, as per the following list:
  185. FAILOVER:
  186. The default strategy is failover. This means that if you input a number of
  187. pools, it will try to use them as a priority list, moving away from the 1st
  188. to the 2nd, 2nd to 3rd and so on. If any of the earlier pools recover, it will
  189. move back to the higher priority ones.
  190. ROUND ROBIN:
  191. This strategy only moves from one pool to the next when the current one falls
  192. idle and makes no attempt to move otherwise.
  193. ROTATE:
  194. This strategy moves at user-defined intervals from one active pool to the next,
  195. skipping pools that are idle.
  196. LOAD BALANCE:
  197. This strategy sends work in equal amounts to all the pools specified. If any
  198. pool falls idle, the rest will take up the slack keeping the miner busy.
  199. ---
  200. LOGGING
  201. cgminer will log to stderr if it detects stderr is being redirected to a file.
  202. To enable logging simply add 2>logfile.txt to your command line and logfile.txt
  203. will contain the logged output at the log level you specify (normal, verbose,
  204. debug etc.)
  205. In other words if you would normally use:
  206. ./cgminer -o xxx -u yyy -p zzz
  207. if you use
  208. ./cgminer -o xxx -u yyy -p zzz 2>logfile.txt
  209. it will log to a file called logfile.txt and otherwise work the same.
  210. There is also the -m option on linux which will spawn a command of your choice
  211. and pipe the output directly to that command.
  212. ---
  213. FAQ
  214. Q: cgminer segfaults when I change my shell window size.
  215. A: Older versions of libncurses have a bug to do with refreshing a window
  216. after a size change. Upgrading to a new version of curses will fix it.
  217. Q: Can I mine on servers from different networks (eg smartcoin and bitcoin) at
  218. the same time?
  219. A: No, cgminer keeps a database of the block it's working on to ensure it does
  220. not work on stale blocks, and having different blocks from two networks would
  221. make it invalidate the work from each other.
  222. Q: Can I change the settings individually for each GPU?
  223. A: Not currently.
  224. Q: Can I put multiple pools in the json config file?
  225. A: Not currently, but you can use multiple config files and specify each with
  226. successive -c. e.g.: cgminer -c cfg1.json -c cfg2.json
  227. Q: The build fails with gcc is unable to build a binary.
  228. A: Remove the "-march=native" component of your CFLAGS as your version of gcc
  229. does not support it.
  230. Q: The CPU usage is high.
  231. A: If you're on linux, the ATI drivers after 11.6 have a bug that makes them
  232. consume 100% of one CPU core unnecessarily so downgrade to 11.6. If you're on
  233. windows, you may be out of luck because the pthread library used consumes a
  234. lot of CPU.
  235. Q: Can you implement feature X?
  236. A: I can, but time is limited, and people who donate are more likely to get
  237. their feature requests implemented.
  238. Q: My GPU hangs and I have to reboot it to get it going again?
  239. A: The more aggressively the mining software uses your GPU, the less overclock
  240. you will be able to run. You are more likely to hit your limits with cgminer
  241. and you will find you may need to overclock your GPU less aggressively. The
  242. software cannot be responsible and make your GPU hang directly.
  243. Q: The Queue total at the top is much more than the sum of all the Queued
  244. values in each device.
  245. A: The per-device queue value is only incremented when that device has
  246. requested work over any buffered amount of work, so with fewer devices this
  247. value may stay very small.
  248. Q: GUI version?
  249. A: No.
  250. ---
  251. This code is provided entirely free of charge by the programmer in his spare
  252. time so donations would be greatly appreciated.
  253. Con Kolivas <kernel@kolivas.org>
  254. 15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ