Table of Contents
- Introduction
- Dependencies
- Build Options
- Usage Instructions
- The Display
- Menu Options
- The Output
- Multi Pool
- Logging
- Overclocking
- GPU Device Issues and Mapping
- FAQ (Frequently Asked Questions)
- Mining Scrypt (Litecoins)
Dependencies:
curl dev library http://curl.haxx.se/libcurl/ (libcurl4-openssl-dev) curses dev library (libncurses5-dev or libpdcurses on WIN32) pkg-config http://www.freedesktop.org/wiki/Software/pkg-config libtool http://www.gnu.org/software/libtool/ jansson http://www.digip.org/jansson/ (jansson is included in-tree and not necessary) yasm 1.0.1+ http://yasm.tortall.net/ (yasm is optional, gives assembly routines for CPU mining) AMD APP SDK http://developer.amd.com/sdks/AMDAPPSDK (This sdk is mandatory for GPU mining) AMD ADL SDK http://developer.amd.com/sdks/ADLSDK (This sdk is mandatory for ATI GPU monitoring & clocking) libudev headers (This is only required for FPGA auto-detection and is linux only) libusb headers (This is only required for ZTEX support)
Build Options
CGMiner specific configuration options: --enable-cpumining Build with cpu mining support(default disabled) --disable-opencl Override detection and disable building with opencl --disable-adl Override detection and disable building with adl --enable-bitforce Compile support for BitForce FPGAs(default disabled) --enable-icarus Compile support for Icarus Board(default disabled) --enable-modminer Compile support for ModMiner FPGAs(default disabled) --enable-ztex Compile support for Ztex Board(default disabled) --enable-scrypt Compile support for scrypt litecoin mining (default disabled) --without-curses Compile support for curses TUI (default enabled) --without-libudev Autodetect FPGAs using libudev (default enabled) Basic *nix build instructions: To build with GPU mining support: Install AMD APP sdk, ideal version (see FAQ!) - no official place to install it so just keep track of where it is if you're not installing the include files and library files into the system directory. (Do NOT install the ati amd sdk if you are on nvidia.) To build with GPU monitoring & clocking support: Extract the AMD ADL SDK, latest version - there is also no official place for these files. Copy all the *.h files in the "include" directory into cgminer's ADL_SDK directory. The easiest way to install the ATI AMD SPP sdk on linux is to actually put it into a system location. Then building will be simpler. Download the correct version for either 32 bit or 64 bit from here: http://developer.amd.com/sdks/AMDAPPSDK/downloads/Pages/default.aspx This will give you a file with a name like AMD-APP-SDK-v2.4-lnx64.tgz Then: sudo su cd /opt tar xf /path/to/AMD-APP-SDK-v2.4-lnx64.tgz cd / tar xf /opt/AMD-APP-SDK-v2.4-lnx64/icd-registration.tgz ln -s /opt/AMD-APP-SDK-v2.4-lnx64/include/CL /usr/include ln -s /opt/AMD-APP-SDK-v2.4-lnx64/lib/x86_64/* /usr/lib/ ldconfig If you are on 32 bit, x86_64 in the 2nd last line should be x86 To actually build: ./autogen.sh # only needed if building from git repo CFLAGS="-O2 -Wall -march=native" ./configure or if you haven't installed the ati files in system locations: CFLAGS="-O2 -Wall -march=native -I<path to AMD APP include>" LDFLAGS="-L<path to AMD APP lib/x86_64> ./configure make If it finds the opencl files it will inform you with "OpenCL: FOUND. GPU mining support enabled." Basic WIN32 build instructions (LIKELY OUTDATED INFO. requires mingw32): ./autogen.sh # only needed if building from git repo rm -f mingw32-config.cache MINGW32_CFLAGS="-O2 -Wall -msse2" mingw32-configure make ./mknsis.shFor Native WIN32 build instructions: Click Here
Usage
Run "cgminer --help" to see these options:Usage: . [-atDdGCgIKklmpPQqrRsTouvwOchnV]
Options for both config file and command line:
NOTE:
-single dash is used for a single letter command (case is sensative)
- -double dash for commands with more than one letter, or phrases
-single dash is used for a single letter command (case is sensative)
- -double dash for commands with more than one letter, or phrases
- --api-allow
- Allow API access (if enabled) only to the given list of [W:]IP[/Prefix] address[/subnets]
- This overrides --api-network and you must specify 127.0.0.1 if it is required
- W: in front of the IP address gives that address privileged access to all api commands
- --api-description
- Description placed in the API status header (default: cgminer version)
- --api-groups
- API one letter groups G:cmd:cmd[,P:cmd:*...]
- See API-README for usage
- --api-listen
- Listen for API requests (default: disabled)
- By default any command that does not just display data returns access denied
- See --api-allow to overcome this
- --api-network
- Allow API (if enabled) to listen on/for any address (default: only 127.0.0.1)
- --api-port
- Port number of miner API (default: 4028)
- --auto-fan
- Automatically adjust all GPU fan speeds to maintain a target temperature
- --auto-gpu
- Automatically adjust all GPU engine clock speeds to maintain a target temperature
- --balance
- Change multipool strategy from failover to even share balance
- --benchmark
- Run cgminer in benchmark mode - produces no shares
- --compact
- Use compact display without per device statistics
- --debug|-D
- Enable debug output
- --expiry|-E <arg>
- Upper bound on how many seconds after getting work we consider a share from it stale (default: 120)
- --failover-only
- Don't leak work to backup pools when primary pool is lagging
- --fix-protocol
- Do not redirect to a different getwork protocol (eg. stratum)
- --kernel-path|-K <arg>
- Specify a path to where bitstream and kernel files are (default: "/usr/local/bin")
- --load-balance
- Change multipool strategy from failover to efficiency based balance
- --log|-l <arg>
- Interval in seconds between log output (default: 5)
- --monitor|-m <arg>
- Use custom pipe cmd for output messages
- --net-delay
- Impose small delays in networking to not overload slow routers
- --no-pool-disable
- Do not automatically disable pools that continually reject shares
- --no-restart
- Do not attempt to restart GPUs that hang or cgminer if it crashes
- --no-submit-stale
- Don't submit shares if they are detected as stale
- --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
- --remove-disabled
- Remove disabled devices entirely, as if they didn't exist
- --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)
- --scrypt
- Use the scrypt algorithm for mining (litecoin only)
- --sharelog <arg>
- Append share log to file
- --shares <arg>
- Quit after mining N shares (default: unlimited)
- --socks-proxy <arg>
- Set socks4 proxy (host:port) for all pools without a proxy specified
- --syslog
- Use system log for output messages (default: standard error)
- --temp-cutoff <arg>
- Temperature where a device will be automatically disabled, one value or comma separated list (default: 95)
- --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
- --verbose
- Log verbose output to stderr as well as status output
- --userpass|-O <arg>
- Username:Password pair for bitcoin JSON-RPC server
- --config|-c <arg>
- Load a JSON-format configuration file
- See example.conf for an example configuration.
- --help|-h
- Print this message
- --version|-V
- Display version and exit
- --auto-fan
- Automatically adjust all GPU fan speeds to maintain a target temperature
- --auto-gpu
- Automatically adjust all GPU engine clock speeds to maintain a target temperature
- --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
- --gpu-threads|-g <arg>
- Number of threads per GPU (1 - 10) (default: 2)
- --gpu-dyninterval <arg>
- Set the refresh interval in ms for GPUs using dynamic intensity (default: 7)
- --gpu-engine <arg>
- GPU engine (over)clock range in Mhz - one value, range and/or comma separated list (e.g. 850-900,900,750-850)
- --gpu-fan <arg>
- GPU fan percentage range - one value, range and/or comma separated list (e.g. 25-85,85,65)
- --gpu-map <arg>
- Map OpenCL to ADL device order manually, paired CSV (e.g. 1:0,2:1 maps OpenCL 1 to ADL 0, 2 to 1)
- --gpu-memclock <arg>
- Set the GPU memory (over)clock in Mhz - one value for all or separate by commas for per card.
- --gpu-memdiff <arg>
- Set a fixed difference in clock speed between the GPU and memory in auto-gpu mode
- --gpu-powertune <arg>
- Set the GPU powertune percentage - one value for all or separate by commas for per card.
- --gpu-reorder
- Attempt to reorder GPU devices according to PCI Bus ID
- --gpu-vddc <arg>
- Set the GPU voltage in Volts - one value for all or separate by commas for per card.
- --intensity|-I <arg>
- Intensity of GPU scanning (d or -10 -> 10, default: d to maintain desktop interactivity)
- --kernel|-k <arg>
- Override kernel to use (diablo, poclbm, phatk or diakgcn) - one value or comma separated
- --ndevs|-n
- Enumerate number of detected GPUs and exit
- --temp-hysteresis <arg>
- Set how much the temperature can fluctuate outside limits when automanaging speeds (default: 3)
- --temp-overheat <arg>
- Overheat temperature when automatically managing fan and GPU speeds (default: 85)
- --temp-target <arg>
- Target temperature when automatically managing fan and GPU speeds (default: 75)
- --vectors|-v <arg>
- Override detected optimal vector (1, 2 or 4) - one value or comma separated list
- --worksize|-w <arg>
- Override detected optimal worksize - one value or comma separated list
- --lookup-gap <arg>
- Set GPU lookup gap for scrypt mining, comma separated
- --thread-concurrency <arg>
- Set GPU thread concurrency for scrypt mining, comma separated
Click Here for more information regarding litecoin mining (scrypt mining)
FPGA mining boards(BitForce, Icarus, ModMiner, Ztex) only options:- --scan-serial|-S <arg>
- Serial port to probe for FPGA mining device
- This option is only for BitForce, Icarus, and/or ModMiner FPGAs
On linux <arg> is usually of the format /dev/ttyUSBn
On windows <arg> is usually of the format \\.\COMn
(where n = the correct device number for the FPGA device)
The official supplied binaries are compiled with support for all FPGAs. To force the code to only attempt detection with a specific driver, prepend the argument with the driver name followed by a colon. For example, "icarus:/dev/ttyUSB0" or "bitforce:\\.\COM5" or using the short name: "ica:/dev/ttyUSB0" or "bfl:\\.\COM5"
For other FPGA details Click Here
CPU only options (deprecated, not included in binaries!): --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) --enable-cpu|-C Enable CPU mining with other mining (default: no CPU mining if other devices exist)
EXECUTIVE SUMMARY ON USAGE:
After saving configuration from the menu, you do not need to give cgminer any arguments and it will load your configuration.
Any configuration file may also contain a single "include" : "filename" to recursively include another configuration file. Writing the configuration will save all settings from all files in the output.
- Single pool, regular desktop:
cgminer -o http://pool:port -u username -p password - Single pool, dedicated miner:
cgminer -o http://pool:port -u username -p password -I 9 - Single pool, first card regular desktop, 3 other dedicated cards:
cgminer -o http://pool:port -u username -p password -I d,9,9,9 - Multiple pool, dedicated miner:
cgminer -o http://pool1:port -u pool1username -p pool1password -o http://pool2:port -u pool2usernmae -p pool2password -I 9 - Add overclocking settings, GPU and fan control for all cards:
cgminer -o http://pool:port -u username -p password -I 9 --auto-fan --auto-gpu --gpu-engine 750-950 --gpu-memclock 300 - Add overclocking settings, GPU and fan control with different engine settings for 4 cards:
cgminer -o http://pool:port -u username -p password -I 9 --auto-fan --auto-gpu --gpu-engine 750-950,945,700-930,960 --gpu-memclock 300 - Single pool with a standard http proxy, regular desktop:
cgminer -o "http:proxy:port|http://pool:port" -u username -p password - Single pool with a socks5 proxy, regular desktop:
cgminer -o "socks5:proxy:port|http://pool:port" -u username -p password - Single pool with stratum protocol support:
cgminer -o stratum+tcp://pool:port -u username -p password - The list of proxy types are:
- http: standard http 1.1 proxy
- http0: http 1.0 proxy
- socks4: socks4 proxy
- socks5: socks5 proxy
- socks4a: socks4a proxy
- socks5h: socks5 proxy using a hostname
If you specify the --socks-proxy option to cgminer, it will only be applied to all pools that don't specify their own proxy setting like above
Click Here to READ WARNINGS AND DOCUMENTATION ABOUT OVERCLOCKING
On Linux you virtually always need to export your display settings before starting to get all the cards recognised and/or temperature+clocking working:
export DISPLAY=:0
The Display
This is what the display looks like while running:
cgminer version 2.8.7 - Started: [2012-11-10 13:39:31] -------------------------------------------------------------------------------- (5s):765.2M (avg):740.1Mh/s | Q:37 A:2995 R:3 HW:0 E:8095% U:163.3/m TQ: 0 ST: 4 SS: 49 DW: 18 NB: 7 LW: 160 GF: 2 RF: 0 WU: 166.5 Connected to localhost with LP as user USER Block: 37ba8546fbbfb95497af0cf9... Started: [13:57:04] Best share: 13.1M -------------------------------------------------------------------------------- [P]ool management [G]PU management [S]ettings [D]isplay options [Q]uit GPU 0: 74.0C 3768RPM | 305.5M/305.7Mh/s | A:1239 R:2 HW:0 U: 67.57/m I:18 GPU 1: 65.0C 2022RPM | 141.7M/141.1Mh/s | A: 574 R:0 HW:0 U: 31.31/m I:12 GPU 2: 74.5C 3169RPM | 293.3M/293.3Mh/s | A:1187 R:1 HW:0 U: 64.74/m I:18 -------------------------------------------------------------------------------- [2012-11-10 13:57:47] Accepted 000000be Diff 344/3 GPU 0 pool 0 [2012-11-10 13:57:49] Accepted 00001acc Diff 9/3 GPU 0 pool 0 [2012-11-10 13:57:49] Accepted 00001515 Diff 12/3 GPU 0 pool 0 [2012-11-10 13:57:49] Accepted 00001915 Diff 10/3 GPU 0 pool 0 [2012-11-10 13:57:50] Accepted 00002e32 Diff 5/3 GPU 2 pool 0 [2012-11-10 13:57:50] Accepted 0000327d Diff 5/3 GPU 2 pool 0 [2012-11-10 13:57:51] Accepted 00001313 Diff 13/3 GPU 1 pool 0 [2012-11-10 13:57:52] Accepted 00003fd4 Diff 4/3 GPU 1 pool 0 [2012-11-10 13:57:53] Accepted 00001f3b Diff 8/3 GPU 2 pool 0 [2012-11-10 13:57:53] Accepted 0000328f Diff 5/3 GPU 2 pool 0 [2012-11-10 13:57:53] Accepted 0000246a Diff 7/3 GPU 1 pool 0
Menu Options - The on-screen menu
The following options are available while running with a single keypress:
The running log shows output like this:
Also many issues and FAQs are covered in the forum thread dedicated to this program,
http://forum.bitcoin.org/index.php?topic=28402.0
[P]ool management [G]PU management [S]ettings [D]isplay options [Q]uitP gives you:
Current pool management strategy: Failover [F]ailover only disabled [A]dd pool [R]emove pool [D]isable pool [E]nable pool [C]hange management strategy [S]witch pool [I]nformationG gives you something like:
GPU 0: [124.2 / 191.3 Mh/s] [Q:212 A:77 R:33 HW:0 E:36% U:1.73/m] Temp: 67.0 C Fan Speed: 35% (2500 RPM) Engine Clock: 960 MHz Memory Clock: 480 Mhz Vddc: 1.200 V Activity: 93% Powertune: 0% Last initialised: [2011-09-06 12:03:56] Thread 0: 62.4 Mh/s Enabled ALIVE Thread 1: 60.2 Mh/s Enabled ALIVE [E]nable [D]isable [R]estart GPU [C]hange settings Or press any other key to continueS gives you:
[Q]ueue: 1 [S]cantime: 60 [E]xpiry: 120 [W]rite config file [C]gminer restartD gives you:
[N]ormal [C]lear [S]ilent mode (disable all output) [D]ebug:off [P]er-device:off [Q]uiet:off [V]erbose:off [R]PC debug:off [W]orkTime details:off co[M]pact: off [L]og interval:5Q quits the application.
The running log shows output like this:
[2012-10-12 18:02:20] Accepted f0c05469 Diff 1/1 GPU 0 pool 1 [2012-10-12 18:02:22] Accepted 218ac982 Diff 7/1 GPU 1 pool 1 [2012-10-12 18:02:23] Accepted d8300795 Diff 1/1 GPU 3 pool 1 [2012-10-12 18:02:24] Accepted 122c1ff1 Diff 14/1 GPU 1 pool 1The 8 byte hex values are the 2nd 8 bytes of the share being submitted to the pool. The 2 diff values are the actual difficulty target that share reached followed by the difficulty target the pool is currently asking for.
Also many issues and FAQs are covered in the forum thread dedicated to this program,
http://forum.bitcoin.org/index.php?topic=28402.0
The Output - What each section means
The first output line shows the following:
(5s):1713.6 (avg):1707.8 Mh/s | Q:301 A:729 R:8 HW:0 E:242% U:22.53/mAnd this is what they mean / stand-for
- 5s:
- A 5 second exponentially decaying average hash rate
- avg:
- An all time average hash rate
- Q:
- The number of requested (Queued) work items from the pools
- A:
- The number of Accepted shares
- R:
- The number of Rejected shares
- HW:
- The number of HardWare errors
- E:
- The Efficiency defined as number of shares returned / work item
- U:
- The Utility defined as the number of shares / minute
TQ: 1 ST: 1 SS: 0 DW: 0 NB: 1 LW: 8 GF: 1 RF: 1 WU:4.4/m
- TQ
- Total Queued work items.
- ST
- STaged work items (ready to use).
- SS
- Stale Shares discarded (detected and not submitted so don't count as rejects)
- DW
- Discarded Work items (work from block no longer valid to work on)
- NB
- New Blocks detected on the network
- LW
- Locally generated Work items
- GF
- Getwork Fail Occasions (server slow to provide work)
- RF
- Remote Fail occasions (server slow to accept work)
- WU
- Work Utility (Rate of difficulty 1 shares solved per minute)
Block: 0074c5e482e34a506d2a051a... Started: [17:17:22] Best share: 65.5K
- Block
- a short stretch of the current block
- Started
- when the new block started
- Best share
- the all-time best difficulty share you've submitted since starting cgminer this session
GPU 3: 73.5C 2551RPM | 427.3/443.0Mh/s | A:8 R:0 HW:0 U:4.39/m
- GPU 3
- Device Type & number
- 73.5C
- Temperature in Celcius(if supported)
- 2551RPM
- Fanspeed in revolutions per minute(if supported)
- 427.3
- A 5 second exponentially decaying average hash rate
- 443.0Mh/s
- An all time average hash rate
- A:
- The number of accepted shares
- R:
- The number of rejected shares
- HW:
- The number of hardware erorrs
- U:
- The utility defines as the number of shares / minute
NOTE: Running intensities above 9 with current hardware is likely to only
diminish return performance even if the hash rate might appear better. A good
starting baseline intensity to try on dedicated miners is 9. Higher values are
there to cope with future improvements in hardware.
MultiPool Strategies
Failover strategies with multipool
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:- FAILOVER
- 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.
- ROUND ROBIN
- This strategy only moves from one pool to the next when the current one falls idle and makes no attempt to move otherwise.
- ROTATE
- This strategy moves at user-defined intervals from one active pool to the next, skipping pools that are idle.
- LOAD BALANCE
- This strategy sends work to all the pools to maintain optimum load. The most efficient pools will tend to get a lot more shares. If any pool falls idle, the rest will tend to take up the slack keeping the miner busy.
- BALANCE
- This strategy monitors the amount of difficulty 1 shares solved for each pool and uses it to try to end up doing the same amount of work for all pools.
Logging
cgminer will log to stderr if it detects stderr is being redirected to a file. To enable logging simply add 2>logfile.txt to your command line and logfile.txt will contain the logged output at the log level you specify (normal, verbose, debug etc.)In other words if you would normally use:
./cgminer -o xxx -u yyy -p zzz
if you use
./cgminer -o xxx -u yyy -p zzz 2>logfile.txt
it will log to a file called logfile.txt and otherwise work the same.
There is also the -m option on linux which will spawn a command of your choice and pipe the output directly to that command.
The WorkTime details 'debug' option adds details on the end of each line displayed for Accepted or Rejected work done. An example would be:
<-00000059.ed4834a3 M:X D:1.0 G:17:02:38:0.405 C:1.855 (2.995) W:3.440 (0.000) S:0.461 R:17:02:47
The first 2 hex codes are the previous block hash, the rest are reported in seconds unless stated otherwise: The previous hash is followed by the getwork mode used M:X where X is one of P:Pool, T:Test Pool, L:LP or B:Benchmark, then D:d.ddd is the difficulty required to get a share from the work, then G:hh:mm:ss:n.nnn, which is when the getwork or LP was sent to the pool and the n.nnn is how long it took to reply, followed by 'O' on it's own if it is an original getwork, or 'C:n.nnn' if it was a clone with n.nnn stating how long after the work was recieved that it was cloned, (m.mmm) is how long from when the original work was received until work started, W:n.nnn is how long the work took to process until it was ready to submit, (m.mmm) is how long from ready to submit to actually doing the submit, this is usually 0.000 unless there was a problem with submitting the work, S:n.nnn is how long it took to submit the completed work and await the reply, R:hh:mm:ss is the actual time the work submit reply was received If you start cgminer with the --sharelog option, you can get detailed information for each share found. The argument to the option may be "-" for standard output (not advisable with the ncurses UI), any valid positive number for that file descriptor, or a filename. To log share data to a file named "share.log", you can use either: ./cgminer --sharelog 50 -o xxx -u yyy -p zzz 50>share.log ./cgminer --sharelog share.log -o xxx -u yyy -p zzz For every share found, data will be logged in a CSV (Comma Separated Value) format: timestamp,disposition,target,pool,dev,thr,sharehash,sharedata For example (this is wrapped, but it's all on one line for real): 1335313090,reject, ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000, http://localhost:8337,GPU0,0, 6f983c918f3299b58febf95ec4d0c7094ed634bc13754553ec34fc3800000000, 00000001a0980aff4ce4a96d53f4b89a2d5f0e765c978640fe24372a000001c5 000000004a4366808f81d44f26df3d69d7dc4b3473385930462d9ab707b50498 f681634a4f1f63d01a0cd43fb338000000000080000000000000000000000000 0000000000000000000000000000000000000000000000000000000080020000
Overclocking - Warning & Information
AS WITH ALL OVERCLOCKING TOOLS YOU ARE ENTIRELY RESPONSIBLE FOR ANY HARM YOU
MAY CAUSE TO YOUR HARDWARE. OVERCLOCKING CAN INVALIDATE WARRANTIES, DAMAGE
HARDWARE AND EVEN CAUSE FIRES. THE AUTHOR ASSUMES NO RESPONSIBILITY FOR ANY
DAMAGE YOU MAY CAUSE OR UNPLANNED CHILDREN THAT MAY OCCUR AS A RESULT.
The GPU monitoring, clocking and fanspeed control incorporated into cgminer
comes through use of the ATI Display Library. As such, it only supports ATI
GPUs. Even if ADL support is successfully built into cgminer, unless the card
and driver supports it, no GPU monitoring/settings will be available.Cgminer supports initial setting of GPU engine clock speed, memory clock speed, voltage, fanspeed, and the undocumented powertune feature of 69x0+ GPUs. The setting passed to cgminer is used by all GPUs unless separate values are specified. All settings can all be changed within the menu on the fly on a per-GPU basis.
For example:
--gpu-engine 950 --gpu-memclock 825
will try to set all GPU engine clocks to 950 and all memory clocks to 825,
while:
--gpu-engine 950,945,930,960 --gpu-memclock 300
will try to set the engine clock of card 0 to 950, 1 to 945, 2 to 930, 3 to 960 and all memory clocks to 300.
AUTO MODES:
There are two "auto" modes in cgminer, --auto-fan and --auto-gpu. These can be used independently of each other and are complementary. Both auto modes are designed to safely change settings while trying to maintain a target temperature. By default this is set to 75 degrees Celcius but can be changed with:--temp-target
e.g. --temp-target 80 Sets all cards' target temperature to 80 degrees. --temp-target 75,85 Sets card 0 target temperature to 75, and card 1 to 85 degrees. AUTO FAN: e.g. --auto-fan (implies 85% upper limit) --gpu-fan 25-85,65 --auto-fanFan control in auto fan works off the theory that the minimum possible fan required to maintain an optimal temperature will use less power, make less noise, and prolong the life of the fan. In auto-fan mode, the fan speed is limited to 85% if the temperature is below "overheat" intentionally, as higher fanspeeds on GPUs do not produce signficantly more cooling, yet significanly shorten the lifespan of the fans. If temperature reaches the overheat value, fanspeed will still be increased to 100%. The overheat value is set to 85 degrees by default and can be changed with:
--temp-overheat
e.g. --temp-overheat 75,85 Sets card 0 overheat threshold to 75 degrees and card 1 to 85. AUTO GPU: e.g. --auto-gpu --gpu-engine 750-950 --auto-gpu --gpu-engine 750-950,945,700-930,960GPU control in auto gpu tries to maintain as high a clock speed as possible while not reaching overheat temperatures. As a lower clock speed limit, the auto-gpu mode checks the GPU card's "normal" clock speed and will not go below this unless you have manually set a lower speed in the range. Also, unless a higher clock speed was specified at startup, it will not raise the clockspeed. If the temperature climbs, fanspeed is adjusted and optimised before GPU engine clockspeed is adjusted. If fan speed control is not available or already optimal, then GPU clock speed is only decreased if it goes over the target temperature by the hysteresis amount, which is set to 3 by default and can be changed with:
--temp-hysteresis
If the temperature drops below the target temperature, and engine clock speed is not at the highest level set at startup, cgminer will raise the clock speed. If at any time you manually set an even higher clock speed successfully in cgminer, it will record this value and use it as its new upper limit (and the same for low clock speeds and lower limits). If the temperature goes over the cutoff limit (95 degrees by default), cgminer will completely disable the GPU from mining and it will not be re-enabled unless manually done so. The cutoff temperature can be changed with:
--temp-cutoff
e.g. --temp-cutoff 95,105 Sets card 0 cutoff temperature to 95 and card 1 to 105.--gpu-memdiff -125
This setting will modify the memory speed whenever the GPU clock speed is modified by --auto-gpu. In this example, it will set the memory speed to be 125 Mhz lower than the GPU speed. This is useful for some cards like the 6970 which normally don't allow a bigger clock speed difference.
CHANGING SETTINGS
When setting values, it is important to realise that even though the driver may report the value was changed successfully, and the new card power profile information contains the values you set it to, that the card itself may refuse to use those settings. As the performance profile changes dynamically, querying the "current" value on the card can be wrong as well. So when changing values in cgminer, after a pause of 1 second, it will report to you the current values where you should check that your change has taken. An example is that 6970 reference cards will accept low memory values but refuse to actually run those lower memory values unless they're within 125 of the engine clock speed. In that scenario, they usually set their real speed back to their default.Cgminer reports the so-called "safe" range of whatever it is you are modifying when you ask to modify it on the fly. However, you can change settings to values outside this range. Despite this, the card can easily refuse to accept your changes, or worse, to accept your changes and then silently ignore them. So there is absolutely to know how far to/from where/to it can set things safely or otherwise, and there is nothing stopping you from at least trying to set them outside this range. Being very conscious of these possible failures is why cgminer will report back the current values for you to examine how exactly the card has responded. Even within the reported range of accepted values by the card, it is very easy to crash just about any card, so it cannot use those values to determine what range to set. You have to provide something meaningful manually for cgminer to work with through experimentation.
STARTUP / SHUTDOWN
When cgminer starts up, it tries to read off the current profile information for clock and fan speeds and stores these values. When quitting cgminer, it will then try to restore the original values. Changing settings outside of cgminer while it's running may be reset to the startup cgminer values when cgminer shuts down because of this.GPU Device Issues & Mapping
GPU DEVICE ISSUES and use of --gpu-map
GPUs mine with OpenCL software via the GPU device driver. This means you need to have both an OpenCL SDK installed, and the GPU device driver RUNNING (i.e. Xorg up and running configured for all devices that will mine on linux etc.) Meanwhile, the hardware monitoring that cgminer offers for AMD devices relies on the ATI Display Library (ADL) software to work. OpenCL DOES NOT TALK TO THE ADL. There is no 100% reliable way to know that OpenCL devices are identical to the ADL devices, as neither give off the same information. cgminer does its best to correlate these devices based on the order that OpenCL and ADL numbers them. It is possible that this will fail for the following reasons:- The device order is listed differently by OpenCL and ADL (rare), even if the number of devices is the same.
- There are more OpenCL devices than ADL. OpenCL stupidly sees one GPU as two devices if you have two monitors connected to the one GPU.
- There are more ADL devices than OpenCL. ADL devices include any ATI GPUs, including ones that can't mine, like some older R4xxx cards.
To get useful information, start cgminer with just the -n option. You will get output that looks like this:
[2012-04-25 13:17:34] CL Platform 0 vendor: Advanced Micro Devices, Inc. [2012-04-25 13:17:34] CL Platform 0 name: AMD Accelerated Parallel Processing [2012-04-25 13:17:34] CL Platform 0 version: OpenCL 1.1 AMD-APP (844.4) [2012-04-25 13:17:34] Platform 0 devices: 3 [2012-04-25 13:17:34] 0 Tahiti [2012-04-25 13:17:34] 1 Tahiti [2012-04-25 13:17:34] 2 Cayman [2012-04-25 13:17:34] GPU 0 AMD Radeon HD 7900 Series hardware monitoring enabled [2012-04-25 13:17:34] GPU 1 AMD Radeon HD 7900 Series hardware monitoring enabled [2012-04-25 13:17:34] GPU 2 AMD Radeon HD 6900 Series hardware monitoring enabled [2012-04-25 13:17:34] 3 GPU devices max detectedNote the number of devices here match, and the order is the same. If devices 1 and 2 were different between Tahiti and Cayman, you could run cgminer with: --gpu-map 2:1,1:2 And it would swap the monitoring it received from ADL device 1 and put it to opencl device 2 and vice versa.
If you have 2 monitors connected to the first device it would look like this:
[2012-04-25 13:17:34] Platform 0 devices: 4 [2012-04-25 13:17:34] 0 Tahiti [2012-04-25 13:17:34] 1 Tahiti [2012-04-25 13:17:34] 2 Tahiti [2012-04-25 13:17:34] 3 Cayman [2012-04-25 13:17:34] GPU 0 AMD Radeon HD 7900 Series hardware monitoring enabled [2012-04-25 13:17:34] GPU 1 AMD Radeon HD 7900 Series hardware monitoring enabled [2012-04-25 13:17:34] GPU 2 AMD Radeon HD 6900 Series hardware monitoring enabledTo work around this, you would use: -d 0 -d 2 -d 3 --gpu-map 2:1,3:2
If you have an older card as well as the rest it would look like this:
[2012-04-25 13:17:34] Platform 0 devices: 3 [2012-04-25 13:17:34] 0 Tahiti [2012-04-25 13:17:34] 1 Tahiti [2012-04-25 13:17:34] 2 Cayman [2012-04-25 13:17:34] GPU 0 AMD Radeon HD 4500 Series hardware monitoring enabled [2012-04-25 13:17:34] GPU 1 AMD Radeon HD 7900 Series hardware monitoring enabled [2012-04-25 13:17:34] GPU 2 AMD Radeon HD 7900 Series hardware monitoring enabled [2012-04-25 13:17:34] GPU 3 AMD Radeon HD 6900 Series hardware monitoring enabledTo work around this you would use: --gpu-map 0:1,1:2,2:3
For RPC API details see the API-README file
F.A.Q.
Q: cgminer segfaults when I change my shell window size. A: Older versions of libncurses have a bug to do with refreshing a window after a size change. Upgrading to a new version of curses will fix it. Q: Can I mine on servers from different networks (eg smartcoin and bitcoin) at the same time? A: No, cgminer keeps a database of the block it's working on to ensure it does not work on stale blocks, and having different blocks from two networks would make it invalidate the work from each other. Q: Can I change the intensity settings individually for each GPU? A: Yes, pass a list separated by commas such as -I d,4,9,9 Q: Can I put multiple pools in the config file? A: Yes, check the example.conf file. Alternatively, set up everything either on the command line or via the menu after startup and choose settings->write config file and the file will be loaded one each startup. Q: The build fails with gcc is unable to build a binary. A: Remove the "-march=native" component of your CFLAGS as your version of gcc does not support it. Q: The CPU usage is high. A: The ATI drivers after 11.6 have a bug that makes them consume 100% of one CPU core unnecessarily so downgrade to 11.6. Binding cgminer to one CPU core on windows can minimise it to 100% (instead of more than one core). Driver version 11.11 on linux and 11.12 on windows appear to have fixed this issue. Note that later drivers may have an apparent return of high CPU usage. Try 'export GPU_USE_SYNC_OBJECTS=1' on Linux before starting cgminer. Q: Can you implement feature X? A: I can, but time is limited, and people who donate are more likely to get their feature requests implemented. Q: My GPU hangs and I have to reboot it to get it going again? A: The more aggressively the mining software uses your GPU, the less overclock you will be able to run. You are more likely to hit your limits with cgminer and you will find you may need to overclock your GPU less aggressively. The software cannot be responsible and make your GPU hang directly. If you simply cannot get it to ever stop hanging, try decreasing the intensity, and if even that fails, try changing to the poclbm kernel with -k poclbm, though you will sacrifice performance. cgminer is designed to try and safely restart GPUs as much as possible, but NOT if that restart might actually crash the rest of the GPUs mining, or even the machine. It tries to restart them with a separate thread and if that separate thread dies, it gives up trying to restart any more GPUs. Q: Work keeps going to my backup pool even though my primary pool hasn't failed? A: Cgminer checks for conditions where the primary pool is lagging and will pass some work to the backup servers under those conditions. The reason for doing this is to try its absolute best to keep the GPUs working on something useful and not risk idle periods. You can disable this behaviour with the option --failover-only. Q: Is this a virus? A: Cgminer is being packaged with other trojan scripts and some antivirus software is falsely accusing cgminer.exe as being the actual virus, rather than whatever it is being packaged with. If you installed cgminer yourself, then you do not have a virus on your computer. Complain to your antivirus software company. They seem to be flagging even source code now from cgminer as viruses, even though text source files can't do anything by themself. Q: Can you modify the display to include more of one thing in the output and less of another, or can you change the quiet mode or can you add yet another output mode? A: Everyone will always have their own view of what's important to monitor. The defaults are very sane and I have very little interest in changing this any further. Q: Can you change the autofan/autogpu to change speeds in a different manner? A: The defaults are sane and safe. I'm not interested in changing them further. The starting fan speed is set to 50% in auto-fan mode as a safety precaution. Q: Why is my efficiency above/below 100%? A: Efficiency simply means how many shares you return for the amount of work you request. It does not correlate with efficient use of your hardware, and is a measure of a combination of hardware speed, block luck, pool design and other factors Q: What are the best parameters to pass for X pool/hardware/device. A: Virtually always, the DEFAULT parameters give the best results. Most user defined settings lead to worse performance. The ONLY thing most users should need to set is the Intensity. Q: What happened to CPU mining? A: Being increasingly irrelevant for most users, and a maintenance issue, it is no longer under active development and will not be supported unless someone steps up to help maintain it. No binary builds supporting CPU mining will be released but CPU mining can be built into cgminer when it is compiled. Q: I upgraded cgminer version and my hashrate suddenly dropped! A: No, you upgraded your SDK version unwittingly between upgrades of cgminer and that caused your hashrate to drop. See the next question. Q: I upgraded my ATI driver/SDK/cgminer and my hashrate suddenly dropped! A: The hashrate performance in cgminer is tied to the version of the ATI SDK that is installed only for the very first time cgminer is run. This generates binaries that are used by the GPU every time after that. Any upgrades to the SDK after that time will have no effect on the binaries. However, if you install a fresh version of cgminer, and have since upgraded your SDK, new binaries will be built. It is known that the 2.6 ATI SDK has a huge hashrate penalty on generating new binaries. It is recommended to not use this SDK at this time unless you are using an ATI 7xxx card that needs it. Q: Which ATI SDK is the best for cgminer? A: At the moment, versions 2.4 and 2.5 work the best. If you are forced to use the 2.6 SDK, the phatk kernel will perform poorly, while the diablo or my custom modified poclbm kernel are optimised for it. Q: I have multiple SDKs installed, can I choose which one it uses? A: Run cgminer with the -n option and it will list all the platforms currently installed. Then you can tell cgminer which platform to use with --gpu-platform. Q: GUI version? A: No. The RPC interface makes it possible for someone else to write one though. Q: I'm having an issue. What debugging information should I provide? A: Start cgminer with your regular commands and add -D -T --verbose and provide the full startup output and a summary of your hardware, operating system, ATI driver version and ATI stream version. Q: cgminer reports no devices or only one device on startup on Linux although I have multiple devices and drivers+SDK installed properly? A: Try "export DISPLAY=:0" before running cgminer. Q: My network gets slower and slower and then dies for a minute? A; Try the --net-delay option. Q: How do I tune for p2pool? A: p2pool has very rapid expiration of work and new blocks, it is suggested you decrease intensity by 1 from your optimal value, and decrease GPU threads to 1 with -g 1. It is also recommended to use --failover-only since the work is effectively like a different block chain. If mining with a minirig, it is worth adding the --bfl-range option. Q: Are kernels from other mining software useable in cgminer? A: No, the APIs are slightly different between the different software and they will not work. Q: I run PHP on windows to access the API with the example miner.php. Why does it fail when php is installed properly but I only get errors about Sockets not working in the logs? A: http://us.php.net/manual/en/sockets.installation.php Q: What is a PGA? A: At the moment, cgminer supports 4 FPGAs: BitForce, Icarus, ModMiner, and Ztex. They are Field-Programmable Gate Arrays that have been programmed to do Bitcoin mining. Since the acronym needs to be only 3 characters, the "Field-" part has been skipped. Q: How do I get my BFL/Icarus/Lancelot/Cairnsmore device to auto-recognise? A: On linux, if the /dev/ttyUSB* devices don't automatically appear, the only thing that needs to be done is to load the driver for them: BFL: sudo modprobe ftdi_sio vendor=0x0403 product=0x6014 Icarus: sudo modprobe pl2303 vendor=0x067b product=0x230 Lancelot: sudo modprobe ftdi_sio vendor=0x0403 product=0x6001 Cairnsmore: sudo modprobe ftdi_sio product=0x8350 vendor=0x0403 On windows you must install the pl2303 or ftdi driver required for the device pl2303: http://prolificusa.com/pl-2303hx-drivers/ ftdi: http://www.ftdichip.com/Drivers/VCP.htm Q: On linux I can see the /dev/ttyUSB* devices for my ICA/BFL/MMQ FPGA, but cgminer can't mine on them A: Make sure you have the required priviledges to access the /dev/ttyUSB* devices: sudo ls -las /dev/ttyUSB* will give output like: 0 crw-rw---- 1 root dialout 188, 0 2012-09-11 13:49 /dev/ttyUSB0 This means your account must have the group 'dialout' or root priviledges To permanently give your account the 'dialout' group: sudo usermod -G dialout -a `whoami` Then logout and back in again Q: What is stratum and how do I use it? A: Stratum is a protocol designed for pooled mining in such a way as to minimise the amount of network communications, yet scale to hardware of any speed. With versions of cgminer 2.8.0+, if a pool has stratum support, cgminer will automatically detect it and switch to the support as advertised if it can. Stratum uses direct TCP connections to the pool and thus it will NOT currently work through a http proxy but will work via a socks proxy if you need to use one. If you input the stratum port directly into your configuration, or use the special prefix "stratum+tcp://" instead of "http://", cgminer will ONLY try to use stratum protocol mining. The advantages of stratum to the miner are no delays in getting more work for the miner, less rejects across block changes, and far less network communications for the same amount of mining hashrate. If you do NOT wish cgminer to automatically switch to stratum protocol even if it is detected, add the --fix-protocol option.This code is provided entirely free of charge by the programmer in his spare time so donations would be greatly appreciated. Please consider donating to the address below.
Con Kolivas <kernel@kolivas.org>
15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ BTC (preferred)
Lc8TWMiKM7gRUrG8VB8pPNP1Yvt1SGZnoH LTC
Scrypt Mining
Scrypt mining, AKA litecoin mining, for GPU is completely different to sha256 used for bitcoin mining. The algorithm was originally developed in a manner that it was anticipated would make it suitable for mining on CPU but NOT GPU. Thanks to some innovative work by Artforz and mtrlt, this was proven to be wrong. However, it has very different requirements to bitcoin mining and is a lot more complicated to get working well. Note that it is a ram dependent workload, and requires you to have enough system ram as well as fast enough GPU ram. If you have less system ram than your GPU has, it may not be possible to mine at any reasonable rate.There are 5 main parameters to tuning scrypt, 2 of which you MUST set, and the others are optional for further fine tuning. When you start scrypt mining with the --scrypt option, cgminer will fail IN RANDOM WAYS. They are all due to parameters being outside what the GPU can cope with. Not giving cgminer a hint as to your GPU type, it will hardly ever perform well.
NOTE that if it does not fail at startup, the presence of hardware errors (HW)
are a sure sign that you have set the parameters too high.
Step 1 on linux:export GPU_MAX_ALLOC_PERCENT=100
If you do not do this, you may find it impossible to scrypt mine. You may find a value of 40 is enough and increasing this further has little effect.
export GPU_USE_SYNC_OBJECTS=1
may help CPU usage a little as well.
--shaders XXX
is a new option where you tell cgminer how many shaders your GPU has. This helps cgminer try to choose some meaningful baseline parameters. Use this table below to determine how many shaders your GPU has, and note that there are some variants of these cards, and nvidia shaders are much much lower and virtually pointless trying to mine on.
GPU | Shaders |
---|---|
5670 | 400 |
5750 | 720 |
5770 | 800 |
5830 | 1120 |
5850 | 1440 |
5870 | 1600 |
5970 | 1600 x2 |
GPU | Shaders |
---|---|
6450 | 160 |
6570 | 480 |
6670 | 480 |
6790 | 800 |
6850 | 960 |
6870 | 1120 |
6950 | 1408 |
6970 | 1536 |
6990 | 1536 x2 |
GPU | Shaders |
---|---|
7750 | 512 |
7770 | 640 |
7850 | 1024 |
7870 | 1280 |
7950 | 1792 |
7970 | 2048 |
--intensity XX
Just like in bitcoin mining, scrypt mining takes an intensity, however the scale goes from 0 to 20 to mimic the "Aggression" used in mtrlt's reaper. The reason this is crucial is that too high an intensity can actually be disastrous with scrypt because it CAN run out of ram. Intensities over 13 start writing over the same ram and it is highly dependent on the GPU, but they can start actually DECREASING your hashrate, or even worse, start producing garbage with HW errors skyrocketing. The low level detail is that intensity is only guaranteed up to the power of 2 that most closely matches the thread concurrency. i.e. a thread concurrency of 6144 has 8192 as the nearest power of two above it, thus as 2^13=8192, that is an intensity of 13.
Optional parameters to tune:
-g, --thread-concurrency, --lookup-gap
-g
Once you have found the optimal shaders and intensity, you can start increasing the -g value till cgminer fails to start. Rarely will you be able to go over about -g 4 and each increase in -g only increases hashrate slightly.
--thread-concurrency
This tunes the optimal size of work that scrypt can do. It is internally tuned by cgminer to be the highest reasonable multiple of shaders that it can allocate on your GPU. Ideally it should be a multiple of your shader count. vliw5 architecture (R5XXX) would be best at 5x shaders, while VLIW4 (R6xxx and R7xxx) are best at 4x. Setting thread concurrency overrides anything you put into --shaders.
--lookup-gap
This tunes a compromise between ram usage and performance. Performance peaks at a gap of 2, but increasing the gap can save you some GPU ram, but almost always at the cost of significant loss of hashrate. Setting lookup gap overrides the default of 2, but cgminer will use the --shaders value to choose a thread-concurrency if you haven't chosen one.
Overclocking for scrypt mining:
First of all, do not underclock your memory initially. Scrypt mining requires
memory speed and on most, but not all, GPUs, lowering memory speed lowers
mining performance.Second, absolute engine clock speeds do NOT correlate with hashrate. The ratio of engine clock speed to memory matters, so if you set your memory to the default value, and then start overclocking as you are running it, you should find a sweet spot where the hashrate peaks and then it might actually drop if you increase the engine clock speed further. Unless you wish to run with a dynamic intensity, do not go over 13 without testing it while it's running to see that it increases hashrate AND utility WITHOUT increasing your HW errors.
Suggested values for 7970 for example:
export GPU_MAX_ALLOC_PERCENT=100
--thread-concurrency 8192 -g 4 --gpu-engine 1135 --gpu-memclock 1375
Appendix A
Windows Build
###################################################################################### # # # Native WIN32 setup and build instructions (on mingw32/Windows): # # # ###################################################################################### ************************************************************************************** * Introduction * ************************************************************************************** The following instructions have been tested on both Windows 7 and Windows XP. Most of what is described below (copying files, downloading files, etc.) can be done directly in the MinGW MSYS shell; these instructions do not do so because package versions and links change over time. The best way is to use your browser, go to the links directly, and see for yourself which versions you want to install. Winrar was used to do the extracting of archive files in the making of this guide. If you think that this documentation was helpful and you wish to donate, you can do so at the following address. 12KaKtrK52iQjPdtsJq7fJ7smC32tXWbWr ************************************************************************************** * A tip that might help you along the way * ************************************************************************************** Enable "QuickEdit Mode" in your Command Prompt Window or MinGW Command Prompt Window (No need to go into the context menu to choose edit-mark/copy/paste): Right-click on the title bar and click Properties. Under the Options tab, check the box for "QuickEdit Mode". Alternately, if you want this change to be permanent on all of your Command Prompt Windows; you can click Defaults instead of Properties as described above. Now you can drag and select text you want to copy, right-click to copy the text to the clipboard and right-click once again to paste it at the desired location. You could for example, copy some text from this document to the clipboard and right click in your Command Prompt Window to paste what you copied. ************************************************************************************** * Install mingw32 * ************************************************************************************** Go to this url ==> http://www.mingw.org/wiki/Getting_Started Click the link that says "Download and run the latest mingw-get-inst version." Download and run the latest file. Install MinGW in the default directory. (I downloaded the one labeled "mingw-get-inst-20120426" - note that this could be a different version later.) Make sure to check the option for "Download latest repository catalogs". I just selected all the check boxes (excluding "Fortran Compiler") so that everything was installed. ************************************************************************************** * Create mstcpip.h * ************************************************************************************** Open notepad and copy the following into it. Save it as "\MinGW\include\mstcpip.h". Make sure it does not have the ".txt" extension (If it does then rename it). struct tcp_keepalive { u_long onoff; u_long keepalivetime; u_long keepaliveinterval; }; #ifndef USE_WS_PREFIX #define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR, 4) #else #define WS_SIO_KEEPALIVE_VALS _WSAIOW(WS_IOC_VENDOR, 4) #endif ************************************************************************************** * Run the MSYS shell for the first time to create your user directory * ************************************************************************************** (Start Icon/keyboard key ==> All Programs ==> MinGW ==> MinGW Shell). This will create your user directory for you. ************************************************************************************** * Install libpdcurses * ************************************************************************************** Type the lines below to install libpdcurses. mingw-get install mingw32-libpdcurses mingw-get install mingw32-pdcurses Ctrl-D or typing "logout" and pressing the enter key should get you out of the window. ************************************************************************************** * Copy CGMiner source to your MSYS working directory * ************************************************************************************** Copy CGMiner source code directory into: \MinGW\msys\1.0\home\(folder with your user name) ************************************************************************************** * Install AMD APP SDK, latest version (only if you want GPU mining) * ************************************************************************************** Note: You do not need to install the AMD APP SDK if you are only using Nvidia GPU's Go to this url for the latest AMD APP SDK: http://developer.amd.com/sdks/AMDAPPSDK/downloads/Pages/default.aspx Go to this url for legacy AMD APP SDK's: http://developer.amd.com/sdks/AMDAPPSDK/downloads/pages/AMDAPPSDKDownloadArchive.aspx Download and install whichever version you like best. Copy the folders in \Program Files (x86)\AMD APP\include to \MinGW\include Copy \Program Files (x86)\AMD APP\lib\x86\libOpenCL.a to \MinGW\lib Note: If you are on a 32 bit version of windows "Program Files (x86)" will be "Program Files". Note2: If you update your APP SDK later you might want to recopy the above files ************************************************************************************** * Install AMD ADL SDK, latest version (only if you want GPU monitoring) * ************************************************************************************** Note: You do not need to install the AMD ADL SDK if you are only using Nvidia GPU's Go to this url ==> http://developer.amd.com/sdks/ADLSDK/Pages/default.aspx Download and unzip the file you downloaded. Pull adl_defines.h, adl_sdk.h, and adl_structures.h out of the include folder Put those files into the ADL_SDK folder in your source tree as shown below. \MinGW\msys\1.0\home\(folder with your user name)\cgminer-x.x.x\ADL_SDK ************************************************************************************** * Install GTK-WIN, required for Pkg-config in the next step * ************************************************************************************** Go to this url ==> http://sourceforge.net/projects/gtk-win/ Download the file. After you have downloaded the file Double click/run it and this will install GTK+ I chose all the selection boxes when I installed. Copy libglib-2.0-0.dll and intl.dll from \Program Files (x86)\gtk2-runtime\bin to \MinGW\bin Note: If you are on a 32 bit version of windows "Program Files (x86)" will be "Program Files". ************************************************************************************** * Install pkg-config * ************************************************************************************** Go to this url ==> http://www.gtk.org/download/win32.php Scroll down to where it shows pkg-cfg. Download the file from the tool link. Extract "pkg-config.exe" from bin and place in your \MinGW\bin directory. Download the file from the "Dev" link. Extract "pkg.m4" from share\aclocal and place in your \MingW\share\aclocal directory. ************************************************************************************** * Install libcurl * ************************************************************************************** Go to this url ==> http://curl.haxx.se/download.html#Win32 At the section where it says "Win32 - Generic", Click on the link that indicates Win32 2000.XP 7.27.0 libcurl SSL and download it. The one I downloaded may not be current for you. Choose the latest. Extract the files that are in the zip (bin, include, and lib) to their respective locations in MinGW (\MinGW\bin, \MinGW\include, and \MinGW\lib). Edit the file \MinGW\lib\pkgconfig\libcurl.pc and change "-lcurl" to "-lcurl -lcurldll". Ref. http://old.nabble.com/gcc-working-with-libcurl-td20506927.html ************************************************************************************** * Build cgminer.exe * ************************************************************************************** Run the MinGW MSYS shell (Start Icon/keyboard key ==> All Programs ==> MinGW ==> MinGW Shell). Change the working directory to your CGMiner project folder. Example: cd cgminer-2.1.2 [Enter Key] if you are unsure then type "ls -la" Another way is to type "cd cg" and then press the tab key; It will auto fill. Type the lines below one at a time. Look for problems after each one before going on to the next. adl.sh (optional - see below) autoreconf -fvi CFLAGS="-O2 -msse2" ./configure (additional config options, see below) make ************************************************************************************** * Copy files to a build directory/folder * ************************************************************************************** Make a directory and copy the following files into it. This will be your CGMiner Folder that you use for mining. Remember the .cl filenames could change on later releases. If you installed a different version of libcurl then some of those dll's may be different as well. cgminer.exe from \MinGW\msys\1.0\home\(username)\cgminer-x.x.x *.cl from \MinGW\msys\1.0\home\(username)\cgminer-x.x.x README from \MinGW\msys\1.0\home\(username)\cgminer-x.x.x libcurl.dll from \MinGW\bin libidn-11.dll from \MinGW\bin libeay32.dll from \MinGW\bin ssleay32.dll from \MinGW\bin libpdcurses.dll from \MinGW\bin pthreadGC2.dll from \MinGW\bin ************************************************************************************** * Optional - Install Git into MinGW/MSYS * ************************************************************************************** Go to this url ==> http://code.google.com/p/msysgit/ Click on the Downloads tab. Download the latest "Portable" git archive. Extract the git*.exe files from the bin folder and put them into \MinGW\bin. Extract the share\git-core folder and place it into \MinGW\share. After the previous step you should have a folder called \MinGW\share\git-core. To test if it is working, open a MinGW shell and type the following: git config -?lobal core.autocrlf false (note: one time run only) git clone git://github.com/ckolivas/cgminer.git If you simply just want to update the source after you have already cloned, type: git pull Now you can get the latest source directly from github. ************************************************************************************** * Optional - Make a .sh file to automate copying over ADL files * ************************************************************************************** Make a folder/directory in your home folder and name it ADL_SDK. (ref: \MinGW\msys\1.0\home\(folder with your user name)\ADL_SDK) Copy the ADL .h files into that folder/directory. Open your favorite text editor and type the following into it. cp -av ../ADL_SDK/*.h ADL_SDK Save the file as "adl.sh" and then place the file into "\MinGW\msys\1.0\bin". From now on when your current working directory is the cgminer source directory You can simply type "adl.sh" and it will place the ADL header files into place For you. Make sure you never remove the ADL_SDK folder from your home folder. ************************************************************************************** * Optional - Install libusb if you need auto USB device detection; required for Ztex * ************************************************************************************** Go to this url ==> http://libusbx.org/ Click on the "Downloads" tab. Click on "releases". Click on the latest version. I downloaded 1.0.12; yours may be newer. Do not download from the link that says "Looking for the latest version?". Click on "Windows" Click on the file and download it. I downloaded libusbx-1.0.12-win.7z. Extract the the following from the file and place in where directed. Copy libusb.h from include\libusbx-1.0 to \MinGW\include\libusb-1.0\libusb.h Copy contents of MinGW32\static \MinGW\lib Copy contents of MinGW32\dll to \MinGW\lib You will have to copy "libusb-1.0.dll" to your working cgminer binary directory. ************************************************************************************** * Some ./configure options * ************************************************************************************** --enable-cpumining Build with cpu mining support(default disabled) --disable-opencl Override detection and disable building with opencl --disable-adl Override detection and disable building with adl --enable-bitforce Compile support for BitForce FPGAs(default disabled) --enable-icarus Compile support for Icarus Board(default disabled) --enable-modminer Compile support for ModMiner FPGAs(default disabled) --enable-ztex Compile support for Ztex Board(default disabled) --enable-scrypt Compile support for scrypt litecoin mining (default disabled) --without-curses Compile support for curses TUI (default enabled) --without-libudev Autodetect FPGAs using libudev (default enabled) ###################################################################################### # # # Native WIN32 setup and build instructions (on mingw32/Windows) complete # # # ######################################################################################| Appendix A
xUbuntu 11.04 Live on USB
How to setup a cgminer using xubuntu 11.04 live on a USB The master version of this document is here: https://github.com/kanoi/linux-usb-cgminer The actual file is: https://github.com/kanoi/linux-usb-cgminer/blob/master/linux-usb-cgminer The copy in cgminer (check to make sure it isn't older) is: https://github.com/ckolivas/cgminer/blob/master/linux-usb-cgminer The original old verion on bitcointalk is: https://bitcointalk.org/index.php?topic=28402.msg426741#msg426741 ======== I have said to select English for the install process for 2 reasons: 1) I don't know any other spoken language very well and 2) I'm not sure what problems installing under a different language might cause (it will probably cause no problems but I don't know) Software ======== Short hardware comment: Your mining computer doesn't need any HDD or CD/DVD/BD as long as it has at least 2GB of RAM, can boot USB, has some network connection to the internet and of course a reasonable mining ATI graphics card ... Or you can boot a windows PC with the USB to only do mining ... and ignore the system HDD ... wasting energy running the HDD (roughly 10 Watts per HDD) :) If you wish to install to an HDD instead of a USB, see the changes to the instructions at the end To create the USB, you need of course a 4GB USB and temporarily need a PC with a CD (or DVD/BD) writer, a USB port and of course an internet connection to the PC 1) Download the xubuntu 11.04 desktop live CD iso for amd64 ( look here for mirrors: http://www.xubuntu.org/getubuntu ) 2) Burn it to CD then boot that temporarily on any PC with a CD/DVD/BD and a USB port (this and the next 2 step won't effect that PC) Select "English" then select "Try Xubuntu without installing" and wait for the desktop to appear (this happens by default if you wait for the timeouts) 3) Plug in your 4GB USB device and it should appear on the desktop - you can leave it's contents as long as there is at least 2.8GB free 4) Now run "Startup Disk Creator" in "Applications->System" (the system menu is the little rat in the top left corner) (if you have no mouse you can get the menu with <ctr><esc> and navigate the menu with the arrow keys and <return> key) From here select the boot CD as the "Source" and the USB as the "Disk to use" lastly move the slider to 2GB for reserved extra space The 2GB should be enough for modifications Click: "Make Install Disk" After about 10-15 minutes you have a base xubuntu 11.04 boot USB (you can shut down this computer now) 5) Boot your cgminer PC with this USB stick, select "English" then select "Try Xubuntu without installing" and wait for the desktop to appear (this happens by default if you wait for the timeouts) 6) Start a terminal "Applications->Accessories->Terminal Emulator" 7) sudo apt-get install openssh-server screen if you have a problem here then it's probably coz the internet isn't available ... sort that out by reading elsewhere about routers etc 8) sudo apt-get install fglrx fglrx-amdcccle fglrx-dev sudo sync sudo shutdown -r now N.B. always do a "sudo sync" and wait for it to finish every time before shutting down the PC to ensure all data is written to the USB 9) sudo aticonfig --lsa this lists your ATI cards so you can see them sudo aticonfig --adapter=all --odgt this checks it can access all the cards ... 10) sudo aticonfig --adapter=all --initial this gets an error - no idea why but the xorg.conf is OK sudo sync sudo shutdown -r now 11) sudo aticonfig --adapter=all --odgt this checks it can access all the cards ... 12) get AMD-APP-SDK-v2.4-lnx64.tgz from http://developer.amd.com/sdks/amdappsdk/downloads/pages/default.aspx ( http://developer.amd.com/Downloads/AMD-APP-SDK-v2.4-lnx64.tgz ) sudo su cd /opt (replace /home/ubuntu/ with wherever you put the file: ) tar -xvzf /home/ubuntu/AMD-APP-SDK-v2.4-lnx64.tgz cd AMD-APP-SDK-v2.4-lnx64/ cp -pv lib/x86_64/* /usr/lib/ rsync -avl include/CL/ /usr/include/CL/ tar -xvzf icd-registration.tgz rsync -avl etc/OpenCL/ /etc/OpenCL/ ldconfig sync shutdown -r now You now have an OpenCL enabled xubuntu 13) cgminer: sudo apt-get install curl get the binary linux cgminer (see the bitcoin forum cgminer thread for where to get it) https://bitcointalk.org/index.php?topic=28402.0 ./cgminer -n this shows you the GPU's it found on your PC See further below if you get an error regarding libtinfo.so.5 14) An OC option: This is no longer needed since cgminer 2.* includes OC, however: sudo apt-get install libwxbase2.8-0 libwxgtk2.8-0 http://sourceforge.net/projects/amdovdrvctrl/ for an Over/underclocking application and get the file listed below then: sudo dpkg -i amdoverdrivectrl_1.2.1_amd64.deb 15) set the screen saver to ONLY blank ... Move the mouse to the bottom of the screen and you see a set of icons like on an Apple PC Click on Settings, then in the Settings window "Screensaver" Set "Mode:" to "Blank Screen Only" 16) apt-get install ntpd An accurate clock is always a good idea :) 17) if you wish to ssh into the box you must set a password to do this you simply have to be logged into it at the screen and type sudo passwd ubuntu it will prompt you (twice) to enter a password for the ubuntu account Initial setup complete. ======== If you want to SSH into the machine and run cgminer: From a terminal on the miner display each time after you boot: xhost + 'xhost +' isn't needed if you ssh into the machine with the same username that the GUI boots into (which is 'ubuntu' in this case) Then after you ssh into the machine: export DISPLAY=:0 before running cgminer Also note, that you should force the screen to blank when mining if the ATI card is displaying the screen (using the screen saver application menu) In my case it takes away 50Mh/s when the screen isn't blanked It will auto blank - but make sure the blank is of course just blank as mentioned above at 15) This is of course just the basics ... but it should get you a computer up and running and able to run cgminer ======== You should keep an eye on USB disk space The system logger writes log files in the /var/log/ directory The two main ones that grow large are 'kern.log' and 'syslog' If you want to keep them, save them away to some other computer When space is low, just delete them e.g. sudo rm -i /var/log/syslog sudo rm -i /var/log/kern.log The 'df' command will show you the current space e.g.: sudo df Filesystem 1K-blocks Used Available Use% Mounted on aufs 2099420 892024 1100748 45% / none 1015720 628 1015092 1% /dev /dev/sda1 3909348 2837248 1072100 73% /cdrom /dev/loop0 670848 670848 0 100% /rofs none 1023772 136 1023636 1% /dev/shm tmpfs 1023772 16 1023756 1% /tmp none 1023772 124 1023648 1% /var/run none 1023772 0 1023772 0% /var/lock This shows the 2GB space allocated when you setup the USB as '/' (aufs) In this example, it's currently 45% full with almost 1.1GB of free space ======== The latest version (2.0.8) of cgminer is built with 11.10 (not 11.04) If you get the following error when running the prebuilt version in 11.04: ./cgminer: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory The fix is to simply link the old curses library to the new name e.g.: cd /lib64/ sudo ln -s libncurses.so.5 libtinfo.so.5 ======== If you wish to install to an HDD instead of a USB: -------------------------------------------------- As per before: 1) Download the xubuntu 11.04 desktop live CD iso for amd64 ( look here for mirrors: http://www.xubuntu.org/getubuntu ) Then: 2) Burn it to CD then boot that on your new mining PC Select "English" then select "Install Xubuntu" (you have 30 seconds to do this) 3) When the Install window comes up - again select "English" and click "Forward" 4) The next page will show you if you meet certain install requirements (make sure you do meet them all) Don't select the download option The 3rd party option isn't needed for mining so ignore that also Click "Forward" 5) With "Allocate drive space" it's probably easiest to say to use the "Erase" option. This is just for mining right? :) However, if you have anything on the HDD that you want to keep - the "Erase" install process will delete it - so back it up (quit the install) Also make sure there are no OTHER HDD attached that it may erase also i.e. only have attached the one HDD that you want to install onto unless you know exactly what you are doing If you see the "Install Xubuntu 11.04 alongside 'something'" then that just means that the HDD wasn't blank. If you want to try this option - do that yourself and then skip to step 7) below when you get to that. There are plenty of other options available if you select "Something else" but I'm not going to go into all the details here other than to say that my preferred partioning is: /boot = 1GB = ext2, swap = twice memory size, / = 100GB = ext3 and the rest: /extra = ext3 Click "Forward" 6) If you selected "Erase" then it allows you to choose the drive to install to Then click "Install Now" 7) "Where are you?" sort that out then click "Forward" 8) "Keyboard layout" sort that out (use the default) then click "Forward" 9) "Who are you?" The important one here is "Pick a username:" coz that's the name you will need to ssh into, to access it remotely (and of course the "Choose a Password" you set) If you set the "username" to anything but "ubuntu" then: wherever in this document I have mentioned the username "ubuntu" you must of course use the username you chose here instead of "ubuntu" Important: set it to "log in automatically" if you ever want to be able to start cgminer without being in front of the computer since 'X' must be running to use cgminer properly That does of course mean that the computer isn't secure from anyone who has access to it - but then again no computer that can automatically reboot is secure from anyone who has access to the actual computer itself Then click "Forward" 10) Of course when it completes click on "Restart Now" ... and remove the Xubuntu CD when it asks you 11) Wait for it to finish rebooting ... and it will auto login (unless you didn't do step 9) "Important:") 12) After it logs in, an upgrade popup for 11.10 (or later) will appear Select "Don't Upgrade" 13) Now go to step 6) of the USB script above for what to do next and that covers everything else needed| Appendix A
FPGA
This README contains extended details about FPGA mining with cgminer ModMinerQuad (MMQ) ------------------ The mining bitstream does not survive a power cycle, so cgminer will upload it, if it needs to, before it starts mining - You must make sure you have an approriate firmware in your MMQ Read here for official details of changing the firmware: http://wiki.btcfpga.com/index.php?title=Firmware The basics of changing the firmware are: You need two short pieces of conductive wire if your MMQ doesn't have buttons on the "RESET" and "ISP" pads on the backplane board Cutting a small (metal) paper-clip in half works well for this Join the 2 left pads of the "RESET" pad with wire and the led will dim Without disconnecting the "RESET", join the 2 left pads of the "ISP" pad with a wire and it will stay dim Release "RESET" then release "ISP" and is should still be dim Unplug the USB and when you plug it back in it will show up as a mass storage device Linux: (as one single line): mcopy -i /dev/disk/by-id/usb-NXP_LPC134X_IFLASH_ISP000000000-0:0 modminer091012.bin ::/firmware.bin Windows: delete the MSD device file firmware.bin and copy in the new one rename the new file and put it under the same name 'firmware.bin' Disconnect the USB correctly (so writes are flushed first) Join and then disconnect "RESET" and then plug the USB back in and it's done Best to update to one of the latest 2 listed below if you don't already have one of them in your MMQ The current latest different firmware are: Latest for support of normal or TLM bitstream: http://btcfpga.com/files/firmware/modminer092612-TLM.bin Latest with only normal bitstream support (Temps/HW Fix): http://btcfpga.com/files/firmware/modminer091012.bin The code is currently tested on the modminer091012.bin firmware. This comment will be updated when others have been tested - On many linux distributions there is an app called modem-manager that may cause problems when it is enabled, due to opening the MMQ device and writing to it The problem will typically present itself by the flashing led on the backplane going out (no longer flashing) and it takes a power cycle to re-enable the MMQ firmware - which then can lead to the problem happening again You can either disable/uninstall modem-manager if you don't need it or: a (hack) solution to this is to blacklist the MMQ USB device in /lib/udev/rules.d/77-mm-usb-device-blacklist.rules Adding 2 lines like this (just above APC) should help # MMQ ATTRS{idVendor}=="ifc9", ATTRS{idProduct}=="0003", ENV{ID_MM_DEVICE_IGNORE}="1" The change will be lost and need to be re-done, next time you update the modem-manager software TODO: check that all MMQ's have the same product ID Bitforce (BFL) -------------- --bfl-range Use nonce range on bitforce devices if supported This option is only for bitforce devices. Earlier devices such as the single did not have any way of doing small amounts of work which meant that a lot of work could be lost across block changes. Some of the "minirigs" have support for doing this, so less work is lost across a longpoll. However, it comes at a cost of 1% in overall hashrate so this feature is disabled by default. It is only recommended you enable this if you are mining with a minirig on p2pool. C source is included for a bitforce firmware flash utility on Linux only: bitforce-firmware-flash.c Using this, you can change the bitstream firmware on bitforce singles. It is untested with other devices. Use at your own risk! To compile: make bitforce-firmware-flash To flash your BFL, specify the BFL port and the flash file e.g.: sudo ./bitforce-firmware-flash /dev/ttyUSB0 alphaminer_832.bfl It takes a bit under 3 minutes to flash a BFL and shows a progress % counter Once it completes, you may also need to wait about 15 seconds, then power the BFL off and on again If you get an error at the end of the BFL flash process stating: "Error reading response from ZBX" it may have worked successfully anyway. Test mining on it to be sure if it worked or not. You need to give cgminer about 10 minutes mining with the BFL to be sure of the MH/s value reported with the changed firmware - and the MH/s reported will be less than the firmware speed since you lose work on every block change. Icarus (ICA) ------------ There are two hidden options in cgminer when Icarus support is compiled in: --icarus-options <arg> Set specific FPGA board configurations - one set of values for all or comma separated baud:work_division:fpga_count baud The Serial/USB baud rate - 115200 or 57600 only - default 115200 work_division The fraction of work divided up for each FPGA chip - 1, 2, 4 or 8 e.g. 2 means each FPGA does half the nonce range - default 2 fpga_count The actual number of FPGA working - this would normally be the same as work_division - range is from 1 up to 'work_division' It defaults to the value of work_division - or 2 if you don't specify work_division If you define fewer comma seperated values than Icarus devices, the last values will be used for all extra devices An example would be: --icarus-options 57600:2:1 This would mean: use 57600 baud, the FPGA board divides the work in half however only 1 FPGA actually runs on the board (e.g. like an early CM1 Icarus copy bitstream) --icarus-timing <arg> Set how the Icarus timing is calculated - one setting/value for all or comma separated default[=N] Use the default Icarus hash time (2.6316ns) short Calculate the hash time and stop adjusting it at ~315 difficulty 1 shares (~1hr) long Re-calculate the hash time continuously value[=N] Specify the hash time in nanoseconds (e.g. 2.6316) and abort time (e.g. 2.6316=80) If you define fewer comma seperated values than Icarus devices, the last values will be used for all extra devices Icarus timing is required for devices that do not exactly match a default Icarus Rev3 in processing speed If you have an Icarus Rev3 you should not normally need to use --icarus-timing since the default values will maximise the MH/s and display it correctly Icarus timing is used to determine the number of hashes that have been checked when it aborts a nonce range (including on a LongPoll) It is also used to determine the elapsed time when it should abort a nonce range to avoid letting the Icarus go idle, but also to safely maximise that time 'short' or 'long' mode should only be used on a computer that has enough CPU available to run cgminer without any CPU delays (an active desktop or swapping computer would not be stable enough) Any CPU delays while calculating the hash time will affect the result 'short' mode only requires the computer to be stable until it has completed ~315 difficulty 1 shares 'long' mode requires it to always be stable to ensure accuracy, however, over time it continually corrects itself When in 'short' or 'long' mode, it will report the hash time value each time it is re-calculated In 'short' or 'long' mode, the scan abort time starts at 5 seconds and uses the default 2.6316ns scan hash time, for the first 5 nonce's or one minute (whichever is longer) In 'default' or 'value' mode the 'constants' are calculated once at the start, based on the default value or the value specified The optional additional =N specifies to set the default abort at N 1/10ths of a second, not the calculated value, which is 112 for 2.6316ns To determine the hash time value for a non Icarus Rev3 device or an Icarus Rev3 with a different bitstream to the default one, use 'long' mode and give it at least a few hundred shares, or use 'short' mode and take note of the final hash time value (Hs) calculated You can also use the RPC API 'stats' command to see the current hash time (Hs) at any time The Icarus code currently only works with an FPGA device that supports the same commands as Icarus Rev3 requires and also is less than ~840MH/s and greater than 2MH/s If an FPGA device does hash faster than ~840MH/s it should work correctly if you supply the correct hash time nanoseconds value The timing code itself will affect the Icarus performance since it increases the delay after work is completed or aborted until it starts again The increase is, however, extremely small and the actual increase is reported with the RPC API 'stats' command (a very slow CPU will make it more noticeable) Using the 'short' mode will remove this delay after 'short' mode completes The delay doesn't affect the calculation of the correct hash time| Appendix A
Appendix B
- Authors
- API
- News & changelog ul>
Authors
Original CPU mining software:Jeff Garzik <jgarzik@pobox.com>
GPU mining and rewrite:
Con Kolivas <kernel@kolivas.org> 15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ
BitFORCE FPGA mining and refactor:
Luke Dashjr <luke-jr+cgminer@utopios.org> 1NbRmS6a4dniwHHoSS9v3tEYUpP1Z5VVdL
API+:
Andrew Smith <kanoi2@kano-kun.net> 1Jjk2LmktEQKnv8r2cZ9MvLiZwZ9gxabKm
README.HTML
David D Ochoa <davidochoa1606@gmail.com> Lf9WKM61AhmXchG2Ph2cftHKSQhxHutcdk (LTC)
| Appendix A | Appendix B
API
This README contains details about the cgminer RPC API It also includes some detailed information at the end, about using miner.php If you start cgminer with the "--api-listen" option, it will listen on a simple TCP/IP socket for single string API requests from the same machine running cgminer and reply with a string and then close the socket each time If you add the "--api-network" option, it will accept API requests from any network attached computer. You can only access the comands that reply with data in this mode. By default, you cannot access any privileged command that affects the miner - you will receive an access denied status message see --api-allow below. You can specify IP addresses/prefixes that are only allowed to access the API with the "--api-allow" option e.g. --api-allow W:192.168.0.1,10.0.0/24 will allow 192.168.0.1 or any address matching 10.0.0.*, but nothing else IP addresses are automatically padded with extra '.0's as needed Without a /prefix is the same as specifying /32 0/0 means all IP addresses. The 'W:' on the front gives that address/subnet privileged access to commands that modify cgminer (thus all API commands) Without it those commands return an access denied status. See --api-groups below to define other groups like W: Privileged access is checked in the order the IP addresses were supplied to "--api-allow" The first match determines the privilege level. Using the "--api-allow" option overides the "--api-network" option if they are both specified With "--api-allow", 127.0.0.1 is not by default given access unless specified More groups (like the privileged group W:) can be defined using the --api-groups command Valid groups are only the letters A-Z (except R & W are predefined) and are not case sensitive The R: group is the same as not privileged access The W: group is (as stated) privileged access (thus all API commands) To give an IP address/subnet access to a group you use the group letter in front of the IP address instead of W: e.g. P:192.168.0/32 An IP address/subnet can only be a member of one group A sample API group would be: --api-groups P:switchpool:enablepool:addpool:disablepool:removepool:poolpriority:* This would create a group 'P' that can do all current pool commands and all non-priviliged commands - the '*' means all non-priviledged commands Without the '*' the group would only have access to the pool commands Defining multiple groups example: --api-groups Q:quit:restart:*,S:save This would define 2 groups: Q: that can 'quit' and 'restart' as well as all non-priviledged commands S: that can only 'save' and no other commands The RPC API request can be either simple text or JSON. If the request is JSON (starts with '{'), it will reply with a JSON formatted response, otherwise it replies with text formatted as described further below. The JSON request format required is '{"command":"CMD","parameter":"PARAM"}' (though of course parameter is not required for all requests) where "CMD" is from the "Request" column below and "PARAM" would be e.g. the CPU/GPU number if required. An example request in both formats to set GPU 0 fan to 80%: gpufan|0,80 {"command":"gpufan","parameter":"0,80"} The format of each reply (unless stated otherwise) is a STATUS section followed by an optional detail section From API version 1.7 onwards, reply strings in JSON and Text have the necessary escaping as required to avoid ambiguity - they didn't before 1.7 For JSON the 2 characters '"' and '\' are escaped with a '\' before them For Text the 4 characters '|' ',' '=' and '\' are escaped the same way Only user entered information will contain characters that require being escaped, such as Pool URL, User and Password or the Config save filename, when they are returned in messages or as their values by the API For API version 1.4 and later: The STATUS section is: STATUS=X,When=NNN,Code=N,Msg=string,Description=string| STATUS=X Where X is one of: W - Warning I - Informational S - Success E - Error F - Fatal (code bug) When=NNN Standard long time of request in seconds Code=N Each unique reply has a unigue Code (See api.c - #define MSG_NNNNNN) Msg=string Message matching the Code value N Description=string This defaults to the cgminer version but is the value of --api-description if it was specified at runtime. For API version 1.10 and later: The list of requests - a (*) means it requires privileged access - and replies are: Request Reply Section Details ------- ------------- ------- version VERSION CGMiner=cgminer, version API=API| version config CONFIG Some miner configuration information: GPU Count=N, <- the number of GPUs PGA Count=N, <- the number of PGAs CPU Count=N, <- the number of CPUs Pool Count=N, <- the number of Pools ADL=X, <- Y or N if ADL is compiled in the code ADL in use=X, <- Y or N if any GPU has ADL Strategy=Name, <- the current pool strategy Log Interval=N, <- log interval (--log N) Device Code=GPU ICA , <- spaced list of compiled devices OS=Linux/Apple/..., <- operating System Failover-Only=true/false, <- failover-only setting ScanTime=N, <- --scan-time setting Queue=N, <- --queue setting Expiry=N| <- --expiry setting summary SUMMARY The status summary of the miner e.g. Elapsed=NNN,Found Blocks=N,Getworks=N,...| pools POOLS The status of each pool e.g. Pool=0,URL=http://pool.com:6311,Status=Alive,...| devs DEVS Each available GPU, PGA and CPU with their details e.g. GPU=0,Accepted=NN,MHS av=NNN,...,Intensity=D| Last Share Time=NNN, <- standand long time in seconds (or 0 if none) of last accepted share Last Share Pool=N, <- pool number (or -1 if none) Will not report PGAs if PGA mining is disabled Will not report CPUs if CPU mining is disabled gpu|N GPU The details of a single GPU number N in the same format and details as for DEVS pga|N PGA The details of a single PGA number N in the same format and details as for DEVS This is only available if PGA mining is enabled Use 'pgacount' or 'config' first to see if there are any cpu|N CPU The details of a single CPU number N in the same format and details as for DEVS This is only available if CPU mining is enabled Use 'cpucount' or 'config' first to see if there are any gpucount GPUS Count=N| <- the number of GPUs pgacount PGAS Count=N| <- the number of PGAs Always returns 0 if PGA mining is disabled cpucount CPUS Count=N| <- the number of CPUs Always returns 0 if CPU mining is disabled switchpool|N (*) none There is no reply section just the STATUS section stating the results of switching pool N to the highest priority (the pool is also enabled) The Msg includes the pool URL enablepool|N (*) none There is no reply section just the STATUS section stating the results of enabling pool N The Msg includes the pool URL addpool|URL,USR,PASS (*) none There is no reply section just the STATUS section stating the results of attempting to add pool N The Msg includes the pool URL Use '\\' to get a '\' and '\,' to include a comma inside URL, USR or PASS poolpriority|N,... (*) none There is no reply section just the STATUS section stating the results of changing pool priorities See usage below disablepool|N (*) none There is no reply section just the STATUS section stating the results of disabling pool N The Msg includes the pool URL removepool|N (*) none There is no reply section just the STATUS section stating the results of removing pool N The Msg includes the pool URL N.B. all details for the pool will be lost gpuenable|N (*) none There is no reply section just the STATUS section stating the results of the enable request gpudisable|N (*) none There is no reply section just the STATUS section stating the results of the disable request gpurestart|N (*) none There is no reply section just the STATUS section stating the results of the restart request gpuintensity|N,I (*) none There is no reply section just the STATUS section stating the results of setting GPU N intensity to I gpumem|N,V (*) none There is no reply section just the STATUS section stating the results of setting GPU N memoryclock to V MHz gpuengine|N,V (*) none There is no reply section just the STATUS section stating the results of setting GPU N clock to V MHz gpufan|N,V (*) none There is no reply section just the STATUS section stating the results of setting GPU N fan speed to V% gpuvddc|N,V (*) none There is no reply section just the STATUS section stating the results of setting GPU N vddc to V save|filename (*) none There is no reply section just the STATUS section stating success or failure saving the cgminer config to filename The filename is optional and will use the cgminer default if not specified quit (*) none There is no status section but just a single "BYE" reply before cgminer quits notify NOTIFY The last status and history count of each devices problem This lists all devices including those not supported by the 'devs' command e.g. NOTIFY=0,Name=GPU,ID=0,Last Well=1332432290,...| privileged (*) none There is no reply section just the STATUS section stating an error if you do not have privileged access to the API and success if you do have privilege The command doesn't change anything in cgminer pgaenable|N (*) none There is no reply section just the STATUS section stating the results of the enable request You cannot enable a PGA if it's status is not WELL This is only available if PGA mining is enabled pgadisable|N (*) none There is no reply section just the STATUS section stating the results of the disable request This is only available if PGA mining is enabled pgaidentify|N (*) none There is no reply section just the STATUS section stating the results of the identify request This is only available if PGA mining is enabled and currently only BFL singles support this command On a BFL single it will flash the led on the front of the device for appoximately 4s All other non BFL PGA devices will return a warning status message stating that they dont support it This adds a 4s delay to the BFL share being processed so you may get a message stating that procssing took longer than 7000ms if the request was sent towards the end of the timing of any work being worked on e.g.: BFL0: took 8438ms - longer than 7000ms You should ignore this devdetails DEVDETAILS Each device with a list of their static details This lists all devices including those not supported by the 'devs' command e.g. DEVDETAILS=0,Name=GPU,ID=0,Driver=opencl,...| restart (*) none There is no status section but just a single "RESTART" reply before cgminer restarts stats STATS Each device or pool that has 1 or more getworks with a list of stats regarding getwork times The values returned by stats may change in future versions thus would not normally be displayed Device drivers are also able to add stats to the end of the details returned check|cmd COMMAND Exists=Y/N, <- 'cmd' exists in this version Access=Y/N| <- you have access to use 'cmd' failover-only|true/false (*) none There is no reply section just the STATUS section stating what failover-only was set to coin COIN Coin mining information: Hash Method=sha256/scrypt, Current Block Time=N.N, <- 0 means none Current Block Hash=XXXX..., <- blank if none LP=true/false| <- LP is in use on at least 1 pool debug|setting (*) DEBUG Debug settings The optional commands for 'setting' are the same as the screen curses debug settings You can only specify one setting Only the first character is checked (case insensitive): Silent, Quiet, Verbose, Debug, RPCProto, PerDevice, WorkTime, Normal The output fields are (as above): Silent=true/false, Quiet=true/false, Verbose=true/false, Debug=true/false, RPCProto=true/false, PerDevice=true/false, WorkTime=true/false| setconfig|name,N (*) none There is no reply section just the STATUS section stating the results of setting 'name' to N The valid values for name are currently: queue, scantime, expiry N is an integer in the range 0 to 9999 When you enable, disable or restart a GPU or PGA, you will also get Thread messages in the cgminer status window The 'poolpriority' command can be used to reset the priority order of multiple pools with a single command - 'switchpool' only sets a single pool to first priority Each pool should be listed by id number in order of preference (first = most preferred) Any pools not listed will be prioritised after the ones that are listed, in the priority order they were originally If the priority change affects the miner's preference for mining, it may switch immediately When you switch to a different pool to the current one (including by priority change), you will get a 'Switching to URL' message in the cgminer status windows Obviously, the JSON format is simply just the names as given before the '=' with the values after the '=' If you enable cgminer debug (-D or --debug) or, when cgminer debug is off, turn on debug with the API command 'debug|debug' you will also get messages showing some details of the requests received and the replies There are included 4 program examples for accessing the API: api-example.php - a php script to access the API usAge: php api-example.php command by default it sends a 'summary' request to the miner at 127.0.0.1:4028 If you specify a command it will send that request instead You must modify the line "$socket = getsock('127.0.0.1', 4028);" at the beginning of "function request($cmd)" to change where it looks for cgminer API.java/API.class a java program to access the API (with source code) usAge is: java API command address port Any missing or blank parameters are replaced as if you entered: java API summary 127.0.0.1 4028 api-example.c - a 'C' program to access the API (with source code) usAge: api-example [command [ip/host [port]]] again, as above, missing or blank parameters are replaced as if you entered: api-example summary 127.0.0.1 4028 miner.php - an example web page to access the API This includes buttons and inputs to attempt access to the privileged commands See the end of this API-README for details of how to tune the display and also to use the option to display a multi-rig summary ---------- Feature Changelog for external applications using the API: API V1.20 Modified API commands: 'pools' - add 'Has Stratum', 'Stratum Active', 'Stratum URL' ---------- API V1.19 (cgminer v2.7.6) Added API commands: 'debug' 'pgaidentify|N' (only works for BFL Singles so far) 'setconfig|name,N' Modified API commands: 'devs' - add 'Diff1 Work', 'Difficulty Accepted', 'Difficulty Rejected', 'Last Share Difficulty' to all devices 'gpu|N' - add 'Diff1 Work', 'Difficulty Accepted', 'Difficulty Rejected', 'Last Share Difficulty' 'pga|N' - add 'Diff1 Work', 'Difficulty Accepted', 'Difficulty Rejected', 'Last Share Difficulty' 'notify' - add '*Dev Throttle' (for BFL Singles) 'pools' - add 'Proxy Type', 'Proxy', 'Difficulty Accepted', 'Difficulty Rejected', 'Difficulty Stale', 'Last Share Difficulty' 'config' - add 'Queue', 'Expiry' 'stats' - add 'Work Diff', 'Min Diff', 'Max Diff', 'Min Diff Count', 'Max Diff Count' to the pool stats ---------- API V1.18 (cgminer v2.7.4) Modified API commands: 'stats' - add 'Work Had Roll Time', 'Work Can Roll', 'Work Had Expire', 'Work Roll Time' to the pool stats 'config' - include 'ScanTime' ---------- API V1.17 (cgminer v2.7.1) Added API commands: 'coin' Modified API commands: 'summary' - add 'Work Utility' 'pools' - add 'Diff1 Shares' ---------- API V1.16 (cgminer v2.6.5) Added API commands: 'failover-only' Modified API commands: 'config' - include failover-only state ---------- API V1.15 (cgminer v2.6.1) Added API commands: 'poolpriority' ---------- API V1.14 (cgminer v2.5.0) Modified API commands: 'stats' - more icarus timing stats added 'notify' - include new device comms error counter The internal code for handling data was rewritten (~25% of the code) Completely backward compatible ---------- API V1.13 (cgminer v2.4.4) Added API commands: 'check' Support was added to cgminer for API access groups with the --api-groups option It's 100% backward compatible with previous --api-access commands ---------- API V1.12 (cgminer v2.4.3) Modified API commands: 'stats' - more pool stats added Support for the ModMinerQuad FPGA was added ---------- API V1.11 (cgminer v2.4.2) Modified API commands: 'save' no longer requires a filename (use default if not specified) 'save' incorrectly returned status E (error) on success before. It now correctly returns S (success) ---------- API V1.10 (cgminer v2.4.1) Added API commands: 'stats' N.B. the 'stats' command can change at any time so any specific content present should not be relied upon. The data content is mainly used for debugging purposes or hidden options in cgminer and can change as development work requires Modified API commands: 'pools' added "Last Share Time" ---------- API V1.9 (cgminer v2.4.0) Added API commands: 'restart' Modified API commands: 'notify' corrected invalid JSON ---------- API V1.8 (cgminer v2.3.5) Added API commands: 'devdetails' Support for the ZTex FPGA was added ---------- API V1.7 (cgminer v2.3.4) Added API commands: 'removepool' Modified API commands: 'pools' added "User" From API version 1.7 onwards, reply strings in JSON and Text have the necessary escaping as required to avoid ambiguity For JSON the 2 characters '"' and '\' are escaped with a '\' before them For Text the 4 characters '|' ',' '=' and '\' are escaped the same way ---------- API V1.6 (cgminer v2.3.2) Added API commands: 'pga' 'pgaenable' 'pgadisable' 'pgacount' Modified API commands: 'devs' now includes Icarus and Bitforce FPGA devices 'notify' added "*" to the front of the name of all numeric error fields 'config' correct "Log Interval" to use numeric (not text) type for JSON Support for Icarus and Bitforce FPGAs was added ---------- API V1.5 was not released ---------- API V1.4 (Kano's interim release of cgminer v2.3.1) Added API commands: 'notify' Modified API commands: 'config' added "Device Code" and "OS" Added "When" to the STATUS reply section of all commands ---------- API V1.3 (cgminer v2.3.1-2) Added API commands: 'addpool' Modified API commands: 'devs'/'gpu' added "Total MH" for each device 'summary' added "Total MH" ---------- API V1.2 (cgminer v2.3.0) Added API commands: 'enablepool' 'disablepool' 'privileged' Modified API commands: 'config' added "Log Interval" Starting with API V1.2, any attempt to access a command that requires privileged security, from an IP address that does not have privileged security, will return an "Access denied" Error Status ---------- API V1.1 (cgminer v2.2.4) There were no changes to the API commands in cgminer v2.2.4, however support was added to cgminer for IP address restrictions with the --api-allow option ---------- API V1.1 (cgminer v2.2.2) Prior to V1.1, devs/gpu incorrectly reported GPU0 Intensity for all GPUs Modified API commands: 'devs'/'gpu' added "Last Share Pool" and "Last Share Time" for each device ---------- API V1.0 (cgminer v2.2.0) Remove default CPU support Added API commands: 'config' 'gpucount' 'cpucount' 'switchpool' 'gpuintensity' 'gpumem' 'gpuengine' 'gpufan' 'gpuvddc' 'save' ---------- API V0.7 (cgminer v2.1.0) Initial release of the API in the main cgminer git Commands: 'version' 'devs' 'pools' 'summary' 'gpuenable' 'gpudisable' 'gpurestart' 'gpu' 'cpu' 'gpucount' 'cpucount' 'quit' ---------------------------------------- miner.php ========= miner.php is a PHP based interface to the cgminer RPC API (referred to simply as the API below) It can show rig details, summaries and input fields to allow you to change cgminer You can also create custom summary pages with it It has two levels to the security: 1) cgminer can be configured to allow or disallow API access and access level security for miner.php 2) miner.php can be configured to allow or disallow privileged cgminer access, if cgminer is configured to allow privileged access for miner.php --------- To use miner.php requires a web server with PHP Basics: On xubuntu 11.04, to install apache2 and php, the commands are: sudo apt-get install apache2 sudo apt-get install php5 sudo /etc/init.d/apache2 reload On Fedora 17: yum install httpd php systemctl restart httpd.service systemctl enable httpd.service --system On windows there are a few options. Try one of these (I've never used either one) http://www.apachefriends.org/en/xampp.html http://www.wampserver.com/en/ --------- The basic cgminer option to enable the API is: --api-listen or in your cgminer.conf "api-listen" : true, (without the ',' on the end if it is the last item) If the web server is running on the cgminer computer, the above is the only change required to give miner.php basic access to the cgminer API - If the web server runs on a different computer to cgminer, you will also need to tell cgminer to allow the web server to access cgminer's API and tell miner.php where cgminer is Assuming a.b.c.d is the IP address of the web server, you would add the following to cgminer: --api-listen --api-allow a.b.c.d or in your cgminer.conf "api-listen" : true, "api-allow" : "a.b.c.d", to tell cgminer to give the web server read access to the API You also need to tell miner.php where cgminer is. Assuming cgminer is at IP address e.f.g.h, then you would edit miner.php and change the line $rigs = array('127.0.0.1:4028'); to $rigs = array('e.f.g.h:4028'); See --api-network or --api-allow for more access details and how to give write access --------- Once you have a web server with PHP running copy your miner.php to the main web folder On Xubuntu 11.04 /var/www/ On Fedora 17 /var/www/html/ On Windows see your windows Web/PHP documentation Assuming the IP address of the web server is a.b.c.d Then in your web browser go to: http://a.b.c.d/miner.php Done :) --------- The rest of this documentation deals with the more complex functions of miner.php, using myminer.php, creaing custom summaries and displaying multiple cgminer rigs --------- If you create a file called myminer.php in the same web folder where you put miner.php, miner.php will load it when it runs This is useful, to put any changes you need to make to miner.php instead of changing miner.php Thus if you update/get a new miner.php, you won't lose the changes you have made if you put all your changes in myminer.php (and don't change miner.php at all) A simple example myminer.php that defines 2 rigs (that I will keep referring to further below) is: <?php # $rigs = array('192.168.0.100:4028:A', '192.168.0.102:4028:B'); # ?> Changes in myminer.php superscede what is in miner.php However, this is only valid for variables in miner.php before the 2 lines where myminer.php is included by miner.php: if (file_exists('myminer.php')) include_once('myminer.php'); Every variable in miner.php above those 2 lines, can be changed by simply defining them in your myminer.php So although miner.php originally contains the line $rigs = array('127.0.0.1:4028'); if you created the example myminer.php given above, it would actually change the value of $rigs that is used when miner.php is running i.e. you don't have to remove or comment out the $rigs line in miner.php It will be superceded by myminer.php --------- The example.php above also shows how to define more that one rig to be shown my miner.php Each rig string is 2 or 3 values seperated by colons ':' They are simply an IP address or host name, followed by the port number (usually 4028) and an optional Name string miner.php displays rig buttons that will show the defails of a single rig when you click on it - the button shows either the rig number, or the 'Name' string if you provide it PHP arrays contain each string seperated by a comma, but no comma after the last one So an example for 3 rigs would be: $rigs = array('192.168.0.100:4028:A', '192.168.0.102:4028:B', '192.168.0.110:4028:C'); Of course each of the rigs listed would also have to have the API running and be set to allow the web server to access the API - as explained before --------- So basically, any variable explained below can be put in myminer.php if you wanted to set it to something different to it's default value and did not want to change miner.php itself every time you updated it Below is each variable that can be changed and an explanation of each --------- Default: $dfmt = 'H:i:s j-M-Y \U\T\CP'; Define the date format used to print full length dates If you get the string 'UTCP' on the end of your dates shown, that means you are using an older version of PHP and you can instead use: $dfmt = 'H:i:s j-M-Y \U\T\CO'; The PHP documentation on the date format is here: http://us.php.net/manual/en/function.date.php --------- Default: $title = 'Mine'; Web page title If you know PHP you can of course use code to define it e.g. $title = 'My Rig at: '.date($dfmt); Which would set the web page title to something like: My Rig at: 10:34:00 22-Aug-2012 UTC+10:00 --------- Default: $readonly = false; Set $readonly to true to force miner.php to be readonly This means it won't allow you to change cgminer even if the cgminer API options allow it to If you set $readonly to false then it will check cgminer 'privileged' and will show input fields and buttons on the single rig page allowing you to change devices, pools and even quit or restart cgminer However, if the 'privileged' test fails, the code will set $readonly to true --------- Default: $notify = true; Set $notify to false to NOT attempt to display the notify command table of data Set $notify to true to attempt to display the notify command on the single rig page If your older version of cgminer returns an 'Invalid command' coz it doesn't have notify - it just shows the error status table --------- Default: $checklastshare = true; Set $checklastshare to true to do the following checks: If a device's last share is 12x expected ago then display as an error If a device's last share is 8x expected ago then display as a warning If either of the above is true, also display the whole line highlighted This assumes shares are 1 difficulty shares Set $checklastshare to false to not do the above checks 'expected' is calculated from the device MH/s value So for example, a device that hashes at 380MH/s should (on average) find a share every 11.3s If the last share was found more than 11.3 x 12 seconds (135.6s) ago, it is considered an error and highlighted If the last share was found more than 11.3 x 8 seconds (90.4s) ago, it is considered a warning and highlighted The default highlighting is very subtle --------- Default: $poolinputs = false; Set $poolinputs to true to show the input fields for adding a pool and changing the pool priorities on a single rig page However, if $readonly is true, it will not display them --------- Default: $rigs = array('127.0.0.1:4028'); Set $rigs to an array of your cgminer rigs that are running format: 'IP:Port' or 'Host:Port' or 'Host:Port:Name' If you only have one rig, it will just show the detail of that rig If you have more than one rig it will show a summary of all the rigs with buttons to show the details of each rig - the button contents will be 'Name' rather than rig number, if you specify 'Name' e.g. $rigs = array('127.0.0.1:4028','myrig.com:4028:Sugoi'); --------- Default: $rigipsecurity = true; Set $rigipsecurity to false to show the IP/Port of the rig in the socket error messages and also show the full socket message --------- Default: $rigtotals = true; $forcerigtotals = false; Set $rigtotals to true to display totals on the single rig page 'false' means no totals (and ignores $forcerigtotals) If $rigtotals is true, all data is also right aligned With false, it's as before, left aligned This option is just here to allow people to set it to false if they prefer the old non-total display when viewing a single rig Also, if there is only one line shown in any section, then no total will be shown (to save screen space) You can force it to always show rig totals on the single rig page, even if there is only one line, by setting $forcerigtotals = true; --------- Default: $socksndtimeoutsec = 10; $sockrcvtimeoutsec = 40; The numbers are integer seconds The defaults should be OK for most cases However, the longer SND is, the longer you have to wait while php hangs if the target cgminer isn't runnning or listening RCV should only ever be relevant if cgminer has hung but the API thread is still running, RCV would normally be >= SND Feel free to increase SND if your network is very slow or decrease RCV if that happens often to you Also, on some windows PHP, apparently the $usec is ignored (so usec can't be specified) --------- Default: $hidefields = array(); List of fields NOT to be displayed You can use this to hide data you don't want to see or don't want shown on a public web page The list of sections are: SUMMARY, POOL, PGA, GPU, NOTIFY, CONFIG, DEVDETAILS, DEVS See the web page for the list of field names (the table headers) It is an array of 'SECTION.Field Name' => 1 This example would hide the slightly more sensitive pool information: Pool URL and pool username: $hidefields = array('POOL.URL' => 1, 'POOL.User' => 1); If you just want to hide the pool username: $hidefields = array('POOL.User' => 1); --------- Default: $ignorerefresh = false; $changerefresh = true; $autorefresh = 0; Auto-refresh of the page (in seconds) - integers only $ignorerefresh = true/false always ignore refresh parameters $changerefresh = true/false show buttons to change the value $autorefresh = default value, 0 means dont auto-refresh --------- Default: $placebuttons = 'top'; Where to place the Refresh, Summary, Custom Pages, Quit, etc. buttons Valid values are: 'top' 'bot' 'both' anything else means don't show them - case sensitive --------- Default: $miner_font_family = 'verdana,arial,sans'; $miner_font_size = '13pt'; Change these to set the font and font size used on the web page --------- Default: $colouroverride = array(); Use this to change the web page colour scheme See $colourtable in miner.php for the list of possible names to change Simply put in $colouroverride, just the colours you wish to change e.g. to change the colour of the header font and background you could do the following: $colouroverride = array( 'td.h color' => 'green', 'td.h background' => 'blue' ); --------- Default: $allowcustompages = true; Should we allow custom pages? (or just completely ignore them and don't display the buttons) --------- OK this part is more complex: Custom Summary Pages A custom summary page in an array of 'section' => array('FieldA','FieldB'...) The section defines what data you want in the summary table and the Fields define what data you want shown from that section Standard sections are: SUMMARY, POOL, PGA, GPU, NOTIFY, CONFIG, DEVDETAILS, DEVS, STATS, COIN Fields are the names as shown on the headers on the normal pages Fields can be 'name=new name' to display 'name' with a different heading 'new name' There are also now joined sections: SUMMARY+POOL, SUMMARY+DEVS, SUMMARY+CONFIG, DEVS+NOTIFY, DEVS+DEVDETAILS SUMMARY+COIN These sections are an SQL join of the two sections and the fields in them are named section.field where section. is the section the field comes from See the example further down Also note: - empty tables are not shown - empty columns (e.g. an unknown field) are not shown - missing field data shows as blank - the field name '*' matches all fields except in joined sections (useful for STATS and COIN) There are 2 hard coded sections: DATE - displays a date table like at the start of 'Summary' RIGS - displays a rig table like at the start of 'Summary' Each custom summary requires a second array, that can be empty, listing fields to be totaled for each section If there is no matching total data, no total will show --------- Looking at the Mobile example: $mobilepage = array( 'DATE' => null, 'RIGS' => null, 'SUMMARY' => array('Elapsed', 'MHS av', 'Found Blocks=Blks', Accepted', 'Rejected=Rej', 'Utility'), 'DEVS+NOTIFY' => array('DEVS.Name=Name', 'DEVS.ID=ID', 'DEVS.Status=Status', 'DEVS.Temperature=Temp', 'DEVS.MHS av=MHS av', 'DEVS.Accepted=Accept', 'DEVS.Rejected=Rej', 'DEVS.Utility=Utility', 'NOTIFY.Last Not Well=Not Well'), 'POOL' => array('POOL', 'Status', 'Accepted', 'Rejected=Rej', 'Last Share Time')); $mobilesum = array( 'SUMMARY' => array('MHS av', 'Found Blocks', 'Accepted', 'Rejected', 'Utility'), 'DEVS+NOTIFY' => array('DEVS.MHS av', 'DEVS.Accepted', 'DEVS.Rejected', 'DEVS.Utility'), 'POOL' => array('Accepted', 'Rejected')); $customsummarypages = array('Mobile' => array($mobilepage, $mobilesum)); This will show 5 tables (according to $mobilepage) Each table will have the chosen details for all the rigs specified in $rigs DATE A single box with the web server's current date and time RIGS A table of the rigs: description, time, versions etc SUMMARY This will use the API 'summary' command and show the selected fields: Elapsed, MHS av, Found Blocks, Accepted, Rejected and Utility However, 'Rejected=Rej' means that the header displayed for the 'Rejected' field will be 'Rej', instead of 'Rejected' (to save space) Same for 'Found Blocks=Blks' - to save space DEVS+NOTIFY This will list each of the devices on each rig and display the list of fields as shown It will also include the 'Last Not Well' field from the 'notify' command so you know when the device was last not well You will notice that you need to rename each field e.g. 'DEVS.Name=Name' since each field name in the join between DEVS and NOTIFY is actually section.fieldname, not just fieldname The join code automatically adds 2 fields to each GPU device: 'Name' and 'ID' They don't exist in the API 'devs' output but I can correctly calculate them from the GPU device data These two fields are used to join DEVS to NOTIFY i.e. find the NOTIFY record that has the same Name and ID as the DEVS record and join them POOL This will use the API 'pools' command and show the selected fields: POOL, Status, Accepted, Rejected, Last Share Time Again, I renamed the 'Rejected' field using 'Rejected=Rej', to save space $mobilesum lists the sections and fields that should have a total You can't define them for 'DATE' or 'RIGS' since they are hard coded tables The example given: SUMMARY Show a total at the bottom of the columns for: MHS av, Found Blocks, Accepted, Rejected, Utility Firstly note that you use the original name i.e. for 'Rejected=Rej' you use 'Rejected', not 'Rej' and not 'Rejected=Rej' Secondly note that it simply adds up the fields If you ask for a total of a string field you will get the numerical sum of the string data DEVS+NOTIFY Simply note in this join example that you must use the original field names which are section.fieldname, not just fieldname POOL Show a total at the bottom of the columns for: Accepted and Rejected Again remember to use the original field name 'Rejected'
No comments:
Post a Comment