Official CGMINER thread - CPU/GPU miner in C for linux/windows/osx

作者:fjbit 来源:未知 日期:2011-9-5 14:42:27 人气: 标签:CGMINER CPU/GPU miner 【打印】

This is the official thread for support and development of cgminer, the combined gpu and cpu miner written in c, cross platform for windows, linux and osx, based on the original code cpuminer.

Help can also be obtained on IRC: #cgminer

Latest source release:

Linux 64 bit ubuntu binary:

Git tree:

Latest git source tarball:

Windows binary:

- Very low overhead free c code for Linux and windows with very low non-mining CPU  and ram usage
- Custom modified phatk and poclbm kernels
- BFI_INT patching
- VECTOR support
- Binary loading of kernels (fast startup)
- long poll support - will use longpoll from any pool if primary pool does not support it
- Self detection of new blocks with a mini-database for slow/failing longpoll scenarios, maximum work efficiency and minimum rejects.
- Heavily threaded code hands out work retrieval and work submission to separate threads to not hinder GPUs working
- Caching of submissions during transient network outages
- Preemptive fetching of work prior to completion of current work
- Local generation of more valid work (ntime rollover) whenever possible, as supported on a per-work item basis
- Prevention of stale work submission on new block
- Multi GPU support (all or discrete selection)
- CPU mining support (disabled when GPU is detected unless explicitly re-enabled)
- Summarised and discrete device data statistics of requests, accepts, rejects, hw errors, efficiency and utility
- Watchdog thread to restart idle threads but not crash machine if they don't respond
- Dynamic intensity that keeps desktop interactive under load and maximises throughput when deskop idle
- Summary displayed when quitting
- Supports multiple pools with multiple intelligent failover mechanisms
- On the fly menu based management of most settings
- Trickling of extra work to backup pools if primary pool is responding but slow
- On the fly enabling/disable/restarting of GPUs
- Lots of other stuff I can't remember. See options.

Sample output:
 cgminer version 1.5.0 - Started: [2011-07-26 23:18:22]
 [(5s):1713.9  (avg):1674.8 Mh/s] [Q:1594  A:1592  R:3  HW:0  E:100%  U:23.90/m]
 TQ: 0  ST: 0  LS: 0  SS: 0  DW: 5  NB: 9  LW: 16  LO: 6  RF: 0  I: 8
 Connected to multiple pools
 Block 00010c416dd4fa23f28652c6bb61e6f6  started: [2011-07-27 00:19:52]
 [P]ool management [G]PU management [S]ettings [D]isplay options [Q]uit
 GPU 0: [423.8 / 420.9 Mh/s] [Q:409  A:399  R:0  HW:0  E:98%  U:6.03/m]
 GPU 1: [422.7 / 417.8 Mh/s] [Q:402  A:391  R:1  HW:0  E:97%  U:5.87/m]
 GPU 2: [420.9 / 418.1 Mh/s] [Q:401  A:417  R:1  HW:0  E:104%  U:6.26/m]
 GPU 3: [422.2 / 418.5 Mh/s] [Q:402  A:387  R:1  HW:0  E:97%  U:5.86/m]

[2011-07-27 00:24:34] Accepted b47dede5 GPU 2 thread 2 pool 0
[2011-07-27 00:24:36] Accepted 8348a518 GPU 1 thread 5 pool 0
[2011-07-27 00:24:37] Accepted 6815422d GPU 0 thread 0 pool 1
[2011-07-27 00:24:41] Accepted 2e5c0036 GPU 2 thread 6 pool 0
[2011-07-27 00:24:43] Accepted 9b487e7f GPU 1 thread 5 pool 0
Pool menu:
0: Enabled Alive Priority 0:  User:ckolivas.2
1: Enabled Alive Priority 1:  User:ckolivas
2: Disabled Alive Priority 2:  User:con

Current pool management strategy: Load Balance
[A]dd pool [R]emove pool [D]isable pool [E]nable pool
[C]hange management strategy [S]witch pool [I]nformation
Or press any other key to continue

GPU menu:
GPU 0: [423.3 / 420.9 Mh/s] [Q:404  A:397  R:0  HW:0  E:99%  U:6.05/m]
Thread 0: 212.7 Mh/s Enabled Alive reported in [2011-07-27 00:24:12]
Thread 4: 210.9 Mh/s Enabled Alive reported in [2011-07-27 00:24:12]
GPU 1: [421.4 / 417.8 Mh/s] [Q:396  A:385  R:1  HW:0  E:97%  U:5.86/m]
Thread 1: 207.6 Mh/s Enabled Alive reported in [2011-07-27 00:24:12]
Thread 5: 211.9 Mh/s Enabled Alive reported in [2011-07-27 00:24:11]
GPU 2: [423.2 / 418.0 Mh/s] [Q:395  A:410  R:1  HW:0  E:104%  U:6.23/m]
Thread 2: 211.8 Mh/s Enabled Alive reported in [2011-07-27 00:24:11]
Thread 6: 211.5 Mh/s Enabled Alive reported in [2011-07-27 00:24:11]
GPU 3: [423.0 / 418.5 Mh/s] [Q:396  A:382  R:1  HW:0  E:96%  U:5.81/m]
Thread 3: 211.8 Mh/s Enabled Alive reported in [2011-07-27 00:24:11]
Thread 7: 211.3 Mh/s Enabled Alive reported in [2011-07-27 00:24:11]
[E]nable [D]isable [R]estart GPU
Or press any other key to continue

