Bitcoin Forum

Bitcoin => Mining software (miners) => Topic started by: jgarzik on June 22, 2011, 10:18:46 PM



Title: cgminer - CPU/GPU miner in C for linux/windows
Post by: jgarzik on June 22, 2011, 10:18:46 PM
The software formerly known as 'cpuminer' is being updated to include OpenCL GPU mining capability, thanks to Con Kolivas.  Until this software is fully "baked" and ready, it is being developed on a git branch at https://github.com/ckolivas/cgminer

Once stable, we intend to merge Con's work and rename 'cpuminer' to something more appropriate.

Update:  See this cgminer thread (http://forum.bitcoin.org/index.php?topic=28402.0) for official cgminer support and development.





Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 22, 2011, 11:20:48 PM
Thanks for starting a new topic JG. I need this project to have more exposure to attract attention to its GPU mining code so that it can be tested and I can keep improving on it. The background behind minerd is that it's built on top of Jeff Garzik's excellent cpuminer application which is programmed in (efficient, fast, lower overhead for low level stuff) c and I've added gpu mining code to it. The idea is to make an all encompassing cpu + gpu miner that performs very well, is cross platform and is being actively developed.

EDITED NOW CALLED CGMINER:
Latest source release:
http://ck.kolivas.org/apps/cgminer-1.2.3.tar.bz2 (http://ck.kolivas.org/apps/cgminer-1.2.3.tar.bz2)

Git tree:
https://github.com/ckolivas/cgminer (https://github.com/ckolivas/cgminer)

Latest git source tarball:
https://github.com/ckolivas/cgminer/tarball/cgminer (https://github.com/ckolivas/cgminer/tarball/cgminer)

Windows binary:
http://ck.kolivas.org/apps/cgminer-1.2.3-win32.zip (http://ck.kolivas.org/apps/cgminer-1.2.3-win32.zip)

Summary of GUI mining features so far: Custom modified phatk and poclbm kernels, BFI_INT patching, new VECTOR code, long poll support, multi-card support while doing +/- CPU mining as well. The GPU mining code now detects the optimal parameters and capabilities for every card and sets each card separately. It has extensive failover logic to keep work going at all times and GPUs should virtually never go idle.

Initially the oclminer code was ported across to get the gpu mining working, but a lot of work has been done in gpu mining since then. I've drastically modified the way work is passed to the GPU to make it as asynchronous as possible and keep the GPU busy without making the GUI come to a standstill. Since then I've ported across the poclbm and phatk kernels, added BFI_INT patching and vectors. I've custom modified the vector code to make the most of modern pipelines and added code to detect optimal settings for each card and set them separately. Performance on my 6770 and 4x6970 is now better than any other GPU mining software.

The output looks like this:

cgminer version 1.2.0
--------------------------------------------------------------------------------
Totals: [(5s):166.9  (avg):194.3 Mh/s] [Q:43  A:14  R:0  HW:2  E:33%  U:2.53/m]
--------------------------------------------------------------------------------
GPU 0: [183.5 Mh/s] [Q:15  A:14  R:0  HW:2  E:93%  U:2.57/m]
CPU 0: [0.0 Mh/s] [Q:1  A:0  R:0  HW:0  E:0%  U:0.00/m]
CPU 1: [3.2 Mh/s] [Q:1  A:0  R:0  HW:0  E:0%  U:0.00/m]
CPU 2: [3.2 Mh/s] [Q:1  A:0  R:0  HW:0  E:0%  U:0.00/m]
CPU 3: [3.2 Mh/s] [Q:5  A:0  R:0  HW:0  E:0%  U:0.00/m]
--------------------------------------------------------------------------------
[2011-07-11 13:35:41] Share accepted from GPU 0
[2011-07-11 13:36:00] Share accepted from GPU 0
[2011-07-11 13:36:37] Share accepted from GPU 0
[2011-07-11 13:36:57] Share accepted from GPU 0
[2011-07-11 13:37:06] Server not providing work fast enough, generating work locally
[2011-07-11 13:37:07] Resumed retrieving work from server
[2011-07-11 13:37:23] LONGPOLL detected new block, flushing work queue
[2011-07-11 13:37:41] Share accepted from GPU 0
[2011-07-11 13:37:43] LONGPOLL detected new block, flushing work queue
[2011-07-11 13:38:10] Share accepted from GPU 0
[2011-07-11 13:39:08] Share accepted from GPU 0
[2011-07-11 13:39:25] Share accepted from GPU 0

Options:
--cpu-threads|-t <arg> Number of miner CPU threads (default: 0)
--debug|-D          Enable debug output
--gpu-threads|-g <arg> Number of threads per GPU (0 - 10) (default: 2)
--intensity|-I <arg> Intensity of GPU scanning (0 - 14) (default: 4)
--log|-l <arg>      Interval in seconds between log output (default: 5)
--no-longpoll       Disable X-Long-Polling support
--pass|-p <arg>     Password for bitcoin JSON-RPC server
--protocol-dump|-P  Verbose dump of protocol-level activities
--queue|-Q <arg>    Number of extra work items to queue (1 - 10) (default: 1)
--quiet|-q          Disable per-thread hashmeter output
--retries|-r <arg>  Number of times to retry before giving up, if JSON-RPC call fails (-1 means never) (default: -1)
--retry-pause|-R <arg> Number of seconds to pause, between retries (default: 5)
--scan-time|-s <arg> Upper bound on time spent scanning current work, in seconds (default: 60)
--syslog            Use system log for output messages (default: standard error)
--url|-o <arg>      URL for bitcoin JSON-RPC server (default: "http://127.0.0.1:8332/")
--user|-u <arg>     Username for bitcoin JSON-RPC server
--vectors|-v <arg>  Override detected optimal vector width (1, 2 or 4)
--verbose           Log verbose output to stderr as well as status output
--worksize|-w <arg> Override detected optimal worksize (default: 0)
--userpass|-O <arg> Username:Password pair for bitcoin JSON-RPC server
Options for command line only:
--config|-c <arg>   Load a JSON-format configuration file
See example-cfg.json for an example configuration.
--help|-h           Print this message
--ndevs|-n          Display number of detected GPUs and exit

---
Please test it and report back!

I recommend limiting intensity to no more than 8 as higher levels cause serious stalls and very little improvement (with possibly more stale shares). Some nvidia cards crash immediately on startup and that's because they report bogus values for their worksize. Try setting worksize to 128 or 256 manually if that happens.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 23, 2011, 02:38:21 AM
I've now added testing for cl_amd_media_ops to detect which cards support BFI_INT and only patch those. This means it should work on all cards now, including nvidia and old ati that don't support it.


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 23, 2011, 04:48:44 AM
It errors out under Fedora 14 i386 and AMD APP 2.4:

Quote
$ ./minerd -t 0 --url http://mineco.in:3000
Error: Getting Platforms. (clGetPlatformsIDs)
[2011-06-23 08:45:27] 0 gpu miner threads started
[2011-06-23 08:45:27] Binding thread -1 to cpu -1
[2011-06-23 08:45:27] Long-polling activated for http://mineco.in:3000/LP
Segmentation Fault (core dumped)

Here's configure line:

CFLAGS="-O2 -Wall -msse2 -I/opt/AMD-APP-SDK-v2.4-lnx32/include -g" LDFLAGS="-L/opt/AMD-APP-SDK-v2.4-lnx32/lib/x86/ -g"  ./configure

Here's the backtrace:

Quote
#0  0x080541ea in scanhash_c (thr_id=-128,
    midstate=0xb65ff0c0 "\276\063mR\262~-\020\323\352\320\366\223\017\250\327\216\233\002]\016H\300n\345\336[JIC\336D\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377",
    data=0xb65ff040 "͢\213]N\002\304#\032\023!\205", hash1=0xb65ff080 "",
    hash=0xb65ff100 "",
    target=0xb65ff0e0 "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377", max_nonce=16777215,
    hashes_done=0xb65ff27c) at sha256_generic.c:252
#1  0x0804a32d in miner_thread (userdata=0x9a590c4) at cpu-miner.c:662
#2  0x00567e99 in start_thread () from /lib/libpthread.so.0
#3  0x0047ad2e in clone () from /lib/libc.so.6


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 23, 2011, 05:00:46 AM
Thanks for testing and reporting. I've just uploaded another commit to the git tree which should fix that. Please pull the latest changes.

I've now also added a command line tuneable to allow you to choose how hard to work the GPU:

--intensity
(-I) Intensity of scanning (0 - 16, default 5)

The higher you set it to, the greater the GPU throughput, but the more lag you'll get. Very large numbers can cause massive stalls without a huge improvement to throughput. Try them cautiously!


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 23, 2011, 05:03:14 AM
It works with AMD APP SDK 2.1.

But there are a few issues:
 - CPU threads can't be disabled - the appropriate option doesn't work
 - the desktop is dog slow (probably as a result of above)
 - there's a delay of about 20 seconds before "initCl() finished" - does it recompile the CL scripts every time?
 - hashrate is about twice as low as poclbm: 13.5Mh/sec for minerd vs 22.5 for poclbm. Running on Radeon 4650:

Quote
Init GPU 0
List of devices:
        0       ATI RV730
Selected 0: ATI RV730
[2011-06-23 08:54:21] cl_amd_media_ops not found, will not BFI_INT patch
initCl() finished. Found ATI RV730
[2011-06-23 08:54:52] Long-polling activated for http://mineco.in:3000/LP
[2011-06-23 08:54:52] [0.27 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:54:53] 1 gpu miner threads started
[2011-06-23 08:54:53] Binding thread 1 to cpu 1
[2011-06-23 08:54:54] Binding thread 2 to cpu 0
[2011-06-23 08:54:55] 2 cpu miner threads started, using SHA256 'c' algorithm.
[2011-06-23 08:55:02] [1.15 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:55:08] [6.50 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:55:13] [8.61 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:55:19] [9.74 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:55:25] [11.56 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:55:30] [11.87 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:55:35] [12.04 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:55:41] [12.21 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:55:46] [12.33 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:55:52] [12.44 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:55:57] [12.53 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:56:03] [12.60 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:56:08] [12.67 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:56:13] [13.14 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:56:19] [13.15 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 08:56:21] GPU 0 found something?
[2011-06-23 08:56:21] PROOF OF WORK RESULT: true (yay!!!)
[2011-06-23 08:56:24] [13.57 Mhash/sec] [1 Accepted] [0 Rejected]
[2011-06-23 08:56:29] [13.55 Mhash/sec] [1 Accepted] [0 Rejected]
[2011-06-23 08:56:29] GPU 0 found something?
[2011-06-23 08:56:29] PROOF OF WORK RESULT: true (yay!!!)
[2011-06-23 08:56:34] [13.54 Mhash/sec] [2 Accepted] [0 Rejected]
[2011-06-23 08:56:39] [13.52 Mhash/sec] [2 Accepted] [0 Rejected]
[2011-06-23 08:56:44] [13.52 Mhash/sec] [2 Accepted] [0 Rejected]


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 23, 2011, 05:05:42 AM
Try again please with the new git tree. You should be able to disable the CPU threads. The default optimisations are for 5x and 6x as I have no experience with the other cards. I've yet to implement other options to set on the command line to tweak performance

EDIT: Yes it does recompile the kernel each time it starts (for now).


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 23, 2011, 05:09:08 AM
With the latest change and intensity=3, the CPU threads parameter works, the desktop feels adequate (about the same as when running other miners), but the hashrate is too low: ~12Mh/sec


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 23, 2011, 05:11:35 AM
APP SDK 2.4 still doesn't work:
Quote
$ ldd minerd|fgrep OpenCL
        libOpenCL.so.1 => /opt/AMD-APP-SDK-v2.4-lnx32/lib/x86/libOpenCL.so.1 (0x00b98000)
$ ./minerd --threads 0 --intensity 3 --url http://mineco.in:3000
Error: Getting Platforms. (clGetPlatformsIDs)


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 23, 2011, 05:16:21 AM
Thanks for that. I'm not sure why it's not working with 2.4. Do you know what settings (if any) help on that card you have with poclbm? I'm currently at work and won't be able to do anything major right now, but I'll look at implementing more tuneables and detection soon.


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 23, 2011, 06:06:29 AM
I can only say that turning off VECTORS ("Enables 2-way vectors. This may improve hashrate if enabled, but it can be slower on some hardware") for phoenix improves hashrate from about 24 to 29 Mh/sec. Looks like 4xxx cards need more workarounds in the code.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 23, 2011, 06:22:49 AM
Thanks, that's most helpful, especially since this currently uses 4 way vectors. That could explain why it's unhappy.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 23, 2011, 06:50:02 AM
If you grab the latest version, you'll see it reports the preferred vector width. I'm planning on getting all the preferred details back from the cards to automatically set the best options.


Title: Re: minerd - CPU and GPU mining software
Post by: gmaxwell on June 23, 2011, 07:34:29 AM
If you grab the latest version, you'll see it reports the preferred vector width. I'm planning on getting all the preferred details back from the cards to automatically set the best options.

Diablo reported that running multiple opencl threads improves utilization substantially, his miner runs three per gpu.  Though this may be due to the excessive usage of blocking IO in the fast path (wtf‽).

I'm looking forward to the phatk kernel.  Getting a miner with a control plane which isn't crap is a dream that I haven't had the free time to realize.

Thanks for working on this!


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 23, 2011, 07:59:12 AM
Okay I've implemented some rudimentary testing of what the GPU reports as its maximum work size and preferred vector width and dynamic patching to make the most of those values. On my brief testing this provides the optimal throughput on the 2 cards I've tried it on (ati 6770 and nvidia GT 330). There is no scope for it coping with multiple different GPUs on the same machine at the moment. Please pull the latest tree and give it a try!


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 23, 2011, 08:11:23 AM
It says "Preferred vector width reported 4" for ATI RV730 (Radeon 4650). Is the vector width thing even the same as "2-way vectors" in Phoenix?

Anyway, with the latest version the rate is somewhat better, it started at ~10Mh/sec and slowly raised up to ~17Mh/sec during the next few minutes. Is the hash rate calculated over the whole program run time?


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 23, 2011, 08:22:51 AM
I let it run a bit longer, and there was a strange drop in the hash rate:
Quote
Init GPU 0
List of devices:
        0       ATI RV730
Selected 0: ATI RV730
[2011-06-23 12:12:01] Preferred vector width reported 4
[2011-06-23 12:12:01] Max work group size reported 128
[2011-06-23 12:12:01] Patched source to suit 4 vectors
[2011-06-23 12:12:01] cl_amd_media_ops not found, will not BFI_INT patch
initCl() finished. Found ATI RV730
[2011-06-23 12:12:32] Long-polling activated for http://mineco.in:3000/LP
[2011-06-23 12:12:32] [0.03 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 12:12:33] 1 gpu miner threads started
[2011-06-23 12:12:33] 0 cpu miner threads started, using SHA256 'c' algorithm.
[2011-06-23 12:12:41] [0.12 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 12:12:46] [6.59 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 12:12:52] [9.54 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 12:12:57] [11.19 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 12:13:02] [12.29 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 12:13:07] [13.06 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 12:13:12] [13.63 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 12:13:17] [14.07 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 12:13:22] [14.41 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 12:13:27] [14.68 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 12:13:32] [14.89 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 12:13:37] [15.08 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 12:13:42] [15.24 Mhash/sec] [0 Accepted] [0 Rejected]
....
[2011-06-23 12:16:13] [16.70 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 12:16:18] [16.71 Mhash/sec] [0 Accepted] [0 Rejected]
[2011-06-23 12:16:22] GPU 0 found something?
[2011-06-23 12:16:22] PROOF OF WORK RESULT: false (booooo)
[2011-06-23 12:16:23] [16.73 Mhash/sec] [0 Accepted] [1 Rejected]
[2011-06-23 12:16:28] [16.74 Mhash/sec] [0 Accepted] [1 Rejected]
[2011-06-23 12:16:33] [16.76 Mhash/sec] [0 Accepted] [1 Rejected]
[2011-06-23 12:16:38] [16.77 Mhash/sec] [0 Accepted] [1 Rejected]
[2011-06-23 12:16:43] [16.78 Mhash/sec] [0 Accepted] [1 Rejected]
[2011-06-23 12:16:48] [16.80 Mhash/sec] [0 Accepted] [1 Rejected]
[2011-06-23 12:16:53] [0.31 Mhash/sec] [0 Accepted] [1 Rejected]
[2011-06-23 12:16:58] [0.64 Mhash/sec] [0 Accepted] [1 Rejected]
[2011-06-23 12:17:04] [0.95 Mhash/sec] [0 Accepted] [1 Rejected]
[2011-06-23 12:17:09] [1.26 Mhash/sec] [0 Accepted] [1 Rejected]
[2011-06-23 12:17:14] [1.55 Mhash/sec] [0 Accepted] [1 Rejected]
...

I stopped the miner and re-run it, with the same results - the hash rate drops to zero after about 4-5 minutes of run time.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 23, 2011, 08:39:15 AM
The hash value returned is the total number of hashes done over the total time. It tends to rise to the real value over a few minutes. If it drops off, usually it's because the server has not responded and it's waiting for more work, but it's not without reason there are other bugs there. The vector count of other apps set to "2 way vectors" in phoenix is the same as an optimal vector count of 2. minerd detects the optimal according to what the card reports and does up to 4 way vectors (the most supported by any card currently).


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 23, 2011, 08:50:09 AM
Looks like other miners show the hash rate as an average over the last few seconds. I think showing the average over the whole run time may be confusing. Also, it's strange that the average reported rate would be zero at some point if it's calculated over the whole run time.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 23, 2011, 08:53:14 AM
Looks like other miners show the hash rate as an average over the last few seconds. I think showing the average over the whole run time may be confusing. Also, it's strange that the average reported rate would be zero at some point if it's calculated over the whole run time.

It does indeed sound like a bug. Perhaps having a rolling average and a total average would be helpful too.


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 23, 2011, 08:54:45 AM
I run minerd --protocol-dump, and the rate drops to zero immediately after the next getwork.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 23, 2011, 09:07:57 AM
I run minerd --protocol-dump, and the rate drops to zero immediately after the next getwork.

It could be the threads=0 option. Try allowing the CPUs to run, or at least one thread.


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 23, 2011, 10:01:45 AM
Yes, that was it. With one CPU thread, the rate stays constant at ~17MH/s even after getworks fetching.


Title: Re: minerd - CPU and GPU mining software
Post by: gmaxwell on June 23, 2011, 10:07:18 AM
Testing on a silly nvidia machine:

