1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-10 23:08:07 +00:00
Commit Graph

569 Commits

Author SHA1 Message Date
Con Kolivas
845af9113e Add --submit-stale option which submits all shares, regardless of whether they would normally be considered stale. 2011-08-16 09:42:26 +10:00
Znort 987
eed634a3ab Merge branch 'ckolivas-master' into merge-ckolivas-master 2011-08-16 00:04:50 +02:00
Con Kolivas
4e48561a13 Rework the last-initialised time displayed. 2011-08-15 23:23:53 +10:00
Con Kolivas
cfe8534c39 Partial restart of threads has proven to be unsuccessful so reinstate device re-initialisation to restart GPUs.
Do this by having a reinit thread that is told via a queue which device to restart.
If this thread fails to return from opencl code, it should not interrupt the workings of other devices.
2011-08-15 23:23:52 +10:00
Con Kolivas
42d49ffdc7 Revert "Restart threads by abstracting out the clcontext initialisation and using that instead of probing all cards."
This reverts commit 8f186e61e2.
2011-08-15 23:23:45 +10:00
Con Kolivas
cf543507c6 Revert "Preinitialise the devices only once on startup."
This reverts commit 071a0ad2f1.
2011-08-15 23:23:39 +10:00
Con Kolivas
b1289a0159 Revert "Move the non cl_ variables into the cgpu info struct to allow creating a new cl state on reinit, preserving known GPU variables."
This reverts commit 28880d0dc7.
2011-08-15 23:23:29 +10:00
Con Kolivas
7c50bb02ab Revert "Display last initialised time in gpu management info."
This reverts commit 177e07aed3.
2011-08-15 23:23:20 +10:00
Con Kolivas
cac54f30b8 Revert "When pinging a sick cpu, flush finish and then ping it in a separate thread in the hope it recovers, but without blocking code elsewhere."
This reverts commit a466942fd8.
2011-08-15 23:23:09 +10:00
Znort 987
92af1925a6 Remove benchmark data from main.c 2011-08-15 15:08:13 +02:00
Znort 987
8256402a63 Remove harmless warning on win32 2011-08-15 14:58:36 +02:00
Znort 987
593022dfd7 Added somme comments 2011-08-15 14:00:09 +02:00
Znort 987
e923ac78d5 Add CPU algo used to summary 2011-08-15 13:59:44 +02:00
Znort 987
4e3f38d047 Re-indent code for fork_monitor 2011-08-15 13:59:07 +02:00
Znort 987
39bdec8bbe Various minor changes
- Fixed a type bug on 32bit platform in algo bench
	- Some re-indenting
2011-08-15 13:58:30 +02:00
Znort 987
75639da1e3 Add WIN32 safe CPU benchmark method
Method for WIN32

	- Add a hidden '--bench-algo' option to cgminer that only
          benchmarks the specified algorithm.

	- Create a chunk of shared mem

	- Launch a new instance of cgminer with --bench-algo, and
          act as a debugger for it to silently catch crashes.

	- Once it completes, either successfully or because of a
	  crash, read benchmarked value from shared mem
2011-08-15 13:55:00 +02:00
Znort 987
84b0467cb2 Fix broken assert in algo bencher 2011-08-15 13:53:15 +02:00
Znort 987
6fd06387b3 On unix, make algo benchmark more generic 2011-08-15 13:51:48 +02:00
Znort 987
01886493cf Add set_non_blocking routing
In preparation for upcoming generic unix automated
    algorithm benchmark method (as opposed to linux specific),
    add a utility method.
2011-08-15 13:49:26 +02:00
Znort 987
29f0f9bc18 Properly detect number of cores on WIN32 2011-08-15 13:48:17 +02:00
Znort 987
7158f9f9ed Add automated benchmark of the CPU hashers
The --algo switch now accepts the "auto" argument.

    When "auto" is passed to --algo, cgminer starts by benchmarking
    all the CPU algorithms it nows about and picks the fastest.

    This is useful for benchmarking, but also for folks who run
    cgminer on a large number of heterogeneous computers because
    it saves them from having to configure each instance optimally.

    Caveat emptor: depending on the platform, some algorithms will
    fail with "illegal instruction" (e.g. via padlock code on non via
    platforms, or SSE4 code on non SSE4 platforms).

    To protect against this, cgminer runs the benchmarks in a child
    process. The crash, if any occurs in the child, and the parent
    marks this algo as "fails" and continues benchmarking the next
    algorithm.

    Unfortunately, this safeguard is only implemented for Linux
    because I have no clue how to do this on win32 (nor access to
    a win32 box).
2011-08-15 13:47:50 +02:00
Con Kolivas
50504ef9e0 If a work item has had any mining done on it, don't consider it discarded work. 2011-08-14 13:57:58 +10:00
Con Kolivas
656067a44e Stale work test should respect age of rolled work as well. 2011-08-14 12:30:50 +10:00
Con Kolivas
232408050c Stick to rolling only work from the current pool unless we're in load balance mode or lagging to avoid aggressive rolling imitating load balancing. 2011-08-14 11:35:53 +10:00
Con Kolivas
01aadda25c Simply set the time of day when the work is decoded. 2011-08-14 11:24:38 +10:00
Con Kolivas
639d38fbd4 Revert "Make sure to give work items a starting time only once when they're staged."
This reverts commit 626ae10d7c.

Failed to address all work items.
2011-08-14 07:54:45 +10:00
Con Kolivas
626ae10d7c Make sure to give work items a starting time only once when they're staged. 2011-08-14 02:33:55 +10:00
Con Kolivas
d6dd5d700b Test each work item to see if it can be rolled instead of per-pool and roll whenever possible, adhering to the 60 second timeout. 2011-08-14 01:54:47 +10:00
Con Kolivas
e9b8344a37 Free all work in one place allowing us to perform actions on it in the future. 2011-08-13 20:56:41 +10:00
Con Kolivas
6da13fb87f Only put the message that a pool is down if not pinging it every minute. 2011-08-13 20:56:34 +10:00
Con Kolivas
510be5c9a4 Summary on exit is sometimes getting lost without a flush of stdout. 2011-08-13 20:56:16 +10:00
Con Kolivas
42c22025d8 The can_roll function fails inappropriately in stale_work. 2011-08-13 20:56:09 +10:00
Con Kolivas
d39e5abfba We can't hit this path since the earlier check for stale work will prevent us ever finding work it can roll here. 2011-08-13 20:56:04 +10:00
Con Kolivas
17e5e17e88 Only consider a pool lagging if we actually need the work and we have none staged despite queue requests stacking up. 2011-08-13 20:55:53 +10:00
Con Kolivas
a466942fd8 When pinging a sick cpu, flush finish and then ping it in a separate thread in the hope it recovers, but without blocking code elsewhere. 2011-08-13 20:55:43 +10:00
Con Kolivas
177e07aed3 Display last initialised time in gpu management info. 2011-08-13 20:55:30 +10:00
Con Kolivas
28880d0dc7 Move the non cl_ variables into the cgpu info struct to allow creating a new cl state on reinit, preserving known GPU variables.
Create a new context from scratch in initCQ in case something was corrupted to maximise our chance of succesfully creating a new worker thread.
2011-08-13 20:54:20 +10:00
Con Kolivas
071a0ad2f1 Preinitialise the devices only once on startup. 2011-08-13 20:50:00 +10:00
Znort 987
2e31e1687c Add missing fflush(stdout) for --ndevs 2011-08-13 20:49:15 +10:00
Znort 987
353789da0b Use tab to indent code instead of spaces 2011-08-13 20:49:02 +10:00
Znort 987
83fa2158d9 Lots more verbiage in error messages 2011-08-13 20:48:46 +10:00
Znort 987
1cbfcba2c1 Disable --monitor-stderr on WIN32 2011-08-13 20:48:30 +10:00
Con Kolivas
467c52bb4a Allocate work from one function to be able to initialise variables added later. 2011-08-13 20:48:03 +10:00
Znort 987
79c989dd48 Add new option: --monitor <cmd>
Option lets user specify a command <cmd> that will get
    forked by cgminer on startup. cgminer's stderr output
    subsequently gets piped directly to this command.

    This permits smart batch monitoring of the miner by a
    baby-sitter log parser while retaining the full benefit
    of the curses interface, e.g. when running cgminer under
    screen.

    Doing the same thing is possible using advanced bash
    redirection paraphernalia, but it is somewhat of a pain,
    especially when running screen'd.

    This option makes things more straightforward.
2011-08-13 20:47:25 +10:00
Con Kolivas
1725a1c021 Fix non-opencl build. 2011-07-30 23:19:53 +10:00
Con Kolivas
bc2976f538 Be more willing to get work from the backup pools if the work is simply being queued faster than it is being retrieved. 2011-07-30 21:56:51 +10:00
Con Kolivas
8f186e61e2 Restart threads by abstracting out the clcontext initialisation and using that instead of probing all cards. 2011-07-30 16:59:54 +10:00
Con Kolivas
411570d348 Revert "Don't use asynchronous work with flushes as it decreases reliability and two threads per GPU achieves the same throughput."
This reverts commit 7223508f7e.

Bad idea. Need to work around sync lineup.
2011-07-30 16:36:19 +10:00
Con Kolivas
decafea0ad Revert "Read buffers only after reading data back now that we're sync."
This reverts commit 5f2c3151b4.

Bad idea. Need to rework around sync lineup.
2011-07-30 16:36:02 +10:00
Con Kolivas
5f2c3151b4 Read buffers only after reading data back now that we're sync. 2011-07-30 16:33:43 +10:00
Con Kolivas
7223508f7e Don't use asynchronous work with flushes as it decreases reliability and two threads per GPU achieves the same throughput. 2011-07-30 16:11:03 +10:00
Con Kolivas
f763b0db10 Don't free up any ram from the dying thread to avoid dereferences. 2011-07-30 14:27:17 +10:00
Con Kolivas
43faa11358 Use correct name in syslog. 2011-07-30 13:37:34 +10:00
Con Kolivas
37115c0e1b RPC call debugging is a mess with \r in it so remove it. 2011-07-30 13:33:52 +10:00
Con Kolivas
59b640870c So we can pthread cancel a stuck thread, but can't pthread join it.
And we can't tq freeze the old queue or we could hang here.
And we need to re-initialise all the opencl contexts so send a test command and if it succeeds reinit the card.
2011-07-30 13:28:25 +10:00
Con Kolivas
74a07eb461 Revert "Send threads message to stop and then send cancel message but don't pthread_join them if they're stuck nor reinit the opencl code to not hang everything."
This reverts commit 62521f3e53.

Not enough to restart a GPU.
2011-07-30 13:14:59 +10:00
Con Kolivas
e100fcc672 Revert "Send ping to wake up new threads."
This reverts commit bf4c3626bc.

Prepare to rollback.
2011-07-30 13:14:47 +10:00
Con Kolivas
bf4c3626bc Send ping to wake up new threads. 2011-07-30 12:00:12 +10:00
Con Kolivas
62521f3e53 Send threads message to stop and then send cancel message but don't pthread_join them if they're stuck nor reinit the opencl code to not hang everything. 2011-07-30 10:16:03 +10:00
Con Kolivas
b2cbaa1ae4 Send a hung device a command. If it returns, try to reinitialise it. 2011-07-30 08:21:17 +10:00
Con Kolivas
a702f599d3 Disable the reinit_thread option till we know it actually works. 2011-07-30 02:31:29 +10:00
Con Kolivas
bb575a5585 Reference correct GPU and only try to restart if it reaches DEAD. 2011-07-30 02:16:29 +10:00
Con Kolivas
947a74bfa3 Differentiate thread failure from GPU failure by declaring a GPU sick first and trying to restart the thread without re-initialising the card.
If that fails, then try once more at ten minutes and declare it dead.
This should prevent an attempted re-initialising of the GPU from taking out other GPUs.
2011-07-30 01:23:17 +10:00
Con Kolivas
20ce1ebf2a Typo. 2011-07-29 20:40:57 +10:00
Con Kolivas
3803760689 Reimplement the per-thread getwork count with proper accounting at get_work(). 2011-07-29 11:11:42 +10:00
Con Kolivas
0fe22d8d94 Revert "Only update the thread getwork queue count if it actually results in a getwork request from the server."
This reverts commit 2e607d44f2.

The count looks far too difficult to add up with this change since many are queued generically.
2011-07-29 11:02:47 +10:00
Con Kolivas
2e607d44f2 Only update the thread getwork queue count if it actually results in a getwork request from the server. 2011-07-29 10:39:58 +10:00
Con Kolivas
5b9bfedda1 Display the correct current hash as per blockexplorer, truncated to 16 characters, with just the time. 2011-07-29 00:40:47 +10:00
Con Kolivas
c94737ceab Add http:// if it's not explicitly set for URL entries. 2011-07-28 12:44:50 +10:00
Con Kolivas
f0fe82ea37 Some Intel HD graphics support the opencl commands but return errors since they don't support opencl. Don't fail with them, just provide a warning and disable GPU mining. 2011-07-28 10:49:36 +10:00
Con Kolivas
10fa821e33 Update utility and efficiency figures when displaying them. 2011-07-28 10:46:28 +10:00
Con Kolivas
0006eb2da4 Make the "quiet" mode still update the status and display errors, and add a new --real-quiet option which disables all output and can be set once while running. 2011-07-28 10:36:48 +10:00
Con Kolivas
da06a348d0 The work length in the miner thread gets smaller but doesn't get bigger if it's under 1 second.
This could end up leading to CPU under-utilisation and lower and lower hash rates.
Fix it by increasing work length if it drops under 1 second.
2011-07-28 10:03:31 +10:00
Con Kolivas
a0924933d0 Restarting a hung GPU can hang the rest of the GPUs so just declare it dead and provide the information in the status. 2011-07-28 09:59:18 +10:00
Con Kolivas
45faff2e26 Add debugging output to all tq_pop calls. 2011-07-27 22:28:41 +10:00
Con Kolivas
2e2b2ba14c Add debugging output to tq_push calls. 2011-07-27 22:20:57 +10:00
Con Kolivas
70fa8f319b Make the display options clearer. 2011-07-27 21:58:08 +10:00
Con Kolivas
c7978f11ed Dividing work is like the work is never removed at all so treat it as such. However the queued bool needs to be reset to ensure we *can* request more work even if we didn't initially. 2011-07-27 20:40:06 +10:00
Con Kolivas
e82e390295 If work has been cloned it is already at the head of the list and when being reinserted into the queue it should be placed back at the head of the list. 2011-07-27 16:40:52 +10:00
Con Kolivas
9c12d49684 Attribute split work as local work generation. 2011-07-27 16:29:37 +10:00
Con Kolivas
720032dacd Make sure to decrease queued count if we discard the work. 2011-07-27 15:11:57 +10:00
Con Kolivas
967acd39bd Don't put an extra work item in the queue as each new device thread will do so itself. 2011-07-27 15:06:04 +10:00
Con Kolivas
82698fbffd Do away with queueing work separately at the start and let each thread grab its own work as soon as it's ready. 2011-07-27 15:01:08 +10:00
Con Kolivas
6cc8d22beb Properly detect stale work based on time from staging and discard instead of handing on, but be more lax about how long work can be divided for up to the scantime. 2011-07-27 14:53:43 +10:00
Con Kolivas
45d5435781 Make cpu mining work submission asynchronous as well. 2011-07-27 14:29:51 +10:00
Con Kolivas
380d145c64 Make threads report out when they're queueing a request and report if they've failed. 2011-07-27 14:03:01 +10:00
Con Kolivas
324dd93bb7 Don't take more than one lock at a time. 2011-07-27 10:36:16 +10:00
Con Kolivas
98f609b5be Sanity check to prove locking. 2011-07-27 10:31:44 +10:00
Con Kolivas
c72840284f Abstract out the decay time function and use it to make hash_div a rolling average so it doesn't change too abruptly and divide work in chunks large enough to guarantee they won't overlap. 2011-07-27 10:00:58 +10:00
Con Kolivas
a48895829e Update both windows separately, but not at the same time to prevent the double refresh crash that old libncurses has.
Do the window resize check only when about to redraw the log window to minimise ncurses cpu usage.
2011-07-27 09:41:52 +10:00
Con Kolivas
6f905932af Only free the thread structures if the thread still exists. 2011-07-27 08:32:25 +10:00
Con Kolivas
40bc82d4ca Don't adjust hash_div only up for GPUs. Disable hash_div adjustment for GPUs. 2011-07-27 02:03:59 +10:00
Con Kolivas
1aadfc580b Two redraws in a row cause a crash in old libncurses so just do one redraw using the main window. 2011-07-27 01:41:16 +10:00
Con Kolivas
93b284dbca Best to serialise the restarting of threads to avoid device initialisation issues. 2011-07-26 23:17:25 +10:00
Con Kolivas
d5d56920dd Off by one limit in device selection. 2011-07-26 22:41:42 +10:00
Con Kolivas
f9bc3771b4 The first work item is tricky so don't try and divide it up to begin with. 2011-07-26 21:40:11 +10:00
Con Kolivas
1536e085da Increase efficiency of slow mining threads such as CPU miners dramatically.
Do this by detecting which threads cannot complete searching a work item within the scantime and then divide up a work item into multiple smaller work items.
Detect the age of the work items and if they've been cloned before to prevent doing the same work over.
If the work is too old to be divided, then see if it can be time rolled and do that to generate work.
This dramatically decreases the number of queued work items from a pool leading to higher overall efficiency (but the same hashrate and share submission rate).
2011-07-26 20:48:05 +10:00
Con Kolivas
7e7a5f777e Don't request work too early for CPUs as CPUs will scan for the full opt_scantime anyway. 2011-07-26 15:16:39 +10:00
Con Kolivas
6045c4d161 Simplify gpu management enable/disable/restart code. 2011-07-26 13:47:18 +10:00
Con Kolivas
fa17f03432 Implement much more accurate rolling statistics per thread and per gpu and improve accuracy of rolling displayed values. 2011-07-26 11:58:45 +10:00
Con Kolivas
ce6af96821 Make the rolling log-second average more accurate. 2011-07-26 10:45:52 +10:00
Con Kolivas
7707ed4db1 Add a menu to manage GPUs on the fly allowing you to enable/disable GPUs or try restarting them.
Keep track of which GPUs are alive versus enabled.
Start threads for devices that are even disabled, but don't allow them to start working.
2011-07-26 10:26:03 +10:00
Con Kolivas
7143c25b72 The last pool is when we are low in total_pools, not active_pools. 2011-07-25 16:44:24 +10:00
Con Kolivas
a53716dc7f Fix compiler warnings. 2011-07-25 13:59:34 +10:00
Con Kolivas
b3d20b573c Make the thread restart do a pthread_join after disabling the device, only re-enabling it if we succeed in restarting the thread.
Do this from a separate thread so as to not block any other code.
This will allow cgminer to continue even if one GPU hangs.
2011-07-25 13:55:01 +10:00
Con Kolivas
a187fe1e7b Try to do every curses manipulation under the curses lock. 2011-07-25 13:00:44 +10:00
Con Kolivas
508c5c4b12 Detect when the primary pool is lagging and start queueing requests on backup pools if possible before needing to roll work. 2011-07-24 12:07:44 +10:00
Con Kolivas
afcff07012 Load balancing puts more into the current pool if there are disabled pools. Fix. 2011-07-24 11:25:23 +10:00
Con Kolivas
27c7d2a480 Disable a GPU device should the thread fail to init. 2011-07-24 10:59:19 +10:00
Con Kolivas
9a928e3407 Fix possible dereference on blank inputs during input_pool. 2011-07-24 08:55:16 +10:00
Con Kolivas
1a789a40c7 Defines missing would segfault on --help when no sse mining is built in. 2011-07-24 08:51:07 +10:00
Con Kolivas
fd473afedc Revert "Free up resources/stale compilers."
This reverts commit b4960ec36b.

Didn't help and might have caused other issues.
2011-07-24 08:44:14 +10:00
Con Kolivas
f3c5f55481 Only try to print the status of active devices. 2011-07-24 08:42:07 +10:00
Con Kolivas
020cf7d63f Build support in for all SSE if possible and only set the default according to machine capabilities. 2011-07-23 16:19:51 +10:00
Con Kolivas
039a5ea7cd No need to make leaveok changes win32 only. 2011-07-23 16:17:28 +10:00
Ycros
a150140eb7 Merge branch 'cgminer' of git://github.com/ckolivas/cgminer into cgminer 2011-07-23 16:00:49 +10:00
Con Kolivas
a9e1a25518 Make it possible to select the choice of kernel on the command line. 2011-07-23 15:15:46 +10:00
Con Kolivas
116a9dc025 Update phatk kernel to one with new parameters for slightly less overhead again.
Make the queue kernel parameters call a function pointer to select phatk or poclbm.
2011-07-23 14:17:25 +10:00
Con Kolivas
b5358483c3 Cannot print the status of threads that don't exist so just queue enough work for the number of mining threads to prevent crash with -Q N. 2011-07-23 09:37:22 +10:00
Ycros
e615b61f0a Merge branch 'cgminer' of git://github.com/ckolivas/cgminer into cgminer 2011-07-23 02:26:07 +10:00
Ycros
e04aee24d3 Win32: Fix for mangled output on the terminal on exit. 2011-07-23 02:25:54 +10:00
Con Kolivas
8d4fbc3258 Clear log window from consistent place. No need for locking since logging is disabled during input. 2011-07-23 00:45:03 +10:00
Con Kolivas
ba89a0a44f Unlocking error on retry. Locking unnecessary anyway so remove it. 2011-07-23 00:33:01 +10:00
Con Kolivas
f94ca32dcf Make sure intensity is carried over to thread count and is at least the minimum necessary to work. 2011-07-22 23:53:24 +10:00
Ycros
d37c3fe56b Win32 threading and longpoll keepalive fixes. 2011-07-22 23:43:26 +10:00
Con Kolivas
e83a32a4e2 Remove the mandatory work requirement at startup by testing for invalid work being passed which allows for work to be queued immediately.
This also removes the requirement for resetting the timecodes at the start which caused huge over-estimates of hashing for a short period.
2011-07-22 23:37:50 +10:00
Con Kolivas
61e555e44c Tell getwork how much of a work item we're likely to complete for future splitting up of work. 2011-07-22 22:22:14 +10:00
Con Kolivas
9e42d63cd6 With huge variation in GPU performance, allow intensity to go from -10 to +10. 2011-07-22 21:57:43 +10:00
Con Kolivas
61e5cc10e9 Extra refresh not required. 2011-07-22 20:12:32 +10:00
Con Kolivas
ae6eb1b0a3 Decrease testing log to info level. 2011-07-22 20:07:15 +10:00
Con Kolivas
ec86da70e1 Limit rolltime work generation to 10 iterations only. 2011-07-22 20:06:06 +10:00
Con Kolivas
6e9b6bf840 Implement pool removal. 2011-07-22 17:46:28 +10:00
Con Kolivas
532587eba4 Set priority correctly on multipools.
Display priority and alive/dead information in display_pools.
2011-07-22 17:23:57 +10:00
Con Kolivas
56defd6e0b Make it possible to enable/disable longpoll. 2011-07-22 17:02:29 +10:00
Con Kolivas
53529a842d Abstract out the longpoll start and explicitly restart it on pool change. 2011-07-22 16:51:38 +10:00
Con Kolivas
62c8a8c1e1 Allow scan settings to be modified at runtime. 2011-07-22 16:32:38 +10:00
Con Kolivas
a8c84da4c9 Allow log interval to be set in the menu. 2011-07-22 16:10:47 +10:00
Con Kolivas
2f976c7406 Make the input windows update immediately instead of needing a refresh. 2011-07-22 15:17:09 +10:00
Con Kolivas
0909facfaf Clean up the messy way the staging thread communicates with the longpoll thread to determine who found the block first. 2011-07-22 15:00:57 +10:00
Con Kolivas
0106c56797 Add a menu and separate out display options. 2011-07-22 14:29:48 +10:00
Con Kolivas
4bfa2809c3 Display pool information on the fly as well. 2011-07-22 14:07:50 +10:00
Con Kolivas
75bf36ff0e Allow the pool strategy to be modified on the fly. 2011-07-22 13:58:06 +10:00
Con Kolivas
cca6f49ef8 Abstract out active pools count. 2011-07-22 12:39:32 +10:00
Con Kolivas
31a8944564 Tidy. 2011-07-22 12:33:54 +10:00
Con Kolivas
ad53696f3f The longpoll blanking of the current_block data may not be happening before the work is converted and appears to be a detected block change.
Blank the current block before submitting the work and stop passing the longpoll bool around.
2011-07-22 12:17:44 +10:00
Con Kolivas
44bcc32234 Display current pool management strategy to enable changing it on the fly. 2011-07-22 12:14:24 +10:00
Con Kolivas
b534ad0aad Only internally test for block changes when the work matches the current pool to prevent interleaved block change timing on multipools. 2011-07-22 12:02:04 +10:00
Con Kolivas
b0a8f279f7 Implement the ability to live add, enable, disable, and switch to pools. 2011-07-22 11:46:26 +10:00
Con Kolivas
baddb82ad9 Do one last check of the work before submitting it. 2011-07-22 07:50:20 +10:00
Con Kolivas
20336ea15d Make input pool capable of bringing up pools while running. 2011-07-21 15:15:38 +10:00
Con Kolivas
7841486f83 Add a bool for explicit enabling/disabling of pools. 2011-07-21 14:41:12 +10:00
Con Kolivas
0bc9574628 Add pool option to input and display current pool status, pending code to allow live changes. 2011-07-21 14:29:33 +10:00
Con Kolivas
ec06940c21 Add a thread that takes keyboard input and allow for quit, silent, debug, verbose, normal, rpc protocol debugging and clear screen options. 2011-07-21 14:05:08 +10:00
Con Kolivas
b4f651f4ff Disable/enable echo & cbreak modes. 2011-07-21 13:26:18 +10:00
Con Kolivas
6fdbe01412 Remove the nil arguments check to allow starting without parameters. 2011-07-21 13:11:15 +10:00
Con Kolivas
9d60b107f1 Abstract out a curses input function and separate input pool function to allow for live adding of pools later. 2011-07-21 13:08:36 +10:00
Con Kolivas
365c90096c Make it possible to enter server credentials with curses input if none are specified on the command line. 2011-07-21 12:25:21 +10:00
Con Kolivas
2b7e5e58c8 Enable curses earlier and exit with message in main for messages to not be lost in curses windows. 2011-07-21 11:46:01 +10:00
Con Kolivas
4766463b78 Only set option to show devices and exit if built with opencl support. 2011-07-21 11:07:51 +10:00
Con Kolivas
f4f018b498 Don't try to stop/cancel threads that don't exist. 2011-07-21 10:15:17 +10:00
Con Kolivas
b4960ec36b Free up resources/stale compilers. 2011-07-21 09:48:06 +10:00
Con Kolivas
fa9e03f487 Implement pool rotation strategy. 2011-07-20 13:48:23 +10:00
Con Kolivas
521025aa75 Implement load balancing algorithm by rotating requests to each pool. 2011-07-20 13:35:55 +10:00
Con Kolivas
0ba06c69f9 Timeout on failed discarding of staged requests. 2011-07-20 13:15:52 +10:00
Con Kolivas
6305146bea Implement proper flagging of idle pools, test them with the watchdog thread, and failover correctly. 2011-07-20 13:07:41 +10:00
Con Kolivas
7c8919328c Move pool active test to own function. 2011-07-20 11:49:03 +10:00
Con Kolivas
40419f1a78 Allow multiple strategies to be set for multipool management. 2011-07-20 11:39:02 +10:00
Con Kolivas
d518f7cbfd Track pool number. 2011-07-20 11:27:21 +10:00
Con Kolivas
02e0e12529 Don't waste the work items queued on testing the pools at startup. 2011-07-20 10:07:39 +10:00
Con Kolivas
ced0e5ad81 Reinstate the mining thread watchdog restart.
Add a getpoll bool into the thread information and don't restart threads stuck waiting on work.
Rename the idlenet bool for the pool for later use.
2011-07-20 09:31:45 +10:00
Con Kolivas
0afab92cd4 Allow the user/pass userpass urls to be input in any order. 2011-07-19 23:16:30 +10:00
Con Kolivas
0d8b8793b5 Reset the queued count to allow more work to be queued for the new pool on pool switch. 2011-07-19 17:00:56 +10:00
Con Kolivas
012456f3b7 Display per pool summary at the end if multiple pools in use. Fine tune statistics and make localgen fail at 5 mins. 2011-07-19 14:33:52 +10:00
Con Kolivas
85bf965cda Force a mandatory work item on pool switch and determine what to do based on server supporting roll time or not. 2011-07-19 14:09:36 +10:00
Con Kolivas
f91a048ae7 Implement the actual switch logic which changes over after 5 minutes of local work generation. 2011-07-19 13:30:29 +10:00
Con Kolivas
81ff7fb3dc Explicitly probe each pool to see if work can be retrieved from it and what it supports. 2011-07-19 13:01:08 +10:00
Con Kolivas
913e120262 Test for rolltime and save it correctly when testing for longpoll. 2011-07-19 12:29:33 +10:00
Con Kolivas
0ce3df10d2 Store whether each server supports X-Roll-Ntime or not. 2011-07-19 11:45:58 +10:00
Con Kolivas
321c4798d4 Make longpoll switch servers should it not match the current pool. 2011-07-19 10:53:04 +10:00
Con Kolivas
529aa70c38 Set pool on work retrieved from longpoll. 2011-07-19 10:32:24 +10:00
Con Kolivas
048bea201f Set first localgen time to max. 2011-07-19 10:31:05 +10:00
Con Kolivas
ecda75946b Set and get the current pool under lock. 2011-07-19 10:19:59 +10:00
Con Kolivas
b8ba2fd44e Implement a per-pool mutex and use that for locking the internal flags. 2011-07-19 09:54:50 +10:00
Con Kolivas
fd10b993b0 Move add pool to somewhere clean and obvious. 2011-07-19 09:43:15 +10:00
Con Kolivas
7073493911 Merge branch 'cgminer' into pools
Conflicts:
	main.c
2011-07-19 01:46:16 +10:00
Con Kolivas
a46b5d1e0a Make it possible to pass multiple urls/users etc in preparation for multiple pool support but only use pool 0 for now. 2011-07-19 01:27:56 +10:00
Con Kolivas
19b80d6db3 Curl's global init can trample dynamically allocated data so do it before anything else. 2011-07-19 00:14:58 +10:00
Con Kolivas
961c43067b Abstract out the pool data to begin move to multiple pool support. 2011-07-19 00:09:45 +10:00
Con Kolivas
1d27c119b6 Don't let total_queued go below zero. 2011-07-18 22:02:10 +10:00
Con Kolivas
8220af8806 Avoid queueing extra work if there's work staged as well. 2011-07-18 20:22:16 +10:00
Con Kolivas
c3e569ed9b Copied the data to longpoll_block too early so the longpoll message will rarely be received.
Submit longpoll's converted work after we've flushed requests since that will blank the current_block for stage_thread to see.
2011-07-18 13:16:15 +10:00
Con Kolivas
5e7c37aebb Make it clear what the sha algorithm is for. 2011-07-18 12:02:37 +10:00
Con Kolivas
e532ac354a Only clear the longpoll block data if we successfully received a longpoll, and do it before converting the longpoll data to work to avoid the staging thread believing it got the new work before the longpoll. 2011-07-18 11:37:33 +10:00
Con Kolivas
01eb4c599d Minimise impact on GUIs by dropping priority and policy in gpu mining threads if dynamic mode is enabled. 2011-07-18 11:36:54 +10:00
Con Kolivas
0aa9887300 Add an sse4 algorithm to CPU mining. 2011-07-18 11:27:58 +10:00
Con Kolivas
fc184625d2 We now are guaranteed to have one fresh work item after a block change and we should only discard staged requests. 2011-07-18 10:33:31 +10:00
Con Kolivas
d53ee8e71b Don't waste the work we retrieve from a longpoll. 2011-07-18 10:19:22 +10:00
Con Kolivas
0c253734e1 Provide a control lock around global bools to avoid racing on them. 2011-07-18 10:12:38 +10:00
Con Kolivas
b6ac9f185e Revert "Make sure not to try and submit work for nonces higher than already submitted in current work item."
This reverts commit a2dd410e36.

Incorrect fix. Missed real shares that are accepted.
2011-07-17 20:06:43 +10:00
Con Kolivas
1d45b7f475 Revert "Don't miss first work item."
This reverts commit 57f5893f4a.

Start reverting. This fix didn't help.
2011-07-17 20:06:25 +10:00
Con Kolivas
57f5893f4a Don't miss first work item. 2011-07-17 19:36:17 +10:00
Con Kolivas
a2dd410e36 Make sure not to try and submit work for nonces higher than already submitted in current work item.
This reduces rejects substantially.
2011-07-17 19:33:53 +10:00
Con Kolivas
eb91b03e22 Show last 8 characters of the share submitted. 2011-07-16 23:31:32 +10:00
Con Kolivas
96cc141ba2 Display URL connected to and user connected as in status. 2011-07-16 17:43:04 +10:00
Con Kolivas
3e032b8a8d Display current block and when it was started in status line. 2011-07-16 12:48:15 +10:00
Con Kolivas
a1339d723f Only pthread_join the mining threads if they exist as determined by pthread_cancel. 2011-07-16 11:06:58 +10:00
Con Kolivas
3cb7ef2b07 Create a unique get work queue instead of faking it all to thread 0. 2011-07-16 10:46:50 +10:00
Con Kolivas
0a9db84d26 Make it clear the restart message is going to the watchdog thread. 2011-07-16 10:33:01 +10:00
Con Kolivas
8203cc67eb Check the current block description hasn't been blanked pending the real new current block data. 2011-07-16 10:28:59 +10:00
Con Kolivas
18af4e6272 Re-enable signal handlers once the custom sighandler has been hit to make it possible to still kill cgminer. 2011-07-16 10:13:49 +10:00
Con Kolivas
70edd0d36f Disable restarting of CPU mining threads pending further investigation. They may not need it and are easily killed off. 2011-07-16 02:55:43 +10:00
Con Kolivas
274022f260 Message too verbose. Simplify it. 2011-07-16 02:07:52 +10:00
Con Kolivas
55695066b6 Display appropriate messages with/without longpoll to make it clear if stalls happen that cgminer is waiting on more work. 2011-07-16 01:57:04 +10:00
Con Kolivas
3785e50d3f Add new block data to status line. 2011-07-16 01:47:58 +10:00
Con Kolivas
77b0f946f6 Only do local generation of work if existing work is not stale. 2011-07-16 00:52:57 +10:00
Con Kolivas
4a94199246 Abstract out the test for stale work and test for it in the actual mining threads as well. 2011-07-16 00:34:05 +10:00
Con Kolivas
6dcf05ffaf Make sure that local work generation does not proceed indefinitely by limiting it to the average block generation time - 10 minutes.
Doing more work will just waste power and will virtually never produce accepted shares.
2011-07-15 23:35:38 +10:00
Con Kolivas
aeaeac0889 Allow queue of zero again and make it default since we can track queued vs staged now and see if the queue needs to be bigger. 2011-07-15 10:42:06 +10:00
Con Kolivas
8a40036974 Just insist on 1 lp staged work per mining thread on new block. 2011-07-15 10:27:48 +10:00
Con Kolivas
4c9171792b Limit the number of work items we put in the queue. 2011-07-15 09:48:26 +10:00
Con Kolivas
32221c4574 We shouldn't be deleting lp_staged value on dec_staged. It prevents detecting get_work failures. 2011-07-15 09:39:29 +10:00
Con Kolivas
23e4add229 Add a system status line to the formatted output. 2011-07-15 09:38:52 +10:00
Con Kolivas
34ecc59f4d Forgot to set total_devices for the purposes of finding a positive active_device. 2011-07-15 08:56:52 +10:00
Con Kolivas
579bd42919 Revert "Change get_work to use a timeout when trying to tq_pop as a sanity failsafe in case of unusual circumstances."
This reverts commit 7b9b078114.

Conflicts:

	util.c

Timeout was a bandaid for other going-idle reasons and never helped. Revert it.
2011-07-15 08:53:05 +10:00
Con Kolivas
6ab2966035 Limit display to total devices to avoid repeating when selecting devices. 2011-07-15 01:11:47 +10:00
Con Kolivas
5fd73374b3 Get the device number from the thread id, not the other way around. 2011-07-15 01:08:23 +10:00
Con Kolivas
2864892e7b Make sure we are working with the correct id devices and only print out the ones that are active. 2011-07-15 01:05:36 +10:00
Con Kolivas
86987b65ab Refresh is missing after each curses_print_status to update the status window. 2011-07-14 23:55:03 +10:00
Con Kolivas
636c425073 Trivial EOL. 2011-07-14 23:46:32 +10:00
Con Kolivas
5bbd3134c3 Show the correct gpu devices only. 2011-07-14 23:43:00 +10:00
Con Kolivas
c36cc61f64 Ensure we connect at least once successfully before continuing to try to connect. 2011-07-14 22:16:06 +10:00
Con Kolivas
e21e923648 Make the curses interface optional with a new --text-only -T option. 2011-07-14 21:46:22 +10:00
Con Kolivas
ed11501742 Make the curses output separate from regular text output and put an executive summary after curses is shut down when cgminer exits. 2011-07-14 21:25:32 +10:00
Con Kolivas
c4cc83dceb Explicitly grab first work item before entering asynchronous loop to prevent apparent HW errors when first starting due to stale data on the GPU. 2011-07-14 18:39:52 +10:00
Con Kolivas
df43b7135e Add start time datestamp to status output. 2011-07-14 18:24:56 +10:00
Con Kolivas
4c859f3284 Make setting of intensity implicitly disable dynamic mode and remove the option to disable dynamic mode by itself. 2011-07-14 18:07:10 +10:00
Con Kolivas
fe8ab94a92 The max_nonce wasn't being reset on starting new work making cpu mining fail on each new work item. 2011-07-14 17:43:16 +10:00
Con Kolivas
3d900e7bc2 Initialise gpu_ms_average. 2011-07-14 11:47:56 +10:00
Con Kolivas
ba4ba7f65c Only restart threads that are not stuck waiting on lp staged work, and add one mandatory queued work item for each restart. 2011-07-14 11:26:56 +10:00
Con Kolivas
7e38a37a54 Fix compiler warnings. 2011-07-14 11:05:12 +10:00
Con Kolivas
20b3e07f63 Implement signal handler and clean up properly. 2011-07-14 11:03:14 +10:00
Con Kolivas
02cd113cd9 Tidy up display. 2011-07-14 10:13:22 +10:00
Con Kolivas
7d517dcfc1 Conflicting options with -n. Change ndevs to -e for enumerate devices. 2011-07-14 01:50:20 +10:00
Con Kolivas
8375d1a21a Add a dynamic flag that tries at all times to maintain the desktop interactive and make it possible to disable it for dedicated miners. 2011-07-13 15:22:06 +10:00
Con Kolivas
56d830a216 Trivial. 2011-07-13 12:08:43 +10:00
Con Kolivas
a8b39bcb7c Make the status window maximum width to begin with. 2011-07-13 12:07:16 +10:00
Con Kolivas
3a968490b2 Turn the wakeup thread into a watchdog thread that checks when the last time a thread reported in was and restarts the thread if it has been idle for more than a minute. 2011-07-13 12:05:04 +10:00
Con Kolivas
c23827cbcc Update the per-thread view as well to not miss dead threads. 2011-07-13 10:51:01 +10:00
Con Kolivas
81f8af85d6 Cope with servers that regularly drop the longpoll connection. 2011-07-13 10:42:12 +10:00
Con Kolivas
4de3f32a22 Move to newer jansson library. 2011-07-13 00:58:13 +10:00
Con Kolivas
bb4deaa245 strcat in longpoll thread can write outside of longpoll_block so cat them all in main(). 2011-07-12 22:36:30 +10:00
Con Kolivas
86bc0426c6 Remove unused variable. 2011-07-12 19:28:48 +10:00
Con Kolivas
7b9b078114 Change get_work to use a timeout when trying to tq_pop as a sanity failsafe in case of unusual circumstances. 2011-07-12 19:19:00 +10:00
Con Kolivas
222d4ee6bf Make curses completely inactivated in quiet mode and do not update curses code in wakeup thread when curses is inactive. 2011-07-12 17:29:59 +10:00
Con Kolivas
76b233a544 Implement locking around curses updates to avoid screen corruption and refresh both windows fully regularly from the wakeup thread which wakes up infrequently to not be too cpu intensive. 2011-07-12 17:03:13 +10:00
Con Kolivas
6d4476bba2 Use correct variable in initialisation. 2011-07-12 00:54:42 +10:00
Con Kolivas
ccf2ea914f Convert the log and status portions of the screen to two separate ncurses windows for simpler cleaner output. 2011-07-12 00:33:08 +10:00
Con Kolivas
c59e2ab8b6 Avoid possible divide by zero. 2011-07-11 22:57:17 +10:00
Con Kolivas
43ef5f5d3f Get rid of the flaky time_lock and use the thread safe localtime_r instead. 2011-07-11 22:45:19 +10:00
Con Kolivas
c836b5bf01 Don't try to find where the cursor is and just set it to the last line for logcursor. 2011-07-11 22:18:10 +10:00
Con Kolivas
73a864c51c vfprintf invalidates the va args so do it after the curses output. 2011-07-11 21:56:34 +10:00
Con Kolivas
a1ffba823e Refresh the display on every commit to applog since detecting bottom of the screen may be unreliable. 2011-07-11 21:22:22 +10:00
Con Kolivas
78ed386bb4 Delay any threads from starting till everything is set up properly. 2011-07-11 21:20:48 +10:00
Con Kolivas
b93e6a4254 Show all devices even if only selected are enabled. 2011-07-11 17:57:54 +10:00
Con Kolivas
505b18597b Merge https://github.com/ycros/cgminer into cgminer 2011-07-11 16:56:28 +10:00
Con Kolivas
215ee79056 thr_id can be successful as -1 which is wrong and could lead to a crash. 2011-07-11 16:52:18 +10:00
Ycros
386489a147 Added support for pdcurses. 2011-07-11 14:56:17 +10:00
Con Kolivas
92e04f47cb Make clear for multiple GPUs. 2011-07-11 13:46:01 +10:00
Con Kolivas
90839cdf5a Implement a completely curses based display and don't output to stderr when log is enabled unless it's redirected away from the terminal. 2011-07-11 13:41:31 +10:00
Con Kolivas
f12edd2fb8 Keep track of number of mining threads explicitly and only enforce that many work items on new block work. 2011-07-10 23:07:53 +10:00
Con Kolivas
94fdff9a3e Fix help typo. 2011-07-10 20:17:09 +10:00
Con Kolivas
75888a1f68 Implement device selection(s) with -d. 2011-07-10 20:14:28 +10:00
Con Kolivas
fbcd2942c8 Really correct the staged count logic failure. 2011-07-10 14:02:23 +10:00
Con Kolivas
82cac38874 Logic failure meant the longpoll fake staged were never removed. This would lead to idle periods and may have even caused complete idle failures. 2011-07-10 12:59:32 +10:00
Con Kolivas
8af98be7b9 Make the utility demonstrated relative to each device when showing per-device work submissions. 2011-07-10 01:01:34 +10:00
Con Kolivas
6464dbfc65 Implement per-device request count to have a per-device efficiency and request status. 2011-07-10 00:53:48 +10:00
Con Kolivas
3d9f244e02 Make all applog at least 80 columns wide obviating the need for spaces at the end of select messages to clear the status line. 2011-07-09 17:30:54 +10:00
Con Kolivas
5e6b8076c6 Tidy output. 2011-07-09 17:12:12 +10:00
Con Kolivas
1c92478997 Make sure to set first work as mandatory instead of generating work locally from it. 2011-07-09 17:11:22 +10:00
Con Kolivas
102c4d4088 Give meaningful message on submission failure and resumption instead of spam. 2011-07-09 17:06:30 +10:00
Ycros
f20e25e0c0 Moved pthread mutex inits up, due to applog using a mutex causing a crash.
Added Win32 compatability to opt.c.
2011-07-09 13:34:56 +10:00
Con Kolivas
c9bbaec3b2 Cope with delays in retrieving work from the server by knowing when we have run out of staged work.
Once we are out of staged work, roll the ntime forwards in the work to generate work locally without a getwork.
Display a message explaining when we move to/from local generation to server retrieval.
Make sure we don't think we've run out of work transiently after a longpoll by flagging a buffer of fake staged work.
2011-07-09 10:18:29 +10:00
Con Kolivas
3126002b51 When shares come frequently on more powerful mining hardware the status line doesn't appear for very long and gets drowned out by share information.
Cache the output and display it after each share submission.
2011-07-08 20:27:12 +10:00
Con Kolivas
a8be6851a9 Formalise the extra work item that the wakeup thread acts as a watchdog for. 2011-07-08 11:53:40 +10:00
Con Kolivas
732baa1812 Use the wakeup thread as a watchdog to ensure we don't fall between the holes of queue and dequeue. 2011-07-08 06:12:38 +10:00
Con Kolivas
bb49287449 Make longpoll aware of when new block detection has detected a new block first and avoid flushing the work queue twice. 2011-07-07 14:29:39 +10:00
Con Kolivas
186666d3d1 Prevent buffer overflow. 2011-07-07 10:43:52 +10:00
Con Kolivas
25bebf3b92 Make the output line much terser now that it has a lot of information on it. 2011-07-07 10:31:36 +10:00
Con Kolivas
1b2355176b Merge branch 'cgminer' into mfontani
Conflicts:
	main.c
2011-07-07 10:04:37 +10:00
Con Kolivas
ed233e8cb5 Put work into a staging area which makes it possible to check the latest work data received.
Then check the latest work data against a store of the current_block and use it to determine if we have moved to a new block.
This makes --no-longpoll work just as efficiently as longpoll, and works around when longpoll is unreliable.
2011-07-07 09:58:26 +10:00
Marco Fontani
c815de4991 Add "efficiency" and "utility"
Efficiency is the percentage of getworks compared to the amount of
work requested from the pool. It can go higher than 100% in case
more shares than getworks were found. Some pools prefer miners to
have a high efficiency; CPU miners likely exhibit a low efficiency.

Utility is the number of shares found per minute, since the miner
was started. It is another way to describe the effectiveness of
a miner.
2011-07-06 19:24:06 +01:00
Rusty Russell
efebee5ab8 Fix the case where there are no GPUs, and exit if they give errors.
If there are no GPUs, set nDevs to 0 not -1 (status is set to an
unhelpful -1001 here on my laptop, so we can't rely on a particular
status value).

Also, if nDevs is -1, exit rather than screwing up later.
2011-07-06 16:47:29 +09:30
Rusty Russell
8b68dc44d4 Fix --ndevs/-n option.
The option should be called from within the callback, and just use
printf to give the raw result, rather than using applog which prepends
a timestamp.
2011-07-06 16:47:29 +09:30
Rusty Russell
8d25df3c72 Cleanup --cpu-threads/-t logic
Currently it gets negated which means the default printed is wrong.
Use an explicit flag to tell if the user has overridden it; if they
haven't, and they turn off the GPUs, reset it to num_processors.
2011-07-06 16:47:29 +09:30
Rusty Russell
3e8181216c Use ccan/opt for commandline parsing.
This cleans up option handling, by using ccan/opt rather than
handcoded getopt_long.  We still have to open-code some things, such
as json config file handling.

The main change is that the --config option causes a file to be parsed
during commandline parsing, so you can override the results, and
provide multiple of them.

Other improvements are that 'help' and 'ndevs' are not valid arguments
in the config file; we use a separate argument table for such
commandline-only flags.
2011-07-06 16:47:29 +09:30
Con Kolivas
5969d65a04 First work for each thread is now queued in advance. 2011-07-06 15:57:50 +10:00
Con Kolivas
e9a397d4b9 More space to wipe old text. 2011-07-06 15:56:30 +10:00
Con Kolivas
e99069808a Fix the extra work queued every longpoll by queueing it all in the beginning. 2011-07-06 15:40:12 +10:00
Con Kolivas
719deb3aac Create a wakeup thread that keeps the hashmeter going in case the mining threads all stall. 2011-07-06 14:20:18 +10:00
Con Kolivas
ddae5aa9d0 Remove unused variable. 2011-07-06 13:29:01 +10:00