Settings menu:
[D]ynamic mode: Off
[L]ongpoll: On
[I]ntensity: 8
[Q]ueue: 0
[S]cantime: 60
[R]etries: -1
[P]ause: 5
Select an option or any other key to return

Display menu:
[D]ebug:off [S]ilent:off [V]erbose:off [R]PC debug:off [L]og interval:5
[N]ormal [C]lear
Select an option or any other key to return

On exiting:
Summary of runtime statistics:

Started at [2011-07-19 14:40:09]
Runtime: 2 hrs : 31 mins : 18 secs
Average hashrate: 1680.1 Megahash/s
Queued work requests: 3317
Share submissions: 3489
Accepted shares: 3489
Rejected shares: 0
Reject ratio: 0.0
Hardware errors: 0
Efficiency (accepted / queued): 105%
Utility (accepted shares / min): 23.06/min

Discarded work due to new blocks: 0
Stale submissions discarded due to new blocks: 9
Unable to get work from server occasions: 16
Work items generated locally: 330
Submitting work remotely delay occasions: 33
New blocks detected on network: 10

 Queued work requests: 3253
 Share submissions: 3426
 Accepted shares: 3426
 Rejected shares: 0
 Reject ratio: 0.0
 Efficiency (accepted / queued): 105%
 Discarded work due to new blocks: 0
 Stale submissions discarded due to new blocks: 9
 Unable to get work from server occasions: 15
 Submitting work remotely delay occasions: 33

 Queued work requests: 64
 Share submissions: 63
 Accepted shares: 63
 Rejected shares: 0
 Reject ratio: 0.0
 Efficiency (accepted / queued): 98%
 Discarded work due to new blocks: 0
 Stale submissions discarded due to new blocks: 0
 Unable to get work from server occasions: 1
 Submitting work remotely delay occasions: 0

Summary of per device statistics:

 GPU 0: [419.9 Mh/s] [Q:913  A:901  R:0  HW:0  E:99%  U:5.96/m]
 GPU 1: [420.1 Mh/s] [Q:912  A:865  R:0  HW:0  E:95%  U:5.72/m]
 GPU 2: [420.5 Mh/s] [Q:908  A:865  R:0  HW:0  E:95%  U:5.72/m]
 GPU 3: [419.6 Mh/s] [Q:910  A:858  R:0  HW:0  E:94%  U:5.68/m]

Command line options:

Usage: ./cgminer [-atDdGCgIKklmpPQqrRsTouvwOchnV] 
Options for both config file and command line:
--algo|-a <arg>     Specify sha256 implementation for CPU mining:
        auto            Benchmark at startup and pick fastest algorithm
        c               Linux kernel sha256, implemented in C
        4way            tcatm's 4-way SSE2 implementation
        via             VIA padlock implementation
        cryptopp        Crypto++ C/C++ implementation
        sse2_64         SSE2 64 bit implementation for x86_64 machines
        sse4_64         SSE4.1 64 bit implementation for x86_64 machines (default: sse2_64)
--cpu-threads|-t <arg> Number of miner CPU threads (default: 4)
--debug|-D          Enable debug output
--device|-d <arg>   Select device to use, (Use repeat -d for multiple devices, default: all)
--disable-gpu|-G    Disable GPU mining even if suitable devices exist
--enable-cpu|-C     Enable CPU mining with GPU mining (default: no CPU mining if suitable GPUs exist)
--failover-only     Don't leak work to backup pools when primary pool is lagging
--gpu-threads|-g <arg> Number of threads per GPU (1 - 10) (default: 2)
--intensity|-I <arg> Intensity of GPU scanning (-10 -> 10, default: dynamic to maintain desktop interactivity)
--kernel-path|-K <arg> Specify a path to where the kernel .cl files are (default: "/usr/local/bin")
--kernel|-k <arg>   Select kernel to use (poclbm or phatk - default: auto)
--load-balance      Change multipool strategy from failover to even load balance
--log|-l <arg>      Interval in seconds between log output (default: 5)
--monitor|-m <arg>  Use custom pipe cmd for output messages
--no-longpoll       Disable X-Long-Polling support
--no-restart        Do not attempt to restart GPUs that hang
--pass|-p <arg>     Password for bitcoin JSON-RPC server
--per-device-stats  Force verbose mode and output per-device statistics
--protocol-dump|-P  Verbose dump of protocol-level activities
--queue|-Q <arg>    Minimum number of work items to have queued (0 - 10) (default: 1)
--quiet|-q          Disable logging output, display status and errors
--real-quiet        Disable all output
--retries|-r <arg>  Number of times to retry before giving up, if JSON-RPC call fails (-1 means never) (default: -1)
--retry-pause|-R <arg> Number of seconds to pause, between retries (default: 5)
--rotate <arg>      Change multipool strategy from failover to regularly rotate at N minutes (default: 0)
--round-robin       Change multipool strategy from failover to round robin on failure
--scan-time|-s <arg> Upper bound on time spent scanning current work, in seconds (default: 60)
--sched-start <arg> Set a time of day in HH:MM to start mining (a once off without a stop time)
--sched-stop <arg>  Set a time of day in HH:MM to stop mining (will quit without a start time)
--shares <arg>      Quit after mining N shares (default: unlimited)
--submit-stale      Submit shares even if they would normally be considered stale
--syslog            Use system log for output messages (default: standard error)
--text-only|-T      Disable ncurses formatted screen output
--url|-o <arg>      URL for bitcoin JSON-RPC server
--user|-u <arg>     Username for bitcoin JSON-RPC server
--vectors|-v <arg>  Override detected optimal vector width (1, 2 or 4)
--verbose           Log verbose output to stderr as well as status output
--worksize|-w <arg> Override detected optimal worksize (default: 0)
--userpass|-O <arg> Username:Password pair for bitcoin JSON-RPC server
Options for command line only:
--config|-c <arg>   Load a JSON-format configuration file
See example-cfg.json for an example configuration.
--help|-h           Print this message
--ndevs|-n          Enumerate number of detected GPUs and exit
--version|-V        Display version and exit


Executive summary of how to use on dedicated miner on one pool:
cgminer -o http://poolurl:port -u username -p pass -I 9

Dedicated miner on two pools:
cgminer -o http://pool1url:port -u username1 -p pass1 -o http://pool2url:port -u username2 -p pass2 -I 9
(repeat entries for more, unlimited)

Desktop that also mines:
cgminer -o http://poolurl:port -u username -p pass

Desktop with one card used regularly for the desktop and other cards just for mining:
cgminer -o http://poolurl:port -u username -p pass -d 0
cgminer -o http://poolurl:port -u username -p pass -I 9 -d 1 -d 2
(run two instances, first is for desktop use to use card 0 and second instance for cards 1 and 2)

Intensity of 9 is about the highest throughput for a 69xx, 8 for most other cards. Higher has no benefit on current cards (maybe more with next generation cards). Note that too high a setting can actually worsen throughput, so experiment, which you can do on the fly while it's running with the Settings menu. Specifying an intensity automatically disables the dynamic intensity feature.

A number of different strategies for dealing with multipool setups are
available. Each has their advantages and disadvantages so multiple strategies
are available by user choice, as per the following list:

The default strategy is failover. This means that if you input a number of
pools, it will try to use them as a priority list, moving away from the 1st
to the 2nd, 2nd to 3rd and so on. If any of the earlier pools recover, it will
move back to the higher priority ones.

This strategy only moves from one pool to the next when the current one falls
idle and makes no attempt to move otherwise.

This strategy moves at user-defined intervals from one active pool to the next,
skipping pools that are idle.

This strategy sends work in equal amounts to all the pools specified. If any
pool falls idle, the rest will take up the slack keeping the miner busy.

What dependencies do I need on linux to build it?
libncurses, libncurses-dev, libcurl, libcurl-dev AMD ATI SDK.

Can I log the output to a file? Yes you can use the interfaced version and log at the same time, as the log goes to stderr. Start with your regular command line options and redirect stderr like this:
./cgminer -o xxx -u xxx -p xxx etc. 2>logfile.txt

It won't start, says something about no active pools: Check your login credentials are correct and that your URL includes both http:// and the port number.

It won't start, just seems to exit straight away: Make sure you run it from the directory it was installed into so it has access to the kernel files.

It won't start, says something about zero sized binary and reboot may be necessary: Try restarting it a few times. For some reason the initialisation code may not start the first time. Then try rebooting.

CPU mining is slow: The windows build does not include the 64 bit assembly required to run fast.

CPU usage is high with GPU mining: On windows it might be due to the pthread implementation in use there. Setting affinity to one CPU will help. Linux is my primary platform, sorry.

CPU usage is high on linux: Problem with the the catalyst 11.7+ drivers. Stick to 11.6 for now till they sort it out. Ironically, 11.8 is better on windows.

Primary developer for cgminer. 
Donation/tips? Sponsors can make feature requests for cgminer.
Please drop me a message when you donate so I can thank you personally if you don't need anonymity. Otherwise, thanks!
安全联盟站长平台 360网站安全平台