Selected 0: GeForce GTX 275
[2011-06-23 06:00:58] Preferred vector width reported 1
[2011-06-23 06:00:58] Max work group size reported 512
[2011-06-23 06:00:58] cl_amd_media_ops not found, will not BFI_INT patch
initCl() finished. Found GeForce GTX 275
[...]
[2011-06-23 06:04:18] GPU 0 found something?
[2011-06-23 06:04:18] No best_g found! Error in OpenCL code?

Looks like it never accepts results from the GPU. CPU mines fine.


on a system with 3 5850s:

(gdb) run -t 6 -a 4way --url http://pool.bitcoin.dashjr.org:8337/ --userpass 15xWuDHSyKzpvp6FacGKXijBeaaaYhKWSi:x --retry-pause 1 -r -1 --intensity 16
Starting program: /root/gm/cpuminer/minerd -t 6 -a 4way --url http://pool.bitcoin.dashjr.org:8337/ --userpass 15xWuDHSyKzpvp6FacGKXijBeaaaYhKWSi:x --retry-pause 1 -r -1 --intensity 16
[Thread debugging using libthread_db enabled]
[New Thread 0x7ffff4141700 (LWP 17510)]
[New Thread 0x7ffff3940700 (LWP 17511)]
Init GPU 0
List of devices:
        0       Cypress
        1       Cypress
        2       Cypress
Selected 0: Cypress
[2011-06-23 06:17:35] Preferred vector width reported 4
[2011-06-23 06:17:35] Max work group size reported 256
[2011-06-23 06:17:35] Preferred vector width reported 4
[2011-06-23 06:17:35] Max work group size reported 256
[2011-06-23 06:17:35] Preferred vector width reported 4
[2011-06-23 06:17:35] Max work group size reported 256
[2011-06-23 06:17:35] Patched source to suit 4 vectors
[2011-06-23 06:17:35] cl_amd_media_ops found, patched source with BFI_INT
[New Thread 0x7ffff313f700 (LWP 17512)]
initCl() finished. Found Cypress
[New Thread 0x7ffff307e700 (LWP 17513)]
[New Thread 0x7ffff287d700 (LWP 17514)]
[Thread 0x7ffff287d700 (LWP 17514) exited]
Init GPU 1
List of devices:
        0       Cypress
        1       Cypress
        2       Cypress
Selected 1: Cypress
[2011-06-23 06:17:37] Preferred vector width reported 4
[2011-06-23 06:17:37] Max work group size reported 256
[2011-06-23 06:17:37] Preferred vector width reported 4
[2011-06-23 06:17:37] Max work group size reported 256
[2011-06-23 06:17:37] Preferred vector width reported 4
[2011-06-23 06:17:37] Max work group size reported 256
[2011-06-23 06:17:37] Patched source to suit 4 vectors
[2011-06-23 06:17:37] cl_amd_media_ops found, patched source with BFI_INT

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6a2b4b0 in ?? ()
   from /root/AMD-APP-SDK-v2.4-lnx64/lib/x86_64/libamdocl64.so
(gdb) bt
#0  0x00007ffff6a2b4b0 in ?? ()
   from /root/AMD-APP-SDK-v2.4-lnx64/lib/x86_64/libamdocl64.so
#1  0x00007ffff6a7a31b in ?? ()
   from /root/AMD-APP-SDK-v2.4-lnx64/lib/x86_64/libamdocl64.so
#2  0x00007ffff6a225a0 in clCreateProgramWithBinary ()
   from /root/AMD-APP-SDK-v2.4-lnx64/lib/x86_64/libamdocl64.so
#3  0x000000000040793b in initCl ()


Stupid binary libraries.  :-/

Update: Still crashing on the system with 5850s with 181070d129259d088219a0dcd0ef41d9a45439d3


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 23, 2011, 12:27:20 PM
I fixed a bug which would make it segfault occasionally when BFI_INT patching.

I've updated the output log to display both a log-interval average and an all-time average.

I've added an option to configure the log interval in seconds with --log.

I think I also fixed the bug where it would stop doing work after a few minutes.

The output now looks like this:
[2011-06-23 22:26:17] [166.81 | 176.26 Mhash/s] [63 Accepted] [1 Rejected]

First entry is rolling average, 2nd is all time average.

Now I'll look some more into the internals and performance.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 23, 2011, 01:28:55 PM
I've committed some changes to the kernel based on phatk's kernel's use of arrays instead of individual variables and this has afforded another speedup at least on my machine.


Title: Re: minerd - CPU and GPU mining software
Post by: gmaxwell on June 23, 2011, 02:57:10 PM
diff --git a/ocl.c b/ocl.c
index 4173026..a8240eb 100644
--- a/ocl.c
+++ b/ocl.c
@@ -425,7 +425,7 @@ _clState *initCl(int gpu, char *name, size_t nameSize)
                        return NULL;
                }
 
-               clState->program = clCreateProgramWithBinary(clState->context, numDevices, &devices[gpu], binary_sizes, (const unsigned char **)binaries, &status, NULL);
+               clState->program = clCreateProgramWithBinary(clState->context, 1, &devices[gpu], binary_sizes, (const unsigned char **)binaries, &status, NULL);


Meh. Makes it not crash, but it's not sufficient for it to work right. I should look at this after sleeping. ;)



Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 23, 2011, 07:49:24 PM
It's a bit faster now on Radeon 4650 (17Mh/sec instead of 16). But all time average still drops to zero every getwork, which I guess is a bug. Unless all time average means getwork time average.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 23, 2011, 09:16:00 PM
Hmm yeah I still haven't figured out what the bug is there, but I'm still working on it.

Just for the record, this miner is now faster than any other miner for my hardware (1 x 6770) when left idle. I used to get 197 with phoenix+phatk and when cpu is done on top I got another 12 with CPU (total of 209), but with minerd and default settings I'm getting 216.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 23, 2011, 11:20:13 PM
Per-GPU optimisations and bugfixes.

I've updated the code now to test every card for its ideal settings and it runs a kernel suitable for each card. This allows you to have different GPUs now and have them all work to their best.

As for the multiple threads question about Diablo's miner, the worker thread that hands out work to the GPU in minerd works asynchronously with very low overhead so it can keep the GPU busy just with the one thread. Ultimately the overhead of this approach and the lack of switching workloads on the GPU should be better.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 24, 2011, 01:20:59 AM
Updated tree:
Ensure the GPU doesn't keep working on blocks longer than opt_scantime.

This makes for much less false blocks on slower GPUs.

I've also limited the max --intensity variable to 10, as higher values returned garbage from the GPU.


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 24, 2011, 05:31:04 AM
Thanks for the quick updates.

With the latest version the hashrate is still not optimal on my GPU, and it still drops to zero periodically when CPU threads are disabled:
Quote
...
[2011-06-24 09:06:39] [17.43 | 16.47 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-24 09:06:44] [17.41 | 16.49 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-24 09:06:49] [17.43 | 0.02 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-24 09:06:54] [17.42 | 0.35 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-24 09:06:59] [17.22 | 0.67 Mhash/s] [0 Accepted] [0 Rejected]
...


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 24, 2011, 06:04:01 AM
Thanks for the quick updates.

With the latest version the hashrate is still not optimal on my GPU, and it still drops to zero periodically when CPU threads are disabled:
Quote
...
[2011-06-24 09:06:39] [17.43 | 16.47 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-24 09:06:44] [17.41 | 16.49 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-24 09:06:49] [17.43 | 0.02 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-24 09:06:54] [17.42 | 0.35 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-24 09:06:59] [17.22 | 0.67 Mhash/s] [0 Accepted] [0 Rejected]
...


Ah. Question: When it drops to zero, do you ever see it still find blocks despite it reading zero? It may just be a 32 bit overflow because I just remembered you're on 32 bits.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 24, 2011, 06:26:06 AM
Further to that thought, I've committed a change to the tree which should prevent 32 bit overflows.


Title: Re: minerd - CPU and GPU mining software
Post by: gmaxwell on June 24, 2011, 07:13:44 AM
Per-GPU optimisations and bugfixes.

It's still segfaulting for me deep in the ati opencl code during the setup of the second card in a three card system.



Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 24, 2011, 07:55:26 AM
Per-GPU optimisations and bugfixes.

It's still segfaulting for me deep in the ati opencl code during the setup of the second card in a three card system.


Without doubt I'm still not setting up multiple cards properly yet. Thanks for testing.


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 24, 2011, 08:25:50 AM
Further to that thought, I've committed a change to the tree which should prevent 32 bit overflows.
And looks like it fixed the drops in hashrate reporting. Thanks!


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 24, 2011, 08:43:49 AM
Further to that thought, I've committed a change to the tree which should prevent 32 bit overflows.
And looks like it fixed the drops in hashrate reporting. Thanks!

Great, thanks for testing. It would be interesting to see how the throughput on yours compares if you leave your machine idle for an hour or so. minerd is very sensitive to user activity.


Title: Re: minerd - CPU and GPU mining software
Post by: m3ta on June 24, 2011, 10:00:48 AM
Any plans for MacOS capabilities? (either binary or compilation-wise)?


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 24, 2011, 03:00:42 PM
Any plans for MacOS capabilities? (either binary or compilation-wise)?

The intention is for the code to be portable. That said I'll need help to ensure it really is cause there are always surprises moving from one OS to another.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 24, 2011, 11:59:15 PM
Updated tree - I've modified work submission to spawn a separate thread of its own now which prevents miner threads from stalling when submitting work to slow pools.


Title: Re: minerd - CPU and GPU mining software
Post by: burp on June 25, 2011, 01:20:10 AM
Here is my quick fix for multi gpu initialization:

Code:
-               clState->program = clCreateProgramWithBinary(clState->context, numDevices, &devices[gpu], binary_sizes, (const unsigned char **)binaries, &status, NULL);
+               clState->program = clCreateProgramWithBinary(clState->context, 1, &devices[gpu], &binary_sizes[gpu], (const unsigned char **)&binaries[gpu], NULL, &status);


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 25, 2011, 02:34:13 AM
Thanks very much!


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 25, 2011, 03:47:00 AM
Updated tree - I've made the getting of work more asynchronous by always having one work item extra in the queue. This means it is much less likely to get a drop in hash rates when connecting to a slow pool. This is particularly useful if you are on one side of the world and the pool you connect to is on the other side.


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 25, 2011, 05:59:11 AM
It would be interesting to see how the throughput on yours compares if you leave your machine idle for an hour or so. minerd is very sensitive to user activity.
It doesn't seem to make a difference for the GPU mining. The hash rate is at the very steady 17.39-17.40 Mh/sec. It still almost twice as slower as poclbm/phoenix.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 25, 2011, 06:28:22 AM
Thanks. I'll implement the ability to override vectors and worksize to see if you can get good throughput by manually setting those.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 25, 2011, 09:01:35 AM
Thanks. I'll implement the ability to override vectors and worksize to see if you can get good throughput by manually setting those.
Updated tree: Configurable vector width and worksize, more multi-gpu fixes and minor cleanups.

minerd now supports the following options:
--vectors N (where N is 1, 2 or 4)
--worksize N (where N is any number supported by the hardware up to max_work_size as reported when minerd is run with -D; usually up to 512)


Title: Re: minerd - CPU and GPU mining software
Post by: burp on June 25, 2011, 10:31:11 AM
Newest version segfaults for me at 2nd GPU initialization:

[2011-06-25 12:28:26] Selected 1: Cypress
[2011-06-25 12:28:26] Initialising kernel with BFI_INT patching, 4 vectors and worksize 64

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff745189b in memchr () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0  0x00007ffff745189b in memchr () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff7458b8a in memmem () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x0000000000405d07 in advance (area=0x7fffffffe940, remaining=0x7fffffffe948, marker=0x421919 ".text") at ocl.c:102
#3  0x0000000000406475 in initCl (gpu=1, name=0x1cb7080 "", nameSize=16) at ocl.c:405
#4  0x0000000000402822 in main (argc=<value optimized out>, argv=<value optimized out>) at cpu-miner.c:1365


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 25, 2011, 10:38:12 AM
Newest version segfaults for me at 2nd GPU initialization:

[2011-06-25 12:28:26] Selected 1: Cypress
[2011-06-25 12:28:26] Initialising kernel with BFI_INT patching, 4 vectors and worksize 64

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff745189b in memchr () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0  0x00007ffff745189b in memchr () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff7458b8a in memmem () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x0000000000405d07 in advance (area=0x7fffffffe940, remaining=0x7fffffffe948, marker=0x421919 ".text") at ocl.c:102
#3  0x0000000000406475 in initCl (gpu=1, name=0x1cb7080 "", nameSize=16) at ocl.c:405
#4  0x0000000000402822 in main (argc=<value optimized out>, argv=<value optimized out>) at cpu-miner.c:1365

Thanks. Has it ever actually worked for you with the 2nd GPU? The fix you posted earlier did not help others (on IRC) who had more than one GPU, if BFI_INT patching was involved. I don't think I've quite got the right fix for that yet, but it's at the top of my bug list to fix :|


Title: Re: minerd - CPU and GPU mining software
Post by: burp on June 25, 2011, 10:52:43 AM
Thanks. Has it ever actually worked for you with the 2nd GPU? The fix you posted earlier did not help others (on IRC) who had more than one GPU, if BFI_INT patching was involved. I don't think I've quite got the right fix for that yet, but it's at the top of my bug list to fix :|

Um, right now I can't make it work again  :o I will investigate …


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 26, 2011, 03:00:27 AM
Updated tree.

Thanks to burp, I now have a fix for building BFI_INT patched kernels on multi-gpu set ups. 32 bit machines don't get work with bfi int patching.

No CPU mining threads are now started if any GPUs are detected.

The CPU threads option has been changed to:
--cpu-threads

There is now a new option:
--gpu-threads N
(-g N) Number of threads per-GPU (1 - 10, default: 2)

By default it now spawns 2 threads per GPU to keep them slightly more busy for better throughput.

Numerous other cleanups have gone into it.

STILL TODO:
Performance for some GPUs is still well down that of other GPU mining software, and I'm still investigating why that is.
Implement BFI INT patching for 32 bit builds.
...
Profit.


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 26, 2011, 06:02:09 AM
Here's a new error (warning?) from the latest version:
Quote
./minerd  --intensity 2 --url http://mineco.in:3000 xxxxx
[2011-06-26 09:40:52] Init GPU thread 0
[2011-06-26 09:40:52] List of devices:
[2011-06-26 09:40:52]   0       ATI RV730
[2011-06-26 09:40:52] Selected 0: ATI RV730
[2011-06-26 09:40:52] Initialising kernel without BFI_INT patching, 4 vectors and worksize 32
[2011-06-26 09:41:24] initCl() finished. Found ATI RV730
[2011-06-26 09:41:24] Init GPU thread 1
[2011-06-26 09:41:24] List of devices:
[2011-06-26 09:41:24]   0       ATI RV730
[2011-06-26 09:41:24] Selected 0: ATI RV730
[2011-06-26 09:41:24] Initialising kernel without BFI_INT patching, 4 vectors and worksize 32
[2011-06-26 09:41:24] Long-polling activated for http://mineco.in:3000/LP
[2011-06-26 09:41:48] [0.02 | 0.02 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-26 09:41:53] [17.25 | 1.47 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-26 09:41:58] [17.07 | 2.68 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-26 09:42:03] [17.02 | 3.71 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-26 09:42:04] initCl() finished. Found ATI RV730
[2011-06-26 09:42:04] 2 gpu miner threads started
[2011-06-26 09:42:04] 0 cpu miner threads started, using SHA256 'c' algorithm.
[2011-06-26 09:42:04] GPU 0 found something?
[2011-06-26 09:42:04] No best_g found! Error in OpenCL code?
[2011-06-26 09:42:04] GPU 0 found something?
[2011-06-26 09:42:04] No best_g found! Error in OpenCL code?
[2011-06-26 09:42:04] GPU 0 found something?
[2011-06-26 09:42:04] No best_g found! Error in OpenCL code?
[2011-06-26 09:42:04] GPU 0 found something?
[2011-06-26 09:42:04] No best_g found! Error in OpenCL code?
[2011-06-26 09:42:04] GPU 0 found something?
[2011-06-26 09:42:04] No best_g found! Error in OpenCL code?
[2011-06-26 09:42:04] GPU 0 found something?
[2011-06-26 09:42:04] No best_g found! Error in OpenCL code?
[2011-06-26 09:42:04] GPU 0 found something?
[2011-06-26 09:42:04] No best_g found! Error in OpenCL code?
[2011-06-26 09:42:04] GPU 0 found something?
[2011-06-26 09:42:04] No best_g found! Error in OpenCL code?
[2011-06-26 09:42:09] [19.84 | 19.84 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-26 09:42:14] [17.30 | 18.60 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-26 09:42:19] [17.34 | 18.19 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-26 09:42:24] [17.61 | 18.04 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-26 09:42:29] [17.61 | 17.96 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-26 09:42:35] [17.62 | 17.90 Mhash/s] [0 Accepted] [0 Rejected]
and it continues from here normally.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 26, 2011, 06:09:47 AM
Thanks, that's a bug on initialisation and is harmless. I'll see if I can avoid it in the future. I just wish I could figure out this 1/2 performance issue first.


Title: Re: minerd - CPU and GPU mining software
Post by: Naven on June 26, 2011, 08:52:44 AM
@ckolivas, maby u should upload daily builds or something like that for more people to contribute (i see potencial in this minner)


Title: Re: minerd - CPU and GPU mining software
Post by: kripz on June 26, 2011, 10:56:04 AM
Am i the only one having trouble compiling with debian 6? Will post logs when i get the chance.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 27, 2011, 03:02:17 AM
Updated the tree:
Curl would crash if multiple instances are run at once from separate threads (seems to be a libcurl bug) so I've gone back to one instance of curl and pushed the threaded work submission / retrieval to a different place to still be non-blocking.
Updated the postcalc testing of nonces from GPUs to be done non-blocking in their own thread.
Further optimised the work loop.
Passed a fresh output buffer before the kernel is instantiated instead of after (could have led to stale blocks).
Patch source for BITALIGN separately from BFI_INT so that if bfi int binary patching fails, the kernel can be rebuilt without trying to BFI INT patch, but still benefit from bitalign on hardware that supports it. This means that 32 bit machines which were failing will at least work now with minerd, but with only part of the performance advantage available.

