Pages:
Author

Topic: Crypto Miners In Tray - a lightweight front-end for unattended mining - page 2. (Read 25829 times)

full member
Activity: 224
Merit: 100
I like this one!  Was using BitMoose, where with some external scripting I was able to stop/start the service according to whether another program was running (could stop the miner while playing a game for example).  This makes it SO much easier to deal with that.  :-)
newbie
Activity: 16
Merit: 0
Since I'm about to release a total-newbie-friendly GUI for Litecoin mining, lemme weigh in on something here that'll help you make your front-end a bit better...

Special note about Pooler’s cpuminer for Litecoins (https://bitcointalksearch.org/topic/an-even-more-optimized-version-of-cpuminer-poolers-cpuminer-cpu-only-55038) – Bitcoin Miners in Tray can run and control it, but due to two quirks, no output from cpuminer is displayed until it is stopped. Cpuminer directs all of its output to stderr, which BMT handles well. However, it does not finish output of a line when a line is written to stderr, thus all lines are dumped on the pipe at the same time when cpuminer stops and closes its streams. There is nothing I can do about it, as this needs to be fixed by Pooler.

I don't know what coding language you're using, but the way to work around this is to peek at the pipe with the PeekNamedPipe API call to see if there's anything in the pipe before trying to read it. Otherwise, your pipe read will deadlock trying to read an empty pipe. (For some reason, pipe reads on Windows like to hang when the pipe's empty, and trying to read an empty pipe will cause a wait state until the pipe has data to read.) Peeking at the pipe will allow testing it without reading from it, and that stops the wait state issue and allows you to continuously monitor the miner's output without having to wait for it to close.

I spent a lot of time trying to solve the "no data until the app closes" problem. I mean a lot of time. PeekNamedPipe turned out to be the solution.

Assuming you're peeking at the pipe, the only other issue you'll have is the fact that cpuminer - and, by extension, all of its forks - will not emit data across a pipe until it fills a send buffer that looks to be about 64KB. So, you'll end up with no reports at all for 5-15 minutes followed by a burst of text followed by more silence, rinse and repeat. This part will require resolution by the app coders themselves.

Here's how I'm handling this in my app - this code is Delphi 7 but should convert readily to whatever language...

Code:
            // This is an important bit of code: we take a peek at the output pipe
            // to see if there's any data in it. This allows us to avoid trying to
            // read from an empty pipe, which will just sit there and wait until
            // data comes in! This is the key to monitoring a console application
            // without having to wait for it to terminate before working with its
            // output.
            PeekNamedPipe(StdOutPipeRead, nil, 0, nil, @DataAvailable, nil);
            if (DataAvailable > 0) then
            begin
              // Since there's actually something to read, read it. Note that
              // we are reading blocks of 16 kilobytes of characters at a time.
              if ReadFile(StdOutPipeRead, Buffer, 16384, BytesRead, nil) then
              begin
                if (BytesRead > 0) then
                begin
                  // Make sure the boffer ends in a null character.
                  Buffer[BytesRead] := #0;

                  // Concatenate with any previous data.
                  Text := Text + Buffer;
                end;
              end;
            end;