STILL TODO:
Performance for some GPUs is still well down that of other GPU mining software, and I'm still investigating why that is.
Implement BFI INT patching for 32 bit builds.
...
Profit.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 27, 2011, 06:12:42 AM
Updated tree.

32 bits and BFI int patching is now working. For some reason on 64bit the opencl compiler builds an elf file within an elf file but not so on 32 bits. Go figure.

STILL TODO:
Testing and performance evaluation.
Windows builds (getting help from someone there hopefully it works).


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 27, 2011, 07:04:44 AM
This small mod to the poclbm OpenCL kernel gives about 3% more performance if BFI_INT is used:
https://forum.bitcoin.org/index.php?topic=22965.0;topicseen
Quote
  #define Ma(x, y, z) amd_bytealign((y), (x | z), (z & x))
and change it to this line
  #define Ma(x, y, z) amd_bytealign( (z^x), (y), (x) )


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 27, 2011, 07:36:41 AM
This small mod to the poclbm OpenCL kernel gives about 3% more performance if BFI_INT is used:
https://forum.bitcoin.org/index.php?topic=22965.0;topicseen
Quote
  #define Ma(x, y, z) amd_bytealign((y), (x | z), (z & x))
and change it to this line
  #define Ma(x, y, z) amd_bytealign( (z^x), (y), (x) )

For some reason that's greatly increased my reject rate.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 27, 2011, 09:34:13 AM
This small mod to the poclbm OpenCL kernel gives about 3% more performance if BFI_INT is used:
https://forum.bitcoin.org/index.php?topic=22965.0;topicseen
Quote
  #define Ma(x, y, z) amd_bytealign((y), (x | z), (z & x))
and change it to this line
  #define Ma(x, y, z) amd_bytealign( (z^x), (y), (x) )

For some reason that's greatly increased my reject rate.

Actually that was sheer coincidence. I'll test this change some more, thanks!


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 27, 2011, 10:20:00 AM
With 4 vectors, this change actually slows down the hash rate. With 2 vectors it speeds it up, but then I get runs of rejected shares. Not sure why but this is consistent now so I'm reluctant to include it at this stage.


Title: Re: minerd - CPU and GPU mining software
Post by: iopq on June 27, 2011, 10:22:05 AM
With 4 vectors, this change actually slows down the hash rate. With 2 vectors it speeds it up, but then I get runs of rejected shares. Not sure why but this is consistent now so I'm reluctant to include it at this stage.
???
are you sure?


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 27, 2011, 10:26:00 AM
With 4 vectors, this change actually slows down the hash rate. With 2 vectors it speeds it up, but then I get runs of rejected shares. Not sure why but this is consistent now so I'm reluctant to include it at this stage.
???
are you sure?

I can keep trying it on and off to see, but every time so far it has happened. It could well be my pool as they're experiencing technical difficulties, but it's always been the same time I enable it that I get the rejects.

2011-06-27 20:22:46] [173.08 | 191.67 Mhash/s] [81 Accepted] [40 Rejected]

Look at that reject rate. Normally it's <5%


Title: Re: minerd - CPU and GPU mining software
Post by: iopq on June 27, 2011, 10:27:13 AM
With 4 vectors, this change actually slows down the hash rate. With 2 vectors it speeds it up, but then I get runs of rejected shares. Not sure why but this is consistent now so I'm reluctant to include it at this stage.
???
are you sure?

I can keep trying it on and off to see, but every time so far it has happened. It could well be my pool as they're experiencing technical difficulties, but it's always been the same time I enable it that I get the rejects.

2011-06-27 20:22:46] [173.08 | 191.67 Mhash/s] [81 Accepted] [40 Rejected]

Look at that reject rate. Normally it's <5%

I'm running GUIMiner with this change and I see no difference other than slight speed increase


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 27, 2011, 10:30:44 AM
I don't doubt it, and no one else is reporting this issue. The other machine I've tried it on it does give a speed up (with minerd) but this one 6770 I'm using it on reliably spits out tons of rejects when I make this change. It's not a heating issue, the card is at 64 degrees.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 27, 2011, 10:42:55 AM
Maybe it's just my pool. They're having a funky time so that would explain it.


Title: Re: minerd - CPU and GPU mining software
Post by: Naven on June 27, 2011, 10:48:58 AM
@ckolivas, could u share daily builds of this minner?


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 27, 2011, 10:50:48 AM
@ckolivas, could u share daily builds of this minner?

linux only at this stage, sure I could do that.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 27, 2011, 02:37:09 PM
Update tree:

I did incorporate that change into my kernel. It turns out that even though my hardware reports 4 as the preferred vector width, it's faster with 2. I assume many people have experienced the same. So I've made the default to be 2 when the hardware says its preferred vector width is anything larger than 1.

I found a little buglet that also would repeat some blocks, thereby artificially raising the hash rate, so the overall rate has dropped slightly (about the same amount it's increased with the other code!).

As for the daily builds, I assume the requester meant windows builds? Most people who have linux will likely be able to build it. It's not building on windows yet, but will in the near future I hope. If you really do want linux binaries, just say the word.

The problem with repeated blocks was my pool not sending me out longpoll information reliably.


Title: Re: minerd - CPU and GPU mining software
Post by: iopq on June 27, 2011, 03:42:57 PM
Update tree:

I did incorporate that change into my kernel. It turns out that even though my hardware reports 4 as the preferred vector width, it's faster with 2.
yeah, same thing in poclbm, window size 128, vectors 2 is the fastest setting for me


Title: Re: minerd - CPU and GPU mining software
Post by: burp on June 27, 2011, 05:37:05 PM
Current status for my dual 5830 setup:

- one poclbm with phatk kernel for each card: 2*308MH/s = 616MH/s
- minerd with 2 threads for each card, gives me 605MH/s

so there is still some room for improvements :)


Title: Re: minerd - CPU and GPU mining software
Post by: jgarzik on June 27, 2011, 06:04:28 PM
- one poclbm with phatk kernel for each card: 2*308MH/s = 616MH/s
- minerd with 2 threads for each card, gives me 605MH/s

Just for knowledge...  what performance do you get with 1 thread per card?



Title: Re: minerd - CPU and GPU mining software
Post by: burp on June 27, 2011, 06:11:45 PM
- one poclbm with phatk kernel for each card: 2*308MH/s = 616MH/s
- minerd with 2 threads for each card, gives me 605MH/s

Just for knowledge...  what performance do you get with 1 thread per card?



About 586MH/s, means 293MH/s per card.

EDIT: Considering minerd uses poclbm kernel (which is slower for me than phatk), minerd might be already on par (with twice the number of threads).


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 28, 2011, 08:01:20 AM
It appears it's not possible to use minerd as a pure CPU miner anymore - setting GPU threads to zero doesn't work.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 28, 2011, 11:38:22 AM
Updated tree:

I've imported the phatk kernel into minerd. The maximum possible throughput is slightly faster on machines that support amd media ops which is nice. However, even nicer is that on sane intensity levels (including the default value of 4), the throughput is significantly faster now as well. The phatk kernel unfortunately doesn't even work on hardware that doesn't have amd media ops (radeon 4x cards and nvidia) so for now it defaults back to the poclbm kernel.

I've also updated the cpu mining component. Now it tries to keep its work sizes within the log update interval instead of the scan interval so that the hash rate doesn't fluctuate all over the place. It is also possible now to set number of gpu threads to 0 to run minerd as just a cpu miner again.

TODO:
-I want to find ways of allowing even larger settings for intensity that would only be suitable for headless boxes. Currently the code ends up racing too much (with all the parallel processing) and generates far too many rejected blocks when the intensity is set to >10. Making the cl code synchronous would avoid that but it also slows it down, thereby making it pointless to push it further.
-Store binary versions of the kernels that could be loaded faster when restarting the app.
-Any bugfixing remaining.
-Profit.


Title: Re: minerd - CPU and GPU mining software
Post by: gat3way on June 28, 2011, 11:57:59 AM
Sorry for the rude OT question but was that you that maintained the -ck tree? :)

Quote
Update tree:

I did incorporate that change into my kernel. It turns out that even though my hardware reports 4 as the preferred vector width, it's faster with 2. I assume many people have experienced the same. So I've made the default to be 2 when the hardware says its preferred vector width is anything larger than 1.

It's due to the high GPR usage, it is high enough to balance the poorer ALUPacking coming from uint2, not uint4 vectors. In fact I found out 3-component vectors to work best and they should be supported by opencl 1.1 standart, but the OpenCL compiler is buggy and generates bad code with uint3. Interlacing uint2 and uint works though :)


Title: Re: minerd - CPU and GPU mining software
Post by: burp on June 28, 2011, 05:40:28 PM
OK, it looks very good for me with 1 thread per gpu, intensity 10, and worksize 256. I get 619MH/s in total, means ~609MH/s per card. Rejection rate is at a normal level. For me it seems to be beneficial to increase intensity and worksize in favor of 2 gpu threads (which leads to more rejections for me).

EDIT: Rejection rate for now is higher than with poclbm (equal settings), minerd so far: 10/220 ~ 4.5%, poclbm: 41/2752 ~1.5%
EDIT2: Better results with intensity 8, gives me "just" 617MH/s in total but no rejections for 100 accepted shares so far. Probably the perfect settings for me.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 28, 2011, 08:49:38 PM
Sorry for the rude OT question but was that you that maintained the -ck tree? :)
Not rude at all. Yes it is me and I still do :)


Title: Re: minerd - CPU and GPU mining software
Post by: gat3way on June 28, 2011, 09:46:58 PM
I thought you quit kernel hacking. I've compiled some of your kernels a while ago on my desktop :) Had no idea you are into bitcoin stuff and OpenCL. Nice :)


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 28, 2011, 10:43:30 PM
I thought you quit kernel hacking. I've compiled some of your kernels a while ago on my desktop :) Had no idea you are into bitcoin stuff and OpenCL. Nice :)
Actually I'm very new to opencl and bitcoin. Just started a week ago, and had to learn all about opencl. I've put in over a hundred hours on this code already  to get up to speed :P

To see what I'm doing with linux kernel, check out http://ck-hack.blogspot.com (http://ck-hack.blogspot.com)


Title: Re: minerd - CPU and GPU mining software
Post by: bumbox on June 28, 2011, 10:57:13 PM
There is a problem with worksize autodetection on nvidia gtx 570. By default it is autodetected as 1024 but that leads to segfault:

Code:
./minerd --userpass xxx:xxx --url http://xxxxxx:8332/
[2011-06-29 02:51:01] Init GPU thread 0
[2011-06-29 02:51:01] List of devices:
[2011-06-29 02:51:01]   0       GeForce GTX 570
[2011-06-29 02:51:01] Selected 0: GeForce GTX 570
[2011-06-29 02:51:18] Initialising kernel poclbm.cl without BFI_INT patching, 1 vectors and worksize 1024
[2011-06-29 02:51:18] initCl() finished. Found GeForce GTX 570
[2011-06-29 02:51:18] Init GPU thread 1
[2011-06-29 02:51:18] List of devices:
[2011-06-29 02:51:18]   0       GeForce GTX 570
[2011-06-29 02:51:18] Selected 0: GeForce GTX 570
[2011-06-29 02:51:18] Long-polling activated for http://xxxxx:8332/LP
Segmentation fault

If I set worksize 512 or less it works fine:

Code:
./minerd --userpass xxx:xxx --url http://xxxx:8332/ --worksize 512
[2011-06-29 02:53:56] Init GPU thread 0
[2011-06-29 02:53:56] List of devices:
[2011-06-29 02:53:56]   0       GeForce GTX 570
[2011-06-29 02:53:56] Selected 0: GeForce GTX 570
[2011-06-29 02:54:12] Initialising kernel poclbm.cl without BFI_INT patching, 1 vectors and worksize 512
[2011-06-29 02:54:12] initCl() finished. Found GeForce GTX 570
[2011-06-29 02:54:12] Init GPU thread 1
[2011-06-29 02:54:12] List of devices:
[2011-06-29 02:54:12]   0       GeForce GTX 570
[2011-06-29 02:54:12] Selected 0: GeForce GTX 570
[2011-06-29 02:54:12] Long-polling activated for http://xxxxxx:8332/LP
[2011-06-29 02:54:13] [3.27 | 3.27 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-29 02:54:18] [70.47 | 18.51 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-29 02:54:23] [89.52 | 31.64 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-29 02:54:28] [69.74 | 37.58 Mhash/s] [0 Accepted] [0 Rejected]
[2011-06-29 02:54:33] [69.03 | 41.83 Mhash/s] [0 Accepted] [0 Rejected]
...


Title: Re: minerd - CPU and GPU mining software
Post by: gat3way on June 28, 2011, 10:57:43 PM
Well then welcome to the wonderful world of experimental programming and cursing AMD and Nvidia :)

It's a lot of fun though :) GPGPU stuff is among the most interesting things I've got into for sure.


Title: Re: minerd - CPU and GPU mining software
Post by: bumbox on June 28, 2011, 10:59:27 PM
...
To see what I'm doing with linux kernel, check out http//ck-hack.blogspot.com (http://http//ck-hack.blogspot.com)

Please add : after //, broken link :)


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 28, 2011, 11:04:07 PM
Thanks and thanks. I wondered why they returned 1024. Looks like more phayl from nvidia with opencl :(


Title: Re: minerd - CPU and GPU mining software
Post by: bumbox on June 28, 2011, 11:18:18 PM
Thanks and thanks. I wondered why they returned 1024. Looks like more phayl from nvidia with opencl :(

Well, I understand that nvidia is not the best hardware for mining but anyway could I somehow help in resolving this bug? Maybe some additional information or debug data are needed?


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 29, 2011, 12:54:33 AM
Updated tree

I've modified the log to only show the summary and not the testing information unless in debug mode. There are now counters stored to say which gpu or cpu found the share, and hw errors are stored as well. The added information can be used to determine whether to turn down intensity or to overclock less.

The output looks like this now:

[2011-06-29 10:46:19] GPU: 0 Accepted: 100 Rejected: 4 HW errors: 0
[2011-06-29 10:46:24] [230.23 | 218.86 Mhash/s] [105 Accepted] [4 Rejected] [0 HW errors]
[2011-06-29 10:46:29] [227.39 | 218.88 Mhash/s] [105 Accepted] [4 Rejected] [0 HW errors]
[2011-06-29 10:46:34] [218.19 | 218.88 Mhash/s] [105 Accepted] [4 Rejected] [0 HW errors]
[2011-06-29 10:46:40] [239.39 | 218.94 Mhash/s] [105 Accepted] [4 Rejected] [0 HW errors]
[2011-06-29 10:46:45] [230.92 | 218.97 Mhash/s] [105 Accepted] [4 Rejected] [0 HW errors]
[2011-06-29 10:46:45] GPU: 0 Accepted: 101 Rejected: 4 HW errors: 0

Also I've updated the code to not allow automatically setting work sizes greater than 512 as a simple way of preventing the nvidia bug mentioned earlier.

EDIT: I've also made the 1st rate reported (the log interval one) a decaying average so it doesn't jump around as much.


Title: Re: minerd - CPU and GPU mining software
Post by: gat3way on June 29, 2011, 07:19:50 AM
clGetDeviceInfo() tends to return BS sometimes :) Anyway, I don't think using the maximum allowed worksize is optimal as you are resource-constrained anyway. Bad thing is that it is hard to determine the optimum without experimenting with the workgroup size (starting from 32 on nvidia all the way to 512 in multiples of 32).


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 29, 2011, 07:29:03 AM
clGetDeviceInfo() tends to return BS sometimes :) Anyway, I don't think using the maximum allowed worksize is optimal as you are resource-constrained anyway. Bad thing is that it is hard to determine the optimum without experimenting with the workgroup size (starting from 32 on nvidia all the way to 512 in multiples of 32).

No of course not. I use max work size / vectors. That works surprisingly well as a default starting setting when none are chosen :)

So is anyone actually finding this client useful? It's getting quite mature now but apart from Burp's feedback I don't really get a sense that anyone's finding it useful. I find a huge improvement in throughput from it at intensity levels that don't affect my desktop.


Title: Re: minerd - CPU and GPU mining software
Post by: Naven on June 29, 2011, 09:12:13 AM
Any ideas how to compile that static?

Code:
CFLAGS="-O3 -static -Wall -msse2 -I/usr/include/nvidia-current/" ./configure
Gives me next error:
Code:
checking for curl-config... /usr/bin/curl-config
checking for the version of libcurl... 7.21.3
checking for libcurl >= version 7.10.1... yes
checking whether libcurl is usable... no
configure: error: Missing required libcurl >= 7.10.1

Code:
# apt-cache policy libcurl4-gnutls-dev 
libcurl4-gnutls-dev:
  Installed: 7.21.3-1ubuntu1.2


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on June 29, 2011, 09:21:25 AM
The last version with poclbm kernel and intensity=3 gives me 25.1 Mh/sec - already very close to the baseline 29.5 Mh/s of other miners! Higher intensity doesn't increase the hash rate much but slows down the desktop alot.


Title: Re: minerd - CPU and GPU mining software
Post by: theowalpott on June 29, 2011, 09:47:18 AM
Any ideas how to compile that static?

Code:
CFLAGS="-O3 -static -Wall -msse2 -I/usr/include/nvidia-current/" ./configure
Gives me next error:
Code:
checking for curl-config... /usr/bin/curl-config
checking for the version of libcurl... 7.21.3
checking for libcurl >= version 7.10.1... yes
checking whether libcurl is usable... no
configure: error: Missing required libcurl >= 7.10.1

Code:
# apt-cache policy libcurl4-gnutls-dev 
libcurl4-gnutls-dev:
  Installed: 7.21.3-1ubuntu1.2

try sudo apt-get-install libcurl4-openssl-dev

had this issue yesterday and it seemed to work with that package installed, rather than the other libcurl4 types.


Title: Re: minerd - CPU and GPU mining software
Post by: Naven on June 29, 2011, 10:44:39 AM
i tried with openssl-dev, nss-dev and also with curl from http://curl.haxx.se/download.html.
Everything works when i build minerd dynamic, but static dont wanna be so polite :)


Title: Re: minerd - CPU and GPU mining software
Post by: bumbox on June 29, 2011, 10:51:13 AM
Recent git version works fine on nvidia. Thanks! Good job!

One more thing. I do not exactly understand how bitcoin generation works but I have noticed the following thing.

oclHashCat-lite (http://www.hashcat.net/oclhashcat-lite/) gives me about ~290M/hash sha256 password bruteforce speed but gpumine only ~120M/hash. Are there any differences with sha256 password bruteforce and bitcoin mining process?
Maybe is it possible to improve the gpumine using kernels from hashcat?

here is the way I start hashcat:

Code:
./cudaHashcat-lite64.bin -m 1400 762d689acf34b57c52be4fad090626d4f44d3cfd83bbd2cceb4526bd95c54551
...
Hash.Type....: SHA256
Speed........:  292.6M/s

Of course I've tried to play with gpumine parameters like threads, intensity, worksize and vectors and was unable to increase the mining speed significantly.


Title: Re: minerd - CPU and GPU mining software
Post by: bumbox on June 29, 2011, 11:06:30 AM
i tried with openssl-dev, nss-dev and also with curl from http://curl.haxx.se/download.html.
Everything works when i build minerd dynamic, but static dont wanna be so polite :)

I have the same problem with static linking. Even tried to compile curl from curl.haxx.se manually. But still no luck.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 29, 2011, 11:12:39 AM
i tried with openssl-dev, nss-dev and also with curl from http://curl.haxx.se/download.html.
Everything works when i build minerd dynamic, but static dont wanna be so polite :)

You can't build a truly static build of something that sends or receives network packets, sorry.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 29, 2011, 02:22:44 PM
Updated tree:

I put some effort into minimising the risk of rejects and cl errors and to not miss shares close to each other. I did this by creating an array for the buffer variables passed to and from the GPU to make it extremely unlikely for a race to occur over the same slot in the array. Then I scan over the entire array when it is flagged as a match being found, but it's scanned in a separate thread to not delay further work being passed to the GPU. This change should allow you to use the higher values for intensity without it increasing the reject or error rate.

In the interim I discovered a nice bug whereby there was a chance the struct with the thread id had its memory freed before an attempt was made to detach the thread with pthread_detach which would lead to a segfault.


Title: Re: minerd - CPU and GPU mining software
Post by: Tartarus on June 29, 2011, 07:00:48 PM
FYI I'm seeing an odd error (and will try and track it down later in the day if I can) where short-opts are ignored and -n/--ndevs just returns the help message.


Title: Re: minerd - CPU and GPU mining software
Post by: gat3way on June 29, 2011, 08:45:21 PM
Hm, that's rather strange. I actually ship binaries statically linked with curl. However I disabled SSL support in curl as well as support for some unneeded protocols and compiled it myself. It's quite possible until you need SSL support. My attempts to build curl statically linked with libssl and libcrypto then build hashkill statically linked with curl failed as well.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 29, 2011, 10:51:36 PM
Thanks very much to those donating. Even tiny donations are most appreciated.

About the libcurl static thing, I had read this elsewhere, I have no real experience in the area, so there may be only some aspects of networking that cannot be compiled statically. What they are, I don't know.

I'll check out the options parsing eventually, as I do see the problem you're reporting.

There appears to be a bug where it starts rejecting all blocks after an extended period, somewhere in the order of ~2500 accepted blocks. I'm trying to investigate why that is, but it's rather hard to reproduce on my slower equipment :P

More improvements to come...


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 30, 2011, 12:42:05 AM
Updated tree:

Build binaries with unique filenames from the kernel generated and save them. Try to load this cached binary if it matches on next kernel instantiation. This speeds up start-up dramatically, and has a unique kernel binary for different kernel configurations.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 30, 2011, 04:51:12 AM
Temporary breakage... hold on please...


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 30, 2011, 05:51:22 AM
Temporary breakage... hold on please...

I've temporarily backed out the binary loading of kernels till I get it working properly everywhere. A couple of potential fixes have also been committed that could have caused segfaults due to memory dereferencing. It should be stable again but I still have more stuff I want to do...


Title: Re: minerd - CPU and GPU mining software
Post by: burp on June 30, 2011, 06:59:06 AM
I'm not sure what causes this behaviour but, repeatedly in two nights of running minerd, after some time it just produces rejected shares:

[2011-06-30 08:57:30] [607.75 | 605.73 Mhash/s] [1091 Accepted] [3890 Rejected] [0 HW errors]

EDIT: Just read you discovered that already yourself.


Title: Re: minerd - CPU and GPU mining software
Post by: Tobin on June 30, 2011, 08:53:38 AM
One more thing. I do not exactly understand how bitcoin generation works but I have noticed the following thing.

oclHashCat-lite (http://www.hashcat.net/oclhashcat-lite/) gives me about ~290M/hash sha256 password bruteforce speed but gpumine only ~120M/hash. Are there any differences with sha256 password bruteforce and bitcoin mining process?
Maybe is it possible to improve the gpumine using kernels from hashcat?
For block generation Bitcoin uses two rounds of sha-256. So one would expect at most half of the speed of oclhashcat, which is in your case 145Mh/s. This explains the huge different. Nonetheless it would be interesting to analyze haschcat's kernels.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 30, 2011, 09:58:45 AM
I'm not sure what causes this behaviour but, repeatedly in two nights of running minerd, after some time it just produces rejected shares:

[2011-06-30 08:57:30] [607.75 | 605.73 Mhash/s] [1091 Accepted] [3890 Rejected] [0 HW errors]

EDIT: Just read you discovered that already yourself.

Yeah thanks. It's killing me trying to figure out / instrument that as well since it happens only after a long time. There is also a bug with cpu mining at the moment where block submission can cause a segfault. I spent hours and hours coding today and threw out heaps of code. Oh well, there are days like this.

Thanks to the other anonymous donor! If you make a donation and want a specific feature, feel free to drop me a line when you donate and I'll see if I can do it.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 30, 2011, 10:33:32 AM
Experimenting with this on a single HD5970 (2 GPU cores):

    - I seem to be getting pretty much the same hashing rate as with phoenix
    - The reject rate seems to be much higher though:
         - with phoenix I usually get a reject rate of about 2% of accepted blocks
         - with this, it seems to be around 10%  :(


Code:
[2011-06-30 10:29:27] [745.63 | 727.37 Mhash/s] [54 Accepted] [6 Rejected] [0 HW errors]

Any idea what's causing this ?

I'm running:

Code:
./minerd                          \
    --intensity 12                \
    --cpu-threads 0               \
    --user $USER                  \
    --pass $PASS                  \
    --url "http://$ADDR:$PORT"    \



There are a few reasons for this. The reject rate goes up if you set the intensity too high on minerd because it can literally take 10 seconds before the gpu returns its results from one single request at high levels! In that time the blocks can get stale. Also, setting the number of gpu threads high basically slows down how long each request takes as well (the purpose for multiple threads is to make sure the gpu remains busy). Finally, some stale blocks are still sneaking through when a new block is detected. I'm working on all of these issues to try and minimise them, but for the time being, you may find less stale blocks with an intensity around 8-9, and the rate doesn't really go up substantially at higher levels anyway.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 30, 2011, 10:46:17 AM
Keep going down, or try dropping gpu threads to 1 ?


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 30, 2011, 10:54:15 AM
No worries, bear in mind this is still all new code and maturing.


Title: Re: minerd - CPU and GPU mining software
Post by: dc740 on June 30, 2011, 11:29:31 AM
Hi, I'm experimenting with m0mchil python gpu miner, jgarzik cpu miner, and your miner.
I think I can reproduce this "bug", but I don't know why it happens, just that it can be reproduced in slower hardware.
The thing is my CPU gets accepted solutions while my gpu doesn't.
I get 4.8 Mhash on a Geforce 8600GT and 0.9 Mhash on one AMD X2 +4400 core using sse2_64 algorithm. So the math doesn't add up. GPU should be getting more accepted solutions.
The difference is so big that the counter was 17 in the cpu and 0 in the gpu (I'm using deepcoin to track both workers). I restarted the gpu miner, got 3 shares in 20 minutes (it's a slow machine. I'm just experimenting) and then it stopped getting shares completely while the cpu just kept getting accepted solutions.

I'm running jgarzik cpu miner (using 1 cpu core), and m0mchil gpu miner (using the gpu and one cpu core for some reason).

I'm using Ubuntu 11.04 x64, 270 DEV drivers and NVidia CUDA 4.0.
AMD64 X2 +4400 EE

One last thing, I get segmentation faults whenever I try to use your miner.
http://forum.bitcoin.org/index.php?topic=24311.msg303201#msg303201
I used this to compile it:
Code:
LD_LIBRARY_PATH="/usr/local/cuda/lib" CFLAGS="-O3 -Wall -msse2 -I/usr/local/cuda/include" ./configure
make
sudo make install


I know it may be it's just not finding anything, but I really think we are talking about the same bug. How could the GPU find 3 shares in 15 minutes, and then just completely stop getting accepted solutions for 24 hours, while the cpu got 29 accepted solutions in the same time? I really don't know but it is strange because we are talking about pooled mining, if I were mining by my own I would have to way a few decades to find an accepted solution.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 30, 2011, 11:34:05 AM
The code doesn't support make install yet... You have to run it from the directory where it's built for now. And you happened to try it at an unfortunately quite unstable development time. I'm working very hard at fixing the instability right now.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on June 30, 2011, 03:29:09 PM
Updated tree:

The work submission and get work was done from the same "curl" and one would block the other. This would mean that delays on one would delay the other and could slow down processing unnecessarily. While trying to split them into different threads I discovered they would crash on using the same curl so each component has its own thread and own curl now. This should make it much less likely that stalls occur due to poor network connectivity. The separate curl instances may also fix other bugs (like the infinite rejects loop).

I've debugged the binary kernel loading and re-instated it. Now it should be much faster to begin after the first time it is started as it will generate an appropriate binary and then load it thereafter.

Still todo:
I'd like to use the block information received to tell submission threads to not both submitting queued stale blocks after longpoll has informed it of a change.
Find other ways of decreasing stale block rate.
Increase throughput (pipedream).
Start looking at cleaning things up for better building, configuration, windows builds and so on, to perhaps make a real release version.
Lots of other things... but sleep first zzzzz....


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 01, 2011, 11:32:08 AM
Updated tree:

Fixed the high stale block rate. Now it should be equivalent to other miners unless you set the intensity absurdly high.


Title: Re: minerd - CPU and GPU mining software
Post by: theowalpott on July 01, 2011, 11:57:03 AM
Whats the reason for not including the cpu miner code developed by ufasoft? - Under a 32bit OS, I can get the same using his miner as the SSE2_64 code on a 64-bit OS. Why can't this speed be matched for a 32 bit OS?


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 01, 2011, 12:00:07 PM
Whats the reason for not including the cpu miner code developed by ufasoft? - Under a 32bit OS, I can get the same using his miner as the SSE2_64 code on a 64-bit OS. Why can't this speed be matched for a 32 bit OS?
Cause I'm hopeless with asm. Happy to include it if someone can port the 32 bit assembly to something more portable.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 01, 2011, 02:23:50 PM
Updated tree:

I put a lot more effort into avoiding rejected blocks. I've reworked the get work code to not require locking and to be flagged itself if longpoll has notified us of a new block. If that happens it will discard and queued work. It also now stores the current block's header once it's known, and on block submission it compares the result being submitted and if it belongs to an older block it will discard it instead of trying to upload it. With these accumulated changes, the block reject rate is lower than ever.


Title: Re: minerd - CPU and GPU mining software
Post by: burp on July 01, 2011, 08:27:29 PM
Yep, looks much better.

[2011-07-01 22:26:54] [619.73 | 618.90 Mhash/s] [1410 Accepted] [63 Rejected] [0 HW errors]

EDIT: [2011-07-02 12:40:02] [616.28 | 619.13 Mhash/s] [8599 Accepted] [318 Rejected] [0 HW errors]

EDIT2: worksize 256 and intensity 6: [2011-07-02 13:52:44] [612.71 | 617.55 Mhash/s] [233 Accepted] [3 Rejected] [0 HW errors]

Lowest rejection percentage ever :)


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 01, 2011, 11:17:13 PM
Thanks for your feedback. I believe I fixed the infinite rejects bug as well.

[2011-07-01 23:14:05] [1293.02 | 1065.65 Mhash/s] [5278 Accepted] [160 Rejected] [0 HW errors]

What next...


Title: Re: minerd - CPU and GPU mining software
Post by: Tartarus on July 02, 2011, 02:11:31 AM
Thanks for your feedback. I believe I fixed the infinite rejects bug as well.

[2011-07-01 23:14:05] [1293.02 | 1065.65 Mhash/s] [5278 Accepted] [160 Rejected] [0 HW errors]

What next...


Locally, the long-term hash rate seems way off.  Looking at 10min worth of scroll-back I see instant rates of between 332MHash/s and 352MHash/s but the long average is 325MHash/s.  This was over a period of at least 3 hours where to start with after 5min or so it was around 342MHash/s, which is what phoenix+phatk show.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 02, 2011, 02:41:55 AM
Updated tree:

Attribute correct GPU for accepted/rejected shares.
Check again that block hasn't gone stale if trying to resubmit after failed submit.
Make failure to load binary kernel go back to building from source instead of failing to initialise that GPU.
Increase gpu thread count back to 2 by default now that stale block control is more robust. This gives a demonstrable throughput benefit.

Currently working on: Incorporating windows build magic from Ycros (thanks!)

TODO:
Increase buffered work to configurable number instead of just 1 and perhaps default to 2.
Look at those other new kernel changes pointed out by znort987 (thanks!).


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 02, 2011, 04:03:15 AM
Updated tree:

First windows builds courtesy of Ycros (Thanks!)
http://ck.kolivas.org/apps/cpuminer-ycros-2011-07-02-1350.zip

New option
--queue N
how many items of work to queue (default 2)

can speed up higher powered hardware.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 02, 2011, 05:09:41 AM
Try decreasing --queue to 1 if you start getting more rejects. I'm not sure 2 is better than 1. More testing needed.


Title: Re: minerd - CPU and GPU mining software
Post by: Naven on July 02, 2011, 05:33:16 AM
Why it is impossible to mine now without supported gpu?


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 02, 2011, 11:47:39 AM
Updated tree:

I've fixed a logic error in the queuing of extra work that would generate more rejects. No new windows binary as yet, sorry.


Title: Re: minerd - CPU and GPU mining software
Post by: burp on July 02, 2011, 12:53:45 PM
Best results ever, you are surpassing poclbm now :)
I have a hard time getting rejected shares now ;)

[2011-07-02 14:52:59] [619.41 | 617.64 Mhash/s | eff.: 626.28 Mhash/s] [296 Accepted] [0 Rejected] [0 HW errors]

eff is accepted * 2^32 / (total_time * 1E6)

EDIT: Somehow mining stopped after ca. 400 blocks, I will try again (but it ran with 0 rejected shares!).


Title: Re: minerd - CPU and GPU mining software
Post by: ulee on July 02, 2011, 01:20:11 PM
If I use minerd on two different GPU's (5830+5770), the second one always produces 100% HW-Errors. This doesn't happen with other mining software.

EDIT: No, not always, can't reproduce it reliably.


Title: Re: minerd - CPU and GPU mining software
Post by: ulee on July 02, 2011, 01:30:29 PM
Updated tree:

Attribute correct GPU for accepted/rejected shares.
[...]

This doesn't work for me, shares from both GPU's show up with "GPU: 0" at the beginning of the line.


Title: Re: minerd - CPU and GPU mining software
Post by: dc740 on July 02, 2011, 02:43:07 PM
Tried setting 1 gpu thread and 1 cpu thread and got a segmentation fault:

Works:
./minerd --gpu-threads 2 --url --pass --user

Segmentation fault:
./minerd  -a sse2_64 -t 1 --gpu-threads 1 --url --pass --user

Code:
[2011-07-02 11:37:12] Init GPU thread 0
[2011-07-02 11:37:12] List of devices:
[2011-07-02 11:37:12] 0 GeForce 8600 GT
[2011-07-02 11:37:12] Selected 0: GeForce 8600 GT
[2011-07-02 11:37:23] Initialising kernel poclbm.cl without BFI_INT patching, 1 vectors and worksize 512
[2011-07-02 11:37:32] initCl() finished. Found GeForce 8600 GT
[2011-07-02 11:37:32] 1 gpu miner threads started
[2011-07-02 11:37:32] 1 cpu miner threads started, using SHA256 'sse2_64' algorithm.
[2011-07-02 11:37:34] Long-polling activated for http://pit.deepbit.net:8332/listenChannel
*** glibc detected *** ./minerd: corrupted double-linked list: 0x00007f8bb4586020 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x76bb6)[0x7f8bbf21fbb6]
/lib/x86_64-linux-gnu/libc.so.6(+0x7a931)[0x7f8bbf223931]
/lib/x86_64-linux-gnu/libc.so.6(+0x7b112)[0x7f8bbf224112]
/lib/x86_64-linux-gnu/libc.so.6(realloc+0xf9)[0x7f8bbf225b19]
./minerd[0x420610]
./minerd[0x41f44d]
./minerd[0x41fd5e]
./minerd[0x41fd69]
./minerd[0x42013e]
./minerd[0x405fd5]
./minerd[0x403229]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x6d8c)[0x7f8bbf748d8c]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f8bbf28f04d]

BTW... the help lists -g as a valid option to set gpu threads, but if you use -g 1 it says it's invalid.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 02, 2011, 02:44:58 PM
Sorry for some reason short options and invalid options are broken at the moment. Please use the long option names.


Title: Re: minerd - CPU and GPU mining software
Post by: burp on July 03, 2011, 10:21:16 AM
OK, I can confirm my previous result that somehow mining for one or multiple GPUs just stops. There is no indication of a crash, and no overheating possible. I can just restart minerd for normal operation.

[2011-07-03 12:18:58] [310.07 | 391.56 Mhash/s | eff.: 385.04 Mhash/s] [4016 Accepted] [3 Rejected] [0 HW errors]


Code:
[2011-07-03 03:11:53] GPU: 0  Accepted: 830  Rejected: 2  HW errors: 0
[2011-07-03 03:11:56] [618.30 | 617.98 Mhash/s | eff.: 582.11 Mhash/s] [1623 Accepted] [2 Rejected] [0 HW errors]
[2011-07-03 03:12:01] [619.46 | 617.98 Mhash/s | eff.: 581.87 Mhash/s] [1623 Accepted] [2 Rejected] [0 HW errors]
[2011-07-03 03:12:03] GPU: 0  Accepted: 831  Rejected: 2  HW errors: 0
[2011-07-03 03:12:06] [617.86 | 617.98 Mhash/s | eff.: 581.98 Mhash/s] [1624 Accepted] [2 Rejected] [0 HW errors]
[2011-07-03 03:12:07] GPU: 1  Accepted: 794  Rejected: 0  HW errors: 0
[2011-07-03 03:12:12] [435.91 | 617.85 Mhash/s | eff.: 582.07 Mhash/s] [1625 Accepted] [2 Rejected] [0 HW errors]
[2011-07-03 03:12:17] [390.26 | 617.72 Mhash/s | eff.: 581.82 Mhash/s] [1625 Accepted] [2 Rejected] [0 HW errors]
[2011-07-03 03:12:22] GPU: 1  Accepted: 795  Rejected: 0  HW errors: 0
[2011-07-03 03:12:22] [346.60 | 617.58 Mhash/s | eff.: 581.93 Mhash/s] [1626 Accepted] [2 Rejected] [0 HW errors]
[2011-07-03 03:12:27] [329.83 | 617.46 Mhash/s | eff.: 581.69 Mhash/s] [1626 Accepted] [2 Rejected] [0 HW errors]
[2011-07-03 03:12:32] [318.97 | 617.33 Mhash/s | eff.: 581.45 Mhash/s] [1626 Accepted] [2 Rejected] [0 HW errors]
[2011-07-03 03:12:34] GPU: 1  Accepted: 796  Rejected: 0  HW errors: 0
[2011-07-03 03:12:37] [313.34 | 617.20 Mhash/s | eff.: 581.56 Mhash/s] [1627 Accepted] [2 Rejected] [0 HW errors]
[2011-07-03 03:12:42] [308.59 | 617.07 Mhash/s | eff.: 581.32 Mhash/s] [1627 Accepted] [2 Rejected] [0 HW errors]
[2011-07-03 03:12:47] [309.94 | 616.94 Mhash/s | eff.: 581.07 Mhash/s] [1627 Accepted] [2 Rejected] [0 HW errors]
[2011-07-03 03:12:52] GPU: 1  Accepted: 797  Rejected: 0  HW errors: 0
[2011-07-03 03:12:52] [309.93 | 616.81 Mhash/s | eff.: 581.19 Mhash/s] [1628 Accepted] [2 Rejected] [0 HW errors]
[2011-07-03 03:12:57] [309.95 | 616.68 Mhash/s | eff.: 580.94 Mhash/s] [1628 Accepted] [2 Rejected] [0 HW errors]
[2011-07-03 03:13:03] [306.25 | 616.55 Mhash/s | eff.: 580.70 Mhash/s] [1628 Accepted] [2 Rejected] [0 HW errors]


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 03, 2011, 10:28:47 AM
Yeah thanks. There is likely a logic error in the queueing of extra requests. I'm currently completely rewriting all that to preemptively request work before it's needed to help cope with dodgy network connectivity and other goodies. Actually it's complete but I'm testing it before pushing it.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 03, 2011, 03:15:43 PM
Updated tree and windows binary:

After an extensive period of poor connectivity with my pool I decided to make minerd much more robust with respect to networking and caching of work items. I modified to code to find when a worker thread is 2/3 of the way through completing that search and will then queue a new work request in advance at that point. This allows getting work over slow or intermittent connections asynchronously from the worker thread without having to have a large buffer of increasingly stale work. Then I added code to flush out all the old items of work when a longpoll is detected -and- queue a whole new set of work for each and every thread in advance since they'll all need new work. I've also updated the cpumining code to properly work to the end of a work item (and not be counted as inefficient mining), and made some of the log updates more robust. Minerd should cope better with spotty connections under periods of server stress now, and rejects across longpolls should be rarer.

New windows binary:
http://ck.kolivas.org/apps/cpuminer-ycros-2011-07-04.zip (http://ck.kolivas.org/apps/cpuminer-ycros-2011-07-04.zip)

Known bugs:
It does not work with short options (only --long time options), and will crash with invalid options.
Sometimes there's a crash deep within libcurl that looks like this:
*** longjmp causes uninitialized stack frame ***
This happens deep within the libcurl code and appears to be not related to minerd at all. The only thing it seems I can do about it is move to a different library. This is the only recurring problem and because of it I put minerd to auto-restart for myself though it's quite rare (sometimes happens immediately on starting on windows).


Title: Re: minerd - CPU and GPU mining software
Post by: Tartarus on July 03, 2011, 05:22:12 PM
With 17faaea and a local network interrupt (I think anyhow, VoIP call hung-up, ssh/etc stuff recovered fine) minerd stopped getting new work or doing anything else on the network for at least 5 minutes (then I ^C'd it).  Retry was the default value.


Title: Re: minerd - CPU and GPU mining software
Post by: ulee on July 03, 2011, 05:22:46 PM
I tried this ↑ new version of minerd, but I still get 100% HW-Errors on my second GPU.  :(
This bug doesn't occur with an old Version of minerd.


Title: Re: minerd - CPU and GPU mining software
Post by: jgarzik on July 03, 2011, 05:29:14 PM

New windows binary:
http://ck.kolivas.org/apps/cpuminer-ycros-2011-07-04.zip (http://ck.kolivas.org/apps/cpuminer-ycros-2011-07-04.zip)

Can you change the name to something other than the now-misleading "cpuminer"?



Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 03, 2011, 11:05:48 PM
I tried this ↑ new version of minerd, but I still get 100% HW-Errors on my second GPU.  :(
This bug doesn't occur with an old Version of minerd.


What does the output look like with -D until it has started getting HW errors?


Title: Re: minerd - CPU and GPU mining software
Post by: ulee on July 03, 2011, 11:58:56 PM
What does the output look like with -D until it has started getting HW errors?

Output from minerd (http://pastebin.com/uD1n9u2V)
I didn't set --queue, --gpu-threads or --intensity, so these were at default values.
These lines look interesting:
Code:
[2011-07-04 01:42:48] GPU 1 found something?
[2011-07-04 01:42:48] No best_g found! Error in OpenCL code?

This only happens with the last few versions of of minerd, an older version (before your "What next..." post) worked fine with both GPUs. Unfortunately I don't know at which exact version it stopped working.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 04, 2011, 12:53:51 AM
What does the output look like with -D until it has started getting HW errors?

Output from minerd (http://pastebin.com/uD1n9u2V)
I didn't set --queue, --gpu-threads or --intensity, so these were at default values.
These lines look interesting:
Code:
[2011-07-04 01:42:48] GPU 1 found something?
[2011-07-04 01:42:48] No best_g found! Error in OpenCL code?

This only happens with the last few versions of of minerd, an older version (before your "What next..." post) worked fine with both GPUs. Unfortunately I don't know at which exact version it stopped working.

Thanks. I'm pretty sure I know what that is. The different cards need different kernels and they're both loading the same binary. I'll get to fixing that.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 04, 2011, 01:06:56 AM

New windows binary:
http://ck.kolivas.org/apps/cpuminer-ycros-2011-07-04.zip (http://ck.kolivas.org/apps/cpuminer-ycros-2011-07-04.zip)

Can you change the name to something other than the now-misleading "cpuminer"?

I'll get around to it sooner or later. Trying to consolidate everything now to make sure it's all actually working :s


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 04, 2011, 03:51:47 AM
Thanks. I'm pretty sure I know what that is. The different cards need different kernels and they're both loading the same binary. I'll get to fixing that.

Updated tree: The binary kernel stored now includes the GPU name in the filename. This will allow separate binary kernels to be saved for each unique GPU type on the same machine which should fix this problem.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 04, 2011, 05:37:53 AM
Updated tree:

I put a careful counter on the number of queued items to ensure we don't fall between the cracks during an updated block and clearing of work that we end up without any work and one ore more threads idle. Also, since minerd now pre-queues work before the previous work is finished, there is no need to have extra queued work by default, so I've changed the default queue value to 0 and made it mean extra queued work instead.


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on July 04, 2011, 05:39:01 AM
Compilation fails on Fedora 14 32bit, can't find CPU_* macros for some reason:
Quote
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson    -O2 -Wall -msse2 -I/opt/ati-stream-sdk-v2.1-lnx32/include -g -MT minerd-cpu-miner.o -MD -MP -MF .deps/minerd-cpu-miner.Tpo -c -o minerd-cpu-miner.o `test -f 'cpu-miner.c' || echo './'`cpu-miner.c
In file included from cpu-miner.c:30:0:
miner.h:29:0: warning: "alloca" redefined
/usr/include/alloca.h:36:0: note: this is the location of the previous definition
cpu-miner.c: In function 'drop_policy':
cpu-miner.c:44:21: warning: unused variable 'param'
cpu-miner.c: In function 'affine_to_cpu':
cpu-miner.c:58:2: warning: implicit declaration of function 'CPU_ZERO'
cpu-miner.c:59:2: warning: implicit declaration of function 'CPU_SET'
cpu-miner.c:60:2: warning: implicit declaration of function 'sched_setaffinity'


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 04, 2011, 05:41:44 AM
Compilation fails on Fedora 14 32bit, can't find CPU_* macros for some reason:
Quote
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson    -O2 -Wall -msse2 -I/opt/ati-stream-sdk-v2.1-lnx32/include -g -MT minerd-cpu-miner.o -MD -MP -MF .deps/minerd-cpu-miner.Tpo -c -o minerd-cpu-miner.o `test -f 'cpu-miner.c' || echo './'`cpu-miner.c
In file included from cpu-miner.c:30:0:
miner.h:29:0: warning: "alloca" redefined
/usr/include/alloca.h:36:0: note: this is the location of the previous definition
cpu-miner.c: In function 'drop_policy':
cpu-miner.c:44:21: warning: unused variable 'param'
cpu-miner.c: In function 'affine_to_cpu':
cpu-miner.c:58:2: warning: implicit declaration of function 'CPU_ZERO'
cpu-miner.c:59:2: warning: implicit declaration of function 'CPU_SET'
cpu-miner.c:60:2: warning: implicit declaration of function 'sched_setaffinity'

That should be in /usr/include/sched.h which is in a virtually standard package for compiling anything: libc6-dev


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on July 04, 2011, 06:16:35 AM
Yes, sure, it's still there. But the problem isn't with the header file. This commit breaks the build:
Quote
commit 5c2eee548c8d6f2e0d90f6f1631cf7d5b49fc3d8
Author: Con Kolivas <kernel@kolivas.org>
Date:   Sat Jul 2 13:46:17 2011 +1000

    Fix redefinition of gnu source.

diff --git a/cpu-miner.c b/cpu-miner.c
index 6168713..72e0a6d 100644
--- a/cpu-miner.c
+++ b/cpu-miner.c
@@ -10,7 +10,6 @@
  */
 
 #include "config.h"
-#define _GNU_SOURCE
 
 #include <stdio.h>
 #include <stdlib.h>
And indeed, man CPU_ZERO says:
Quote
...
SYNOPSIS
       #define _GNU_SOURCE
       #include <sched.h>
...
I'm not sure how it works on your system though.


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 04, 2011, 06:20:02 AM
Gnu source is in config.h now
So it should be pulled in by everything
Make sure you have done ./autogen.sh and then ./configure


Title: Re: minerd - CPU and GPU mining software
Post by: figvam on July 04, 2011, 07:29:12 AM
Yes, thanks, that was it.


Title: cgminer
Post by: -ck on July 04, 2011, 11:08:34 AM
I've decided to rename this application cgminer which means "cpu and gpu miner" or "ck and garzik miner" or "c gpu miner" or... just plain cgminer.

So I've moved the git tree to
https://github.com/ckolivas/cgminer (https://github.com/ckolivas/cgminer)

and have started renaming files and have cleaned up the git log, rebasing it, for it to build with the name cgminer version 1.0.9

So I'm trying to clean all this code up for a meaningful release now.


Title: Re: minerd - CPU and GPU mining software
Post by: Fletch on July 04, 2011, 11:17:13 AM
Forgive my ignorance, but as this miner supports both GPU and CPU, does it "intelligently" pick which processor to use or do you have to tell it to either use the GPU or the CPU (or both)?


Title: Re: minerd - CPU and GPU mining software
Post by: -ck on July 04, 2011, 11:20:05 AM
Forgive my ignorance, but as this miner supports both GPU and CPU, does it "intelligently" pick which processor to use or do you have to tell it to either use the GPU or the CPU (or both)?
If it does not detect any gpus it will cpu mine. If it detects any gpus it will only gpu mine unless you explicitly tell it to cpu mine as well. I'm working on modifying the code to build in the absence of opencl code and be a pure cpu miner still if need be.


Title: Re: minerd - CPU and GPU mining software
Post by: ulee on July 04, 2011, 12:04:26 PM
I pulled from the new tree, and everything appears to be working now. Thanks.

Feature suggestion: Option to set a different worksize for each GPU.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 05, 2011, 12:54:04 AM
Updated tree:

I believe we've tracked down the cause of the libcurl bug as being signal handling in the dns lookup code. So I've disabled signal handling and this has allowed me to add multiple curl handles thus making each get work and submit work completely asynchronous rather than each getwork waiting on the previous one and so on. It is theoretically possible it could spend forever waiting for a dns resolve but I doubt this can happen in reality as the lookup code would have to timeout at some stage. I've also addressed a bug where it was possible after a longpoll that a gpu could be left idle without any work. New windows builds coming soon.


Title: Re: cgminer - CPU and GPU mining software
Post by: figvam on July 05, 2011, 04:25:32 AM
Is it possible to make it compile without AMD APP SDK? To run it as a pure CPU miner on a machine without any GPU.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 05, 2011, 04:26:53 AM
Is it possible to make it compile without AMD APP SDK? To run it as a pure CPU miner on a machine without any GPU.
I'm working on that still.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 05, 2011, 06:16:10 AM
New windows binary:
http://ck.kolivas.org/apps/cgminer-ycros-2011-07-05.zip (http://ck.kolivas.org/apps/cgminer-ycros-2011-07-05.zip)


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 05, 2011, 06:51:30 AM
Updated tree:

Fixed parameter parsing. Now short parameters should work, and it wont crash with invalid parameters.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 05, 2011, 07:37:15 AM
Is it possible to make it compile without AMD APP SDK? To run it as a pure CPU miner on a machine without any GPU.
Updated tree:

It should build now without opencl as a cpuminer only. The help message should say what it is compiled for after it's built.


Title: Re: cgminer - CPU and GPU mining software
Post by: d3m0n1q_733rz on July 05, 2011, 08:33:56 AM
Hey, have you added in the SSE2_x64_atom update yet?


Title: Re: cgminer - CPU and GPU mining software
Post by: figvam on July 05, 2011, 08:42:13 AM
Still not possible to build without OpenCL:

In file included from main.c:30:
miner.h:15:19: error: CL/cl.h: No such file or directory
In file included from main.c:30:
miner.h:215: error: expected specifier-qualifier-list before ‘cl_uint’
main.c: In function ‘miner_thread’:
main.c:869: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:880: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:890: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:903: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:913: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:920: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:941: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:943: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:949: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:952: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:963: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:967: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:974: error: ‘dev_blk_ctx’ has no member named ‘nonce’


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 05, 2011, 09:11:57 AM
Still not possible to build without OpenCL:

In file included from main.c:30:
miner.h:15:19: error: CL/cl.h: No such file or directory
In file included from main.c:30:
miner.h:215: error: expected specifier-qualifier-list before ‘cl_uint’
main.c: In function ‘miner_thread’:
main.c:869: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:880: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:890: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:903: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:913: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:920: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:941: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:943: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:949: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:952: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:963: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:967: error: ‘dev_blk_ctx’ has no member named ‘nonce’
main.c:974: error: ‘dev_blk_ctx’ has no member named ‘nonce’


Did you do ./autogen.sh followed by configure first? If so, what was the output please?


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 05, 2011, 09:13:10 AM
Hey, have you added in the SSE2_x64_atom update yet?
No. Is it stable/working ok? Link?


Title: Re: cgminer - CPU and GPU mining software
Post by: figvam on July 05, 2011, 09:32:55 AM
The thing is that #include <CL/cl.h> line isn't wrapped in the #ifdef HAVE_OPENCL block, so the file is always included regardless of the OpenCL presence. There are more OpenCL-related bits in miner.h and mine.c which are always compiled.

Did you do ./autogen.sh followed by configure first? If so, what was the output please?
autogen doesn't output anything.
I had to remove the libcurl macro from configure and added the curl flags manually to the generated Makefile since RHEL5 doesn't have libcurl pkgconfig bits.
configure output:
Quote
$ CFLAGS="-O3 -Wall -msse2" ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for ranlib... ranlib
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether gcc needs -traditional... no
checking whether gcc and cc understand -c and -o together... yes
checking for ranlib... (cached) ranlib
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking for stdint.h... (cached) yes
checking for mprotect... yes
checking for mmap... yes
checking for MAP_ANONYMOUS... yes
checking whether memchr works... yes
checking whether memmem is declared... yes
checking for memmem... yes
checking whether memmem works... yes
checking for wchar_t... yes
checking whether the preprocessor supports include_next... yes
checking whether system header files limit the line length... no
checking for unsigned long long int... yes
checking for long long int... yes
checking whether stdint.h conforms to C99... yes
checking for C/C++ restrict keyword... __restrict
checking whether memmem is declared without a macro... yes
checking whether mempcpy is declared without a macro... yes
checking whether memrchr is declared without a macro... yes
checking whether rawmemchr is declared without a macro... yes
checking whether stpcpy is declared without a macro... yes
checking whether stpncpy is declared without a macro... yes
checking whether strchrnul is declared without a macro... yes
checking whether strdup is declared without a macro... yes
checking whether strncat is declared without a macro... yes
checking whether strndup is declared without a macro... yes
checking whether strnlen is declared without a macro... yes
checking whether strpbrk is declared without a macro... yes
checking whether strsep is declared without a macro... yes
checking whether strcasestr is declared without a macro... yes
checking whether strtok_r is declared without a macro... yes
checking whether strerror_r is declared without a macro... yes
checking whether strsignal is declared without a macro... yes
checking whether strverscmp is declared without a macro... yes
checking whether memmem works in linear time... no
checking for memmem... (cached) yes
checking whether memmem works... (cached) yes
checking whether NULL can be used in arbitrary expressions... yes
checking for ANSI C header files... (cached) yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for OpenCL... no
checking for json_loads in -ljansson... no
checking for pthread_create in -lpthread... yes
checking for yasm... /usr/bin/yasm
checking if yasm version is greater than 1.0.1... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating compat/Makefile
config.status: creating compat/jansson/Makefile
config.status: creating x86_64/Makefile
config.status: creating lib/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands

OpenCL: NOT FOUND. GPU mining support DISABLED.



Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 05, 2011, 09:50:49 AM
Thanks very much. Updated the tree. Please try again.


Title: Re: cgminer - CPU and GPU mining software
Post by: figvam on July 05, 2011, 11:14:22 AM
It crashes after some run time with a floating point exception:

Quote
Core was generated by `./cgminer --algo sse2_64 --debug --url http://mineco.in:3000/ --userpass xxxxxx'.
Program terminated with signal 8, Arithmetic exception.
#0  0x00000000004024b2 in miner_thread (userdata=<value optimized out>)
    at main.c:949
949                             max64 = work.blk.nonce +
(gdb) where
#0  0x00000000004024b2 in miner_thread (userdata=<value optimized out>)
    at main.c:949
#1  0x000000393800673d in start_thread () from /lib64/libpthread.so.0
#2  0x00000039374d44bd in clone () from /lib64/libc.so.6


Title: Re: cgminer - CPU and GPU mining software
Post by: kripz on July 05, 2011, 12:10:21 PM
Maybe im dreaming, would it be possible to detect a dropped/slow gpu and restart that thread?

Not that this has happened but have happened with the other single instance mine on all gpu hashers.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 05, 2011, 12:12:39 PM
Maybe im dreaming, would it be possible to detect a dropped/slow gpu and restart that thread?

Not that this has happened but have happened with the other single instance mine on all gpu hashers.
That shouldn't happen. This miner goes to great lengths to keep the mining threads busy at all times in the face of terrible network connectivity. Unless the pool is down for extended periods it should do what you want already.


Title: Re: cgminer - CPU and GPU mining software
Post by: d3m0n1q_733rz on July 05, 2011, 06:11:00 PM
Hey, have you added in the SSE2_x64_atom update yet?
No. Is it stable/working ok? Link?
Link:  http://yyz.us/bitcoin/sha256_xmm_amd64_atom.asm (http://yyz.us/bitcoin/sha256_xmm_amd64_atom.asm)

And yes, it's stable and working.  It was determined that you need to strip "_atom" from both the name of the file and the name within the text of the file.  Use it to replace your existing sha256_xmm_amd64.asm file in the x86_64 folder then recompile.  I've been using it since it came out.  Alternatively, just copy-paste the code I already stripped from the cpuminer thread and name it sha256_xmm_amd64.asm.  You'll be surprised at how many more hashes you'll find with it.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 05, 2011, 11:01:09 PM
Updated tree:
Reworked the screen update to have a non-scrolling status line and make the stderr log optional.
Updated assembly for 64 bit cpu mining - d3m0n1q thanks a lot. Updated with newer assembly. It seems to be worth 5-10% improvement.

Getting close now to a release. Need to find a way to include the kernel files in distdir and install.


Title: Re: cgminer - CPU and GPU mining software
Post by: kripz on July 06, 2011, 12:24:37 AM
Quote
[2011-07-06 09:26:27] [188.20 | 188.33 Mhash/s] [1484 Accepted] [21 Rejected] [0 HW errors]
[2011-07-06 09:26:27] [thread 1: 67108864 hashes, 41359356 khash/sec]
[2011-07-06 09:26:27] [thread 0: 50331648 hashes, 31027223 khash/sec]
[2011-07-06 09:26:28] LONGPOLL detected new block
[2011-07-06 09:26:30] getwork thread 1
[2011-07-06 09:26:30] work retrieval failed, exiting gpu mining thread 0
[2011-07-06 09:26:30] [thread 1: 50331648 hashes, 22013848 khash/sec]
[2011-07-06 09:26:30] Failed to tq_push work in workio_get_work
[2011-07-06 09:26:30] Received kill message
[2011-07-06 09:26:30] workio thread dead, exiting.

What happened here?


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 06, 2011, 03:19:23 AM
Quote
[2011-07-06 09:26:27] [188.20 | 188.33 Mhash/s] [1484 Accepted] [21 Rejected] [0 HW errors]
[2011-07-06 09:26:27] [thread 1: 67108864 hashes, 41359356 khash/sec]
[2011-07-06 09:26:27] [thread 0: 50331648 hashes, 31027223 khash/sec]
[2011-07-06 09:26:28] LONGPOLL detected new block
[2011-07-06 09:26:30] getwork thread 1
[2011-07-06 09:26:30] work retrieval failed, exiting gpu mining thread 0
[2011-07-06 09:26:30] [thread 1: 50331648 hashes, 22013848 khash/sec]
[2011-07-06 09:26:30] Failed to tq_push work in workio_get_work
[2011-07-06 09:26:30] Received kill message
[2011-07-06 09:26:30] workio thread dead, exiting.

What happened here?

For some reason it was unable to retrieve any work and that's a fatal error, so it aborted cgminer entirely. I've updated the tree to retry getting work up to the configured amount of times (infinite by default) now.


Title: Re: cgminer - CPU and GPU mining software
Post by: d3m0n1q_733rz on July 06, 2011, 09:22:05 AM
Question about an optimization:  I was wondering if I were to take advantage of the horizontal math function of SSE3 in place of the multiple paddd functions, would it be quicker?  And also, I was wondering if someone could give me a hand with si/di registers and explain why they weren't used effectively in the code?


Title: Re: cgminer - CPU and GPU mining software
Post by: mf on July 06, 2011, 09:29:17 AM
Getting close now to a release. Need to find a way to include the kernel files in distdir and install.

Con, would you consider adding or receiving a pull request to get the status line to be similar to phoenix's, and add a couple more info points:
- Total getworks received in the current run
- Efficiency %, calculated as percentage of getworks received vs accepted (can be >100%) in the current run
- Utility (for lack of a better name), calculated as being the number of accepted per minute in the current run (varies wildly at first, should stabilise after a bit).

All the above needs is:
- an unsigned to hold the total getworks received
- one more %d per log printf and/or _info for the total getworks
- two more %.2f per log printf and/or _info for the efficiency % and utility:
- Efficiency: getwork_requested ? cgpu->accepted * 100 / getwork_requested : 0.0
- Utility: accepted/total_secs*60

cgminer's MHash/s seem to wildly differ from other miners I have. The "efficiency" and "utility" are probably better measures of how the miner has performed in the long run than "just" the MHash.

Especially the "Utility", as (together with "accepted") is the only measure of how well the miner performs with regards to submitting the shares upstream.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 06, 2011, 09:31:51 AM
Yes, I'm more than happy to take code from elsewhere. Just be aware the code is still in heavy flux so make sure you pull before making any changes.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 06, 2011, 09:57:41 AM
New windows build:
http://ck.kolivas.org/apps/cgminer-ycros-2011-07-06-1950.zip (http://ck.kolivas.org/apps/cgminer-ycros-2011-07-06-1950.zip)


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 07, 2011, 05:06:33 AM
Updated tree.

I've included mf's changes (thanks) which add the efficiency and utility columns to the output. Since the output got very busy I've abbreviated it to look like the following (new columns are efficiency and utility):

[(5s):186.5  (avg):204.5 Mh/s] [Q:84  A:83  R:9  HW:0  E:99%  U:2.75/m]

I've also added code to put new work into a staging area first where the latest work is examined to see if it belongs to the same block or not. The utility of this is to cope at times when longpoll becomes unreliable, slow or is not supported/working. This minimises the chance of working on stale work under those circumstances and will produce a message like this:

[Accepted] [GPU 0] [192.0 Mh/s] [Q:60  A:50  R:6  HW:0  E:83%  U:2.45/m]                 
[2011-07-07 14:52:01] New block detected, possible missed longpoll, flushing work queue
[Accepted] [GPU 0] [191.8 Mh/s] [Q:64  A:51  R:6  HW:0  E:80%  U:2.35/m]                 


Title: Re: cgminer - CPU and GPU mining software
Post by: kripz on July 07, 2011, 12:46:30 PM
Windows build please.

Quote
[2011-07-06 09:26:27] [188.20 | 188.33 Mhash/s] [1484 Accepted] [21 Rejected] [0 HW errors]
[2011-07-06 09:26:27] [thread 1: 67108864 hashes, 41359356 khash/sec]
[2011-07-06 09:26:27] [thread 0: 50331648 hashes, 31027223 khash/sec]
[2011-07-06 09:26:28] LONGPOLL detected new block
[2011-07-06 09:26:30] getwork thread 1
[2011-07-06 09:26:30] work retrieval failed, exiting gpu mining thread 0
[2011-07-06 09:26:30] [thread 1: 50331648 hashes, 22013848 khash/sec]
[2011-07-06 09:26:30] Failed to tq_push work in workio_get_work
[2011-07-06 09:26:30] Received kill message
[2011-07-06 09:26:30] workio thread dead, exiting.

What happened here?

For some reason it was unable to retrieve any work and that's a fatal error, so it aborted cgminer entirely. I've updated the tree to retry getting work up to the configured amount of times (infinite by default) now.

I have dropped cgminer for now because of this.

It runs for about half a day, then randomly exits,
forcing me to re-start it or run a restart loop around
it. Not worth the hassle. Once I've seen it run stable
for a week or so in the presence of pool shenanigans
(ddos, upgrade downtime, etc), I'll consider running it
again.


He said it was fixed?


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 07, 2011, 01:56:09 PM
Updated windows binary. In sync with source code now.

http://ck.kolivas.org/apps/cgminer-ycros-2011-07-07-2300.zip (http://ck.kolivas.org/apps/cgminer-ycros-2011-07-07-2300.zip)


Title: Re: cgminer - CPU and GPU mining software
Post by: dikidera on July 07, 2011, 09:23:55 PM
With the latest version, it doesnt seem to like pools that much

Quote
[2011-07-08 00:22:18] 0 gpu miner threads started
[2011-07-08 00:22:18] Long-polling activated for http://192.168.233.128:8337/LP
[2011-07-08 00:22:18] 2 cpu miner threads started, using SHA256 '4way' algorithm.
[2011-07-08 00:22:18] JSON decode failed(-1): unable to decode byte 0xc9 at position 592
[2011-07-08 00:22:19] Failed json_rpc_call in get_upstream_work
[2011-07-08 00:22:19] json_rpc_call failed on get work, retry after 5 seconds


Title: Re: cgminer - CPU and GPU mining software
Post by: d3m0n1q_733rz on July 08, 2011, 12:09:16 PM
Question:  Which is more optimum?
Code:
	movdqa	xmm1, [rdx]
pshufd xmm2, xmm1, 0x55
paddd xmm5, xmm2
pshufd xmm6, xmm1, 0xAA
paddd xmm4, xmm6
pshufd xmm11, xmm1, 0xFF
paddd xmm3, xmm11
pshufd xmm1, xmm1, 0
paddd xmm7, xmm1

movdqa xmm1, [rdx+4*4]
pshufd xmm2, xmm1, 0x55
paddd xmm8, xmm2
pshufd xmm6, xmm1, 0xAA
paddd xmm9, xmm6
pshufd xmm11, xmm1, 0xFF
paddd xmm10, xmm11
pshufd xmm1, xmm1, 0
paddd xmm0, xmm1

movdqa [hash+0*16], xmm7
movdqa [hash+1*16], xmm5
movdqa [hash+2*16], xmm4
movdqa [hash+3*16], xmm3
movdqa [hash+4*16], xmm0
movdqa [hash+5*16], xmm8
movdqa [hash+6*16], xmm9
movdqa [hash+7*16], xmm10
or
Code:
	movdqa	xmm1, [rdx]
pshufd xmm2, xmm1, 0x55
pshufd xmm6, xmm1, 0xAA
pshufd xmm11, xmm1, 0xFF
pshufd xmm1, xmm1, 0

paddd xmm5, xmm2
paddd xmm4, xmm6
paddd xmm3, xmm11
paddd xmm7, xmm1

movdqa xmm1, [rdx+4*4]
pshufd xmm2, xmm1, 0x55
pshufd xmm6, xmm1, 0xAA
pshufd xmm11, xmm1, 0xFF
pshufd xmm1, xmm1, 0

paddd xmm8, xmm2
paddd xmm9, xmm6
paddd xmm10, xmm11
paddd xmm0, xmm1

movdqa [hash+0*16], xmm7
movdqa [hash+1*16], xmm5
movdqa [hash+2*16], xmm4
movdqa [hash+3*16], xmm3
movdqa [hash+4*16], xmm0
movdqa [hash+5*16], xmm8
movdqa [hash+6*16], xmm9
movdqa [hash+7*16], xmm10

Oddly enough, I'm seeing higher optimization using the first set of code which is part of my modifications to the sse2_64_atom code.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 09, 2011, 12:35:14 AM
Updated tree:

Implemented never idle logic. During periods of network or server problems it takes existing work and generates more work from that till the server starts responding properly or fast enough. This means that hash rates should -never- drop now with cgminer.

This is it in action:

[Accepted] [GPU 2] [435.0 Mh/s] [Q:111  A:21  R:0  HW:0  E:19%  U:22.20/m]                 
[2011-07-09 10:26:01] Server not providing work fast enough, generating work locally
[Accepted] [GPU 3] [429.4 Mh/s] [Q:135  A:21  R:1  HW:0  E:16%  U:18.13/m]                 
[2011-07-09 10:26:53] Resumed retrieving work from server

If your network is down for extensive periods eventually this will generate more rejected blocks, but for transient blips this makes a massive difference.


Title: Re: cgminer - CPU and GPU mining software
Post by: d3m0n1q_733rz on July 09, 2011, 01:50:53 AM
Question:  Which is more optimum?
Code:
	movdqa	xmm1, [rdx]
pshufd xmm2, xmm1, 0x55
paddd xmm5, xmm2
pshufd xmm6, xmm1, 0xAA
paddd xmm4, xmm6
pshufd xmm11, xmm1, 0xFF
paddd xmm3, xmm11
pshufd xmm1, xmm1, 0
paddd xmm7, xmm1

movdqa xmm1, [rdx+4*4]
pshufd xmm2, xmm1, 0x55
paddd xmm8, xmm2
pshufd xmm6, xmm1, 0xAA
paddd xmm9, xmm6
pshufd xmm11, xmm1, 0xFF
paddd xmm10, xmm11
pshufd xmm1, xmm1, 0
paddd xmm0, xmm1

movdqa [hash+0*16], xmm7
movdqa [hash+1*16], xmm5
movdqa [hash+2*16], xmm4
movdqa [hash+3*16], xmm3
movdqa [hash+4*16], xmm0
movdqa [hash+5*16], xmm8
movdqa [hash+6*16], xmm9
movdqa [hash+7*16], xmm10
or
Code:
	movdqa	xmm1, [rdx]
pshufd xmm2, xmm1, 0x55
pshufd xmm6, xmm1, 0xAA
pshufd xmm11, xmm1, 0xFF
pshufd xmm1, xmm1, 0

paddd xmm5, xmm2
paddd xmm4, xmm6
paddd xmm3, xmm11
paddd xmm7, xmm1

movdqa xmm1, [rdx+4*4]
pshufd xmm2, xmm1, 0x55
pshufd xmm6, xmm1, 0xAA
pshufd xmm11, xmm1, 0xFF
pshufd xmm1, xmm1, 0

paddd xmm8, xmm2
paddd xmm9, xmm6
paddd xmm10, xmm11
paddd xmm0, xmm1

movdqa [hash+0*16], xmm7
movdqa [hash+1*16], xmm5
movdqa [hash+2*16], xmm4
movdqa [hash+3*16], xmm3
movdqa [hash+4*16], xmm0
movdqa [hash+5*16], xmm8
movdqa [hash+6*16], xmm9
movdqa [hash+7*16], xmm10

Oddly enough, I'm seeing higher optimization using the first set of code which is part of my modifications to the sse2_64_atom code.
I've managed to smooth out the beginning hashes by prefetching the initial values so that the beginning hashes don't start slow and make their way up to their max value.  With some adjustments to function placement along with some vertical and horizontal math conversions via SSE3, we've managed to squeeze quite a few more hashes out of this code.  Unfortunately, it's no longer just SSE2_64 but just about all 64-bit processors support SSE3 anyway.  I've sent a copy of the newer optimized code to everyone that's helped me out as a thank you.   ;D

Stay frosty!   8)

Edit:  New portion of the project includes the use of YMM registers.  Anyone feel like playing around with this?


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 09, 2011, 03:05:34 AM
New windows build with latest no-idle logic included.
http://ck.kolivas.org/apps/cgminer-ycros-2011-07-09.zip (http://ck.kolivas.org/apps/cgminer-ycros-2011-07-09.zip)


Title: Re: cgminer - CPU and GPU mining software
Post by: burp on July 09, 2011, 09:31:26 AM
Updated tree:

Implemented never idle logic. During periods of network or server problems it takes existing work and generates more work from that till the server starts responding properly or fast enough. This means that hash rates should -never- drop now with cgminer.

This is it in action:

[Accepted] [GPU 2] [435.0 Mh/s] [Q:111  A:21  R:0  HW:0  E:19%  U:22.20/m]                 
[2011-07-09 10:26:01] Server not providing work fast enough, generating work locally
[Accepted] [GPU 3] [429.4 Mh/s] [Q:135  A:21  R:1  HW:0  E:16%  U:18.13/m]                 
[2011-07-09 10:26:53] Resumed retrieving work from server

If your network is down for extensive periods eventually this will generate more rejected blocks, but for transient blips this makes a massive difference.

Awesome feature :)


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 09, 2011, 04:19:41 PM
Updated source.

I cleaned up the output to make it clear what's going on instead of spitting out the meaningless network errors:

When it can not submit work:
[2011-07-09 17:05:11] Upstream communication failure, caching submissions

and it will continue to mine unhindered (either with fresh work it can retrieve or locally generated work) until:
[2011-07-09 17:05:26] Upstream communication resumed, submitting work         

and then all the work finished in that time will be pushed upstream. If the work is no longer valid because a new block has since appeared, cgminer knows this since it can detect a block change itself, and will not submit a whole lot of rejects and will instead say:

[2011-07-10 01:19:20] Stale work detected, discarding       

This may happen immediately after a longpoll as well, and is harmless, but minimises your reject count.

I've also updated the efficiency and utility values printed to be per-device when reporting on share submissions:

[Accepted] [GPU 1] [411.0 Mh/s] [Q:425  A:410  R:17  HW:0  E:96%  U:5.67/m]                 
[Rejected] [GPU 0] [411.1 Mh/s] [Q:425  A:384  R:24  HW:0  E:90%  U:5.31/m]                 
[Accepted] [GPU 1] [411.1 Mh/s] [Q:426  A:411  R:17  HW:0  E:96%  U:5.68/m]                 
[Accepted] [GPU 0] [410.9 Mh/s] [Q:426  A:385  R:24  HW:0  E:90%  U:5.32/m]                 
[(5s):1696.1  (avg):1643.1 Mh/s] [Q:1704  A:1538  R:81  HW:0  E:90%  U:21.25/m]         

The status line will continue to be a grand total with overall efficiency and utility.


Title: Re: cgminer - CPU and GPU mining software
Post by: Tartarus on July 09, 2011, 05:08:59 PM
With the current tree, under Linux, SDK 2.4, 6950 card, as soon as I hit 100 accepted blocks it stops getting new work.  Any ideas?


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 09, 2011, 09:50:16 PM
With the current tree, under Linux, SDK 2.4, 6950 card, as soon as I hit 100 accepted blocks it stops getting new work.  Any ideas?
That sounds very wrong. Can you do it while running with -D and store the log please? All of my miners are in the thousands of accepted shares.


Title: Re: cgminer - CPU and GPU mining software
Post by: Nobu on July 10, 2011, 12:16:26 AM
If you're getting this fairly often:
Code:
New block detected, possible missed longpoll, flushing work queue
Does that mean you should reduce the scan time? If it's not too often, is it okay to just leave it be?

I'm on slush's pool, which I think doesn't support longpolling, so seeing the message doesn't surprise me.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 10, 2011, 01:22:56 AM
If you're getting this fairly often:
Code:
New block detected, possible missed longpoll, flushing work queue
Does that mean you should reduce the scan time? If it's not too often, is it okay to just leave it be?

I'm on slush's pool, which I think doesn't support longpolling, so seeing the message doesn't surprise me.

That's a harmless message that you need do nothing about. It means the automated new block detection which I implemented for cgminer is detecting the block before longpoll is telling it there's a new block. It also means that longpoll is activated, but auto detection is beating it. If longpoll was disabled it would have just said "New block detected, flushing work queue".


Title: Re: cgminer - CPU and GPU mining software
Post by: kripz on July 10, 2011, 01:59:14 AM
Updated tree:

Implemented never idle logic. During periods of network or server problems it takes existing work and generates more work from that till the server starts responding properly or fast enough. This means that hash rates should -never- drop now with cgminer.

This is it in action:

[Accepted] [GPU 2] [435.0 Mh/s] [Q:111  A:21  R:0  HW:0  E:19%  U:22.20/m]                
[2011-07-09 10:26:01] Server not providing work fast enough, generating work locally
[Accepted] [GPU 3] [429.4 Mh/s] [Q:135  A:21  R:1  HW:0  E:16%  U:18.13/m]                
[2011-07-09 10:26:53] Resumed retrieving work from server

If your network is down for extensive periods eventually this will generate more rejected blocks, but for transient blips this makes a massive difference.

Can you explain this further? So my card just hashes to keep its hash rate up? Why is this needed? I think i'd rater save power than generate rejected blocks.


Title: Re: cgminer - CPU and GPU mining software
Post by: Tartarus on July 10, 2011, 02:17:51 AM
With the current tree, under Linux, SDK 2.4, 6950 card, as soon as I hit 100 accepted blocks it stops getting new work.  Any ideas?
That sounds very wrong. Can you do it while running with -D and store the log please? All of my miners are in the thousands of accepted shares.

OK, I let it go with -D for almost 200 accepted and aside from some odd looking output:
Code:
[2011-07-09 22:58:09] [Rate (5s):35.5  (avg):267.47 Mhash/s] [Requested:196  Accepted:186  Rejected:8  HW errors:2048  Efficiency:95%  Utility:3.66/m]

I didn't see the problem.  But when I ran it again w/o -D, I saw it after 63.  Which got me thinking, when I reported this problem the first time a few days ago I know it was when I had a network hiccup.  So I forced a hiccup (ifdown, sleep 5, ifup), but that didn't do it.  So, I'm not sure what's up.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 10, 2011, 02:31:37 AM
Updated tree:

Implemented never idle logic. During periods of network or server problems it takes existing work and generates more work from that till the server starts responding properly or fast enough. This means that hash rates should -never- drop now with cgminer.

This is it in action:

[Accepted] [GPU 2] [435.0 Mh/s] [Q:111  A:21  R:0  HW:0  E:19%  U:22.20/m]                
[2011-07-09 10:26:01] Server not providing work fast enough, generating work locally
[Accepted] [GPU 3] [429.4 Mh/s] [Q:135  A:21  R:1  HW:0  E:16%  U:18.13/m]                
[2011-07-09 10:26:53] Resumed retrieving work from server

If your network is down for extensive periods eventually this will generate more rejected blocks, but for transient blips this makes a massive difference.

Can you explain this further? So my card just hashes to keep its hash rate up? Why is this needed? I think i'd rater save power than generate rejected blocks.

Until the next block is solved, which happens every ten minutes on average, there is a valid way to take existing work from your pool, modify it and make it new work for your machine. The shares generated from solving that work are actually valid if returned to the server before the next block is solved. Thus it is not just consuming power, it is actually generating valid shares by deriving new work off the work received from the pool.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 10, 2011, 03:02:53 AM
Important updated tree:

I didn't see the problem.  But when I ran it again w/o -D, I saw it after 63.  Which got me thinking, when I reported this problem the first time a few days ago I know it was when I had a network hiccup.  So I forced a hiccup (ifdown, sleep 5, ifup), but that didn't do it.  So, I'm not sure what's up.

Okay that got me thinking and I did some more instrumenting. I seem to have had a logic failure in the queueing of locally generated work, which may have caused this issue! It was also preventing local work generation ever occurring. Please update to the latest tree.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 10, 2011, 03:25:51 AM
No wait, it's still not right. Everyone hang on while I fix it properly...


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 10, 2011, 04:09:54 AM
Updated tree:

Now I've fixed it for real, and incremented the version number and tag to v1.1.1 so people know which is the current good version. Everyone should upgrade.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 10, 2011, 05:09:30 AM
New windows build of version 1.1.1

http://ck.kolivas.org/apps/cgminer-1.1.1-win32.zip (http://ck.kolivas.org/apps/cgminer-1.1.1-win32.zip)


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 10, 2011, 10:16:34 AM
Updated tree:

You can now choose which device(s) to start cgminer on:

--device|-d <arg>   Select device to use, (Use repeat -d for multiple devices, default: all)


Title: Re: cgminer - CPU and GPU mining software
Post by: Tartarus on July 10, 2011, 02:49:20 PM
Updated tree:

Now I've fixed it for real, and incremented the version number and tag to v1.1.1 so people know which is the current good version. Everyone should upgrade.

Still having problems, seeing if they'll happen with -D now.

EDIT: -D and 411 requests, 352 accepts and the only odd thing is I start doing work before I have completed a getwork and these cause "HW" errors:
Code:
[2011-07-10 14:48:14] [thread 1: 134217728 hashes, 73762500 khash/sec]
[2011-07-10 14:48:15] [thread 0: 268435456 hashes, 244103467 khash/sec]
[2011-07-10 14:48:15] [thread 0: 134217728 hashes, 77439887 khash/sec]
[2011-07-10 14:48:15] GPU 0 found something?              
[2011-07-10 14:48:15] [thread 1: 134217728 hashes, 122021441 khash/sec]
[2011-07-10 14:48:15] No best_g found! Error in OpenCL code?

Trying to get the failure again without -D

EDIT2:
That was quick.  Any ideas on how to debug this?
Code:
[(5s):360.4  (avg):367.1 Mh/s] [Q:29  A:26  R:3  HW:3  E:90%  U:4.70/m]         [Accepted] [GPU 0] [369.5 Mh/s] [Q:29  A:28  R:3  HW:3  E:97%  U:5.06/m]                 
[(5s):360.4  (avg):367.1 Mh/s] [Q:29  A:26  R:3  HW:3  E:90%  U:4.70/m]         [(5s):248.1  (avg):363.8 Mh/s] [Q:30  A:28  R:3  HW:3  E:93%  U:4.97/m]         [(5s):124.3  (avg):357.4 Mh/s] [Q:30  A:28  R:3  HW:3  E:93%  U:4.88/m]         ^C5s):0.1  (avg):304.4 Mh/s] [Q:30  A:28  R:3  HW:3  E:93%  U:4.15/m]

EDIT3: Ah-ha!  Finally: http://pastebin.com/vRQFkmRs


Title: Re: cgminer - CPU and GPU mining software
Post by: Nobu on July 10, 2011, 03:14:54 PM
Seems to be alternating between "Long poll received" and "New block detected" messages now; first the poll message, then the other, sometimes with a second or less between the messages. Here's a sample:

Code:
[2011-07-10 08:24:28] LONGPOLL received - new block detected and work flushed already
[2011-07-10 08:24:30] New block detected, possible missed longpoll, flushing work queue
[2011-07-10 08:27:23] LONGPOLL received - new block detected and work flushed already
[2011-07-10 08:27:36] New block detected, possible missed longpoll, flushing work queue
[2011-07-10 08:32:39] LONGPOLL received - new block detected and work flushed already
[2011-07-10 08:32:54] New block detected, possible missed longpoll, flushing work queue
[2011-07-10 08:38:41] LONGPOLL received - new block detected and work flushed already
[2011-07-10 08:39:16] New block detected, possible missed longpoll, flushing work queue
[2011-07-10 08:47:03] LONGPOLL received - new block detected and work flushed already
[2011-07-10 08:47:04] New block detected, possible missed longpoll, flushing work queue
[2011-07-10 08:56:18] LONGPOLL received - new block detected and work flushed already
[2011-07-10 08:56:19] New block detected, possible missed longpoll, flushing work queue
[Accepted] [CPU 0] [0.9 Mh/s] [Q:530  A:4  R:3  HW:0  E:1%  U:0.01/m]
[2011-07-10 09:36:24] LONGPOLL received - new block detected and work flushed already
[2011-07-10 09:36:51] New block detected, possible missed longpoll, flushing work queue
[2011-07-10 09:50:50] LONGPOLL received - new block detected and work flushed already
[2011-07-10 10:10:05] New block detected, possible missed longpoll, flushing work queue

I'm on commit 4bb13bda68fca91a8f96ec3c17cf6f99ecf70342

Edit: before 6:46 I was only getting this message: "LONGPOLL detected new block, flushing work queue", now I'm not getting it at all.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 11, 2011, 04:14:46 AM
Updated tree: Much improved interface using ncurses. It now looks like this:

cgminer version 1.2.0
--------------------------------------------------------------------------------
Totals: [(5s):166.9  (avg):194.3 Mh/s] [Q:43  A:14  R:0  HW:2  E:33%  U:2.53/m]
--------------------------------------------------------------------------------
GPU 0: [183.5 Mh/s] [Q:15  A:14  R:0  HW:2  E:93%  U:2.57/m]
CPU 0: [3.2 Mh/s] [Q:1  A:0  R:0  HW:0  E:0%  U:0.00/m]
CPU 1: [3.2 Mh/s] [Q:1  A:0  R:0  HW:0  E:0%  U:0.00/m]
CPU 2: [3.2 Mh/s] [Q:1  A:0  R:0  HW:0  E:0%  U:0.00/m]
CPU 3: [3.2 Mh/s] [Q:5  A:0  R:0  HW:0  E:0%  U:0.00/m]
--------------------------------------------------------------------------------
[2011-07-11 13:35:41] Share accepted from GPU 0
[2011-07-11 13:36:00] Share accepted from GPU 0
[2011-07-11 13:36:37] Share accepted from GPU 0
[2011-07-11 13:36:57] Share accepted from GPU 0
[2011-07-11 13:37:06] Server not providing work fast enough, generating work locally
[2011-07-11 13:37:07] Resumed retrieving work from server
[2011-07-11 13:37:23] LONGPOLL detected new block, flushing work queue
[2011-07-11 13:37:41] Share accepted from GPU 0
[2011-07-11 13:37:43] LONGPOLL detected new block, flushing work queue
[2011-07-11 13:38:10] Share accepted from GPU 0
[2011-07-11 13:39:08] Share accepted from GPU 0

The text at the top stays there while the log messages below scroll. It now needs libcurses-dev to build. pdcurses on windows should achieve the same thing, and the windows version is currently being worked on.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 11, 2011, 04:28:15 AM
@Tartarus: I can't really see anything obvious in that debug output. I'll have to code in some way of dumping all sorts of information when you tell it to, and hopefully I can figure it out from there.

@Nobu: Ddetecting new blocks faster than the server is sending out longpolls almost every single time is fine. However I'm not sure that's exactly what's going on in your case. I'll review the code further.


Title: Re: cgminer - CPU and GPU mining software
Post by: iopq on July 11, 2011, 08:02:48 AM
this is the same speed as poclbm for me, around 141Mhash/s
but every time a share is accepted, it overestimates the average even though every 5 seconds it's obvious the average is say 141.3Mhash/s when a share is accepted it will say something like 143.2Mhash/s which is probably not true


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 11, 2011, 08:07:58 AM
this is the same speed as poclbm for me, around 141Mhash/s
but every time a share is accepted, it overestimates the average even though every 5 seconds it's obvious the average is say 141.3Mhash/s when a share is accepted it will say something like 143.2Mhash/s which is probably not true
The 5 second average is quite a coarse measure and not meant to have great weight placed on it. I update it infrequently in order to minimise the overhead as much as possible and depending on when on the time boundary you land on it, it can be higher or lower than the real figure. The overall average is the only reliable number. As for overall speed, most mining software should give pretty much the same performance when running flat out since they all use the same opencl kernels. The difference between them is how they manage the rest (like intermittent network connectivity, ddosed servers, maximising accepted shares, minimising cpu and ram overhead and so on...).


Title: Re: cgminer - CPU and GPU mining software
Post by: rb2k on July 11, 2011, 08:26:58 AM
first of all: wow, I think it's awesome to see ckolivas here! Loved your BFS work :)

Just a short question about the statistics:
Code:
GPU 0: [360.6 Mh/s] [Q:22  A:23  R:0  HW:3841  E:105%  U:5.28/m]

What are the HW and E parameters?


Title: Re: cgminer - CPU and GPU mining software
Post by: kripz on July 11, 2011, 09:20:24 AM
ncurses is sexy when it works... with debug, intensity 8 and 2 cards at about 600mhash i get corruption all over the screen via ssh. Lines dissapear, reappear, all weird stuff.

Also,

With my 5770 ~180mhash/s i get 100% efficiency, this is for like 3000 shares. With 2 5850 at about 600mhash/s i get like 80% over about 2000 shares. Is there a reason for this?

Even with a short test i get the same result every time.

Code:
cgminer version 1.2.0
--------------------------------------------------------------------------------
Totals: [(5s):188.4  (avg):185.8 Mh/s] [Q:10  A:8  R:0  HW:1  E:80%  U:2.47/m]

GPU 0: [186.7 Mh/s] [Q:10  A:8  R:0  HW:1  E:100%  U:2.87/m]

With my 6970 i get

q: 44 a:36 r:2 e: 82%

The higher the hash rate the lower the efficiency.

I'm adding a third card to my 5850 machine so i expect the eff to be even lower, ill post back with results. Could just be confirmation bias or something (prob heat >:().

EDIT:

5850 machine crashed, this is all i could get.

Code:
7-111-07-11 18:57:26] Failed json_rpc_call in get_upstream_work
[201 [18:250171:-072-6] 1j1 1s8:o57n:_rp2c6] _jcaslon_lrpc _caflalil ed foailend o ns suubbmimt_iwortk_, wroetrryk,  aftreetrry 1  safteeconrd s1 [ecKonds2011-07-11 18:57:29] submit_upstream_work json_rpc_call failed
20111-07-11 18:57:29] submit_upstream_work json_rpc_call failed
[201-07-[11 2108:517:216-07]- js1o1 1n8:5_7:2r6pc_]c jsaolnl_ faripc_lced aon lsublm faiit_wlorke,d  oretnr syu afbtmite_r 1w orks,eco nretdrsy aftr 1[ seKconds7-11 18:57:29] json_rpc_call failed on submit_work, retry after 1 seconds
7-111-07-11 18:57:29] Failed json_rpc_call in get_upstream_work
[201 1[8201:15-70:7-216]1  Fai1l8:5e7d j:s26]o nFa_irpcl_ecadll  in jgsone_t_urppc_sctreaall min_ worgket_uptr[eKam_work
7-111-07-11 18:57:31] [Rate (5s):0.0  (avg):485.16 Mhash/s] [Requested:229  Accepted:185  Rejected:13  HW errors:0  Efficiency:81%  Utility:5.89/m]
 --1 1[82:570:11-206] 7j-1s1on_ r18:p5c_c7a:26l]l f ajsoinled_ rpocn ge_t cwaoll rfk, arileedt onr yget  aftweorrk , 1r seetconrdys aftr [1 Kseconds
07-11-
   1[1201 1-017-811: 518:757::292]9]  subsmubmiit_utps_tuprseamt_reawmork_ jswoorkn _jsropn_rcpc__ccaalll lf ailfeailded

[2[02110-071-1-101 178-:5171 1:829]: 57:s2ubm9i] stu_upbsmitt_reaumpst_rworekam_ wjsoonrk _jsorn_rppc_ccal_l fcaalli ledfail[Kd
[
 2011-07-1[Segmentation fault

dmesg
Code:
[   23.564791] eth0: no IPv6 routers present
[29222.255373] cgminer[18711]: segfault at 1a4 ip b77a6ad6 sp a9d15050 error 4 in libncurses.so.5.9[b778a000+36000]

Time to add third card while it's down :D


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 11, 2011, 10:03:03 AM
Wow kripz you got all the luck.

I guess I never really tested debug output very well. All in good time :P

As for the efficiency, I did notice a slight trend towards lower efficiency with more Mhash but I have one machine with a 5770 (~200MH) and another machine with 4x6970 (~1700MH) and they're both running to within 3% of the same efficiency after 10,000 shares on the big box. I've considered a number of reasons for why the shares may be lower in your case, but nothing really seems convincing. I wonder if bitcoind actually hands out the same work and you might well be doing overlapping work between the multiple cards. I've found that even if the efficiency drops off, the total accepted is higher and that's what ultimately matters? Check what your pool is reporting since they report back the hash rate according to how many accepted shares you return (but you'll need to get a few samples from the pool since they average over too small a period and it will fluctuate a lot).

As for your crash, I found a small bug that I pushed a couple of changes to fix, and hopefully it's one and the same thing.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 11, 2011, 10:05:26 AM
first of all: wow, I think it's awesome to see ckolivas here! Loved your BFS work :)

Just a short question about the statistics:
Code:
GPU 0: [360.6 Mh/s] [Q:22  A:23  R:0  HW:3841  E:105%  U:5.28/m]

What are the HW and E parameters?

Thanks ;)

It's in the readme. HW is hardware errors and E is efficiency. There is an issue where cgminer can have a run of apparent HW errors when you first start it, and it's harmless. I'm looking into that. If the hardware errors continue to rise after that, though, be concerned about your hardware.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 11, 2011, 10:16:28 AM
Oh and kripz, hardware overheating/failing will not cause low "efficiency", but hardware errors... Low efficiency is when you queue much more work than you return generally (like CPU mining does). You can have that effect if you decrease the scantime or increase the gpu threads per card (not the overall number of gpus, but the number of threads per card).


Title: Re: cgminer - CPU and GPU mining software
Post by: dikidera on July 11, 2011, 10:54:30 AM
....and compatibility for windows is comletely broken....i think rollback...for you ckolivas.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 11, 2011, 10:57:45 AM
....and compatibility for windows is comletely broken....i think rollback...for you ckolivas.

Dunno what you're talking about
Windows build:
http://ck.kolivas.org/apps/cgminer-1.2.0.1-win32.zip (http://ck.kolivas.org/apps/cgminer-1.2.0.1-win32.zip)


Title: Re: cgminer - CPU and GPU mining software
Post by: dikidera on July 11, 2011, 11:13:31 AM
Ok, a suggestion for the CPU miner thread. Instead of new work for each thread, every thread should work on the same work. I.e, the nonces to be tried are split by the number of threads.
So thread 1 does X nonces, thread 2 does XX nonces and so on and so forth.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 11, 2011, 11:15:57 AM
Ok, a suggestion for the CPU miner thread. Instead of new work for each thread, every thread should work on the same work. I.e, the nonces to be tried are split by the number of threads.
So thread 1 does X nonces, thread 2 does XX nonces and so on and so forth.
Very interesting idea considering how inefficient cpu mining is. I'll consider it after sorting out all the new bugs from the new interface.


Title: Re: cgminer - CPU and GPU mining software
Post by: Nobu on July 11, 2011, 02:40:17 PM
Techwtf mentioned longpolling was slow in the pool's thread; I guess that could have been part of the problem.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 11, 2011, 02:43:14 PM
Updated tree:

Fixed lots of little bugs here and there in the curses code, some of which would lead to screen corruption and some of which would lead to crashes.


Title: Re: cgminer - CPU and GPU mining software
Post by: dikidera on July 11, 2011, 05:38:31 PM
Dunno if it's a bug or not, but:
In sha256 4way.c you declare the doubleblock sha function's prototype like this
Quote
static void DoubleBlockSHA256(const void* pin, void* pout, const void* pinit, unsigned int hash[8][NPAR], const void* init2);

However when you declare the function it's
Quote
static void DoubleBlockSHA256(const void* pin, void* pad, const void *pre, unsigned int thash[9][NPAR], const void *init)


Title: Re: cgminer - CPU and GPU mining software
Post by: kr105 on July 12, 2011, 04:13:31 AM
I have a fresh setup of Ubuntu 11.04 and tried to compile this miner, it failed on the last step saying something about syntax error on main.c.

Short history:
change:
Code:
config = json_load_file(arg, &err);

to
Code:
config = json_load_file(arg, 0, &err);

on main.c

Long history:
LibJansson changed it API structure on the new 2.1 version, it added a flag parameter on the json_load_file function and that is why the compiler cry when i try to compile this.
My suggested patch just set that flag to 0, and problem solved.

This also will need a change on the ./configure to make it compatible with 2.1 and pre-2.1 versions.


Title: Re: cgminer - CPU and GPU mining software
Post by: c00w on July 12, 2011, 06:13:20 AM
Hello,

It appears that you use post instead of get when doing Long Polling. That is contradictory to the unofficial spec and really annoying when trying to debug software LP failures.

See https://deepbit.net/longpolling.php

-C00w


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 12, 2011, 06:38:00 AM
Hello,

It appears that you use post instead of get when doing Long Polling. That is contradictory to the unofficial spec and really annoying when trying to debug software LP failures.

See https://deepbit.net/longpolling.php

-C00w

That's good to know, thanks. I didn't implement any of the original communications parts that cgminer grew out of, so I had no idea. I'll look into correcting that.


Title: Re: cgminer - CPU and GPU mining software
Post by: kripz on July 12, 2011, 06:53:49 AM
Debug results in this:

http://img695.imageshack.us/img695/5954/unled1zg.th.gif (http://imageshack.us/photo/my-images/695/unled1zg.gif/)

Uploaded with ImageShack.us (http://imageshack.us)

EDIT: Fixed with latest commit 76b233a.


Title: Re: cgminer - CPU and GPU mining software
Post by: kripz on July 12, 2011, 07:17:07 AM
Quote
14310 user  20   0  248m  96m  29m S   17  9.7   0:14.11 ./cgminer -O miner:miner -o http://192.168.1.10:81 -R 1 -D

14398 user  20   0  254m  97m  29m S   17  9.8   0:15.46 ./cgminer -O miner:miner -o http://192.168.1.10:81 -R 1 --verbose

14488 user  20   0  245m  96m  29m S   17  9.7   0:05.97 ./cgminer -O miner:miner -o http://192.168.1.10:81 -R 1 -q

14546 user  20   0  249m  97m  29m S   17  9.8   0:12.93 ./cgminer -O miner:miner -o http://192.168.1.10:81 -R 1

Verbosity has no impact on CPU usage and is IMO, quite high.

CPU: G620 (http://ark.intel.com/Product.aspx?id=53480)

My AMD x4 640 has <1% usage.

Quote
620e   
2.6 GHz   
45nm SOI   
2MB    
socket AM3   
45W


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 12, 2011, 07:20:55 AM
Would you like a no-curses version as an option? It's using hardly any CPU here but clearly it will use more CPU with curses than a basic printf.


Title: Re: cgminer - CPU and GPU mining software
Post by: kripz on July 12, 2011, 07:22:10 AM
That would be nice and probably save some watts.

Though shouldnt -q do that? It doesnt update anything on the screen at all..


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 12, 2011, 07:31:34 AM
That would be nice and probably save some watts.

Though shouldnt -q do that? It doesnt update anything on the screen at all..

Good point.

Updated tree: Fixed the debug output by using locking around any screen updates. Made quiet mode not enable curses at all. Changed longpoll calls to not use POST.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 12, 2011, 01:44:53 PM
Updated tree and first "Release" version.

Source:
http://ck.kolivas.org/apps/cgminer-1.2.3.tar.bz2 (http://ck.kolivas.org/apps/cgminer-1.2.3.tar.bz2)

Windows binary:
http://ck.kolivas.org/apps/cgminer-1.2.3-win32.zip (http://ck.kolivas.org/apps/cgminer-1.2.3-win32.zip)

Major change is a new improved phatk kernel based on
http://forum.bitcoin.org/index.php?topic=25860.0

It's worth a tiny improvement in throughput, but as I understand it if you underclock your memory a lot (for heat reasons) you not see much improvement. It varies from card to card but don't expect magic increases in Mhash.

Other changes include finally supporting make install and make distdir should work from the git tree. Two other potential crashing bugs were also fixed.

Thanks to those who have donated :)


Title: Re: cgminer - CPU and GPU mining software
Post by: RobertRibbeck on July 12, 2011, 03:55:38 PM

Would be nice if the windows version actually worked
It wont even connect to slushes pool

error can't rewind ... say what !


Updated tree and first "Release" version.

Source:
http://ck.kolivas.org/apps/cgminer-1.2.3.tar.bz2 (http://ck.kolivas.org/apps/cgminer-1.2.3.tar.bz2)

Windows binary:
http://ck.kolivas.org/apps/cgminer-1.2.3-win32.zip (http://ck.kolivas.org/apps/cgminer-1.2.3-win32.zip)

Major change is a new improved phatk kernel based on
http://forum.bitcoin.org/index.php?topic=25860.0

It's worth a tiny improvement in throughput, but as I understand it if you underclock your memory a lot (for heat reasons) you not see much improvement. It varies from card to card but don't expect magic increases in Mhash.

Other changes include finally supporting make install and make distdir should work from the git tree. Two other potential crashing bugs were also fixed.

Thanks to those who have donated :)


Title: Re: cgminer - CPU and GPU mining software
Post by: twmz on July 12, 2011, 04:39:30 PM
Does cgminer support X-Roll-NTime?  Since my efficiency was below 100%, I'm guessing not.


Title: Re: cgminer - CPU and GPU mining software
Post by: Diapolo on July 12, 2011, 05:53:16 PM
Updated tree and first "Release" version.

Source:
http://ck.kolivas.org/apps/cgminer-1.2.3.tar.bz2 (http://ck.kolivas.org/apps/cgminer-1.2.3.tar.bz2)

Windows binary:
http://ck.kolivas.org/apps/cgminer-1.2.3-win32.zip (http://ck.kolivas.org/apps/cgminer-1.2.3-win32.zip)

Major change is a new improved phatk kernel based on
http://forum.bitcoin.org/index.php?topic=25860.0

It's worth a tiny improvement in throughput, but as I understand it if you underclock your memory a lot (for heat reasons) you not see much improvement. It varies from card to card but don't expect magic increases in Mhash.

Other changes include finally supporting make install and make distdir should work from the git tree. Two other potential crashing bugs were also fixed.

Thanks to those who have donated :)

Cool, thanks for using my modified kernel as the basic kernel for your miner :). Remember guys, if you like it donate a few Bitcents :D.

Dia


Title: Re: cgminer - CPU and GPU mining software
Post by: gmaxwell on July 12, 2011, 08:19:19 PM

Wow. Cgminer has been coming along nicely!

Any plans for pool load balancing / redundancy?   Diablominer has load balancing, poclbm has failover. Both are nice for different reasons.

Load balancing is good because mining against multiple pools concurrently lowers your variance, reduces the concentration of hashing power to large pools, better tolerance to TCP head of line blocking (e.g. when a connection loses some packets and ends up stalled for a long time), and loses less time during a failure (because you already have current work for multiple pools).  The additional pool load is justified by the fact that the miner is pooling multiple cards (where older cards were one card one connection), and efficiency enhancements like ntime rolling.

Failover is good because all options are not always equal:  I might strictly prefer to mine for a medium sized cheating resistant pool, assuming its up and working correctly, and failing that mine for some large proportional pool,  and failing that mine solo, because solo is better than sitting idle or generating many minute stale work which is likely to be rejected by any current pool even if it isn't for an already orphaned block.

The obvious way to configure for both of these would bet to have lists of lists of RPC URLs:

{
  {"http://pool1/","http://pool2", ...},
  { "http://localhost..."}
}

and some timeout setting to consider a group failed when there hasn't been an updated prev or merkle root in N seconds or if all the TCP connections are closed, beyond with it fails to the next group.







Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 12, 2011, 09:47:42 PM
Does cgminer support X-Roll-NTime?  Since my efficiency was below 100%, I'm guessing not.

Yes it does, but it only needs to resort to using it when network connectivity is down. Since cgminer preemptively asynchronously gathers work before its needed it copes with poor network connectivity very well so it doesn't often need to even use it. Also note that super high efficiency benefits the pool server by decreasing the number of getworks it asks for, but it does not benefit the person mining if they are already at 100% utilisation since you get paid according to how much work you do. Since cgminer basically uses rolltime only when it *might* have dropped utilisation, but it keeps utilisation high at all times, there is no advantage to using it more. You can tell when cgminer has started doing it with this message:

Server not providing work fast enough, generating work locally

and when it stops doing it the message follows:

Resumed retrieving work from server


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 12, 2011, 09:50:47 PM

Wow. Cgminer has been coming along nicely!

Any plans for pool load balancing / redundancy?   Diablominer has load balancing, poclbm has failover. Both are nice for different reasons.


As far as I can see, Diablominer supports two pools at once, not really load balancing. If you run two instances of cgminer, one connecting to each pool, you get exactly the same effect so I see no advantage of doing this in the one process? Failover I have certainly considered adding.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 12, 2011, 10:20:20 PM

Would be nice if the windows version actually worked
It wont even connect to slushes pool

error can't rewind ... say what !


I registered with slush just to try it and it works fine for me?

cgminer doesn't give meaningful enough errors or fail if you give the wrong login credentials and I need to do something about that. Perhaps that was the issue here?


Title: Re: cgminer - CPU and GPU mining software
Post by: twmz on July 13, 2011, 12:08:54 AM
Does cgminer support X-Roll-NTime?  Since my efficiency was below 100%, I'm guessing not.

Yes it does, but it only needs to resort to using it when network connectivity is down. Since cgminer preemptively asynchronously gathers work before its needed it copes with poor network connectivity very well so it doesn't often need to even use it. Also note that super high efficiency benefits the pool server by decreasing the number of getworks it asks for, but it does not benefit the person mining if they are already at 100% utilisation since you get paid according to how much work you do. Since cgminer basically uses rolltime only when it *might* have dropped utilisation, but it keeps utilisation high at all times, there is no advantage to using it more. You can tell when cgminer has started doing it with this message:

Server not providing work fast enough, generating work locally

and when it stops doing it the message follows:

Resumed retrieving work from server


I care about my efficiency because I want to be a good pool citizen.   Doing getworks only once a minute reduces load on the pool.  Less load on the pool means higher pool reliability and more scalability with less hardware (which may translate to lower fees).  I can think of no reason to waste CPU and bandwidth with getwork requests every 5-10 seconds instead of once a minute for pools that support it.  There is benefit to the pool and no downside to the miner.


Title: Re: cgminer - CPU and GPU mining software
Post by: twmz on July 13, 2011, 12:12:28 AM
Another question for you.  Does cgminer adapt to changing pool behavior on the fly?  For example, a long poll URL changing to a new URL.  Or X-Roll-NTime support appearing and disappearing from getwork to getwork.  In other words, does cgminer work well when pointed at a proxy where any given getwork request may be handled by one of several real pools with different capabilities.

I had some problems with DiabloMiner with that and so I currently stick with a bunch of individually started poclbm miners, but I am very interested in the idea of one miner per rig instead of multiple miners per GPU.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 13, 2011, 12:33:17 AM
I care about my efficiency because I want to be a good pool citizen.   Doing getworks only once a minute reduces load on the pool.  Less load on the pool means higher pool reliability and more scalability with less hardware (which may translate to lower fees).  I can think of no reason to waste CPU and bandwidth with getwork requests every 5-10 seconds instead of once a minute for pools that support it.  There is benefit to the pool and no downside to the miner.

I never said cgminer was a low efficiency miner! It usually is >90% even without rolling the time. It asks for work whenever it needs work, and that depends on how fast your GPU is as to how often it requests more work. I could certainly make it roll time by default at intermittent work intervals, but -not all pools support it- so that will bring unexpected results with rejected shares rising even though the efficiency rises.


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 13, 2011, 12:35:28 AM
Another question for you.  Does cgminer adapt to changing pool behavior on the fly?  For example, a long poll URL changing to a new URL.  Or X-Roll-NTime support appearing and disappearing from getwork to getwork.  In other words, does cgminer work well when pointed at a proxy where any given getwork request may be handled by one of several real pools with different capabilities.

I had some problems with DiabloMiner with that and so I currently stick with a bunch of individually started poclbm miners, but I am very interested in the idea of one miner per rig instead of multiple miners per GPU.
I'm really not sure how it would cope with that. I doubt it will handle it gracefully.


Title: Re: cgminer - CPU and GPU mining software
Post by: twmz on July 13, 2011, 12:43:17 AM
I never said cgminer was a low efficiency miner! It usually is >90% even without rolling the time. It asks for work whenever it needs work, and that depends on how fast your GPU is as to how often it requests more work. I could certainly make it roll time by default at intermittent work intervals, but -not all pools support it- so that will bring unexpected results with rejected shares rising even though the efficiency rises.

Ya, certainly doesn't make sense to do it by default.  But if a pool (Eligius, for example, which also has a very high CPU cost to return a getwork response) announces to the miner that it supports it via the X-Roll-NTime: Y http header in the response to the getwork, you could increment the ntime when you exhausted all possible nonces instead of switching to another getwork.


Title: Re: cgminer - CPU and GPU mining software
Post by: twmz on July 13, 2011, 12:48:33 AM
I'm really not sure how it would cope with that. I doubt it will handle it gracefully.

Bummer.  I'll stick with poclbm for now.  It appears to handle it by toggling RollNTime support on and off based on the response to every getwork.  And it uses the most recently indicated LP URL each time a LP request is started instead of caching the URL once at startup and using it over and over.  I don't think it does anything to abort an in progress LP and start a new one when a more recent getwork http header indicates that it should be different, but it could do that as well, I guess.

Anyway, cgminer looks well done and I'm sure I'll keep playing with it on and off just because it is cool.  Thanks for making it!


Title: Re: cgminer - CPU and GPU mining software
Post by: -ck on July 13, 2011, 02:26:00 AM
Updated source tree and new source version:
http://ck.kolivas.org/apps/cgminer-1.2.4.tar.bz2 (http://ck.kolivas.org/apps/cgminer-1.2.4.tar.bz2)

Changes in this version:
I've updated the jansson library to be in line with the current version (make sure to do ./autogen.sh again if you're building from git)
Fixed a bug where pools that return empty body http requests (such as bitcoinpool.com on longpoll requests) would crash.
Updated the display to make sure all the threads' progress is updated regularly.
Made the default display on the status line wider to not cut off last characters on high hash counts.

and most importantly:

Implemented a watchdog thread that keeps an eye on all the worker threads. If they are idle for more than a minute it restarts them completely. Hopefully this should address the GPU going idle issue since it re-initialises the card. I suspect that since both threads on the same GPU go idle at the same time that it's actually within the opencl code that there is an issue and I hope that it will respond to re-init.


Title: Re: cgminer - CPU/GPU miner in C for linux/windows
Post by: -ck on July 13, 2011, 03:04:42 AM
Generated a new thread making it the official CGMINER thread since it is the primary development now (and not cpuminer) and long since has become a project in its own right.

http://forum.bitcoin.org/index.php?topic=28402.0 (http://forum.bitcoin.org/index.php?topic=28402.0)