Quote
CGMiner (https://bitcointalksearch.org/topic/official-cgminer-mining-software-thread-for-linuxwinosxmipsarmr-pi-4110-28402) must be started with --text-only or -T parameter to disable ncurses and with --log 1 or -l 1 to log output every second. CGMiner suffers from the same problem as pooler’s cpuminer, which is not strange as it was forked from it. The problem is however only with the redirected stdout stream, while stderr works fine, outputting the lines as they are pushed into the pipe. Once CGMiner is stopped, all text on stdout will be dumped in one go. -l 1 seems to fix this.

I haven't had to add "-l 1" but "-T" was definitely a necessity.
legendary
Activity: 1680
Merit: 1014
Version 5.10 has been released:

– Added “Run with Windows” checkbox to the GUI and tray context menu.
– Improved positional handling of the output text box when autoScroll feature is disabled.
– KeepAlive Hits column now shows counters for each category.
– Reset KeepAlive Hits counters when a miner is manually restarted.
– Added threshold attribute to the checkHashRate keepAlive option. An average hashing speed during the keepAlive check interval, which is below this threshold will trigger miner restart.
– Added a small and unobtrusive donation hint to the main GUI screen. Wink
legendary
Activity: 1680
Merit: 1014
Version 5.00 has been released:

– Long-running prerequisites are now stopped when the program exits or the config file is reloaded.
– Prerequisites can now have keepAlive setting, watching for Process and Output conditions.
– Replaced custom-drawn checkbox-containing ListBox with ListView control. It is now multi-selectable, and without checkboxes.
– ListView box now contains detailed information about each miner’s configuration, including current priority and keepAlive hit count. Ideally it should stay on 0. If the value is growing, it means that you either have a misconfigured keepAlive condition, so that the function kicks in more than it should, or that you have overclocked your GPU too much and it keeps crashing the driver.
– KeepAlive now reports reasons for restarting the miner (in the log window).
– The application now targets .Net Frameverk ver. 4.0 and is built with explicit platform target set to x86 (this should hopefully help anyone having trouble running it on Windows XP).
newbie
Activity: 13
Merit: 0
Nope, she's fully aware of it & what it's doing.

Although at the moment CGminer is throwing hardware errors on her system (With or without BMIT), so it's been offline for a little bit.
legendary
Activity: 1680
Merit: 1014
Glad you find the program useful. If it is any consolation, I too had to change the config files on my 4 mining rigs.
The config format will not be changed any more - only eventual additions will appear henceforth.
Do you use stealthMode on your wife's PC?  Tongue
newbie
Activity: 13
Merit: 0
It took me a while to get the config tweaked the way I want (and more to update to the current revisions), but this app is so kick ass it's worth it. I can easily game & use my PC while letting BMIT wrangle the miners in the background without any effort. Handy for me, really important if I want to mine on my wife's PC.  Wink
legendary
Activity: 1680
Merit: 1014
Version 4.10 has been released:

– Fixed a bug, where setting keepAlive to 0 would cause a crash
keepAlive is back to being a child node of a miner, and can now be configured with interval and restart conditions: Process, Output, and HashRate.
– Fixed a rare occasion, when both the user and a watcher starting a miner at exactly the same time would result in two instances of the miner to be launched.
– Fixed handling of start/stop/restart watcher events to make it more resilient.
– Added killDelay miner attribute, so it is possible to tweak the time between Ctrl-C event is sent to the miner and the miner is deemed unresponsive to it and is forcefully killed.
waitForExit attribute of a prerequisite execute statement is renamed to delay and can now specify a delay in seconds, in addition to special values of ‘no’ and ‘forever’.
legendary
Activity: 1680
Merit: 1014
Version 4.00 has been released.

IMPORTANT! I have changed the XML configuration format somewhat. Refer to the list below and to the included example configuration file.

– Added locks around critical sections in miner start and stop routines. Addition of asynchronous watchers introduced a possibility of race conditions.
– Changed the colour of miner entries in the list and context menu: Green – running, Orange – suspended by watcher, Red – stopped. Misconfigured/invalid miners are no longer shown in the lists.
– Changed the way watchers are defined: condition and action parameters are now specified in the body of the watcher element. See example config file.
– Watcher check interval can now be configured on a per-miner level.
– Added two new watcher actions: RestartWithArguments and ChangeAffinity.
Priority action is renamed into ChangePriority.
– Added three new watcher conditions: BatteryPower, TimeInterval and DaysOfWeek.
– Renamed Enabled miner setting to autoStart to better reflect what that setting actually does.
– Made averageWindow setting miner-specific.
– Application watcher can now specify multiple processes to watch.
– Tray icon is now visible while GUI is maximized (unless Stealth Mode TrayIcon is specified).
– Seconds are now displayed in the log timestamp.
– Breaking change to the config format: id, autoStart, keepAlive, averageWindow, and watcherCheckInterval are now attributes of the node, instead of being child nodes. This is done so as to make the config file less cluttered
– Breaking change to the config format: waitForExit is now an attributes of the node, instead of being a child node.
legendary
Activity: 1680
Merit: 1014
Version 3.00 has been released:

– Introduced watchers that can observe such conditions as human activity or a running application and start/stop/change priority of the miners accordingly.
– Stealth config option which can either disable on-hover balloon tooltip or hide the tray icon altogether, in which case showing GUI is done by running the program again.
– Keep-alive setting is moved to individual miners (because of pooler’s cpumine’s faulty output mechanism). The default is now ‘off’.
– Total hashing speed info moved to status bar.
– Added possibility to specify any config file through the command line argument.
– Added possibility to open any config file through the GUI.
– Information about currently loaded config file is in the status bar.
– AutoScroll can be togged from GUI.
– Stealth mode and average window info is in the status bar.
– Fixed a bug, where user-stopped miner would sometimes be treated as dead and restarted.
– Fixed a bug, where the program would crash if no averageWindow was specified in the config (missing default).
– Improved stdout parsing heuristics to read correct speed info from CGMiner output and to avoid false positives.
– Brought most of the business logic under test, reordered some code, latest additions programmed using TDD.
– Various bug fixes as the result of unit testing.
legendary
Activity: 1680
Merit: 1014
Special note about Pooler’s cpuminer for Litecoins (https://bitcointalksearch.org/topic/an-even-more-optimized-version-of-cpuminer-poolers-cpuminer-cpu-only-55038) – Bitcoin Miners in Tray can run and control it, but due to two quirks, no output from cpuminer is displayed until it is stopped. Cpuminer directs all of its output to stderr, which BMT handles well. However, it does not finish output of a line when a line is written to stderr, thus all lines are dumped on the pipe at the same time when cpuminer stops and closes its streams. There is nothing I can do about it, as this needs to be fixed by Pooler.

CGMiner (https://bitcointalksearch.org/topic/official-cgminer-mining-software-thread-for-linuxwinosxmipsarmr-pi-4110-28402) must be started with --text-only or -T parameter to disable ncurses and with --log 1 or -l 1 to log output every second. CGMiner suffers from the same problem as pooler’s cpuminer, which is not strange as it was forked from it. The problem is however only with the redirected stdout stream, while stderr works fine, outputting the lines as they are pushed into the pipe. Once CGMiner is stopped, all text on stdout will be dumped in one go. -l 1 seems to fix this.

@CapnGimp: Experiment with the command line settings in a cmd.exe window. Once you are satisfied with the settings, copy them to the config file. You can also play with the settings in directly in the config file and hit reload config, which will reinitialise both the program and restart all the enabled miners.
Yes, keep-alive will auto-restart the miner, if the miners terminates by itself or if there is no output coming from the miner on stdout and/or stderr. I haven't had any issues with poclbm dying either, but I implemented keep-alive as a safety net, because I want a 100% unattended system.
I am still not on Stratum, so cannot advise on -a parameter.
newbie
Activity: 17
Merit: 0
btw somewhere i read the GETWORK protocol/? was being phased out in Slush's pool, and isn't used as stratum appears to have replaced it... do I have to insert this  -a x    the askrate value or not?
newbie
Activity: 17
Merit: 0
Thank you very much for this, I realize it takes time to type. I have it installed and since I couldn't ensure I would not f it up, I haven't loaded it with my pwd's and tried it out. After I digest all this, I will try it tomorrow. I am pretty much all experimental right now as I am trying to acquire a mb and memory to put my i5 on line with my good video card and use it as a miner exclusively (well, when I'm not gaming lol) all the while choosing the best linux distro to use...which I STILL have to research.  
      
   "Can keep the miners alive by checking they output and run state and re-starting them if they become unresponsive"
     "Can stop the miners nicely, by issuing Crl-C event, so that the miners have a chance to clean up. (GuiMiner simply terminated the miners, which resulted in NVidia display driver crash.)"
   this is what has occurred on mine, which is why I found you lol

 I would assume this will auto-restart the poclbm ?... when and if the graphics crashes, which if I stay away, it won't. I have an umbilical to this rig til then  Grin  Thanks again for your help!
legendary
Activity: 1680
Merit: 1014
Here is an example command line for poclbm:
username:[email protected]:8332 username:[email protected]:8332 -t 5 -b 10 -r 2 --device=0 --platform=0 -v -w 128 -f 60

If you use the card exclusively for mining and not for desktop, replace -f 60 with -f 0
Make sure you use correct values for platform and device. Start poclbm without any options to see what is available.
--verbose is not required for Bitcoin Miners in Tray to operate.
This command line will configure a back-up pool, to which poclbm will fall to if the primary pool becomes unavailable.

Otherwise, here is a list of options:

poclbm.exe --help
Usage: poclbm.exe [OPTION]... SERVER[#tag]...
SERVER is one or more [http[ s ]://]user:pass@host:port          (required)
[#tag] is a per SERVER user friendly name displayed in stats   (optional)

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  --verbose             verbose output, suitable for redirection to log file
  -q, --quiet           suppress all output except hash rate display
  --no-server-failbacks
                        disable using failback hosts provided by server

  Miner Options:
    -r RATE, --rate=RATE
                        hash rate display interval in seconds, default=1
    -e ESTIMATE, --estimate=ESTIMATE
                        estimated rate time window in seconds, default 900 (15 minutes)
    -a ASKRATE, --askrate=ASKRATE
                        how many seconds between getwork requests, default 5, max 10
    -t TOLERANCE, --tolerance=TOLERANCE
                        use fallback pool only after N consecutive connection errors, default 2
    -b FAILBACK, --failback=FAILBACK
                        attempt to fail back to the primary pool every N getworks, default 2

  Kernel Options:
    -p PLATFORM, --platform=PLATFORM
                        use platform by id
    -d DEVICE, --device=DEVICE
                        use device by id, by default asks for device
    -w WORKSIZE, --worksize=WORKSIZE
                        work group size, default is maximum returned by opencl
    -f FRAMES, --frames=FRAMES
                        will try to bring single kernel execution to 1/frames seconds, default=30, increase this for less desktop lag
    -s FRAMESLEEP, --sleep=FRAMESLEEP
                        sleep per frame in seconds, default 0
    -v, --vectors       use vectors
newbie
Activity: 17
Merit: 0
Saw this a few days ago and didn't bookmark it, found it and am about to try it. Seems to be the only solution for guiminer ceasing to work at random times-caused by video kernel/driver failure etc etc...
 As GUIMiner is the ONLY one I have used(newbie) I am going to attempt to use this with poclbm...not so good with command line tho lol
I'll get back with you, thanks for putting this out here.
legendary
Activity: 1680
Merit: 1014
Version 2.20 has been released:
 - Individual and total hashing speed is now shown in on-hover balloon tooltip in tray icon.
 - Tray icon now has a context menu with the commands to open the GUI, stop all miners, reload config, start/stop individual miners, and exit.
 - Average window for hashing speed calculation is now configurable.
 - Checkboxes of the misconfigured miners are now disabled.

The program has now taken the shape that I envisioned, so I don't expect to do many more modifications, save for possible bug fixes.
If you have any feature requests or bug reports, post them here or in my blog.
legendary
Activity: 1680
Merit: 1014
Version 2.10 released:
– Fixed a rare bug, where an exception would be thrown if checkbox list redraw occurred at the same time as config file reload.
– Simplified routine that stops the miners, eliminating the need for briefly-flashing command line windows when starting miners.
– Added colour tagging of the output window: Green – program output; Blue – miner stdout, Red – miner stderr.
– Made output textbox read-only.
– Average hashing speed across all miners is now displayed in the GUI.
legendary
Activity: 1680
Merit: 1014
Minor update to ver 2.01:
 - Fixed hiding of the icon in task switcher, when the application is minimised to tray.
legendary
Activity: 1680
Merit: 1014
No, this is a Windows application, addressing some Windows-specific problems, like a far more troublesome way of sending a signal to a command-line process, or minimising an application to a system tray area.
You have the source, though, so you can see what I've done and re-write it to one of the *nix GUI environments. Maybe it will also run on Mono.
full member
Activity: 160
Merit: 100
Linux (ubuntu) support?
Pages:
Jump to: