Bitcoin Forum

Bitcoin => Mining software (miners) => Topic started by: jgarzik on November 25, 2010, 12:45:23 AM



Title: New demonstration CPU miner available
Post by: jgarzik on November 25, 2010, 12:45:23 AM
A new CPU miner is now available, making use of the new 'getwork' RPC command.

In the beginning, this is intended largely to demonstrate a 'getwork' miner.  It is written in straight C, with minimal dependencies (libcurl, jansson).

It has successfully generated blocks on testnet, mainnet and almost all pools.

Linux/BSD release tarball: http://yyz.us/bitcoin/cpuminer-1.0.2.tar.gz
Windows installer: http://yyz.us/bitcoin/cpuminer-installer-1.0.2.zip
git repository: git://github.com/jgarzik/cpuminer.git

Contributions welcomed!  (GPL v2 license)

UPDATE:  This has largely been superceded by Con Kolivas's cgminer fork (http://forum.bitcoin.org/index.php?topic=28402.0).  See cgminer's official forum thread (http://forum.bitcoin.org/index.php?topic=28402.0) for updates and details.



Title: Re: New demonstration CPU miner available
Post by: slush on November 25, 2010, 02:14:17 AM
In the beginning, this is intended largely to demonstrate a 'getwork' miner.  It is written in straight C, with minimal dependencies (libcurl, libcrypto, jansson).

Cool, I like simplicity of your code. I want to try similar implementation in javascript. Partially because of curiosity and partialy because (inspired by hashcash) it can generate few hashes by fighting comments spam :-).

I just made few tests. In four javascript threads I get ~4khash/s, which is EXTREMELY slow. Probably because javascript is interpreted and without any JIT yet. Would be great if javascript supports GPU. Flash will support GPU soon, so we will see ;).


Title: Re: New demonstration CPU miner available
Post by: sturle on November 25, 2010, 01:28:45 PM
In the beginning, this is intended largely to demonstrate a 'getwork' miner.  It is written in straight C, with minimal dependencies (libcurl, libcrypto, jansson).
Cool, I like simplicity of your code. I want to try similar implementation in javascript. Partially because of curiosity and partialy because (inspired by hashcash) it can generate few hashes by fighting comments spam :-).

I just made few tests. In four javascript threads I get ~4khash/s, which is EXTREMELY slow. Probably because javascript is interpreted and without any JIT yet. Would be great if javascript supports GPU. Flash will support GPU soon, so we will see ;).
Is your JavaScript code available?

I wish the getwork RPC command could be allowed for non-authenticated users from other hosts.  It isn't revealing any secret information, is it?


Title: Re: New demonstration CPU miner available
Post by: wumpus on November 25, 2010, 01:34:05 PM
Nice idea on the independent C miner.

On the JS one: Oh no, soon all kinds of websites will be sneakily generating bitcons on the background while you browse them, hogging your CPU even more :P


Title: Re: New demonstration CPU miner available
Post by: slush on November 25, 2010, 02:53:20 PM
Is your JavaScript code available?

I wish the getwork RPC command could be allowed for non-authenticated users from other hosts.  It isn't revealing any secret information, is it?

Will be available if I finish that. It is just for curiosity because it will be slow as hell. Also network overhead will be significant.

I expect simple PHP proxy will do good work for hiding credentials to client. something like yourdomain.com/getwork.php which call rpc to localhost and return json encoded data.


Title: Re: New demonstration CPU miner available
Post by: wumpus on November 25, 2010, 02:59:26 PM
Will be available if I finish that. It is just for curiosity because it will be slow as hell. Also network overhead will be significant.
I believe that IE has cryptographic extensions that you can use from javascript. Maybe that will speed it up?


Title: Re: New demonstration CPU miner available
Post by: slush on November 25, 2010, 04:47:30 PM
I believe that IE has cryptographic extensions that you can use from javascript. Maybe that will speed it up?


 Do you have any link or reference? I found only 3rd party ActiveX component here http://www.chilkatsoft.com/js-sha512-hash.asp (http://www.chilkatsoft.com/js-sha512-hash.asp).


Title: Re: New demonstration CPU miner available
Post by: bugmenot on November 26, 2010, 12:08:00 PM
Nice work.

But :
Quote
DBG: found zeroes in hash:
6c1e0d9af9b06eab5aae7fbe058760708c1c7869870142b91b9c0ae300000000
PROOF OF WORK FOUND?  submitting...
PROOF OF WORK RESULT: false (booooo)
[...]
DBG: found zeroes in hash:
c155613cbd70edad88bf56b06cbd788329a2a741b27ee78f25abdb2e00000000
PROOF OF WORK FOUND?  submitting...
PROOF OF WORK RESULT: false (booooo)

I don't know if this is a bug or not.
The miner has been compiled with cygwin, I don't know if it matters.


Title: Re: New demonstration CPU miner available
Post by: teknohog on November 26, 2010, 01:41:39 PM
Should I use a particular version of jansson? I installed it from git, and get the following compile error:

Code:
util.c: In function ‘json_rpc_call’:
util.c:133:2: warning: passing argument 2 of ‘json_loads’ makes integer from pointer without a cast
/usr/local/include/jansson.h:188:9: note: expected ‘size_t’ but argument is of type ‘struct json_error_t *’
util.c:133:2: error: too few arguments to function ‘json_loads’
/usr/local/include/jansson.h:188:9: note: declared here


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 26, 2010, 06:10:29 PM
Nice work.

But :
Quote
DBG: found zeroes in hash:
6c1e0d9af9b06eab5aae7fbe058760708c1c7869870142b91b9c0ae300000000
PROOF OF WORK FOUND?  submitting...
PROOF OF WORK RESULT: false (booooo)
[...]
DBG: found zeroes in hash:
c155613cbd70edad88bf56b06cbd788329a2a741b27ee78f25abdb2e00000000
PROOF OF WORK FOUND?  submitting...
PROOF OF WORK RESULT: false (booooo)

I don't know if this is a bug or not.
The miner has been compiled with cygwin, I don't know if it matters.

Not a bug.  The miner finds a hash with "several" zeroes in it, but then relies on bitcoin to do the full 256-bit hash < target value comparison.  It's normal that some hashes will be found by the CPU miner, then rejected by bitcoin.  We call those almost-solutions :)


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 26, 2010, 07:47:02 PM
FWIW, the default bitcoin miner also does this -- it just doesn't print out when it "finds some zeroes", only when a real proof of work is found.

Thus, my CPU miner always shows when it stops working on a solution, and starts working on a new solution.  Just giving you a bit more information on the whole process.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 26, 2010, 09:32:51 PM
Attached is a Windows executable build with mingw32.  I'd be interested to know if it works.

run "minerd.exe --help" or "minerd.exe -h" to show command line options.

minerd.exe SHA-1 sum: 722fa3b956de3ed3438ed3294fe191f0d55c1514
minerd.exe MD5 sum: 9f75f8da7a5d02da1d45d46d4a032489


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 26, 2010, 09:45:54 PM
Should I use a particular version of jansson? I installed it from git, and get the following compile error:

Code:
util.c: In function ‘json_rpc_call’:
util.c:133:2: warning: passing argument 2 of ‘json_loads’ makes integer from pointer without a cast
/usr/local/include/jansson.h:188:9: note: expected ‘size_t’ but argument is of type ‘struct json_error_t *’
util.c:133:2: error: too few arguments to function ‘json_loads’
/usr/local/include/jansson.h:188:9: note: declared here

It's been tested with jansson 1.2 and 1.3 release versions.

EDIT:  If you lack jansson, current cpuminer.git will build an in-tree version.  Thus, you may opt to fix the problem by... removing jansson from your system.


Title: Re: New demonstration CPU miner available
Post by: satoshi on November 26, 2010, 10:02:41 PM
You should try it with tcatm's 4-way SSE2 SHA in sha256.cpp.  It compiles fine as a C file, just rename sha256.cpp to sha256.c.  I was able to get it to work in simple tests on Windows, but not when linked in with Bitcoin.  It may have a better chance of working as part of a C program instead of C++.

Currently it's only enabled in the Linux build, so if you get it to work you could make it available to Windows users.  It's about 100% speedup on AMD CPUs.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 26, 2010, 11:03:51 PM
You should try it with tcatm's 4-way SSE2 SHA in sha256.cpp.  It compiles fine as a C file, just rename sha256.cpp to sha256.c.  I was able to get it to work in simple tests on Windows, but not when linked in with Bitcoin.  It may have a better chance of working as part of a C program instead of C++.

I'll take a look.  VIA Padlock support may also be similarly easy to integrate.


Title: Re: New demonstration CPU miner available
Post by: BitLex on November 26, 2010, 11:27:55 PM
Quote
I'd be interested to see how well this works on Vista, XP, 7, ...
complaining about "libcurl-4.dll missing" (although it's there at c:\CPU-miner\usr\i686-pc-mingw32\sys-root\mingw\bin\) it won't even start on 64bit XP&7, 32bit XP,
am i missing something?


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 27, 2010, 12:06:59 AM
Quote
I'd be interested to see how well this works on Vista, XP, 7, ...
complaining about "libcurl-4.dll missing" (although it's there at c:\CPU-miner\usr\i686-pc-mingw32\sys-root\mingw\bin\) it won't even start on 64bit XP&7, 32bit XP,
am i missing something?

Try adding c:\CPU-miner\usr\i686-pc-mingw32\sys-root\mingw\bin\ to your PATH, then run minerd.exe?


Title: Re: New demonstration CPU miner available
Post by: slush on November 27, 2010, 12:08:44 AM
complaining about "libcurl-4.dll missing" (although it's there at c:\CPU-miner\usr\i686-pc-mingw32\sys-root\mingw\bin\) it won't even start on 64bit XP&7, 32bit XP,
am i missing something?

Same here (WinXP)


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 27, 2010, 12:09:30 AM
You should try it with tcatm's 4-way SSE2 SHA in sha256.cpp.

Added.  Users may select this by enabling SSE2 instructions in their compiler during build, and then

Code:
$ minerd --algo=4way

will select the 4way implementation, rather than the default 'c' implementation.  Run "minerd --help" to make sure 4way is listed as an available option first; if not, you did not build with SSE2 enabled (-msse2, or many values of -march=xxx).


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 27, 2010, 12:11:18 AM
complaining about "libcurl-4.dll missing" (although it's there at c:\CPU-miner\usr\i686-pc-mingw32\sys-root\mingw\bin\) it won't even start on 64bit XP&7, 32bit XP,
am i missing something?

Same here (WinXP)

Clearly my installer-maker is having a problem  :(   Will investigate (though probably tomorrow).


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 27, 2010, 12:32:04 AM
Quote
I'd be interested to see how well this works on Vista, XP, 7, ...
complaining about "libcurl-4.dll missing" (although it's there at c:\CPU-miner\usr\i686-pc-mingw32\sys-root\mingw\bin\) it won't even start on 64bit XP&7, 32bit XP,
am i missing something?

Updated the installer at http://yyz.us/bitcoin/cpuminer-installer.zip

Does the problem still exist?

EDIT:  Here are the checksums for the latest Windows installer zipfile...
     Size: 1978933 bytes
     SHA1: fdea8a045db5e09b7441a4059fbdba186490e742  
     MD5: e60dbfb7c3b458c2a98e71cb295f9b7d  


Title: Re: New demonstration CPU miner available
Post by: BitLex on November 27, 2010, 12:50:02 AM
yay! now it works.

running at ~50% on dual-, 30-40% on a triple-core only (at default settings), but it works.
gonna play with settings later.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 27, 2010, 12:52:44 AM
Note that the khash/sec calculations are known to be buggy, so you cannot trust those numbers :(  Will try to fix that soonish, so people may accurately compare numbers with other installations.


Title: Re: New demonstration CPU miner available
Post by: BitLex on November 27, 2010, 01:28:24 AM
--threads scales nicely with cores, unfortunately it drags GPU-miners down (a lot) when running on all cores,
but i guess most GPU miners won't care about one CPU more or less anyway.  ;D

--algo=4way pretends to work, burns CPU and stuff, but only shows 0.00khash/s all time and some PROOF...false msgs, so i think it doesn't.

--url works just fine, all my (non-client) miners are connected to a single node

tested on 64bit XP & 7


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 27, 2010, 04:25:07 AM
Updated the git repo (Linux) and http://yyz.us/bitcoin/cpuminer-installer.zip (Windows) to fix hash meter problems.

Size: 1858209
SHA1: c9c2695b7f6708956dfe9b06e02a28fdc0cf46c9
MD5: 144e2c7d61d739a267bb623122e103e7

--algo=4way pretends to work, burns CPU and stuff, but only shows 0.00khash/s all time and some PROOF...false msgs, so i think it doesn't.

I fixed the 0.00 khash/s problem, but it looks like the algorithm might be returning incorrect hashes.  I marked it "EXPERIMENTAL" in --help for now.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 27, 2010, 06:32:26 AM
Added VIA padlock support, in git.

Completely untested -- I don't have the hardware.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 27, 2010, 09:08:02 AM
Ok, I think I've fixed 4way.  The 4way scanhash was only patching the base nonce into the data block, rather than the nonce successfully found using the vector SSE2 code.  The code now seems to be successfully finding hashes with a large amount of zero bits.

Version 0.2 has been pushed out to git repo, and Windows installer has been updated.  See top of thread for updated URLs. See NEWS file or git repo for full list of changes.

SHA1: 61809a3f09363ab9d83e7b727909e70d2e1a3f8c  cpuminer-installer-0.2.zip
MD5: bdcf1b956688f46cd8591656887cb3a6  cpuminer-installer-0.2.zip

Edit:  just generated a testnet block w/ 4way.  Looks like it's working.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 27, 2010, 10:09:51 AM
Curious users may find the following patch useful for observing bitcoin miner proof-of-work results.  Current miners seem to work like this:
  • Increment nonce in block header
  • Double-SHA256 hash the block header
  • If some number of high bits are zero, stop hashing, and perform an exhaustive proof-of-work validation check:  Decompose the sha256 hash result into a 256-bit integer, and compare that integer with the target.
  • Otherwise, loop back to step #1.

The net result is that it is entirely normal to stop hashing, perform proof-of-work validation, and fail.

The following simple patch will log such failures to the debug log. Again, it is normal to see these sorts of events pop up occasionally.

Code:
diff --git a/main.cpp b/main.cpp
index acfcbc9..1c5ca69 100644
--- a/main.cpp
+++ b/main.cpp
@@ -3273,8 +3273,11 @@ bool CheckWork(CBlock* pblock, CReserveKey& reservekey)
     uint256 hash = pblock->GetHash();
     uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
 
-    if (hash > hashTarget)
+    if (hash > hashTarget) {
+           printf("proof-of-work check FAILED...\n  hash:   %s\n  target: %s\n"
+                  hash.GetHex().c_str(), hashTarget.GetHex().c_str());
         return false;
+    }
 
     //// debug print
     printf("BitcoinMiner:\n");


Title: Re: New demonstration CPU miner available
Post by: BitLex on November 27, 2010, 11:08:15 AM
some more tests with v0.2

AMD X3 720 @2.8GHz winXPx64
threads=1
c=1020khash/s -> 4way=2400khash/s

default client-miner gets ~3800khash/s on this machine, so if your HashMeter is a bit less wildly inaccurate now, 4way runs almost twice as fast.


AMD X2 BE-2350 @2.36GHz win7x64
therads=1
c=860khash/s -> 4way=1060khash/s

default client-miner gets ~2000khash/s here, still a little improvement, but far from the one above.


Title: Re: New demonstration CPU miner available
Post by: teknohog on November 27, 2010, 11:22:31 AM
EDIT:  If you lack jansson, current cpuminer.git will build an in-tree version.  Thus, you may opt to fix the problem by... removing jansson from your system.

Cheers, this is now faster than mainline on an Atom D510 :) While a GPU miner is hogging one core, mainline gives about 305 khash/s, and cpuminer gives about 480. Both of these are using several threads for HT, which actually makes a huge difference.

One reason may be that the mainline client segfaults with -march=atom (gcc 4.5.1), but for cpuminer it works fine. Since the Atom has an in-order architecture, this again makes a big difference.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 27, 2010, 06:32:15 PM
AMD X3 720 @2.8GHz winXPx64
c=1020khash/s -> 4way=2400khash/s

default client-miner gets ~3800khash/s on this machine

AMD X2 BE-2350 @2.36GHz win7x64
c=860khash/s -> 4way=1060khash/s

default client-miner gets ~2000khash/s here, still a little improvement, but far from the one above.

It is strange that the default client-miner is so much faster for you.  Surely your bitcoin client is running multiple threads, to achieve 3800 khash/s, yes?

Thanks for reporting results!  cpuminer v0.2's hashmeter should be accurate.  Note that cpuminer prints out speed for each thread, not a total for all threads:

Code:
[jgarzik@bd cpuminer]$ ./minerd -t2 -a4way
2 miner threads started, using SHA256 '4way' algorithm.
HashMeter(0): 16777216 hashes, 1828.44 khash/sec
HashMeter(1): 16777216 hashes, 1832.77 khash/sec

"HashMeter(0)" is thread #0.  "HashMeter(1)" is thread #1.

Therefore, I am getting 3660 khash/sec in total.



Title: Re: New demonstration CPU miner available
Post by: BitLex on November 27, 2010, 07:25:29 PM
Quote
Surely your bitcoin client is running multiple threads, to achieve 3800 khash/s, yes?
yes of course, it's 3800 running unlimited (=on all cores) on the AMD X3 bitcoin client,
thats a bit faster than your miner at default c=3x1020= 3060khash/s,
but only about half of what yours does at 4way=3x2400= 7200khash/s.
impressive!

on the older X2 the math goes
bitcoin client= 2000khash/s
jgarzik c=2x860= 1720khash/s
jgarzik 4way=2x1060= 2120khash/s
not that much, but still noticable.


and here's another one
Intel(R) Atom N270 @1600MHz (singlecore pretending to be 2) WinXP 32

bitcoin-client= 420khash/s (330 "limited to 1 core")

jgarzik's miner=
threads=1 c= 220khash/s
threads=2 c=2x164= 328khash/s


4way just slows it down to 196 on a single and 2x140 on 2threads.


Title: Re: New demonstration CPU miner available
Post by: farmer_boy on November 28, 2010, 07:27:11 PM
The 4way implementation is slower on my IntelCore2Duo. The 'c' implementation is about 20% slower than the one in mainline. Still, I understood from the announcement that it was not actually the intention to go faster, but simply to show how to write one. In terms of work required to get this miner to work, it is the best miner sofar. It compiled out of the "box" (git).

I would consider this experiment to be a complete success.

What exactly happens when I send the KILL signal to the program? Is there any chance that bitcoins are lost for example? The same question applies to all miner programs.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 28, 2010, 08:07:15 PM
The 4way implementation is slower on my IntelCore2Duo. The 'c' implementation is about 20% slower than the one in mainline.

What platform?  And, is it 32-bit or 64-bit?

I'm guessing my miner will be slower than mainline on 32-bit, because Crypto++ has a SHA256 32-bit assembly implementation, and I think mainline uses that on 32-bit platforms.

Quote
What exactly happens when I send the KILL signal to the program? Is there any chance that bitcoins are lost for example? The same question applies to all miner programs.

Miners submit work immediately, via HTTP JSON-RPC, as soon as they find a possible solution.  You'll only lose bitcoins if you KILL in a tiny window of opportunity where you found a solution and it has not yet submitted.


Title: Re: New demonstration CPU miner available
Post by: farmer_boy on November 28, 2010, 09:46:15 PM
The 4way implementation is slower on my IntelCore2Duo. The 'c' implementation is about 20% slower than the one in mainline.

What platform?  And, is it 32-bit or 64-bit?

I'm guessing my miner will be slower than mainline on 32-bit, because Crypto++ has a SHA256 32-bit assembly implementation, and I think mainline uses that on 32-bit platforms.

Quote
What exactly happens when I send the KILL signal to the program? Is there any chance that bitcoins are lost for example? The same question applies to all miner programs.

Miners submit work immediately, via HTTP JSON-RPC, as soon as they find a possible solution.  You'll only lose bitcoins if you KILL in a rare situation where you found a solution and it has not yet submitted.
Platform: 64 bit Linux. It might be better to catch the KILL SIGNAL complete the current work and even catch this unlikely case. OTOH, it might not be worth the effort, since the chance of creating one is so small...


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 29, 2010, 01:19:00 AM
Platform: 64 bit Linux.

Strange.  I wouldn't have thought the mainline implementation would be that much faster on 64-bit.

Quote
It might be better to catch the KILL SIGNAL complete the current work and even catch this unlikely case. OTOH, it might not be worth the effort, since the change of creating one is so small...

At some point you have to surrender to the fact that killing the miner means possibly missing a solution that would have been found, if you only gave it another microsecond to run...  :)


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 29, 2010, 01:20:09 AM
Just added the Crypto++ implementation of SHA256 to cpuminer.git.  C only, though I would eventually like to add asm for 32-bit.

sha.cpp, converted to C, seems slower than cpuminer's current "c" algorithm.


Title: Re: New demonstration CPU miner available
Post by: neptop on November 29, 2010, 01:40:50 AM
I think miners should retry connection every now and then if the master is not available, so you don't have to care if it is temporary down (i.e. while updating).


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 29, 2010, 02:27:42 AM
I think miners should retry connection every now and then if the master is not available, so you don't have to care if it is temporary down (i.e. while updating).

'getwork' miners (such as mine) already do this.  The basic algorithm looks like this:
  • 1. Connect to bitcoin via TCP, obtain work
  • 2. Work on work (no TCP connection required, needed, or used)
  • 3. If solution found, connect to bitcoin via TCP and submit solution
  • 4. Go to step #1.

If bitcoin is down when a solution is found, presumably the solution will be invalid by the time bitcoin comes back up, so the "retry" with solution seems less than useful.  A "retry" is really just going back to obtain more work (step #1).


Title: Buffer overflow
Post by: teknohog on November 29, 2010, 01:48:54 PM
This has happened to me every time a hash with zeros is found on my 64-bit Atom system:

Code:
DBG: found zeroes in hash:
d624b64665519a6e0c74eeca4e00a5be937086db86f106b0ed6e759400000000
HashMeter(2): 8150287 hashes, 123.22 khash/sec
PROOF OF WORK FOUND?  submitting... 
*** buffer overflow detected ***: ./minerd terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7f6a2387f847]
/lib/libc.so.6(+0xe56c0)[0x7f6a2387d6c0]
/lib/libc.so.6(+0xe4a39)[0x7f6a2387ca39]
/lib/libc.so.6(_IO_default_xsputn+0x81)[0x7f6a23809651]
/lib/libc.so.6(_IO_vfprintf+0x3f6f)[0x7f6a237ddbef]
/lib/libc.so.6(__vsprintf_chk+0x9d)[0x7f6a2387cadd]
/lib/libc.so.6(__sprintf_chk+0x7f)[0x7f6a2387ca1f]
./minerd[0x401958]
/lib/libpthread.so.0(+0x6c1a)[0x7f6a23b04c1a]
/lib/libc.so.6(clone+0x6d)[0x7f6a2386992d]

I mentioned the problems with -march=atom CFLAGS previously, but this does not go away when changing the -march.


Title: Re: Buffer overflow
Post by: jgarzik on November 29, 2010, 05:21:55 PM
This has happened to me every time a hash with zeros is found on my 64-bit Atom system:

Fixed in git commit 145e5fe141857c0757fdb5bb6909583aa67691b1, just pushed to cpuminer.git.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on November 29, 2010, 05:31:36 PM
Just pushed out v0.2.1 to cpuminer.git, and updated the Windows installer:
http://yyz.us/bitcoin/cpuminer-installer-0.2.1.zip

SHA1: d85390e1bb4da94b84f0968d0c98590f4be22f39  cpuminer-installer-0.2.1.zip
MD5: 02bcd0b22fa62499e96244ebd86efcd5  cpuminer-installer-0.2.1.zip

Windows users should see a slight increase in khash/sec, due to improved optimization.


Title: Re: New demonstration CPU miner available
Post by: Cdecker on December 03, 2010, 05:32:36 PM
I wonder what this might mean:
Quote
checking for json_loads in -ljansson... no
checking for pthread_create in -lpthread... yes
./configure: line 4305: syntax error near unexpected token `LIBCURL_CHECK_CONFIG'
./configure: line 4305: `LIBCURL_CHECK_CONFIG(, 7.10.1, ,'

Any ideas?


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 03, 2010, 06:32:35 PM
I wonder what this might mean:
Quote
checking for json_loads in -ljansson... no
checking for pthread_create in -lpthread... yes
./configure: line 4305: syntax error near unexpected token `LIBCURL_CHECK_CONFIG'
./configure: line 4305: `LIBCURL_CHECK_CONFIG(, 7.10.1, ,'

Any ideas?

autogen.sh did not find the necessary libcurl autoconf magic to build your configure script.  Thus, instead of transforming the macro LIBCURL_CHECK_CONFIG into something useful, it left it as-is.

So, your libcurl install is missing some pieces (or autogen.sh cannot find them).


Title: Re: New demonstration CPU miner available
Post by: prometheus on December 04, 2010, 04:01:57 AM
Fantastic work.  Are you able to get the 4way algorithm into the main client?  It performs twice as well as the main client's algorithm on intel hardware, and seems to be working terrific on the AMD hardware.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 04, 2010, 05:42:58 AM
Fantastic work.  Are you able to get the 4way algorithm into the main client?  It performs twice as well as the main client's algorithm on intel hardware, and seems to be working terrific on the AMD hardware.

4way is in the main client already -- albeit Linux-only, if I understand correctly.  That's an open project for someone to tackle, if they're interested.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 06, 2010, 07:38:23 AM
Version 0.2.2 released:
- VIA padlock works (lfm)
- minor bug fixes (lfm)

SHA1: b7ffda89f3b76302b948a715905105b4cf0c080f  cpuminer-installer-0.2.2.zip
MD5: 716f883b92e93082e2dfa9a3130972cb  cpuminer-installer-0.2.2.zip

See top of thread for URLs.


Title: Re: New demonstration CPU miner available
Post by: lfm on December 06, 2010, 10:58:39 AM
note if you wanted to do a full difficulty test rather than returning the preliminary "proof of work" to the server, its not hard, I think this would work:

Code:
/* do full difficulty test of hash */

#define OFF 75

int fulltest(void * block, void *hash)
{
  unsigned char *blk = block;  // 80 bytes
  unsigned char *hsh = hash;   // 32 bytes
  int i;
  int shift = blk[OFF] - 2;

  for (i = 31; i > shift && i >= 0; i--)
    if (hsh[i] != 0)
      return 0;

  if (shift < 32)
    for (i = 0; i < 3 && shift >= i; i++) {
      if (hsh[shift - i] > blk[OFF - 1 - i])
        return 0;
      if (hsh[shift - i] < blk[OFF - 1 - i])
        return 1;
    }

  return 1;
}


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 07, 2010, 01:27:27 AM
A test version of cpuminer, with crypto++ 32-bit assembly implementation, has been pushed out to git, and a test installer for Windows uploaded at http://yyz.us/bitcoin/cpuminer-installer-0.2.2test.zip

SHA1: c105454954b63c4f846ced958b553c87182b88e5  cpuminer-installer-0.2.2test.zip
MD5: ce5fd9d17167080892b8d9c06f582660  cpuminer-installer-0.2.2test.zip

I'm interested if this works at all.  Should be faster for Windows users than the current Crypto++ implementation, I'm guessing.


Title: Re: New demonstration CPU miner available
Post by: BitLex on December 07, 2010, 01:46:47 AM
Quote
I'm interested if this works at all.
it does, installs and runs nice as usual,
on my PhenomII X3 it's
slightly faster using 'c' 1070khash/s (+50)
but slower using '4way' 1440khash/s (-960), which is also the case in version 0.2.2, haven't tested that one before.

so, with 0.2.1 '4way' i get 2400,
0.2.2-0.2.2test '4way' i get 1440.

you broke it.  :'(    ;)
    
and yes, it's all single threads.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 07, 2010, 05:23:47 AM
Quote
I'm interested if this works at all.
it does, installs and runs nice as usual,

Did you test 'cryptopp_asm32' algorithm?

Quote
so, with 0.2.1 '4way' i get 2400,
0.2.2-0.2.2test '4way' i get 1440.

hmmm.  On my side, I upgraded Fedora 13 to Fedora 14, and changed -O2 to -O3 in compile flags.  Gotta wonder what changed :(

I should also look into a better CPU architecture setting than the default.


Title: Re: New demonstration CPU miner available
Post by: BitLex on December 07, 2010, 06:02:00 AM
Quote
Did you test 'cryptopp_asm32' algorithm?

sorry, the slow 4way-algo confused me a bit, so i totally missed to post those,
yes i did.

cryptopp = 890khash/s
cryptopp_asm32 = 1350khash/s


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 07, 2010, 06:39:45 AM
cryptopp_asm32 = 1350khash/s

This is faster than standard bitcoin client, yes?

Anyway, how much patience do you have for testing?  :)  Other readers.. your help in comparing 0.2 versus 0.2.2test* speed is welcomed.  Here is a matrix of options, to see if 4way can be improved:

Compiler flagsURL
-O2 -msse2http://yyz.us/bitcoin/cpuminer-installer-0.2.2test-o2.zip
-O2 -march=pentium4 -msse2http://yyz.us/bitcoin/cpuminer-installer-0.2.2test-o2-pentium4.zip
-O2 -march=k8http://yyz.us/bitcoin/cpuminer-installer-0.2.2test-o2-k8.zip
-O3 -msse2http://yyz.us/bitcoin/cpuminer-installer-0.2.2test-o3.zip
-O3 -march=pentium4 -msse2http://yyz.us/bitcoin/cpuminer-installer-0.2.2test-o3-pentium4.zip
-O3 -march=k8http://yyz.us/bitcoin/cpuminer-installer-0.2.2test-o3-k8.zip


Title: Re: New demonstration CPU miner available
Post by: BitLex on December 07, 2010, 07:27:37 AM
Phenom II X3 720 2.8GHz XP x64

--algo=4way --threads=1

0.2.2test-o2 = 1450
0.2.2test-o2-pentium4 = 1438
0.2.2test-o2-k8 = 1450
0.2.2test-o3 = 1450
0.2.2test-o3-pentium4 = 1438
0.2.2test-o3-k8 = 1450

 

0.2.1 = 2418.34 interesting on this one is, that it's not fluctuating,
all others go up and down by 1-few khash, 0.2.1 isnt, it's rockstable at 2418.34,
except the CPU is doing some other stuff, then it drops a bit too.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 07, 2010, 07:38:12 AM
Thanks for testing.  Here's another test, integrating the 4way algorithm and removing the others:
     http://yyz.us/bitcoin/cpuminer-installer-0.2.2test-4way-only.zip

Unlikely to change anything, but it seems that we are narrowing this down to gcc 4.4 -> gcc 4.5 changes in Fedora 13 -> 14.


Title: Re: New demonstration CPU miner available
Post by: slush on December 07, 2010, 08:41:47 AM
Hi jgarzik, getting problem with configure on pretty old CentOS 5. Any idea, please?  ::)

Quote
[root@virt10 jgarzik-cpuminer-080ddb6]# ./autogen.sh
[root@virt10 jgarzik-cpuminer-080ddb6]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
...
checking pkg-config is at least version 0.9.0... yes
./configure: line 4516: syntax error near unexpected token `,'
./configure: line 4516: `LIBCURL_CHECK_CONFIG(, 7.10.1, ,'


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 07, 2010, 08:56:00 AM
Hi jgarzik, getting problem with configure on pretty old CentOS 5. Any idea, please?  ::)

Quote
./configure: line 4516: `LIBCURL_CHECK_CONFIG(, 7.10.1, ,'

Scroll up to this post (http://bitcointalk.org/index.php?topic=1925.msg26520#msg26520), in the current thread.  Your libcurl devel pkg is missing, or your libcurl devel pkg is missing autoconf macros.


Title: Re: New demonstration CPU miner available
Post by: slush on December 07, 2010, 02:49:40 PM
Thanks. I tried to find solution here before post, but missed this comment  ::)
Scroll up to this post (http://bitcointalk.org/index.php?topic=1925.msg26520#msg26520), in the current thread.  Your libcurl devel pkg is missing, or your libcurl devel pkg is missing autoconf macros.


Title: Re: New demonstration CPU miner available
Post by: tuxsoul on December 11, 2010, 06:34:44 AM
Hi,

I created a debian/ubuntu package from this app, if somebody will like test or support this package, give feedbacks here:
http://bitcointalk.org/index.php?topic=2207.0

Sorry my english is bad.
Greeting's.


Title: Re: New demonstration CPU miner available
Post by: pc on December 13, 2010, 03:19:26 AM
I've compiled a binary for 64-bit Intel Mac and have it posted at http://dl.dropbox.com/u/16187822/minerd

It gives better performance than the native Bitcoin client on CPU generation, and even better with 4way on my system that has a processor that supports it. I couldn't get 4way to work in the native Bitcoin client, so I'm glad that I've got a chance to use it. It's not enough to compete with some of those GPU monsters, but every hash counts, right?


Title: Re: New demonstration CPU miner available
Post by: Azetab on December 16, 2010, 06:11:41 PM
hey, can someone upload a binary zip version of the cpu miner?


Title: Re: New demonstration CPU miner available
Post by: BitLex on December 16, 2010, 06:16:11 PM
Quote from: Azetab
i need a portable file to run on certain computers
just "install" it once and copy the folder to your thumbdrive, works fine for me (note that i only used 0.2.1, newer versions slow 4way down on my phenomX3).


Title: Re: New demonstration CPU miner available
Post by: Azetab on December 16, 2010, 06:40:26 PM
Quote from: Azetab
i need a portable file to run on certain computers
just "install" it once and copy the folder to your thumbdrive, works fine for me (note that i only used 0.2.1, newer versions slow 4way down on my phenomX3).

oh didnt know i could do that thanks!


Title: Re: New demonstration CPU miner available
Post by: Azetab on December 17, 2010, 02:13:02 AM
when I run this I get a json_rpc_call failed, does anyone know why?


Title: Re: New demonstration CPU miner available
Post by: slush on December 17, 2010, 03:23:01 AM
Hi jgarzik, as I promised somewhere on this forum, I'm sending you my first reward from cooperative mining, because your code helped me a lot to understand, how mining works inside. So 38 BTC is yours, enjoy :-).


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 17, 2010, 03:27:08 AM
when I run this I get a json_rpc_call failed, does anyone know why?

The miner is unable to connect to the URL you gave it, for some reason.


Quote from: slush
Hi jgarzik, as I promised somewhere on this forum, I'm sending you my first reward from cooperative mining, because your code helped me a lot to understand, how mining works inside. So 38 BTC is yours, enjoy :-).

Thanks!


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 17, 2010, 06:02:08 AM
Updated first post with a release tarball for Linux/BSD, so that people don't have to bother with autotools and the git repo.

Recommend avoiding gcc 4.5.x at the moment.


Title: Re: New demonstration CPU miner available
Post by: Raulo on December 18, 2010, 01:28:51 PM
I like the miner for its simplicity (and is also a bit faster than standard bitcoin program).

While using this miner in the pooled mining I came across a few problems and I'd like to offer suggestions.

First one is in the code that reads the work
Code:
             val = json_rpc_call(rpc_url, userpass, rpc_req);
             if (!val) {
             fprintf(stderr, "json_rpc_call failed\n");
             return NULL;
            }
If there is a network or server problem, the client will fail and it happens quite frequently with pooled mining. I changed return NULL; to some sleep and
put it in a loop to wait until the network is up again. After such modification (and similar in submit_work) the client survived several server restarts.

Another suggestion is in the 4way code. The code will not compile with Intel Compiler due to non-standard use of bit operations. If you change the lines that define macros to:

Code:
static inline __m128i Ch(const __m128i b, const __m128i c, const __m128i d) {
    return _mm_xor_si128(_mm_and_si128(b,c),_mm_andnot_si128(b,d));
}

static inline __m128i Maj(const __m128i b, const __m128i c, const __m128i d) {
    return _mm_xor_si128(_mm_xor_si128(_mm_and_si128(b,c),_mm_and_si128(b,d)),_mm_and_si128(c,d));
}

static inline __m128i ROTR(__m128i x, const int n) {
    return _mm_or_si128(_mm_srli_epi32(x, n),_mm_slli_epi32(x, 32 - n));
}

static inline __m128i SHR(__m128i x, const int n) {
    return _mm_srli_epi32(x, n);
}

/* SHA256 Functions */
#define BIGSIGMA0_256(x)    (_mm_xor_si128(_mm_xor_si128(ROTR((x), 2),ROTR((x), 13)),ROTR((x), 22)))
#define BIGSIGMA1_256(x)    (_mm_xor_si128(_mm_xor_si128(ROTR((x), 6),ROTR((x), 11)),ROTR((x), 25)))


#define SIGMA0_256(x)       (_mm_xor_si128(_mm_xor_si128(ROTR((x), 7),ROTR((x), 18)), SHR((x), 3 )))
#define SIGMA1_256(x)       (_mm_xor_si128(_mm_xor_si128(ROTR((x),17),ROTR((x), 19)), SHR((x), 10)))
it will compile with both gcc and icc. I hoped for a significant speed-up but for me Intel compiler is only about 10% faster on only one of my machines (Core i5) and slower on Core 2 and Opteron.  Nevertheless, the code is more universal. Isn't a similar code used also in the main bitcoin cruncher?

Last issue is very mysterious and I may have come across a strange race-condition bug in GLIBC (or something else) on my Cent OS. The program randomly segfaulted in multithreaded mode while working fine in single-threaded one and working OK on my another Ubuntu machine. Long story short, it seems it was related in name resolving and  I (hopefully) solved the problem by compiling libcurl with --enable-ares, which uses an asynchronous name resolution.


Title: Re: New demonstration CPU miner available
Post by: LZ on December 18, 2010, 07:54:44 PM
HP Mini 2133 (1 thread)
--algo c ~140-150 khps
--algo 4way ~165-175 khps
--algo via ~800-1200 khps
--algo cryptopp ~115-125 khps

It's great! Thanks! :D


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 18, 2010, 09:35:39 PM
New version 0.3 released (see top post for URLs).

Changes:
  • Add crypto++ 32bit assembly implementation
  • show version upon 'minerd --help'
  • work around gcc 4.5.x bug that killed 4way performance

SHA1: e748faf3272a766f6de3e99ad1b6e434a0f3d023  cpuminer-installer-0.3.zip
MD5: c1fc335c2548afa726ac49871ff73d08  cpuminer-installer-0.3.zip


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 18, 2010, 09:44:49 PM
Note that older versions are moved, with each new release, to http://yyz.us/bitcoin/old/


Title: Re: New demonstration CPU miner available
Post by: kseistrup on December 18, 2010, 09:50:05 PM
I started mining with cpuminer/minerd a few days ago, and to keep the dæmon in the air I'm using Gerrit Pape's “runit” (an equivalent to DJB's dæmontools).  However, since stdout is fully buffered by default I don't see any informative output until stdout's buffer is full.  By making stdout line buffered each HashMeter line can be read as it happens.  Here's a tiny patch:

Code:
diff --git a/cpu-miner.c b/cpu-miner.c
index 5371296..82c1355 100644
--- a/cpu-miner.c
+++ b/cpu-miner.c
@@ -402,6 +402,7 @@ static void parse_cmdline(int argc, char *argv[])
 int main (int argc, char *argv[])
 {
  int i;
+        int dummy = setvbuf(stdout, (char *) NULL, _IOLBF, 0);
 
  /* parse command line */
  parse_cmdline(argc, argv);

Cheers,


Title: Re: New demonstration CPU miner available
Post by: kseistrup on December 19, 2010, 08:30:57 AM
Code:
             val = json_rpc_call(rpc_url, userpass, rpc_req);
             if (!val) {
             fprintf(stderr, "json_rpc_call failed\n");
             return NULL;
            }
If there is a network or server problem, the client will fail and it happens quite frequently with pooled mining. I changed return NULL; to some sleep and
put it in a loop to wait until the network is up again. After such modification (and similar in submit_work) the client survived several server restarts.
Could you post an example, please?

Cheers,
Klaus


Title: Re: New demonstration CPU miner available
Post by: Raulo on December 19, 2010, 10:07:12 AM
Could you post an example, please?

I made an infinite loop but it might be a good idea to set up a retry counter.
Code:
          /* obtain new work from bitcoin */
             do {
             val = json_rpc_call(rpc_url, userpass, rpc_req);
             if (!val) {
                           fprintf(stderr, "json_rpc_call failed. sleeping 60s\n");
                           sleep(60);
                          }
             } while (!val);

You should also do the same around fprintf("submit_work json_rpc_call failed\n") with maybe a shorter sleep(10).


Title: Re: New demonstration CPU miner available
Post by: slush on December 19, 2010, 12:04:56 PM
I made an infinite loop but it might be a good idea to set up a retry counter.
Code:
             val = json_rpc_call(rpc_url, userpass, rpc_req);
             if (!val) {
                           fprintf(stderr, "json_rpc_call failed. sleeping 60s\n");
                           sleep(60);
                          }

I'm not so familiar with miner sources, but don't forget server can sometimes return 'false' when PoW not meet server's target. Doesn't your patch deadlock script for ages in this case?


Title: Re: New demonstration CPU miner available
Post by: Raulo on December 19, 2010, 01:09:09 PM
I'm not so familiar with miner sources, but don't forget server can sometimes return 'false' when PoW not meet server's target. Doesn't your patch deadlock script for ages in this case?

I'm not 100% sure there is no possibility of deadlock in any situation but in this case, no. json_rpc_call returns non-null pointer on successful communication. Even if communication results in 'false' result, this check will pass.

I tested the patched version on pooled mining (where success is frequent) and standalone mining (where the result usually does not pass the target) and it does not deadlock.


Title: Re: New demonstration CPU miner available
Post by: romkyns on December 19, 2010, 01:44:40 PM
Seems to work! :) Algo results on Q6600: c: 920, 4way: ~600, cryptopp: ~600, cryptopp_asm32: 1050. This is for a single thread.

I wish the way you logged information was compatible with file redirection. I run my miners in the background and redirect all output to a file. Most implementations log the data just fine, but yours outputs nothing.

For example:

   poclbm.exe --user=... --pass=... --host=...  >file

this outputs *nothing* in the console, but saves progress in "file". This is the expected behaviour for console programs.

   minerd.exe --algo cryptopp_asm32 --url [...] --userpass [...] >file

this prints progress info to the console, and creates an empty file.

(also, since I'm firing off requests... a zip package (no installer) would be most appreciated! :D)

Thanks for your effort!

---------

There's something dodgy with using multiple threads: one of the threads doesn't start, and the CPU usage is correspondingly below the expected amount. E.g. "starting 3 threads", but only 2 cores are used, only 2 threads report khash/sec, and only 2 threads are doing work according to ProcessExplorer.

Lastly, algorithm cryptopp_asm32 consistently generates proof of work that gets rejected with a "Boo" message.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 19, 2010, 06:07:47 PM
Current git version will retry, if JSON-RPC call fails.


Title: Re: New demonstration CPU miner available
Post by: Azetab on December 19, 2010, 06:18:26 PM
Seems to work! :) Algo results on Q6600: c: 920, 4way: ~600, cryptopp: ~600, cryptopp_asm32: 1050. This is for a single thread.

I wish the way you logged information was compatible with file redirection. I run my miners in the background and redirect all output to a file. Most implementations log the data just fine, but yours outputs nothing.

For example:

   poclbm.exe --user=... --pass=... --host=...  >file

this outputs *nothing* in the console, but saves progress in "file". This is the expected behaviour for console programs.

   minerd.exe --algo cryptopp_asm32 --url [...] --userpass [...] >file

this prints progress info to the console, and creates an empty file.

(also, since I'm firing off requests... a zip package (no installer) would be most appreciated! :D)

Thanks for your effort!

---------

There's something dodgy with using multiple threads: one of the threads doesn't start, and the CPU usage is correspondingly below the expected amount. E.g. "starting 3 threads", but only 2 cores are used, only 2 threads report khash/sec, and only 2 threads are doing work according to ProcessExplorer.

Lastly, algorithm cryptopp_asm32 consistently generates proof of work that gets rejected with a "Boo" message.

I have this same problem, I have a Q9550, and with 4 threads, only 2 cores are used, and my khash/sec does not appear to be utilizing all four threads.


Title: Re: New demonstration CPU miner available
Post by: lfm on December 20, 2010, 02:03:14 AM
another fix for Via padlock, the 64 byte offset to the data parameter in the sha256 calls should not be used for via or it should be subtracted back out in the sha256_via.c


Title: Re: New demonstration CPU miner available
Post by: adv on December 20, 2010, 02:11:15 AM
If "d" in minerd mean daemon, then it must have ability to detach terminal. I think it must be first in TODO.


Title: Re: New demonstration CPU miner available
Post by: lfm on December 20, 2010, 02:25:25 AM
...
Lastly, algorithm cryptopp_asm32 consistently generates proof of work that gets rejected with a "Boo" message.

This would be normal. Only 1/difficulty (1 in 12253) of the initial proof of work gets a yay, the rest get boo.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 20, 2010, 02:40:22 AM
another fix for Via padlock, the 64 byte offset to the data parameter in the sha256 calls should not be used for via or it should be subtracted back out in the sha256_via.c

Good catch.  This seems to imply that sha256_via has never actually worked.  I pushed the following change out to git... can anyone test the latest git on testnet and verify that a proof-of-work is actually found?  This bitcoind patch may help debugging: http://yyz.us/bitcoin/patch.bitcoin-pow-fail

Code:
diff --git a/cpu-miner.c b/cpu-miner.c
index ac151f6..138ec9c 100644
--- a/cpu-miner.c
+++ b/cpu-miner.c
@@ -319,7 +319,7 @@ static void *miner_thread(void *thr_id_int)
 
 #ifdef WANT_VIA_PADLOCK
                case ALGO_VIA:
-                       rc = scanhash_via(work.midstate, work.data + 64,
+                       rc = scanhash_via(work.midstate, work.data,
                                          work.hash1, work.hash,
                                          &hashes_done);
                        break;
diff --git a/sha256_via.c b/sha256_via.c
index 45e6821..ef2c102 100644
--- a/sha256_via.c
+++ b/sha256_via.c
@@ -35,7 +35,7 @@ bool scanhash_via(const unsigned char *midstate, const unsigne
        unsigned char data[128] __attribute__((aligned(128)));
        unsigned char tmp_hash1[32] __attribute__((aligned(128)));
        uint32_t *hash32 = (uint32_t *) hash;
-       uint32_t *nonce = (uint32_t *)(data + 12);
+       uint32_t *nonce = (uint32_t *)(data + 64 + 12);
        uint32_t n = 0;
        unsigned long stat_ctr = 0;
        int i;


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 20, 2010, 02:52:45 AM
Version 0.3.1 released.  Changes:
- Critical fix for sha256_via
- Retry JSON-RPC failures (see --retry, under "minerd --help" output)

SHA1: c8da4ed8d73d71a73795b153f4ea157041cc51ba  cpuminer-installer-0.3.1.zip
MD5: 69c228d4846e9940e3129a395a947080  cpuminer-installer-0.3.1.zip

Still don't know if sha256_via actually works -- testnet or pool testers requested.


Title: Re: New demonstration CPU miner available
Post by: DerrikeG on December 20, 2010, 03:28:58 AM
Version 0.3.1 released.  Changes:
- Critical fix for sha256_via
- Retry JSON-RPC failures (see --retry, under "minerd --help" output)

SHA1: c8da4ed8d73d71a73795b153f4ea157041cc51ba  cpuminer-installer-0.3.1.zip
MD5: 69c228d4846e9940e3129a395a947080  cpuminer-installer-0.3.1.zip

Still don't know if sha256_via actually works -- testnet or pool testers requested.
I can't get via to work, it just starts and ends without any messages, even when -d and -P flags are provided. Running the windows build on windows XP.
Also, what is (if there is any) the sleep time between retries? Is there a way to set it to retry indefinitely with a reasonable amount of time between attempts? Supplying the retry command at all causes it to instantly crash for me.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 20, 2010, 04:05:30 AM
I can't get via to work, it just starts and ends without any messages, even when -d and -P flags are provided. Running the windows build on windows XP.

Can you try this?   http://yyz.us/bitcoin/cpuminer-installer-0.3.1-i486.zip

The default cpuminer is built "-march=i686", which means the compiler generates and optimizes for Intel chips i686 and later.  Some VIA chips lack a few key CPU instructions such as 'cmov' that the compiler generates, and as a result, minerd.exe binaries on these older VIA CPUs will probably crash.


Title: Re: New demonstration CPU miner available
Post by: DerrikeG on December 20, 2010, 04:35:34 AM
Can you try this?   http://yyz.us/bitcoin/cpuminer-installer-0.3.1-i486.zip

The default cpuminer is built "-march=i686", which means the compiler generates and optimizes for Intel chips i686 and later.  Some VIA chips lack a few key CPU instructions such as 'cmov' that the compiler generates, and as a result, minerd.exe binaries on these older VIA CPUs will probably crash.
No luck. Additionally, 4way on that build  behaves like via does (doesn't work, quits instantly). C goes slower than usual. Cryptopp too. Cryptopp_asm32 clocks in where it used to, though.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 20, 2010, 04:46:45 AM
DerrikeG, what is your CPU manufacturer and model name?


Title: Re: New demonstration CPU miner available
Post by: ColdHardMetal on December 20, 2010, 01:02:05 PM
I just set this miner up and it appears to be working. However it is only running at about a third to a quarter of the hash speed I get when running the bitcoin client. It says it only has 1 miner thread started, do I need to increase that number in order for it to up it's speed?

I have a quad-core processor running Win7 64 if that matters.


Title: Re: New demonstration CPU miner available
Post by: slush on December 20, 2010, 01:03:36 PM
I just set this miner up and it appears to be working. However it is only running at about a third to a quarter of the hash speed I get when running the bitcoin client. It says it only has 1 miner thread started, do I need to increase that number in order for it to up it's speed?

I have a quad-core processor running Win7 64 if that matters.

Rise your 'threads' parameter to 4. Also play with 'algo' parameter, this can help a lot.


Title: Re: New demonstration CPU miner available
Post by: davout on December 20, 2010, 01:03:55 PM
It does, you should check the command line options, they'll allow you to specify the number of threads you want running, usually one per core.
Also you can try the other options and see what works best for you.


Title: Re: New demonstration CPU miner available
Post by: ColdHardMetal on December 20, 2010, 01:34:58 PM
I just set this miner up and it appears to be working. However it is only running at about a third to a quarter of the hash speed I get when running the bitcoin client. It says it only has 1 miner thread started, do I need to increase that number in order for it to up it's speed?

I have a quad-core processor running Win7 64 if that matters.

Rise your 'threads' parameter to 4. Also play with 'algo' parameter, this can help a lot.

Yeah, there it is.

I tried that before and it was just doing the same thing. However there were some json_rpc_call failed messages that must have been 3 of the threads not starting right away. This time they all hooked on.

Thanks.


Title: Re: New demonstration CPU miner available
Post by: ColdHardMetal on December 20, 2010, 01:44:05 PM
Weird. Running it with 4 threads is causing my GPU hash rate to bog down. That doesn't seem right. Why would the 2 be connected. The certainly are though because it sped up again when I shut the CPU miner down. That never happened when I was using the bitcoin client to generate. I'll try it with 2 threads and see what happens.


Title: Re: New demonstration CPU miner available
Post by: Qoad Sof on December 20, 2010, 04:37:53 PM
Lastly, algorithm cryptopp_asm32 consistently generates proof of work that gets rejected with a "Boo" message.

I'm seeing the same problem. I've had many rejects and no successes using cryptopp_asm32 and have had many successes and very few rejects using the default algorithm. I'm using version 0.3.1. Has anyone had any success using cryptopp_asm32?


Title: Re: New demonstration CPU miner available
Post by: mestar on December 20, 2010, 05:37:33 PM
Works here, cryptopp_asm32 works 20% faster than 'c', so its about the same speed as the bitcoin standard client on windows 7-64.  This is the fastest client so far.

1200 khash per core, on both 2.66 intel quad core and 2.66 intel core duo, per core that is.



Title: Re: New demonstration CPU miner available
Post by: mestar on December 20, 2010, 06:52:55 PM
340494672d3a2d92b7b2e00000000
HashMeter(3): 4491213 hashes, 1214.76 khash/sec
PROOF OF WORK FOUND?  submitting...
PROOF OF WORK RESULT: false (booooo)

Yes, same here, never seen those booo's on 'c' setting, now on cryptopp_asm32 and I only get those.


Title: Re: New demonstration CPU miner available
Post by: kseistrup on December 20, 2010, 07:03:40 PM
PROOF OF WORK FOUND?  submitting...
PROOF OF WORK RESULT: false (booooo)

Yes, same here, never seen those booo's on 'c' setting, now on cryptopp_asm32 and I only get those.
Same here…

Cheers,


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 20, 2010, 07:10:07 PM
What does this bitcoin patch print out for you, when using cryptopp_asm32?

http://yyz.us/bitcoin/patch.bitcoin-pow-fail



Title: Re: New demonstration CPU miner available
Post by: kseistrup on December 21, 2010, 06:18:38 PM
What does this bitcoin patch print out for you, when using cryptopp_asm32?

http://yyz.us/bitcoin/patch.bitcoin-pow-fail
main.cpp?  There's no such file in the cpuminer directory…

Cheers,


Title: Re: New demonstration CPU miner available
Post by: DerrikeG on December 21, 2010, 06:21:20 PM
Also, what is (if there is any) the sleep time between retries? Is there a way to set it to retry indefinitely with a reasonable amount of time between attempts? Supplying the retry command at all (as -r or --retry) causes it to instantly crash for me.
This problem still exists with the latest version of CPU miner. (The one presently in the OP.)


Title: Re: New demonstration CPU miner available
Post by: zipslack on December 21, 2010, 06:48:31 PM
main.cpp?  There's no such file in the cpuminer directory…

I think he's asking you to patch the Bitcoin client to which you are connecting your CPU miner, not the miner itself.


Title: Re: New demonstration CPU miner available
Post by: kseistrup on December 21, 2010, 07:31:39 PM
main.cpp?  There's no such file in the cpuminer directory…

I think he's asking you to patch the Bitcoin client to which you are connecting your CPU miner, not the miner itself.
You're right, I missed that…  :)

Cheers,


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 21, 2010, 07:59:08 PM
What does this bitcoin patch print out for you, when using cryptopp_asm32?

http://yyz.us/bitcoin/patch.bitcoin-pow-fail
main.cpp?  There's no such file in the cpuminer directory…

"bitcoin patch" == a patch to bitcoin, not cpuminer.


Title: Re: New demonstration CPU miner available
Post by: lfm on December 23, 2010, 10:03:38 PM
another fix for Via padlock, the 64 byte offset to the data parameter in the sha256 calls should not be used for via or it should be subtracted back out in the sha256_via.c

Good catch.  This seems to imply that sha256_via has never actually worked.  I pushed the following change out to git... can anyone test the latest git on testnet and verify that a proof-of-work is actually found?  This bitcoind patch may help debugging: http://yyz.us/bitcoin/patch.bitcoin-pow-fail

ok it seems the via c7 hash is NOT working right. the bitcoin patch puts out this:

proof-of-work check FAILED...
  hash: 0690332bc5f9d16e9071934f5bccdb1a1b9a7265a2cdfc2a59bd9f72c6e137a5
target: 0000000045120800000000000000000000000000000000000000000000000000

which doest match the minerd:

DBG: found zeroes in hash:
ca71e510100ee12f70ff852e168f332cf155c60fc8eac979d5080c3600000000

at all.

Im not sure if its one of the byteswap loops or the asm() compiling wrong or what. Ill try to figure it out.


Title: Re: New demonstration CPU miner available
Post by: lfm on December 23, 2010, 10:17:50 PM
I think the problem for via is we have to move the (byte swapped) nonce back into the data_in parameter to return it.


yes now I get

proof-of-work check FAILED...
  hash: 00000000b91b13334f2636c2e0350bcb9592884ffe5af36e1f13a49e16f081fa
target: 0000000045120800000000000000000000000000000000000000000000000000

with

DBG: found zeroes in hash:
16f081fa1f13a49efe5af36e9592884fe0350bcb4f2636c2b91b133300000000

which matches correctly now when you do the byte swaps and all makes sense


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 24, 2010, 01:25:31 AM
I think the problem for via is we have to move the (byte swapped) nonce back into the data_in parameter to return it.

Indeed.  cpuminer 0.3.2 is out there, with another sha256_via fix attempt.

Via CPU owners, please report feedback.


Title: Re: New demonstration CPU miner available
Post by: lfm on December 24, 2010, 10:21:53 AM
I think the problem for via is we have to move the (byte swapped) nonce back into the data_in parameter to return it.

Indeed.  cpuminer 0.3.2 is out there, with another sha256_via fix attempt.

Via CPU owners, please report feedback.

I got a (yay!!) block on testnet with 0.3.2. I think we can declare it works. For via C7. Can someone else try Nano?




Title: Re: New demonstration CPU miner available
Post by: SawEfDir on December 24, 2010, 12:58:41 PM
Output of good hash found on VIA Nano running on Debian Sid amd64:

Code:
DBG: found zeroes in hash:
4ec9d2d025d0efbfb8c014783dba964ddfb9e9f337d72c62038bd65d00000000
HashMeter(0): 5887329 hashes, 1635.98 khash/sec
PROOF OF WORK FOUND?  submitting...
PROOF OF WORK RESULT: true (yay!!!)

It seems algo-via works on VIA Nano now, thanks a lot.


Title: Re: New demonstration CPU miner available
Post by: slush on December 26, 2010, 10:13:25 PM
There are few reports from users (http://bitcointalk.org/index.php?topic=1976.msg33203#msg33203) that cryptopp_asm32 is not working correctly for them. Is it known issue?


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 27, 2010, 05:38:18 AM
Version 0.3.3 is out there, with a critical one-line fix for cryptopp_asm algo.

SHA1: a7c0822c3ab0f9f2089fbc65cdbe2506789e4241  cpuminer-installer-0.3.3.zip
MD5: 2df889eebf752b5f35293e4cbe53f7e8  cpuminer-installer-0.3.3.zip


Title: Re: New demonstration CPU miner available
Post by: Cdecker on December 27, 2010, 11:06:44 PM
I can confirm the cryptopp_asm algo to be working and also got the shortest ever waiting time for a yay :D
Code:
$  ./minerd --userpass user:pass --url http://mining.bitcoin.cz:8332 --threads 2 --algo cryptopp_asm32
2 miner threads started, using SHA256 'cryptopp_asm32' algorithm.
DBG: found zeroes in hash:
78bf640434f5b45f8095269ed74d04ce23ea3fdaf6e16f0233006b8400000000
HashMeter(1): 1336480 hashes, 887.16 khash/sec
PROOF OF WORK FOUND?  submitting...
PROOF OF WORK RESULT: true (yay!!!)


Title: Re: New demonstration CPU miner available
Post by: Mithrandir on December 28, 2010, 07:27:46 AM
All I get on Trisquel GNU/Linux is:

JSON key 'midstate' not found
JSON inval midstate
JSON-decode of work failed, retry after 30 seconds


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 28, 2010, 07:39:02 AM
All I get on Trisquel GNU/Linux is:

JSON key 'midstate' not found
JSON inval midstate
JSON-decode of work failed, retry after 30 seconds

What does 'getwork' return for you, if you issue it manually?

It sounds like there is a problem with your bitcoin client's JSON-RPC server.  Maybe password is incorrect, or rpcallowip option is misused?


Title: Re: New demonstration CPU miner available
Post by: slush on December 28, 2010, 11:37:52 AM
For info: I made little tweak on pool side; it returns json rpc error in case of site maintenance (instead of 500 Server Error and some HTML stuff). I believe this is more correct for miners, but it may lead to errors like 'midstate not found', because on getwork there is simply result:null and some error text.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 28, 2010, 08:25:03 PM
For info: I made little tweak on pool side; it returns json rpc error in case of site maintenance (instead of 500 Server Error and some HTML stuff). I believe this is more correct for miners, but it may lead to errors like 'midstate not found', because on getwork there is simply result:null and some error text.

Just pushed the following to cpuminer.git...

commit 9e5a173c3845fb7b5d316b0455352a08847b8c23
Author: Jeff Garzik <jeff@garzik.org>
Date:   Tue Dec 28 15:22:53 2010 -0500

    Improve JSON-RPC result/error checking, and improve error diagnostic output.



Title: Re: New demonstration CPU miner available
Post by: Mithrandir on December 28, 2010, 09:54:44 PM
What does 'getwork' return for you, if you issue it manually?

It sounds like there is a problem with your bitcoin client's JSON-RPC server.  Maybe password is incorrect, or rpcallowip option is misused?

Thanks. I got the latest release from github and it works great now. Weird thing is that this release only works when I define my user and pass in cpu-miner.c.  :o


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 29, 2010, 03:43:30 AM
Version 0.5 is released.  See top post for URLs.  Changes:
- Exit program, when all threads have exited
- Improve JSON-RPC failure diagnostics and resilience
- Add --quiet option, to disable hashmeter output.

SHA1: 59a6b409c016468fb195619e46efe14db2f1aca8  cpuminer-installer-0.5.zip
MD5: 9d3fca8067ed4a3de9fb1df9d066c7be  cpuminer-installer-0.5.zip

The new logic to wait for thread exit should work just fine under Windows.  Let me know if version 0.5 behaves strangely under Windows, doing things like exiting immediately.


Title: Re: New demonstration CPU miner available
Post by: Rai on December 29, 2010, 04:46:05 AM
Running on Windows 7 Ultimate with an Intel Core 2 Duo 2.4 ghz
It seems to exit immediately, but it could just be exiting properly too fast for me to notice.  Is there a way to tell if it is exiting properly?


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 29, 2010, 06:14:16 AM
Running on Windows 7 Ultimate with an Intel Core 2 Duo 2.4 ghz
It seems to exit immediately, but it could just be exiting properly too fast for me to notice.  Is there a way to tell if it is exiting properly?

What arguments are you passing to minerd?  Have you verified that version 0.3.3 works with the same command line?

The purpose of a miner is to continue running into infinity, so it should only exit if downloading work via JSON-RPC is repeatedly failing.


Title: Re: New demonstration CPU miner available
Post by: Rai on December 29, 2010, 07:22:33 AM
minerd.exe -a cryptopp_asm32 --url http://mining.bitcoin.cz:8332 --userpass MyUserName:MyPassword

Version 0.5 works, it gets good proofs, and I didn't change the command line from 0.3.3.  I just can't tell if it exits correctly, which is what you were asking about if I'm reading your post correctly.  

The new logic to wait for thread exit should work just fine under Windows.  Let me know if version 0.5 behaves strangely under Windows, doing things like exiting immediately.

I eventually have to stop it myself to shut the machine down from time to time, and I cannot tell if it's stopping the threads the way they're supposed to.  Also, I'm not specifying a number of threads over 1 because I'm also running a GPU miner, and running 2 or more threads makes the GPU miner lose performance, so this miner just provides 1200 supplemental khps.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 29, 2010, 07:45:28 PM
It is supposed to exit immediately upon Ctrl-C.

Rai said "it exits immediately", which I interpreted to mean "exits as soon as it is run, without calculating any hashes."  That would be a huge problem, indicating that cpuminer no longer did any useful work! Rai clarified in a later post.

Everything appears to be working correctly on Windows.


Title: Re: New demonstration CPU miner available
Post by: nanotube on December 30, 2010, 06:57:38 PM
running ./configure for the .5 release, i get this:

Code:
configure: error: Missing required libcurl >= 7.10.1

this is on ubuntu lucid 32bit, with libcurl 7.19.7-1ubuntu1 installed.
any thoughts on why it'd think 7.19.7 is not >= 7.10.1 ?


Title: Re: New demonstration CPU miner available
Post by: jgarzik on December 30, 2010, 09:59:54 PM
running ./configure for the .5 release, i get this:

Code:
configure: error: Missing required libcurl >= 7.10.1

this is on ubuntu lucid 32bit, with libcurl 7.19.7-1ubuntu1 installed.
any thoughts on why it'd think 7.19.7 is not >= 7.10.1 ?

maybe curl-config is broken or missing?  You could try passing --with-libcurl={directory} to configure.


Title: Re: New demonstration CPU miner available
Post by: j16sdiz on December 31, 2010, 02:48:26 AM
running ./configure for the .5 release, i get this:

Code:
configure: error: Missing required libcurl >= 7.10.1

this is on ubuntu lucid 32bit, with libcurl 7.19.7-1ubuntu1 installed.
any thoughts on why it'd think 7.19.7 is not >= 7.10.1 ?

sudo apt-get install libcurl4-openssl-dev


Title: Re: New demonstration CPU miner available
Post by: nanotube on December 31, 2010, 03:09:51 AM
running ./configure for the .5 release, i get this:

Code:
configure: error: Missing required libcurl >= 7.10.1

this is on ubuntu lucid 32bit, with libcurl 7.19.7-1ubuntu1 installed.
any thoughts on why it'd think 7.19.7 is not >= 7.10.1 ?

sudo apt-get install libcurl4-openssl-dev
doh, forgot to look at the -dev package. thanks, that did it. :)


Title: Re: New demonstration CPU miner available
Post by: lfm on January 01, 2011, 08:31:24 PM
can we use gcc's __builtin_bswap32()?

ie in miner.h

#define swab32(x) __builtin_bswap32(x)

then it can compile to a single instruction in most cases

should work ok for anything gcc supports

it helps via a fair bit


Title: Re: New demonstration CPU miner available
Post by: SawEfDir on January 02, 2011, 01:08:25 AM
I've tried the following patch on a VIA Nano L2200 @ 1600 MHz on a Debian unstable amd64 system.

The speed increase is almost negligible. I've compiled minerd with using -O3, and with the patch, I'm getting really close to
1700kh/s. Without the patch, I'm getting about 1680. Using the builtin seems to gain 1% speed or so.

I've tried it on the testnet and got a good hash really quickly, so it seems to work ok.

Code:
diff --git a/miner.h b/miner.h
index 7979dc0..eda9498 100644
--- a/miner.h
+++ b/miner.h
@@ -22,15 +22,9 @@
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 #endif
 
-#define ___constant_swab32(x) ((uint32_t)(                       \
-        (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) |            \
-        (((uint32_t)(x) & (uint32_t)0x0000ff00UL) <<  8) |            \
-        (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >>  8) |            \
-        (((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24)))
-
 static inline uint32_t swab32(uint32_t v)
 {
-       return ___constant_swab32(v);
+       return __builtin_bswap32(v);
 }
 
 extern bool opt_debug;


Title: Re: New demonstration CPU miner available
Post by: eMansipater on January 05, 2011, 11:52:16 AM
using minerd -a cryptopp_asm32 --url http://minining.bitcoin.cz:8332 --userpass XXXXXXX:YYYYYYYYYY
and getting http:400 errors on ubuntu lucid.  Anyone have compiled binaries in case I botched up compiling?


Title: Re: New demonstration CPU miner available
Post by: slush on January 05, 2011, 01:00:48 PM
using minerd -a cryptopp_asm32 --url http://minining.bitcoin.cz:8332 --userpass XXXXXXX:YYYYYYYYYY
and getting http:400 errors on ubuntu lucid.  Anyone have compiled binaries in case I botched up compiling?

Remove one 'ni' in minining ;)


Title: Re: New demonstration CPU miner available
Post by: eMansipater on January 05, 2011, 10:55:40 PM
sorry--that was a mistype in my post.  I am running the command with the proper spelling (I've also gone by IP address).  I still get the 400 error, which is a malformed request, so that's why I was guessing compile error?


Title: Re: New demonstration CPU miner available
Post by: David Armstrong on January 06, 2011, 10:35:17 AM
A new CPU miner is now available, making use of the new 'getwork' RPC command.

In the beginning, this is intended largely to demonstrate a 'getwork' miner.  It is written in straight C, with minimal dependencies (libcurl, jansson).

It has successfully generated blocks on testnet.

Linux/BSD release tarball: http://yyz.us/bitcoin/cpuminer-0.5.tar.gz
Windows installer: http://yyz.us/bitcoin/cpuminer-installer-0.5.zip
git repository: git://github.com/jgarzik/cpuminer.git

Contributions welcomed!  (GPL v2 license)  It's still quite rough around the edges.

Hi,

I just have a question about how the miner behaves after it has found a solution to a piece of work.  I briefly looked at the code and the run loop goes something like this:

while (running) {
  get_work();

  rc = find_solution();   // NOTE: solution here is for a reduced difficulty than that required to generate a new bitcoin block and generate 50 BTC.
  if (rc) {
    submit_solution();
  }
}

So my question then is what will happen, and what should happen, when a solution is found part-way through a block of work?  Does the miner continue looking for further solutions, or does it throw away the rest of the piece of work?  (I guess as well the answer partially depends on what the mining server is expecting).

If it throws away the rest of the piece of work that means the miner is behaving differently to the vanilla bitcoin client - in that case the worker loop keeps going until a solution is found (or someone else beats us to the solution).  Would there be any reason for the miner not to continue as well?

thanks,
David.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on January 06, 2011, 05:12:46 PM
So my question then is what will happen, and what should happen, when a solution is found part-way through a block of work?  Does the miner continue looking for further solutions, or does it throw away the rest of the piece of work?  (I guess as well the answer partially depends on what the mining server is expecting).

If it throws away the rest of the piece of work that means the miner is behaving differently to the vanilla bitcoin client - in that case the worker loop keeps going until a solution is found (or someone else beats us to the solution).  Would there be any reason for the miner not to continue as well?

If a solution is found, it is pointless to continue work on that block.  You cannot solve a block twice.

cpuminer's behavior matches the vanilla bitcoin client's BitcoinMiner().


Title: Re: New demonstration CPU miner available
Post by: David Armstrong on January 07, 2011, 12:40:53 AM
So my question then is what will happen, and what should happen, when a solution is found part-way through a block of work?  Does the miner continue looking for further solutions, or does it throw away the rest of the piece of work?  (I guess as well the answer partially depends on what the mining server is expecting).

If it throws away the rest of the piece of work that means the miner is behaving differently to the vanilla bitcoin client - in that case the worker loop keeps going until a solution is found (or someone else beats us to the solution).  Would there be any reason for the miner not to continue as well?

If a solution is found, it is pointless to continue work on that block.  You cannot solve a block twice.

cpuminer's behavior matches the vanilla bitcoin client's BitcoinMiner().

I should clarify - I meant specifically in the case when the miner is running as part of a pooled mining effort like the one Slush is running.

The blocks the miner is solving are of a lower difficulty than required to generate a new Bitcoin block and generate the 50 BTC, but of a high enough difficulty to earn a share in the 50 BTC.  It is the pooled mining server that evaluates whether or not the solution is good enough to meet the main bitcoin difficulty level. 

By giving up on this piece of work and moving to the next I might be missing out on a) finding another solution within the same block of work, and therefore another share in the eventual 50 BTC, and b) more importantly, finding a solution within the block that reaches the main bitcoin difficulty threshold and so the whole pool is missing out on a chance of generating 50 BTC.

I've only just started using bitcoin so maybe I missed something obvious - please tell me if this is the case.


Title: Re: New demonstration CPU miner available
Post by: j16sdiz on January 07, 2011, 01:17:18 AM
.....

By giving up on this piece of work and moving to the next I might be missing out on a) finding another solution within the same block of work, and therefore another share in the eventual 50 BTC, and b) more importantly, finding a solution within the block that reaches the main bitcoin difficulty threshold and so the whole pool is missing out on a chance of generating 50 BTC.

.....

You are right. --- But, consider this:

  1. The miner is general purpose. It have to work with the official bincoin client.

  2. You have to get a new block when a new block is generated on the network (this is every ~30sec). You need extra lucks to get two blocks in 30s.

Of course you can have it work for more blocks, but the only time saved is one json-rpc request.


Title: Re: New demonstration CPU miner available
Post by: Metal on January 07, 2011, 02:27:05 AM
Cool, I like simplicity of your code. I want to try similar implementation in javascript. Partially because of curiosity and partialy because (inspired by hashcash) it can generate few hashes by fighting comments spam :-).

I just made few tests. In four javascript threads I get ~4khash/s, which is EXTREMELY slow. Probably because javascript is interpreted and without any JIT yet. Would be great if javascript supports GPU. Flash will support GPU soon, so we will see ;).

I do find the idea of web sites generating bitcoins using their visitor browsers very entertaining. If nothing else, it's a novel idea to monetize your traffic without having to hope your ad network won't get moody on you. Also, a little devious. No downside. ;)

Random ideas in no particular order:

- Flash Pixel Bender. GPU-rendered shaders. Not too sure how practical it is to use that to compute hashes.
- WebGL. more GPU-rendered stuff. meant for graphics too. see above.
- Web Workers: where available, will allow CPU-intensive JS code to run without noticeably slowing down the browser UI. Unfortunately, can't be used to control GPU approaches, but good as a CPU fallback method. Note that many JS engines are using JITs now. you'll get very different results on different browsers.
- unload event handler using a synchronous XHR: fairly reliable way to sync up whatever the browser computed back to a server when the user navigates away. except on some browsers, where periodic syncs are the only way.

Mix it all in a bag, use shaders creatively ( maybe a pixel could encode whether a bunch of hashes met some criteria for example), and you might get hashrates that don't totally suck, multiplied by whatever amount of traffic your site gets.

Interestingly, if the hashrates somehow approached what a real GPGPU solution can output (unlikely as that may be), then miner pooling sites could offer install-less approaches to participate in the pool..


Title: Re: New demonstration CPU miner available
Post by: tuxsoul on January 07, 2011, 07:48:52 AM
using minerd -a cryptopp_asm32 --url http://minining.bitcoin.cz:8332 --userpass XXXXXXX:YYYYYYYYYY
and getting http:400 errors on ubuntu lucid.  Anyone have compiled binaries in case I botched up compiling?

Hi @emansipater,

I have debian and ubuntu packages of bitcoin-cpuminer (0.5), you can find info here:
http://bitcointalk.org/index.php?topic=2207.0

This packages are no oficial.
Sorry my english is bad  ;).
Greeting's.


Title: Re: New demonstration CPU miner available
Post by: m0mchil on January 07, 2011, 08:12:53 AM
You are right. --- But, consider this:

  1. The miner is general purpose. It have to work with the official bincoin client.

Searching for more than one solution doesn't break compatibility - bitcoind would just reject second solution. Nothing is lost, you will have new search space in a short period.

But even if other miners do this, I am not quite sure if it improves apparent performance (to pool). Every nonce has equal probability.


Title: Re: New demonstration CPU miner available
Post by: eMansipater on January 07, 2011, 10:55:19 AM
Thanks so much @tuxsoul!!  If I can ever get set up with the pool I'll be sure to send a donation your way.  I'm afraid that even with the proper compile I'm getting the http:400 error.  Can anybody provide some insight?  The full message is:
Code:
HTTP request failed: The requested URL returned error: 400
json_rpc_call failed, retry after 30 seconds
and appears no matter what options I run minerd with (against http://mining.bitcoin.cz:8332 that is).  I have an account set up and am using that user/pass but is there a test account too?  Thanks in advance!


Title: Re: New demonstration CPU miner available
Post by: slush on January 07, 2011, 12:09:14 PM
Code:
HTTP request failed: The requested URL returned error: 400
json_rpc_call failed, retry after 30 seconds

HTTP 40x server returns when JSON response is different that miner should expect. That means bad login, bad password, malformed request and so on. Typically the JSON response tell you what wrong happen. I don't know why miner does not display this message to user...

HTTP 50x is returned when pool has outage.


Title: Re: New demonstration CPU miner available
Post by: eMansipater on January 07, 2011, 07:07:13 PM
Found it! (little bit of egg on my face though  ::) )  Usernames are case sensitive, and mine was autofilled as "eMansipater" when signing up for the account.  D'oh!


Title: Re: New demonstration CPU miner available
Post by: David Armstrong on January 07, 2011, 11:06:33 PM
You are right. --- But, consider this:

  1. The miner is general purpose. It have to work with the official bincoin client.

Searching for more than one solution doesn't break compatibility - bitcoind would just reject second solution. Nothing is lost, you will have new search space in a short period.

But even if other miners do this, I am not quite sure if it improves apparent performance (to pool). Every nonce has equal probability.

A nonce that isn't tested has zero probability  :)


Title: Re: New demonstration CPU miner available
Post by: huesped on January 08, 2011, 10:24:42 AM
Hey

I have an account on minining.bitcoin.cz and I crated own worker. In this line:

Code:
minerd -a cryptopp_asm32 --url http://minining.bitcoin.cz:8332 --userpass XXXXXXX:YYYYYYYYYY

should I write "huesped.name_of_worker:password" or only my nick without nick of worker?


Title: Re: New demonstration CPU miner available
Post by: doublec on January 08, 2011, 10:38:38 AM
should I write "huesped.name_of_worker:password" or only my nick without nick of worker?

This first one: "huesped.name_of_worker:password"


Title: Re: New demonstration CPU miner available
Post by: dooglus on January 12, 2011, 06:02:00 AM
The available options don't match the help text.

For instance:

Code:
$ ./minerd -q
./minerd: invalid option -- 'q'
minerd version 0.5

Usage:  minerd [options]

Supported options:
[...]
(-q) Disable per-thread hashmeter output (default: off)

-r doesn't work either.

Chris.


Title: Re: New demonstration CPU miner available
Post by: dooglus on January 12, 2011, 05:21:27 PM
--quiet works
-q doesn't

That's the bug I was reporting.

Similarly with -r.


Title: Re: New demonstration CPU miner available
Post by: dooglus on January 13, 2011, 08:32:06 PM
I regularly get a crash when running 2 threads, and never when running one.

I'm using the current git version, which claims to be "minerd version 0.5".

The crash looks like this:

Code:
$ ~/Programs/cpuminer/minerd --algo cryptopp_asm32 --threads 2 --url http://mining.bitcoin.cz:8332 --userpass user.worker:password
2 miner threads started, using SHA256 'cryptopp_asm32' algorithm.
[...]
HashMeter(1): 16777216 hashes, 569.79 khash/sec
HashMeter(0): 16777216 hashes, 447.54 khash/sec
*** longjmp causes uninitialized stack frame ***: /home/chris/Programs/cpuminer/minerd terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x50)[0xb7625cc0]
/lib/libc.so.6(+0xe5c2a)[0xb7625c2a]
/usr/lib/libcurl-gnutls.so.4(+0x8b18)[0xb76c4b18]
[0xb7726400]
/home/chris/Programs/cpuminer/minerd[0x8049956]
/lib/libc.so.6(__libc_start_main+0xe6)[0xb7556ce6]
/home/chris/Programs/cpuminer/minerd[0x8048e61]
======= Memory map: ========
08048000-08054000 r-xp 00000000 08:01 158243     /home/chris/Programs/cpuminer/minerd
08054000-08055000 r--p 0000b000 08:01 158243     /home/chris/Programs/cpuminer/minerd
08055000-08056000 rw-p 0000c000 08:01 158243     /home/chris/Programs/cpuminer/minerd
083e9000-0842b000 rw-p 00000000 00:00 0          [heap]
b61eb000-b6205000 r-xp 00000000 08:01 51253      /lib/libgcc_s.so.1
b6205000-b6206000 r--p 00019000 08:01 51253      /lib/libgcc_s.so.1
b6206000-b6207000 rw-p 0001a000 08:01 51253      /lib/libgcc_s.so.1
b6220000-b6221000 ---p 00000000 00:00 0
b6221000-b6a21000 rw-p 00000000 00:00 0
b6a21000-b6a25000 r-xp 00000000 08:01 17645      /lib/libnss_dns-2.12.2.so
b6a25000-b6a26000 r--p 00003000 08:01 17645      /lib/libnss_dns-2.12.2.so
b6a26000-b6a27000 rw-p 00004000 08:01 17645      /lib/libnss_dns-2.12.2.so
b6a27000-b6a29000 r-xp 00000000 08:01 2648       /lib/libnss_mdns4_minimal.so.2
b6a29000-b6a2a000 r--p 00001000 08:01 2648       /lib/libnss_mdns4_minimal.so.2
b6a2a000-b6a2b000 rw-p 00002000 08:01 2648       /lib/libnss_mdns4_minimal.so.2
b6a2b000-b6a35000 r-xp 00000000 08:01 21674      /lib/libnss_files-2.12.2.so
b6a35000-b6a36000 r--p 00009000 08:01 21674      /lib/libnss_files-2.12.2.so
b6a36000-b6a37000 rw-p 0000a000 08:01 21674      /lib/libnss_files-2.12.2.so
b6a37000-b6a38000 ---p 00000000 00:00 0
b6a38000-b723a000 rw-p 00000000 00:00 0
b723a000-b723c000 r-xp 00000000 08:01 1046       /lib/libkeyutils.so.1.3
b723c000-b723d000 r--p 00001000 08:01 1046       /lib/libkeyutils.so.1.3
b723d000-b723e000 rw-p 00002000 08:01 1046       /lib/libkeyutils.so.1.3
b723e000-b7240000 r-xp 00000000 08:01 14733      /lib/libdl-2.12.2.so
b7240000-b7241000 r--p 00001000 08:01 14733      /lib/libdl-2.12.2.so
b7241000-b7242000 rw-p 00002000 08:01 14733      /lib/libdl-2.12.2.so
b7242000-b7245000 r-xp 00000000 08:01 581        /lib/libgpg-error.so.0.8.0
b7245000-b7246000 r--p 00002000 08:01 581        /lib/libgpg-error.so.0.8.0
b7246000-b7247000 rw-p 00003000 08:01 581        /lib/libgpg-error.so.0.8.0
b7247000-b7248000 rw-p 00000000 00:00 0
b7248000-b7257000 r-xp 00000000 08:01 270737     /usr/lib/libtasn1.so.3.1.9
b7257000-b7258000 r--p 0000e000 08:01 270737     /usr/lib/libtasn1.so.3.1.9
b7258000-b7259000 rw-p 0000f000 08:01 270737     /usr/lib/libtasn1.so.3.1.9
b7259000-b725f000 r-xp 00000000 08:01 265677     /usr/lib/libkrb5support.so.0.1
b725f000-b7260000 r--p 00005000 08:01 265677     /usr/lib/libkrb5support.so.0.1
b7260000-b7261000 rw-p 00006000 08:01 265677     /usr/lib/libkrb5support.so.0.1
b7261000-b7263000 r-xp 00000000 08:01 2180       /lib/libcom_err.so.2.1
b7263000-b7264000 r--p 00001000 08:01 2180       /lib/libcom_err.so.2.1
b7264000-b7265000 rw-p 00002000 08:01 2180       /lib/libcom_err.so.2.1
b7265000-b7286000 r-xp 00000000 08:01 264676     /usr/lib/libk5crypto.so.3.1
b7286000-b7287000 r--p 00021000 08:01 264676     /usr/lib/libk5crypto.so.3.1
b7287000-b7288000 rw-p 00022000 08:01 264676     /usr/lib/libk5crypto.so.3.1
b7288000-b7330000 r-xp 00000000 08:01 265623     /usr/lib/libkrb5.so.3.3
b7330000-b7335000 r--p 000a8000 08:01 265623     /usr/lib/libkrb5.so.3.3
b7335000-b7336000 rw-p 000ad000 08:01 265623     /usr/lib/libkrb5.so.3.3
b7336000-b7337000 rw-p 00000000 00:00 0
b7337000-b734c000 r-xp 00000000 08:01 262572     /usr/lib/libsasl2.so.2.0.23
b734c000-b734d000 r--p 00015000 08:01 262572     /usr/lib/libsasl2.so.2.0.23
b734d000-b734e000 rw-p 00016000 08:01 262572     /usr/lib/libsasl2.so.2.0.23
b734e000-b735f000 r-xp 00000000 08:01 23646      /lib/libresolv-2.12.2.so
b735f000-b7360000 r--p 00010000 08:01 23646      /lib/libresolv-2.12.2.so
b7360000-b7361000 rw-p 00011000 08:01 23646      /lib/libresolv-2.12.2.so
b7361000-b7363000 rw-p 00000000 00:00 0
b7363000-b73d4000 r-xp 00000000 08:01 1042       /lib/libgcrypt.so.11.5.3
b73d4000-b73d5000 r--p 00070000 08:01 1042       /lib/libgcrypt.so.11.5.3
b73d5000-b73d7000 rw-p 00071000 08:01 1042       /lib/libgcrypt.so.11.5.3
b73d7000-b7468000 r-xp 00000000 08:01 264937     /usr/lib/libgnutls.so.26.14.12
b7468000-b746c000 r--p 00090000 08:01 264937     /usr/lib/libgnutls.so.26.14.12
b746c000-b746d000 rw-p 00094000 08:01 264937     /usr/lib/libgnutls.so.26.14.12
b746d000-b7480000 r-xp 00000000 08:01 1852       /lib/libz.so.1.2.3.4
b7480000-b7481000 r--p 00012000 08:01 1852       /lib/libz.so.1.2.3.4
b7481000-b7482000 rw-p 00013000 08:01 1852       /lib/libz.so.1.2.3.4
b7482000-b74b0000 r-xp 00000000 08:01 265607     /usr/lib/libgssapi_krb5.so.2.2
b74b0000-b74b1000 r--p 0002d000 08:01 265607     /usr/lib/libgssapi_krb5.so.2.2
b74b1000-b74b2000 rw-p 0002e000 08:01 265607     /usr/lib/libgssapi_krb5.so.2.2
b74b2000-b74b3000 rw-p 00000000 00:00 0
b74b3000-b74ba000 r-xp 00000000 08:01 23648      /lib/librt-2.12.2.so
b74ba000-b74bb000 r--p 00006000 08:01 23648      /lib/librt-2.12.2.so
b74bb000-b74bc000 rw-p 00007000 08:01 23648      /lib/librt-2.12.2.so
b74bc000-b74fe000 r-xp 00000000 08:01 265686     /usr/lib/libldap_r-2.4.so.2.5.6
b74fe000-b74ff000 r--p 00041000 08:01 265686     /usr/lib/libldap_r-2.4.so.2.5.6
b74ff000-b7500000 rw-p 00042000 08:01 265686     /usr/lib/libldap_r-2.4.so.2.5.6
b7500000-b7501000 rw-p 00000000 00:00 0
b7501000-b750c000 r-xp 00000000 08:01 265727     /usr/lib/liblber-2.4.so.2.5.6
b750c000-b750d000 r--p 0000a000 08:01 265727     /usr/lib/liblber-2.4.so.2.5.6
b750d000-b750e000 rw-p 0000b000 08:01 265727     /usr/lib/liblber-2.4.so.2.5.6
b750e000-b753e000 r-xp 00000000 08:01 262982     /usr/lib/libidn.so.11.6.1
b753e000-b753f000 r--p 0002f000 08:01 262982     /usr/lib/libidn.so.11.6.1
b753f000-b7540000 rw-p 00030000 08:01 262982     /usr/lib/libidn.so.11.6.1
b7540000-b769a000 r-xp 00000000 08:01 14730      /lib/libc-2.12.2.so
b769a000-b769b000 ---p 0015a000 08:01 14730      /lib/libc-2.12.2.so
b769b000-b769d000 r--p 0015a000 08:01 14730      /lib/libc-2.12.2.so
b769d000-b769e000 rw-p 0015c000 08:01 14730      /lib/libc-2.12.2.so
b769e000-b76a2000 rw-p 00000000 00:00 0
b76a2000-b76b8000 r-xp 00000000 08:01 23645      /lib/libpthread-2.12.2.so
b76b8000-b76b9000 r--p 00015000 08:01 23645      /lib/libpthread-2.12.2.so
b76b9000-b76ba000 rw-p 00016000 08:01 23645      /lib/libpthread-2.12.2.so
b76ba000-b76bc000 rw-p 00000000 00:00 0
b76bc000-b7708000 r-xp 00000000 08:01 262488     /usr/lib/libcurl-gnutls.so.4.2.0Aborted



Title: Re: New demonstration CPU miner available
Post by: Raulo on January 13, 2011, 11:24:28 PM
I regularly get a crash when running 2 threads, and never when running one.

I found the same problem on some of my systems. This is likely a bug in glibc.
See my post http://bitcointalk.org/index.php?topic=1925.msg31333#msg31333 (http://bitcointalk.org/index.php?topic=1925.msg31333#msg31333).

I recommend compiling your own libcurl with --enable-ares (you need to have c-ares libraries). After linking to such libcurl, the problem is gone and my miner is working without a crash for 2+ weeks.


Title: Re: New demonstration CPU miner available
Post by: SawEfDir on January 15, 2011, 10:19:53 PM
something doesn't seem to be quite right with algo_via on 64bit yet

here's the output of cpuminer for a positive hash that was found running on testnet:
Code:
DBG: found zeroes in hash:
52a65c69ea7bfda3788ee2337f9bece38dbdc6d918c4e16c05f567b700000000
PROOF OF WORK FOUND?  submitting...
PROOF OF WORK RESULT: true (yay!!!)

here is the correspoding output from bitcoins testnet debug log
Code:
BitcoinMiner:
proof-of-work found
  hash: 0000000005f567b718c4e16c8dbdc6d97f9bece3788ee233ea7bfda352a65c69
target: 0000000015ebbe00000000000000000000000000000000000000000000000000
CBlock(hash=0000000005f567b718c4, ver=1, hashPrevBlock=00000000144f6debddf8, hashMerkleRoot=d645677c76, nTime=1294828227, nBits=1c15ebbe, nNonce=14019820, vtx=1)
  CTransaction(hash=d645677c76, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(0000000000, -1), coinbase 04beeb151c0174)
    CTxOut(nValue=50.00000000, scriptPubKey=04bfa0f2be2ed07c434e900ec80e09)
  vMerkleTree: d645677c76
01/12/11 10:30 generated 50.00

it seems the byte swapping isn't working fully correctly yet, any hints?


Title: Re: New demonstration CPU miner available
Post by: lfm on January 15, 2011, 10:51:15 PM
something doesn't seem to be quite right with algo_via on 64bit yet

here's the output of cpuminer for a positive hash that was found running on testnet:
Code:
DBG: found zeroes in hash:
52a65c69ea7bfda3788ee2337f9bece38dbdc6d918c4e16c05f567b700000000
PROOF OF WORK FOUND?  submitting...
PROOF OF WORK RESULT: true (yay!!!)

here is the correspoding output from bitcoins testnet debug log
Code:
BitcoinMiner:
proof-of-work found
  hash: 0000000005f567b718c4e16c8dbdc6d97f9bece3788ee233ea7bfda352a65c69
target: 0000000015ebbe00000000000000000000000000000000000000000000000000
CBlock(hash=0000000005f567b718c4, ver=1, hashPrevBlock=00000000144f6debddf8, hashMerkleRoot=d645677c76, nTime=1294828227, nBits=1c15ebbe, nNonce=14019820, vtx=1)
  CTransaction(hash=d645677c76, ver=1, vin.size=1, vout.size=1, nLockTime=0)
    CTxIn(COutPoint(0000000000, -1), coinbase 04beeb151c0174)
    CTxOut(nValue=50.00000000, scriptPubKey=04bfa0f2be2ed07c434e900ec80e09)
  vMerkleTree: d645677c76
01/12/11 10:30 generated 50.00

it seems the byte swapping isn't working fully correctly yet, any hints?

nope, this is all correct. The line:
52a65c69ea7bfda3788ee2337f9bece38dbdc6d918c4e16c05f567b700000000

is actually the same value as the line:
  hash: 0000000005f567b718c4e16c8dbdc6d97f9bece3788ee233ea7bfda352a65c69

which looks like a 32 bit word swap but the byteswap involved is hidden

If this was not done right you would not have gotten the 50.00 btc at the end.


Title: Re: New demonstration CPU miner available
Post by: The Script on January 16, 2011, 12:02:36 AM

So reading these posts I've realized I'm way out of my league.  I downloaded this miner but don't know how to use it.  I have virtually no programming experience so I don't understand all the technical talk in previous threads.  I'm trying to join Slush's pool mining operation but when I open the CPU-miner.exe file it says

HTTP request failed: couldn't connect to host
json_rpc_call failed, retry after 30 seconds

I know that I have to pass my worker credentials to the program and then connect to Slush's URL, but don't know how to do that.  If someone could help I'd appreciate it.

Thanks.


Title: Re: New demonstration CPU miner available
Post by: jontaylor on January 16, 2011, 12:44:42 AM
Hello

I installed libcurl and jansson on my new Ubuntu 10.10 system.

When I run sudo ./minerd --help

I get this:
./minerd: error while loading shared libraries: libjansson.so.0: cannot open shared object file: No such file or directory.

This lib was installed in: /usr/local/lib

Also the readme describes an autogen.sh file i don't have and it says that jansson is optional???

Any thoughts?

Thanks
Jon


Title: Re: New demonstration CPU miner available
Post by: doublec on January 16, 2011, 01:55:57 AM
I know that I have to pass my worker credentials to the program and then connect to Slush's URL, but don't know how to do that.  If someone could help I'd appreciate it.

Code:
minerd --userpass username.minername:minerpassword --url http://mining.bitcoin.cz:8332 --algo 4way

Replace 'username'  with your username on the pool site. Replace 'minername' and 'minerpassword' with the miner's name and password that you registered on the pool site. Replace (or keep) '4way' with whatever algorithm you want ('c', 'cryptopp', cryptopp_asm32', etc).


Title: Re: New demonstration CPU miner available
Post by: doublec on January 16, 2011, 01:58:28 AM
Also the readme describes an autogen.sh file i don't have and it says that jansson is optional???

If you don't have jansson installed then the cpuminer build system uses its own source copy of it. Try uninstalling libjansson and reconfiguring/building.


Title: Re: New demonstration CPU miner available
Post by: SawEfDir on January 16, 2011, 07:07:45 AM
which looks like a 32 bit word swap but the byteswap involved is hidden

If this was not done right you would not have gotten the 50.00 btc at the end.

If you reverse the hash from cpuminer, the nibbles in each word are reversed. You would need to reverse the nibbles in each word, as well, in order to get the right hash. I guess the hash calculated is still correct, but it makes for bad surprises checking the minerd's output, getting hashes that seem to hit the target but actually don't.


Title: Re: New demonstration CPU miner available
Post by: LZ on January 17, 2011, 01:02:47 PM
I know that I have to pass my worker credentials to the program and then connect to Slush's URL, but don't know how to do that.
It seems that you use Windows. The easiest way for you is to install CPU miner (https://www.bitcoin.org/smf/index.php?topic=1925.0) and then
find the file on your desktop without any name. In fact, it is a shortcut, and you can give
it any name, if you wish. Then go to its properties and add all need command line options.


Title: Re: New demonstration CPU miner available
Post by: lfm on January 18, 2011, 04:55:50 AM
I installed libcurl and jansson on my new Ubuntu 10.10 system.

When I run sudo ./minerd --help

I get this:
./minerd: error while loading shared libraries: libjansson.so.0: cannot open shared object file: No such file or directory.

This lib was installed in: /usr/local/lib

Also the readme describes an autogen.sh file i don't have and it says that jansson is optional???

Any thoughts?

did you remember ldconfig ?


Title: Re: New demonstration CPU miner available
Post by: BeeCee1 on January 20, 2011, 03:31:30 AM
I found the configure script didn't correctly recognize my cpu (an I5) on Ubuntu 10.10.  Since it didn't ID it, I didn't get SSE2 4way support.  I added -msse2 -march=core2 to the CFLAGS and it worked (I added it in the Makefile, but adding it in the configure script should work).  If you don't get SSE2 support you can try this.

I also found changing the -O2 to -O4 gave me a bit more than a 2% speed increase.  I'll take every khash I can get.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on January 20, 2011, 07:35:55 AM
I found the configure script didn't correctly recognize my cpu (an I5) on Ubuntu 10.10.  Since it didn't ID it, I didn't get SSE2 4way support.  I added -msse2 -march=core2 to the CFLAGS and it worked (I added it in the Makefile, but adding it in the configure script should work).  If you don't get SSE2 support you can try this.

I also found changing the -O2 to -O4 gave me a bit more than a 2% speed increase.  I'll take every khash I can get.

Yeah, the configure script is not intended to "recognize your cpu."  If you are doing your own builds, you are expected to be able to supply the best compiler flags for your CPU through the CFLAGS environment variable.  This is the standard, recognized method for passing compiler flags to 95% of all configure scripts:

Code:
    CFLAGS="-O3 -march=native" ./configure

-march=native tells recent gcc versions to build programs tuned specificaly for the build machine's CPU (and may not work on other CPUs).  By default, the compiler tries to generate code that is best suited to a wide range of CPUs.


Title: Re: New demonstration CPU miner available
Post by: BeeCee1 on January 21, 2011, 02:00:02 AM
Yeah, the configure script is not intended to "recognize your cpu."  If you are doing your own builds, you are expected to be able to supply the best compiler flags for your CPU through the CFLAGS environment variable.  This is the standard, recognized method for passing compiler flags to 95% of all configure scripts:

Code:
    CFLAGS="-O3 -march=native" ./configure

-march=native tells recent gcc versions to build programs tuned specificaly for the build machine's CPU (and may not work on other CPUs).  By default, the compiler tries to generate code that is best suited to a wide range of CPUs.


You're right.  since it compiled with 4way support on a different machine I thought the configure script was making the choice.  On further reflection it seems more likely it is because the other machine is running in 64bit mode (which always has sse2).  -march=native didn't give me better results, I don't thing GCC recognizes my chip so uses more generic instructions, I still had to give -march=core2 for best performance.


Title: Re: New demonstration CPU miner available
Post by: gusti on January 25, 2011, 02:07:46 PM
Hi :

I'm running minerd in a Debian environment.
Is there any way to run it as a daemon, with no terminal needed ?

Tks
Gustavo


Title: Re: New demonstration CPU miner available
Post by: lfm on January 26, 2011, 07:18:24 AM
Hi :

I'm running minerd in a Debian environment.
Is there any way to run it as a daemon, with no terminal needed ?

Tks
Gustavo

add " --quiet >>miner.log 2>&1 & " onto your start command and it will run in background just fine



Title: Re: New demonstration CPU miner available
Post by: jgarzik on January 29, 2011, 07:18:57 AM
cpuminer version 0.6 released (see top of thread for URLs).

Changes:
- Fetch new work unit, if scanhash takes longer than 5 seconds (--scantime)
- BeeCee1's sha256 4way optimizations (faster!)
- lfm's byte swap optimization (faster! improves via, cryptopp)
- Fix non-working short options -q, -r

SHA1: d4c21a3fc1c3f433771101cf1e71186df3a94032  cpuminer-installer-0.6.zip
MD5: 1936f4f71574643825f8d8d31e456a3a  cpuminer-installer-0.6.zip


Title: Re: New demonstration CPU miner available
Post by: jgarzik on February 04, 2011, 07:33:57 PM
cpuminer version 0.6.1 released (see top of thread for URLs).

Changes:
- Fully validate "hash < target", rather than simply stopping our scan
  if the high 32 bits are 00000000.
- Add --retry-pause, to set length of pause time between failure retries
- Display proof-of-work hash and target, if -D (debug mode) enabled
- Fix max-nonce auto-adjustment to actually work.  This means if your
  scan takes longer than 5 seconds (--scantime), the miner will slowly
  reduce the number of hashes you work on, before fetching a new work unit.

SHA1: dca174e0e433cda072a1acd7884dbdc15fa4a53c  cpuminer-installer-0.6.1.zip
MD5: 675242118b337c6d2bfc23a13eb2dd82  cpuminer-installer-0.6.1.zip


Title: Re: New demonstration CPU miner available
Post by: geekmug on February 07, 2011, 06:37:49 AM
- lfm's byte swap optimization (faster! improves via, cryptopp)

This optimization (__builtin_bswap32) is only available on gcc 4.3 or later, and it's a bit silly because you can get this optimization from <byteswap.h> via bswap_32() (which is smart enough to use the bswap opcode) on gcc 2.0 or later. AFAIK, as long as you have optimizations turned on, the generated code is identical. I appreciate your work here, I am using your miner on my servers to mine with their idle cpu-time -- the power is already bought, after all. I've attached a patch if you don't want to trust bswap_32() to be equivalent:

Code:
diff --git a/miner.h b/miner.h
index 539b5d6..eef4ee0 100644
--- a/miner.h
+++ b/miner.h
@@ -1,6 +1,7 @@
 #ifndef __MINER_H__
 #define __MINER_H__
 
+#include <byteswap.h>
 #include <stdbool.h>
 #include <stdint.h>
 #include <sys/time.h>
@@ -24,7 +25,11 @@
 
 static inline uint32_t swab32(uint32_t v)
 {
+#if (__GNUC__ >= 4 && __GNUC_PATCHLEVEL__ >= 3)
        return __builtin_bswap32(v);
+#else
+       return bswap_32(v);
+#endif
 }
 
 static inline void swap256(void *dest_p, const void *src_p)



Title: Re: New demonstration CPU miner available
Post by: roldansu on February 08, 2011, 01:53:35 PM
Hi,

I'm trying to run the miner on my Ubuntu 8.04 (Hardy) system, with an Intel Pentium Dual CPU E2140 .

The  CFLAGS="-O3 -Wall -msse2" ./configure command seems to work fine, but then after the "make" command I get the following:

make  all-recursive
make[1]: Entering directory `/home/roldansu/Desktop/cpuminer-0.6.1'
Making all in compat
make[2]: Entering directory `/home/roldansu/Desktop/cpuminer-0.6.1/compat'
Making all in jansson
make[3]: Entering directory `/home/roldansu/Desktop/cpuminer-0.6.1/compat/jansson'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/roldansu/Desktop/cpuminer-0.6.1/compat/jansson'
make[3]: Entering directory `/home/roldansu/Desktop/cpuminer-0.6.1/compat'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/roldansu/Desktop/cpuminer-0.6.1/compat'
make[2]: Leaving directory `/home/roldansu/Desktop/cpuminer-0.6.1/compat'
make[2]: Entering directory `/home/roldansu/Desktop/cpuminer-0.6.1'
gcc  -O3 -Wall -msse2 -pthread  -o minerd cpu-miner.o sha256_generic.o sha256_4way.o sha256_via.o sha256_cryptopp.o util.o -lcurl -Wl,-Bsymbolic-functions -lgssapi_krb5 compat/jansson/libjansson.a -lpthread
sha256_via.o: In function `scanhash_via':
sha256_via.c:(.text+0x4c): undefined reference to `__builtin_bswap32'
sha256_via.c:(.text+0x70): undefined reference to `__builtin_bswap32'
sha256_via.c:(.text+0x120): undefined reference to `__builtin_bswap32'
sha256_via.c:(.text+0x12e): undefined reference to `__builtin_bswap32'
sha256_via.c:(.text+0x13c): undefined reference to `__builtin_bswap32'
sha256_via.o:sha256_via.c:(.text+0x14a): more undefined references to `__builtin_bswap32' follow
collect2: ld returned 1 exit status
make[2]: *** [minerd] Error 1
make[2]: Leaving directory `/home/roldansu/Desktop/cpuminer-0.6.1'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/roldansu/Desktop/cpuminer-0.6.1'
make: *** [all] Error 2

My programing knowledge is almost zero, so I'd appreciate some advice on this.

Thanks


Title: Re: New demonstration CPU miner available
Post by: Cerebrum on February 09, 2011, 06:52:16 PM
So, I was looking at the processor meter in my machine while the miner was running, and noticed something strange: Every time a work-unit is completed, that processor sits idle for a few seconds.

I looked through the code to see what was causing this, and I found that the I/O for the getwork() calls is done inside the mining threads while the main thread sits idle and waits for the miners to exit.

To fix this, I implemented a blocking bounded queue and had the main thread constantly do getwork() commands while the mining threads crunch the resulting work. This seems to have removed the potentially long wait for a response form the RPC server, especially when doing pooled mining from a remote server.

However, something strange is occurring. When I set the queue up such that each mining thread has a small work queue of length 1, there is no problem and the system works as intended. However, when the queue length goes above one for each queue, all the results get a response to the effect that they are invalid. I have verified that the correct data is getting into the work structures, so I'm asking in here because I don't know much about how this RPC system works.

Is there some reason that the same thread can't do this queueing? For instance, some kind of an ID for the block that gets overwritten if a new getwork() request is made? I'm doing this while mining in slush's pool, so is that causing a problem?


Title: Re: New demonstration CPU miner available
Post by: slush on February 10, 2011, 01:40:07 AM
However, something strange is occurring. When I set the queue up such that each mining thread has a small work queue of length 1, there is no problem and the system works as intended. However, when the queue length goes above one for each queue, all the results get a response to the effect that they are invalid.

How old are these calls? Miners need to have jobs as fresh as possible. Crunching too old jobs leads to rejecting by pool server. Usualy the ask rate is 5 seconds, this leads only to decent overhead.


Title: Re: New demonstration CPU miner available
Post by: Cerebrum on February 10, 2011, 01:56:15 AM
Well, the queue length I was testing was three. My processor can get through a getwork() in about 5 seconds per core, so I guess I was falling outside of that range for your server. Well, I guess this can't be solved in the way I was thinking. Maybe there's some other way to do it, I'll have to think through how I could do it without a queue and without taking a long time. Maybe having the miner threads call to the main thread to get the next work unit ready just before they crunch an existing one would be a good idea. I'll look into doing that.

Also, it looks like an entire new curl object is created every time that you want to get more work. It might be a good idea to use the existing object over again, since I'm sure that wastes some resources and time. All requests for more work have the same form anyway. I'll see if I can get that working as well, and then I'll submit my changes here. I'm not so sure how to git, so if anyone could link me a good tutorial on how to use it to make those patch files that seem so popular, I would be grateful.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on February 10, 2011, 05:55:24 AM
Just committed two changes to git, based on suggestions here:
  • Re-use CURL object.  This means persistent HTTP/1.1 connections, if your pool server supports it!
  • Use bswap_32(), if compiler does not provide intrinsic.  Useful for older OS's.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on February 10, 2011, 06:01:12 AM
Well, the queue length I was testing was three. My processor can get through a getwork() in about 5 seconds per core, so I guess I was falling outside of that range for your server. Well, I guess this can't be solved in the way I was thinking. Maybe there's some other way to do it, I'll have to think through how I could do it without a queue and without taking a long time. Maybe having the miner threads call to the main thread to get the next work unit ready just before they crunch an existing one would be a good idea. I'll look into doing that.

Someone implemented a work queue a long time ago.  The reason that changed was never merged into upstream:  it basically guaranteed that you are always working on "old work," lagging a second or three.  Ideally, a background thread polls for work, carefully observing timings sufficient that it issues a 'getwork' JSON-RPC call, downloads and parses the JSON response just in time for a thread to request new work from the queue.


Title: Re: New demonstration CPU miner available
Post by: tashlan on February 10, 2011, 07:45:51 AM
I'll throw my suggestion in too.. any chance the miner could optionally time-stamp the successful results?

Maybe something like: "PROOF OF WORK RESULT: true (yay!!!) 18:24:32 02.10.2011"


Title: Re: New demonstration CPU miner available
Post by: Cerebrum on February 10, 2011, 01:08:10 PM

Someone implemented a work queue a long time ago.  The reason that changed was never merged into upstream:  it basically guaranteed that you are always working on "old work," lagging a second or three.  Ideally, a background thread polls for work, carefully observing timings sufficient that it issues a 'getwork' JSON-RPC call, downloads and parses the JSON response just in time for a thread to request new work from the queue.


OK, that sounds like a good plan. I'll see what I can do to get that working. Maybe I can get an average time for the mining thread to process one getwork(), and the average time for a getwork() to resolve. I'll look into how the threads might be scheduled more effectively.

Also, it may be a good idea to set CURLOPT_DNS_CACHE_TIMEOUT to -1 or suggest that people use the IP address of the server they wish to connect to instead of the hostname. I used both, and the performance of the networking code improved significantly in both cases. However, this might cause a problem if the IP address of the server changes while crunching is happening. Maybe causing the cache to reset whenever a connection fails would be a good idea. Again, I'll look into doing these things.


Title: Re: New demonstration CPU miner available
Post by: slush on February 10, 2011, 02:30:53 PM
suggest that people use the IP address of the server

No please! No for my pool! Hardcoded IP makes system migration almost impossible or with significant drop in hashrate until all of 400 workers is fixed. I already migrated server to stronger machine and I'll do it again soon.


Title: Re: New demonstration CPU miner available
Post by: Cerebrum on February 10, 2011, 05:42:27 PM
No please! No for my pool! Hardcoded IP makes system migration almost impossible or with significant drop in hashrate until all of 400 workers is fixed. I already migrated server to stronger machine and I'll do it again soon.

So instead, perhaps we make the DNS cache not expire, except in cases where the connection fails. When a failure occurs, we assume that the IP address of the server might have changed, so we will clear the cache and do the DNS look-up again. I'll look into how to do this with CURL.


Title: Re: New demonstration CPU miner available
Post by: slush on February 11, 2011, 10:19:11 AM
So instead, perhaps we make the DNS cache not expire, except in cases where the connection fails. When a failure occurs, we assume that the IP address of the server might have changed, so we will clear the cache and do the DNS look-up again. I'll look into how to do this with CURL.

Yes, this is better. But, it is necessary? DNS typically expires once every 8 hours, so if your DNS cache works properly, you're saving rountrip of 3 requests daily. Worthless.


Title: Re: New demonstration CPU miner available
Post by: Cerebrum on February 11, 2011, 01:35:50 PM
Yes, this is better. But, it is necessary? DNS typically expires once every 8 hours, so if your DNS cache works properly, you're saving rountrip of 3 requests daily. Worthless.

Yes, however, libcurl has its internal DNS cache set to expire once every 60 seconds. So I'd be saving 1440 DNS requests per day and per thread even after the changes that jgarzik recently made to the networking code are released. This will be an increase in performance of about 1.6% over the current code in the git repository (assumes one second to do a DNS look-up, which is what I experience at my machine).

Also the current release of the program does one DNS request for every time it does work since it does not re-use curl objects. My local DNS server blows and takes almost a full second to do a look-up, so you can imagine that this gets very costly, since the network code is synchronous with the crunching code. I was spending 10-20% of my time doing DNS requests instead of crunching hashes before making changes to the code to prevent this. This is the reason that I started looking at the code: I wanted to know why my processors were sitting idle for so much time instead of making hashes.

EDIT:

I think I just changed some of the files in the git repository:
-DNS caching now lasts indefinitely, until a connection attempt fails, at which point the cache is cleared and the look-up happens again.
-All threads use a single shared CURL object which is initialized only once.
-Yay and Boo results are now timestamped.

I've been testing this in slush's pool for the last few minutes and it's working fine so far, it's found about 5 shares.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on February 11, 2011, 06:13:20 PM
The current solution in git is sufficient: We re-use the CURL object in each miner thread, which implies we fully cache DNS entries according to their cache timeouts.


Title: Re: New demonstration CPU miner available
Post by: tashlan on February 13, 2011, 12:33:17 AM
Thank you Cerebrum for your code contributions.  I think such code review is great and eagerly await the packaging into the next version of the client (thanks jgarzik).


Title: Re: New demonstration CPU miner available
Post by: jgarzik on February 13, 2011, 12:48:28 AM
I'm sorry but it's me again))

after I added CFLAGS
./configure CFLAGS="-I/usr/local/include"
and then run "make"
I get another error :)

Quote
vitsum# make
make  all-recursive
Making all in compat
Making all in jansson
gcc  -I/usr/local/include -pthread   -o minerd cpu-miner.o sha256_generic.o  sha256_4way.o sha256_via.o  sha256_cryptopp.o util.o -L/usr/local/lib -lcurl -rpath=/usr/lib:/usr/local/lib -lssl -lcrypto -lz compat/jansson/libjansson.a -lpthread
sha256_via.o(.text+0x49): In function `scanhash_via':
/root/cpuminer-0.6.1/miner.h:27: undefined reference to `__builtin_bswap32'
sha256_via.o(.text+0xd5):/root/cpuminer-0.6.1/miner.h:27: undefined reference to `__builtin_bswap32'
sha256_via.o(.text+0x189):/root/cpuminer-0.6.1/miner.h:27: undefined reference to `__builtin_bswap32'
util.o(.text+0xb44): In function `swab32':
: undefined reference to `__builtin_bswap32'
*** Error code 1

Stop in /root/cpuminer-0.6.1.
*** Error code 1

Stop in /root/cpuminer-0.6.1.
*** Error code 1

Stop in /root/cpuminer-0.6.1.

What do I do wrong?

This is a bug in the current version, that is fixed in git.  Scroll up for the bswap fix, check out the fix from the git repository, or wait for the next release.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on February 13, 2011, 01:04:36 AM
cpuminer version 0.7 is released (see top of thread for URLs).

Changes:
- Re-use CURL object, thereby reusing DNS cache and HTTP connections.  Pool users are strongly encouraged to upgrade to this version of cpuminer.
- Use bswap_32, if compiler intrinsic is not available.  Fixes "__builtin_bswap32" compile problems.
- Disable full target validation (as opposed to simply H==0) for now

SHA1: 9fb370d019e475d9a01a34c42fbcbcae823d971b  cpuminer-installer-0.7.zip
MD5: 3546f606c99bdba9ad2796ecfa86f2cc  cpuminer-installer-0.7.zip



Title: Re: New demonstration CPU miner available
Post by: Cryptoman on February 13, 2011, 01:12:03 AM
Changes:
- Re-use CURL object, thereby reuseing DNS cache and HTTP connections.  Pool users are strongly encouraged to upgrade to this version of cpuminer.

This is a very welcome update.  I was using IPs rather than hostnames to partially work around this problem.  Thanks!


Title: Re: New demonstration CPU miner available
Post by: Big Bear on February 13, 2011, 09:34:47 AM
So what command line do I write to execute the new program?

I've tried...

minerd -url=mining.bitcoin.cz:8332 -user=XXXX.XXXX -password=XXXXXXX

but all I get is the help options?

is there a way I can change or see the program settings so I don't have to constantly write that in to start the program?

Thanks!


Title: Re: New demonstration CPU miner available
Post by: BitLex on February 13, 2011, 10:24:48 AM
try --userpass=worker.ID:pass


Title: Re: New demonstration CPU miner available
Post by: Big Bear on February 13, 2011, 11:05:38 AM
try --userpass=worker.ID:pass

Didn't work. I still get the program options menu.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on February 13, 2011, 11:23:11 AM
So what command line do I write to execute the new program?

I've tried...

minerd -url=mining.bitcoin.cz:8332 -user=XXXX.XXXX -password=XXXXXXX

but all I get is the help options?

The help shows you need two dashes (--), but you are providing only one dash (-).


Title: Re: New demonstration CPU miner available
Post by: dishwara on February 13, 2011, 12:45:40 PM
1 miner threads started, using SHA256 'c' algorithm.
HTTP request failed: The requested URL returned error: 400
json_rpc_call failed, retry after 30 seconds

C:\CPU-miner\minerd.exe --url=http://minining.bitcoin.cz:8332  --userpass=***:***

Windows 7 32 bit, not same workers.
How to solve?


Title: Re: New demonstration CPU miner available
Post by: vitsum on February 13, 2011, 01:01:26 PM

C:\CPU-miner\minerd.exe --url=http://minining.bitcoin.cz:8332  --userpass=***:***
not minining.
mining


Title: Re: New demonstration CPU miner available
Post by: Big Bear on February 13, 2011, 01:51:47 PM
I got the same thing as dishwara, pretty sure I spelled it right.


Title: Re: New demonstration CPU miner available
Post by: vitsum on February 13, 2011, 02:07:31 PM
probably you type wrong pass or username.
on mining.bitcoin.cz - username has such format username.worker
in my case it is vitsum.worker1
this worker should be registered at your account
i tried to enter wrong username/pass and got the same error, so I suggest you to recheck it =)


Title: Re: New demonstration CPU miner available
Post by: Big Bear on February 13, 2011, 02:58:47 PM
Here's what I happens...

C:\>cd cpu-miner

C:\>CPU-miner>minerd.exe --url=http://mining.bitcoin.cz:8332 --userpass=grizzly.fire:redlake

1 miner threads started, using SHA256 'c' algorithm.
HTTP request failed: The requested URL returned error: 400
json_rpc_call failed, retry after 30 seconds


I know how to spell my worker names, I have my mining pool account open on the other tab. I've literally tried this a hundred times, in various combinations.. Ever since I installed this latest version, my puddinpop miner fails to work as well. :(

I can't seem to figure this out, it's really frustrating.


Title: Re: New demonstration CPU miner available
Post by: vitsum on February 13, 2011, 03:39:43 PM
is grizzly.fire:redlake real? I tried and got your error, but when I tried my login:password everything worked

C:\Documents and Settings\User>C:\CPU-miner\minerd.exe --url http://mining.bitcoin.cz:8332 --userpass vitsum.two:******

and there must not be "=" just space " "


Title: Re: New demonstration CPU miner available
Post by: Big Bear on February 13, 2011, 04:18:46 PM
Thanks for the help... turns out I wasn't donating enough!


Title: Re: New demonstration CPU miner available
Post by: tuxsoul on February 14, 2011, 03:59:55 AM
Hi,

Thanks @jgarzik, bitcoin-cpuminer is ready for debian and ubuntu:
http://bitcointalk.org/index.php?topic=2207.msg48507#msg48507

Greeting's.


Title: Re: New demonstration CPU miner available
Post by: Chuck on February 14, 2011, 04:49:17 AM
cpuminer version 0.7 is released (see top of thread for URLs).


I am getting slightly slower speeds with this version, compared to 0.6.1. Using an AMD 640 and 4way I was getting 2839 per core, now 2819. Running on Windows 7.

Also, for whatever strange reason, my GPU miner (poclbm) gives better rates (an extra 5000 khash/sec on a 5850) when my CPU is nearly maxed out. With this new version, I am not seeing as much of a boost like I was with 0.6.1. For now I will stick with the old version...


Title: Re: New demonstration CPU miner available
Post by: Raulo on February 14, 2011, 12:46:52 PM
I am getting slightly slower speeds with this version, compared to 0.6.1. Using an AMD 640 and 4way I was getting 2839 per core, now 2819.

The same with me. Although I can go back (almost) to the old hashspeed by commenting out the following lines in sha256_4way.c
Code:
//if (fulltest(phash, ptarget)) {
  *nHashesDone = nonce;
  *nNonce_p = nonce + j;
  return nonce + j;
//}

fulltest returns true all the time anyway in the current version.


Title: Re: New demonstration CPU miner available
Post by: nelisky on February 14, 2011, 02:17:52 PM
Tried this on osx 10.6, using gcc 4.2.1, which does not have the builtin byte swap, apparently:

Code:
#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
#define WANT_BUILTIN_BSWAP
#else
#include <byteswap.h>
#endif

But the current master HEAD (6d2882937f8b2a5291ae68ae9ea985ad5271d0fb) does not have this byteswap.h file.

Also, using ./autogen.h left me with a weird check for libcurl in configure:

Code:
LIBCURL_CHECK_CONFIG(, 7.10.1, ,
  AC_MSG_ERROR([Missing required libcurl >= 7.10.1]))



Title: Re: New demonstration CPU miner available
Post by: jgarzik on February 14, 2011, 05:34:01 PM
Tried this on osx 10.6, using gcc 4.2.1, which does not have the builtin byte swap, apparently:

Code:
#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
#define WANT_BUILTIN_BSWAP
#else
#include <byteswap.h>
#endif

But the current master HEAD (6d2882937f8b2a5291ae68ae9ea985ad5271d0fb) does not have this byteswap.h file.

byteswap.h is provided by your OS.  cpuminer will probably need a few minor patches before building on osx.   Patches welcome!

Quote
Also, using ./autogen.h left me with a weird check for libcurl in configure:

Code:
LIBCURL_CHECK_CONFIG(, 7.10.1, ,
  AC_MSG_ERROR([Missing required libcurl >= 7.10.1]))

Why is that weird?  That's the standard CURL autotools macro invocation.


Title: Re: New demonstration CPU miner available
Post by: nelisky on February 14, 2011, 05:36:55 PM
Tried this on osx 10.6, using gcc 4.2.1, which does not have the builtin byte swap, apparently:

Code:
#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
#define WANT_BUILTIN_BSWAP
#else
#include <byteswap.h>
#endif

But the current master HEAD (6d2882937f8b2a5291ae68ae9ea985ad5271d0fb) does not have this byteswap.h file.

byteswap.h is provided by your OS.  cpuminer will probably need a few minor patches before building on osx.   Patches welcome!

Right, I'll find where that is on my OS and why it isn't picked up using the default paths then.

Quote




Quote
Also, using ./autogen.h left me with a weird check for libcurl in configure:

Code:
LIBCURL_CHECK_CONFIG(, 7.10.1, ,
  AC_MSG_ERROR([Missing required libcurl >= 7.10.1]))

Why is that weird?  That's the standard CURL autotools macro invocation.


Because:
Code:
$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
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 whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
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 ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking whether gcc needs -traditional... no
checking whether gcc and cc understand -c and -o together... yes
checking for ranlib... ranlib
checking for ANSI C header files... yes
checking for json_loads in -ljansson... no
checking for pthread_create in -lpthread... yes
checking for pkg-config... /opt/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
./configure: line 4301: syntax error near unexpected token `,'
./configure: line 4301: `LIBCURL_CHECK_CONFIG(, 7.10.1, ,'


Title: Re: New demonstration CPU miner available
Post by: jgarzik on February 14, 2011, 06:41:34 PM
Because:
Code:
$ ./configure
[...]
checking for pkg-config... /opt/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
./configure: line 4301: syntax error near unexpected token `,'
./configure: line 4301: `LIBCURL_CHECK_CONFIG(, 7.10.1, ,'

autogen could not find your libcurl autoconf macros.  Sounds like you have a non-standard installation, outside the normal autoconf/automake paths.



Title: Re: New demonstration CPU miner available
Post by: nelisky on February 14, 2011, 07:02:40 PM
Because:
Code:
$ ./configure
[...]
checking for pkg-config... /opt/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
./configure: line 4301: syntax error near unexpected token `,'
./configure: line 4301: `LIBCURL_CHECK_CONFIG(, 7.10.1, ,'

autogen could not find your libcurl autoconf macros.  Sounds like you have a non-standard installation, outside the normal autoconf/automake paths.



Yeah, I'm probably crying wolf a bit. My development environment is highly customized, both for work requirements and laziness factors. I'll work my way around these issues myself, sorry for the inconvenience :)


Title: Re: New demonstration CPU miner available
Post by: chromicant on February 14, 2011, 07:36:07 PM
I've been looking at the code, and my collection of ARM boxes...

For @jgarzik, would you accept pull requests as a way to share patches (via github) the way you want to manage patches? I'm looking at adding a benchmark code to automagically select a core, and *cough* eying how to get the best performance out of this TI DM3730...wonder how fast the DSP really is as a "second core", and porting to NEON.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on February 14, 2011, 09:14:25 PM
For @jgarzik, would you accept pull requests as a way to share patches (via github) the way you want to manage patches? I'm looking at adding a benchmark code to automagically select a core, and *cough* eying how to get the best performance out of this TI DM3730...wonder how fast the DSP really is as a "second core", and porting to NEON.

github pull request, emailed pull request (Linux kernel-style) or a posted patch are all welcomed.  It's a small project :)


Title: Re: New demonstration CPU miner available
Post by: hangover on February 15, 2011, 03:22:26 PM
Because:
Code:
$ ./configure
[...]
checking for pkg-config... /opt/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
./configure: line 4301: syntax error near unexpected token `,'
./configure: line 4301: `LIBCURL_CHECK_CONFIG(, 7.10.1, ,'

autogen could not find your libcurl autoconf macros.  Sounds like you have a non-standard installation, outside the normal autoconf/automake paths.


I have the same thing. Trying to configure sources on FreeBSD 8.1-RELEASE-p2 i386.
Maybe, there are some linker flags or workarounds or something?


Title: Re: New demonstration CPU miner available
Post by: adv on February 16, 2011, 01:11:29 AM
Hello Jgarzik.
Thanks for the good miner.

I want to suggest some improvements (possibly incorrect).
As I understand your sources. Now, each thread makes his getwork and processes it.
Why not parallelize the processing of one getwork a few threads? Like this: thread_1(nonce = 0 to N), thread_2(nonce = N to M), ..., thread_X(nonce = Y to Z).

This should reduce the load on the network and the loss in the processing of RPC request. (For the case when the block solution time > maximum admissible (skantime). But this is the most common case, no?)

The following improvements (for the distant future) - Miner parallelization on multiple hosts with the aid of a binary (for fast) protocol supports pooling, an indication of nonse range and calibrate the performance of customers (to determine the nonce range). In practice, this task of building a new server pool with their customers. It is interesting to you?

P.S.
This is somewhat similar to the processing of one getwork on SSE2 processors that are discussed in the next thread.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on February 16, 2011, 02:35:23 AM
I want to suggest some improvements (possibly incorrect).
As I understand your sources. Now, each thread makes his getwork and processes it.
Why not parallelize the processing of one getwork a few threads? Like this: thread_1(nonce = 0 to N), thread_2(nonce = N to M), ..., thread_X(nonce = Y to Z).

This should reduce the load on the network and the loss in the processing of RPC request. (For the case when the block solution time > maximum admissible (skantime). But this is the most common case, no?)

Yes, this is a good idea for the future.  If someone wanted to contributed a clean implementation of this, I would accept it.

As it stands now, simply starting completely independent threads was easier to code.  Breaking up the nonce work implies some level of coordination among threads, which must be done carefully to avoid hurting performance due to locks / asynchronous queues / similar threading details.  One must also take care never to stall one thread, while it waits on other threads.  This is not a hard problem... but it must be done right to avoid these pitfalls.

Quote
The following improvements (for the distant future) - Miner parallelization on multiple hosts with the aid of a binary (for fast) protocol supports pooling, an indication of nonse range and calibrate the performance of customers (to determine the nonce range). In practice, this task of building a new server pool with their customers. It is interesting to you?

Pooling already exists.  See this thread (http://bitcointalk.org/index.php?topic=1976.0), or see this thread (http://bitcointalk.org/index.php?topic=3493.0) for a binary pool protocol.



Title: Re: New demonstration CPU miner available
Post by: jgarzik on February 16, 2011, 02:37:51 AM
Because:
Code:
$ ./configure
[...]
checking for pkg-config... /opt/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
./configure: line 4301: syntax error near unexpected token `,'
./configure: line 4301: `LIBCURL_CHECK_CONFIG(, 7.10.1, ,'

autogen could not find your libcurl autoconf macros.  Sounds like you have a non-standard installation, outside the normal autoconf/automake paths.


I have the same thing. Trying to configure sources on FreeBSD 8.1-RELEASE-p2 i386.
Maybe, there are some linker flags or workarounds or something?

The solution here is easy:  don't build from git, build from tarball releases.  The tarball already has the proper configure script generated, so you don't have to worry about missing macros or broken OS configurations.



Title: Re: New demonstration CPU miner available
Post by: hangover on February 16, 2011, 08:25:03 AM
I have the same thing. Trying to configure sources on FreeBSD 8.1-RELEASE-p2 i386.
Maybe, there are some linker flags or workarounds or something?

The solution here is easy:  don't build from git, build from tarball releases.  The tarball already has the proper configure script generated, so you don't have to worry about missing macros or broken OS configurations.


Thank you very much!


Title: Re: New demonstration CPU miner available
Post by: myrkul on February 16, 2011, 11:27:53 AM
Quick question: is there a way to setup minerd to run as a linux screensaver? an extra thread while i'm not using the computer at all would be a nice way to boost my hash/sec.


Title: Re: New demonstration CPU miner available
Post by: hangover on February 16, 2011, 03:15:06 PM
Patch for successfull compilation of minerd under FreeBSD:

Code:
--- miner.h.orig 2011-02-10 11:51:55.000000000 +0600
+++ miner.h 2011-02-16 16:04:28.000000000 +0600
@@ -5,7 +5,7 @@
 #include <stdint.h>
 #include <sys/time.h>
 #include <jansson.h>
-#include <curl/curl.h>
+#include </usr/local/include/curl/curl.h>
 
 #ifdef __SSE2__
 #define WANT_SSE2_4WAY 1
@@ -18,7 +18,12 @@
 #if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
 #define WANT_BUILTIN_BSWAP
 #else
-#include <byteswap.h>
+/* #include <byteswap.h> */  // <-- doesn't exist under FreeBSD
+# define bswap_64 __bswap64
+# define bswap_32 __bswap32
+# define bswap_16 __bswap16
+# define __BIG_ENDIAN__ (_BYTE_ORDER == _BIG_ENDIAN)
+#include <sys/endian.h>
 #endif
 
 #if defined(__i386__)


Title: Re: New demonstration CPU miner available
Post by: myrkul on February 17, 2011, 09:53:00 AM
One more thing to ask: Is there a way to log the output? I tried the standard > redirect, but nothing is dumped into the text file, and nothing displays in the terminal screen, either.

Interestingly, the redirect works with the --help switch, and does fill the text file with the help output, and once I try redirecting the live program output, the text is blanked, but even with the >> append, nothing is ever put into the file. What am I doing wrong?

OS: Linux 10.04
Processor: Crap
GPU: Crap


Title: Re: New demonstration CPU miner available
Post by: hangover on February 17, 2011, 10:10:12 AM
One more thing to ask: Is there a way to log the output? I tried the standard > redirect, but nothing is dumped into the text file, and nothing displays in the terminal screen, either.

Interestingly, the redirect works with the --help switch, and does fill the text file with the help output, and once I try redirecting the live program output, the text is blanked, but even with the >> append, nothing is ever put into the file. What am I doing wrong?

OS: Linux 10.04
Processor: Crap
GPU: Crap

To double program output to file, you can make something like that:

Code:
minerd --threads X --url http://mypool.local:8332 --userpass user:pass 2>&1 | tee /some/path/log.log


Title: Re: New demonstration CPU miner available
Post by: myrkul on February 17, 2011, 10:28:48 AM
To double program output to file, you can make something like that:

Code:
minerd --threads X --url http://mypool.local:8332 --userpass user:pass 2>&1 | tee /some/path/log.log

Ok, that puts "1 miner threads started, using SHA256 'cryptopp_asm32' algorithm." into the logfile, but fails to record (or display) the hashcount.

Progress, but still not 100%
Thanks for the fast response, btw. :)


Title: Re: New demonstration CPU miner available
Post by: hangover on February 17, 2011, 11:28:06 AM
To double program output to file, you can make something like that:

Code:
minerd --threads X --url http://mypool.local:8332 --userpass user:pass 2>&1 | tee /some/path/log.log

Ok, that puts "1 miner threads started, using SHA256 'cryptopp_asm32' algorithm." into the logfile, but fails to record (or display) the hashcount.

Progress, but still not 100%
Thanks for the fast response, btw. :)
Hmm. It seems to me that cpuminer with tee gives output 'by portions'.
I started minerd and got this:

Code:
hangover@hangover:~$ minerd --threads 2 --url http://mining.bitcoin.cz:8332 --userpass hangover.XX:YY 2>&1 | tee /home/hangover/loglog
2 miner threads started, using SHA256 'c' algorithm.

And after waiting for 5 minutes I got this:
Code:
HashMeter(1): 16777215 hashes, 628.20 khash/sec
HashMeter(0): 16777215 hashes, 620.19 khash/sec
HashMeter(0): 8388607 hashes, 643.54 khash/sec
HashMeter(1): 8388607 hashes, 637.17 khash/sec
HashMeter(1): 4194303 hashes, 502.27 khash/sec
HashMeter(0): 4194303 hashes, 430.20 khash/sec
HashMeter(1): 3194303 hashes, 582.57 khash/sec
HashMeter(0): 3194303 hashes, 602.13 khash/sec
HashMeter(1): 3194303 hashes, 582.68 khash/sec
HashMeter(0): 3194303 hashes, 586.11 khash/sec
HashMeter(0): 3194303 hashes, 632.09 khash/sec
HashMeter(1): 3194303 hashes, 598.81 khash/sec
HashMeter(0): 3194303 hashes, 643.12 khash/sec
HashMeter(1): 3194303 hashes, 628.86 khash/sec
HashMeter(0): 3294303 hashes, 638.16 khash/sec
HashMeter(1): 3194303 hashes, 643.76 khash/sec
HashMeter(0): 3294303 hashes, 661.30 khash/sec
HashMeter(1): 3294303 hashes, 641.22 khash/sec
HashMeter(0): 3394303 hashes, 645.43 khash/sec
HashMeter(1): 3294303 hashes, 645.00 khash/sec
HashMeter(0): 3394303 hashes, 647.02 khash/sec
...


Title: Re: New demonstration CPU miner available
Post by: myrkul on February 17, 2011, 11:47:54 AM
Ahh. Just need to wait longer then?

Me and my impatient self. Thanks!


Title: Re: New demonstration CPU miner available
Post by: jwf on February 17, 2011, 06:58:11 PM
ymmv, but I found that -Os (optimize for size, better exploits caches) outperforms -O3 or -O4 by about 8%.

update:

only bothered testing on 4way, but tested on 3 recent Intel processors, a Xeon W3530 @ 2.80GHz (8192 KB cache), a Xeon @ 3.00GHz (2048 KB cache), and a Xeon E5430 @ 2.66GHz (6144 KB cache). All with approximately the same results.

Using version obtained from git with most recent commit 4a7f3f70b5628cb804ca4f46cf51651a1a42507f.

gcc version Ubuntu 4.4.3-4ubuntu5, CFLAGS="-O(s|3) -ftree-vectorize -march=native".

jordan


Title: Re: New demonstration CPU miner available
Post by: Cerebrum on February 17, 2011, 07:12:25 PM
ymmv, but I found that -Os (optimize for size, better exploits caches) outperforms -O3 or -O4 by about 8%.

jordan

This may also be why ufasoft's code runs faster than the 4way implementation used here. Since he doesn't unroll the loop used in the SHA calculation, the code is smaller and may fit into the cache more easily. MEMORY HIERARCHIES: THAT $#%! IS SO CACHE.


Title: Re: New demonstration CPU miner available
Post by: Patches on February 18, 2011, 01:42:35 PM
Just to share, the miner seems to work quite well under wine on OS X on a Mac Pro. Just install wine as per these instructions: http://wiki.winehq.org/MacOSX/Installing (I used Mac Ports) and you are good to go.



Title: Re: New demonstration CPU miner available
Post by: BeeCee1 on February 19, 2011, 04:34:30 PM
For those of you on Linux that are itching to try out ufasoft's optimizations (see this thread: http://bitcointalk.org/index.php?topic=3486.0 (http://bitcointalk.org/index.php?topic=3486.0)).  one of the optimizations he does is "skip last 3 rounds, because we need not them to calc last 32-bit word of hash [h word]."  I tried this by simply commenting out the final three rounds and it successfully generated shares in slush's mining pool and made things a tiny bit faster (1 or 2 %).  I didn't verify that it works in all cases, someone more familiar with the protocol might want to.

Like this:
        //w13 = add4(SIGMA1_256(w11), w6, SIGMA0_256(w14), w13);
        //SHA256ROUND(d, e, f, g, h, a, b, c, 61, w13);
        //w14 = add4(SIGMA1_256(w12), w7, SIGMA0_256(w15), w14);
        //SHA256ROUND(c, d, e, f, g, h, a, b, 62, w14);
        //w15 = add4(SIGMA1_256(w13), w8, SIGMA0_256(w0), w15);
        //SHA256ROUND(b, c, d, e, f, g, h, a, 63, w15);

        /* store resulsts directly in thash */


Title: cpuminer v0.7.1 released
Post by: jgarzik on March 03, 2011, 03:51:21 AM
Version 0.7.1 is released.  See top of thread for URLs.

Changes:
- Add support for JSON-format configuration file.  See example
  file example-cfg.json.  Any long argument on the command line
  may be stored in the config file.
- Timestamp each solution found
- Improve sha256_4way performance.  NOTE: This optimization makes
  the 'hash' debug-print output for sha256_way incorrect.
- Use __builtin_expect() intrinsic as compiler micro-optimization
- Build on Intel compiler
- HTTP library now follows HTTP redirects

SHA1: 5520112505b16f89b473ed897b89e1593aeb1371  cpuminer-installer-0.7.1.zip
MD5: 1b77192b76bf50938c005b2c26d3809f  cpuminer-installer-0.7.1.zip


Title: Re: New demonstration CPU miner available
Post by: TurdHurdur on March 03, 2011, 04:27:28 AM
Fine update.

I have a question though, is there a reason STDIN and STDERR aren't accessible when exec'd from Perl? I've had luck with IO::Pty on Linux, but not on Cygwin or Strawberry Perl on Win32. I ask this assuming that exec-ing it from any non-term/console would have the same issue and this isn't a Perl-specific problem.


Title: Re: cpuminer v0.7.1 released
Post by: mrballcb on March 03, 2011, 08:57:37 PM
- Add support for JSON-format configuration file.  See example
  file example-cfg.json.  Any long argument on the command line
  may be stored in the config file.
Curious, how come a json format was chosen over something like yaml?  JSON is extremely unforgiving when it comes to syntax, compared to yaml which is much more forgiving.  Personally I also find YAML to be more readable, but that's just a personal preference not based on capabilities nor function.  Are there plans to centralize configs or something (since json is so web friendly)?  Or was it just a convenient way to save/retrieve configuration?

Regards...        Todd


Title: Re: cpuminer v0.7.1 released
Post by: chromicant on March 03, 2011, 08:59:30 PM
Curious, how come a json format was chosen over something like yaml?

Probably because there's a whole JSON parser that's part of the miner...so might as well reuse the code!


Title: Re: New demonstration CPU miner available
Post by: Raulo on March 03, 2011, 10:04:38 PM
If anybody is interested, this is the assembly code from Intel Compiler which gives me the fastest 4way code on AMD K10. 1.13 GH/s MH/s per 1 GHz per physical core.
https://gist.github.com/853566
Compile cpuminer-0.7.1, download the above code, issue:
gcc -c sha256_4way.s
and do make again to link the object file to the executable.  It's about 7% faster than the gcc version.


Title: Re: cpuminer v0.7.1 released
Post by: jgarzik on March 03, 2011, 10:32:48 PM
Probably because there's a whole JSON parser that's part of the miner...so might as well reuse the code!

Bingo.



Title: Re: New demonstration CPU miner available
Post by: JWU42 on March 03, 2011, 10:55:16 PM
If anybody is interested, this is the assembly code from Intel Compiler which gives me the fastest 4way code on AMD K10. 1.13 GH/s per 1 GHz per physical core.
https://gist.github.com/853566
Compile cpuminer-0.7.1, download the above code, issue:
gcc -c sha256_4way.s
and do make again to link the object file to the executable.  It's about 7% faster than the gcc version.

1.13 GH/s ?!?


Title: Re: New demonstration CPU miner available
Post by: Raulo on March 03, 2011, 11:30:10 PM
1.13 GH/s ?!?

1.13MH/s, of course. Sorry.


Title: Re: New demonstration CPU miner available
Post by: smgoller on March 03, 2011, 11:47:54 PM
Just tried to run 0.7.1 on a q6600, ubuntu 10.10 32-bit, and got segfaults when i tried to run cryptopp_asm32. Tried compiling from git, same result. Any thoughts?


Title: Re: New demonstration CPU miner available
Post by: myrkul on March 04, 2011, 12:02:08 AM
Just tried to run 0.7.1 on a q6600, ubuntu 10.10 32-bit, and got segfaults when i tried to run cryptopp_asm32. Tried compiling from git, same result. Any thoughts?

check your options. I had that happen to me when I had a malformed url in there... mining.bitboin.cz. ;)


Title: Re: New demonstration CPU miner available
Post by: decibel on March 04, 2011, 06:00:41 AM
Patch for successfull compilation of minerd under FreeBSD:

Expanding on hangover's work; I had to also patch cpu-miner.c and util.c. Complete patch-set is:
Code:
diff -u cpuminer-0.7.1.orig/cpu-miner.c cpuminer-0.7.1/cpu-miner.c
--- cpuminer-0.7.1.orig/cpu-miner.c     2011-02-17 00:54:45.000000000 -0600
+++ cpuminer-0.7.1/cpu-miner.c  2011-03-03 23:38:39.000000000 -0600
@@ -24,7 +24,7 @@
 #include <pthread.h>
 #include <getopt.h>
 #include <jansson.h>
-#include <curl/curl.h>
+#include </usr/local/include/curl/curl.h>
 #include "compat.h"
 #include "miner.h"
 
diff -u cpuminer-0.7.1.orig/miner.h cpuminer-0.7.1/miner.h
--- cpuminer-0.7.1.orig/miner.h 2011-02-17 00:20:34.000000000 -0600
+++ cpuminer-0.7.1/miner.h      2011-03-03 23:28:11.000000000 -0600
@@ -5,7 +5,7 @@
 #include <stdint.h>
 #include <sys/time.h>
 #include <jansson.h>
-#include <curl/curl.h>
+#include </usr/local/include/curl/curl.h>
 
 #ifdef __SSE2__
 #define WANT_SSE2_4WAY 1
@@ -18,7 +18,12 @@
 #if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
 #define WANT_BUILTIN_BSWAP
 #else
-#include <byteswap.h>
+/* #include <byteswap.h> */  // <-- doesn't exist under FreeBSD
+# define bswap_64 __bswap64
+# define bswap_32 __bswap32
+# define bswap_16 __bswap16
+# define __BIG_ENDIAN__ (_BYTE_ORDER == _BIG_ENDIAN)
+#include <sys/endian.h>
 #endif
 
 #if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
Only in cpuminer-0.7.1: patch
diff -u cpuminer-0.7.1.orig/util.c cpuminer-0.7.1/util.c
--- cpuminer-0.7.1.orig/util.c  2011-03-02 21:06:20.000000000 -0600
+++ cpuminer-0.7.1/util.c       2011-03-03 23:42:56.000000000 -0600
@@ -15,7 +15,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <jansson.h>
-#include <curl/curl.h>
+#include </usr/local/include/curl/curl.h>
 #include "miner.h"
 
 struct data_buffer {


Title: Re: New demonstration CPU miner available
Post by: adv on March 08, 2011, 05:07:33 AM
I build debian package 0.7.1 for SPARC architectures (sparc64).

Unfortunately it's more of a test assembly, as on Sun Enterprise 250 (2 * 400MHz) I managed to achieve maximum performance: ~87Khps with "--algo c" and ~81Kps with "--algo cryptopp". Algorithms foк via, 4waySSE2 and cryptopp_asm32 on this architecture is not available. :^(

Some tech info:
Code:
uname -a
Linux debsparc 2.6.32-5-sparc64-smp #1 SMP Wed Jan 12 05:23:55 UTC 2011 sparc64 GNU/Linux

Code:
cat /proc/cpuinfo
cpu             : TI UltraSparc II  (BlackBird)
fpu             : UltraSparc II integrated FPU
pmu             : ultra12
prom            : OBP 3.22.0 2000/12/20 16:20
type            : sun4u
ncpus probed    : 2
ncpus active    : 2
D$ parity tl1   : 0
I$ parity tl1   : 0
Cpu0ClkTck      : 0000000017d78400
Cpu1ClkTck      : 0000000017d78400
MMU Type        : Spitfire
State:
CPU0:           online
CPU1:           online

Command line:
Code:
btc-cpuminer --url http://192.168.1.1:8334 -r -1 -D -s 5 --threads=2
.....
HashMeter(1): 462143 hashes, 84.75 khash/sec
HashMeter(0): 462143 hashes, 86.89 khash/sec
HashMeter(1): 462143 hashes, 84.75 khash/sec
HashMeter(0): 462143 hashes, 86.80 khash/sec

2 cpu's load at 80-100% by 3 btc-cpuminer threads.

System load: 2.09 2.02 1.74

Is there any hope for improvement in performance for this architecture?


Discussion of issues related to the Debian packages is welcome in this thread: http://bitcointalk.org/index.php?topic=2207


Title: Re: New demonstration CPU miner available
Post by: jgarzik on March 09, 2011, 01:29:03 AM

Call for hacking:

Anybody want to volunteer to add server failover support to cpuminer?  (m0mchil's miner, too...)

Server failure should not interrupt mining [much], ideally.



Title: Re: New demonstration CPU miner available
Post by: TurdHurdur on March 09, 2011, 12:14:46 PM

Call for hacking:

Anybody want to volunteer to add server failover support to cpuminer?  (m0mchil's miner, too...)

Server failure should not interrupt mining [much], ideally.


Hah, you're going to make my script do a double-take. :P


Title: Re: New demonstration CPU miner available
Post by: mtve on March 10, 2011, 01:32:43 PM
I build debian package 0.7.1 for SPARC architectures (sparc64).
just of curiosity, small performance test here:

sun fire v120 (sun4u), sparcv9 650 MHz - 109.6 Khash/s
sun netra t2000 (sun4v), sparcv9 1.2 GHz - 117.4 Khash/s (strange)

second box has 32 virtual cpus, so supposedly it can do 3.7 Mhash/s total.

yes, cryptopp speed is around 82% of c's.

i've managed to compile only 32bit binary of cpuminer, hope it does not beat performance too much.

Quote
Is there any hope for improvement in performance for this architecture?
There is ncp crypto provider in UltraSPARC T1, but it accelerates only RSA (really good).
UltraSPARC T2 with n2cp should help to SHA256.

Would somebody with T2 play with http://frox25.no-ip.org/~mtve/tmp/sun_pkcs11_sha256.c please?   On T1 it's around 58 Khash/s.

Update: from http://cs.anu.edu.au/student/projects/10S2/Reports/Cody%20Christopher.pdf it can be concluded that for 32 bytes (one block of SHA256) and for 64 bytes (full bitcoin block) without special efforts it will be slower than CPU.


Title: Re: New demonstration CPU miner available
Post by: lucky on March 12, 2011, 05:08:38 AM
0.7.1 fails to build on Mac OS X 10.6.6...

I went with % ./configure ; make

and :

Code:
joel@baldur:~/cpuminer-0.7.1% make
make  all-recursive
Making all in compat
Making all in jansson
gcc -DHAVE_CONFIG_H -I. -I../..     -g -O2 -MT dump.o -MD -MP -MF .deps/dump.Tpo -c -o dump.o dump.c
mv -f .deps/dump.Tpo .deps/dump.Po
gcc -DHAVE_CONFIG_H -I. -I../..     -g -O2 -MT hashtable.o -MD -MP -MF .deps/hashtable.Tpo -c -o hashtable.o hashtable.c
mv -f .deps/hashtable.Tpo .deps/hashtable.Po
gcc -DHAVE_CONFIG_H -I. -I../..     -g -O2 -MT load.o -MD -MP -MF .deps/load.Tpo -c -o load.o load.c
mv -f .deps/load.Tpo .deps/load.Po
gcc -DHAVE_CONFIG_H -I. -I../..     -g -O2 -MT strbuffer.o -MD -MP -MF .deps/strbuffer.Tpo -c -o strbuffer.o strbuffer.c
mv -f .deps/strbuffer.Tpo .deps/strbuffer.Po
gcc -DHAVE_CONFIG_H -I. -I../..     -g -O2 -MT utf.o -MD -MP -MF .deps/utf.Tpo -c -o utf.o utf.c
mv -f .deps/utf.Tpo .deps/utf.Po
gcc -DHAVE_CONFIG_H -I. -I../..     -g -O2 -MT value.o -MD -MP -MF .deps/value.Tpo -c -o value.o value.c
mv -f .deps/value.Tpo .deps/value.Po
rm -f libjansson.a
ar cru libjansson.a dump.o hashtable.o load.o strbuffer.o utf.o value.o
ranlib libjansson.a
make[3]: Nothing to be done for `all-am'.
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson    -g -O2 -MT cpu-miner.o -MD -MP -MF .deps/cpu-miner.Tpo -c -o cpu-miner.o cpu-miner.c
In file included from cpu-miner.c:29:
miner.h:21:22: error: byteswap.h: No such file or directory
make[2]: *** [cpu-miner.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
joel@baldur:~/cpuminer-0.7.1%


Title: Re: New demonstration CPU miner available
Post by: jgarzik on March 12, 2011, 05:25:44 AM
Yep, OSX is known broken at this time.  Waiting for someone to fix it, in a way that doesn't break everyone else's build...


Title: Re: New demonstration CPU miner available
Post by: mrballcb on March 12, 2011, 04:06:23 PM
Yep, OSX is known broken at this time.  Waiting for someone to fix it, in a way that doesn't break everyone else's build...
There was a guy on IRC last week building your miner who made a quick change per some post he found via google that got byteswap to work.  I'll dig and see if I can find it.

Regards...      Todd


Title: Re: New demonstration CPU miner available
Post by: mrballcb on March 12, 2011, 04:15:43 PM
Yep, OSX is known broken at this time.  Waiting for someone to fix it, in a way that doesn't break everyone else's build...
There was a guy on IRC last week building your miner who made a quick change per some post he found via google that got byteswap to work.  I'll dig and see if I can find it.

Regards...      Todd
Some asshat came into the channel and trolled the entire freakin channel on Thu and wiped out all my scrollback (gotta remember to increase that on Monday).  But was able to find the post he was talking about.  From http://www.mail-archive.com/barry-devel@lists.sourceforge.net/msg00113.html , there is a link to this commit that defines it inline if OSX is detected:  http://lists.freedesktop.org/archives/xorg-commit/2007-January/010041.html

Regards...     Todd


Title: Re: New demonstration CPU miner available
Post by: fatalfurry on March 13, 2011, 01:05:16 PM
Is there a way of adding or removing threads on the fly? I like running it with three threads on my 4 core processor but when I'm doing something a little more intense I would want to throttle it down to two or one thread.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on March 15, 2011, 03:46:47 AM
Version 0.7.2 is released.  Changes:

- Add port of ufasoft's sse2 assembly implementation (Linux only)
  This is a substantial speed improvement on Intel CPUs.

  Big thanks to mmarker/chromicant for this work.

- Move all JSON-RPC I/O to separate thread.  This reduces the
  number of HTTP connections from one-per-thread to one, reducing resource
  usage on upstream bitcoind / pool server.

  This is prepartion for adding long-polling support.

See top of thread for URLs and info.

SHA1: 2673c5f5c2cd85acc332a9c8a1f48415b8dd0fc9  cpuminer-installer-0.7.2.zip
MD5: 24211f26b1d6b0c68fe696662b3082e7  cpuminer-installer-0.7.2.zip


Title: Re: New demonstration CPU miner available
Post by: gbl4ck on March 16, 2011, 05:09:02 AM
Quick question on estimating my hash rate....  I'm currently running 12 threads and each is running @ ~1400 khash/sec.  Each line looks like:

HashMeter(0): 8288293 hashes, 1455.67 khash/sec
HashMeter(4): 7778834 hashes, 1462.78 khash/sec
HashMeter(11): 8287566 hashes, 1505.17 khash/sec
etc for the rest of the threads (one for each logical processor)

So would my total CPU rate be ~16800 khash/sec?


Title: Re: New demonstration CPU miner available
Post by: jgarzik on March 16, 2011, 05:20:31 AM
So would my total CPU rate be ~16800 khash/sec?

Yes, that's correct.  HashMeter output is per-thread, not a total for all threads.

Do you really have a 12-core?  If not, I bet you could do better with fewer threads and perhaps another algo.



Title: Re: New demonstration CPU miner available
Post by: gbl4ck on March 16, 2011, 05:42:22 AM
So would my total CPU rate be ~16800 khash/sec?

Yes, that's correct.  HashMeter output is per-thread, not a total for all threads.

Do you really have a 12-core?  If not, I bet you could do better with fewer threads and perhaps another algo.



Not 12 cores but 6 cores with HT on.  I did just realize tho that running it like this is killing my GPU processing which i'm using poclbm-gui.  I was around 80 Mhash/s but now it drops down to around 30 and will jump to 60 but is very inconsistant. 


Title: Re: New demonstration CPU miner available
Post by: gbl4ck on March 16, 2011, 05:46:46 AM
Looks like I found a better combo.  I'm still using the 4way algo but I dropped the threads down to 6.  Now all 6 threads are around 2000 khash/s but my GPU is staying steady at 85 Mhash/s.

edit - According to taskmanager i'm only using 50% CPU so maybe I'm not yet in the sweet spot and need to try another algo... i'm running a i7 980x


Title: Re: New demonstration CPU miner available
Post by: jgarzik on March 18, 2011, 06:56:45 AM
Long polling was just added to git, and I posted a test Windows version here:
     http://yyz.us/bitcoin/cpuminer-installer-0.7.2-lp1.zip

Test feedback appreciated, on Linux (build your own from git) or Windows.  http://deepbit.net/ is known to support long polling, and slush's pool should be able to do it soon, too.

This should increase people's CPU mining efficiency quite a bit, while also reducing network usage (and load on pool servers).



Title: Re: New demonstration CPU miner available
Post by: Arceny on March 19, 2011, 12:21:38 AM
Hello

I have a problems with compilation 0.7.2 under FreeBSD 8.1, gcc version 4.2.1 20070719  [FreeBSD]

Code:
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson     -I/usr/local/include -MT sha256_4way.o -MD -MP -MF .deps/sha256_4way.Tpo -c -o sha256_4way.o sha256_4way.c
sha256_4way.c: In function 'ROTR':
sha256_4way.c:51: error: shift must be an immediate
sha256_4way.c:51: error: shift must be an immediate
sha256_4way.c: In function 'SHR':
sha256_4way.c:55: error: shift must be an immediate

Any ideas ???


Title: Re: New demonstration CPU miner available
Post by: Arceny on March 20, 2011, 02:16:13 PM
Hello

I have a problems with compilation 0.7.2 under FreeBSD 8.1, gcc version 4.2.1 20070719  [FreeBSD]
gcc 4.5 will fix this problem.

But speed is to slow for 2x Xeon E5420, only 133 khash per thread (8 threads total). In linux this will be at least ~1000 khash/thread speed.


Title: Re: New demonstration CPU miner available
Post by: TurdHurdur on March 21, 2011, 01:24:51 AM
Sometimes I'll get a "Floating point exception" which kills it on my Debian 6 VM. Anything build-wise I should be doing to avoid that?


Title: Re: New demonstration CPU miner available
Post by: jgarzik on March 21, 2011, 01:51:10 AM
Sometimes I'll get a "Floating point exception" which kills it on my Debian 6 VM. Anything build-wise I should be doing to avoid that?

Which algorithm are you using?

Which cpuminer version?  Longpolling/git or a release version?



Title: Re: New demonstration CPU miner available
Post by: TurdHurdur on March 21, 2011, 01:55:36 AM
Which algorithm are you using?

Which cpuminer version?  Longpolling/git or a release version?
I'm using sse2_64 with the Longpolling/git version.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on March 21, 2011, 07:29:45 AM
Which algorithm are you using?

Which cpuminer version?  Longpolling/git or a release version?
I'm using sse2_64 with the Longpolling/git version.

Does it happen with any other algorithm, such as 4way?



Title: Re: New demonstration CPU miner available
Post by: jgarzik on March 21, 2011, 07:47:28 AM
Sometimes I'll get a "Floating point exception" which kills it on my Debian 6 VM. Anything build-wise I should be doing to avoid that?

I spotted one potential problem source, and pushed a fix out to git.



Title: cpuminer v0.8 released
Post by: jgarzik on March 21, 2011, 08:40:06 AM
Version 0.8 released.  See top of thread for URLs.

Changes:
- Support long polling (beta): http://deepbit.net/longpolling.php  By default, cpuminer will enable long-polling automatically, if the X-Long-Polling HTTP header is present.  To disable this autodetection, pass option --no-longpoll.

- Adjust max workload based on --scantime (default 5 seconds, or 60 seconds for longpoll)

- Standardize program output, and support syslog on Unix platforms

- Suport --user/--pass options (and "user" and "pass" in config file), as an alternative to the current --userpass

SHA1: 2b89588a99912d3980a9d5871b439fdbbd1d806b  cpuminer-installer-0.8.zip
MD5: 12464cf941dee3e317d98c643dfaee5a  cpuminer-installer-0.8.zip


Title: Re: New demonstration CPU miner available
Post by: Arceny on March 21, 2011, 10:32:49 AM
Why sse2_amd64 algorithm did not compiling? My system is ubuntu 10.04 64 bit and Core2Duo P8400 cpu.

As I can see in miner.h there is a definition WANT_X8664_SSE2, with checking sse2 support. But checking don't passing. When i comment this checking and try to 'make' there is an error:

Code:
gcc  -g -O2 -pthread  -o minerd cpu-miner.o util.o sha256_generic.o sha256_4way.o sha256_via.o sha256_cryptopp.o sha256_sse2_amd64.o -lcurl compat/jansson/libjansson.a -lpthread 
sha256_sse2_amd64.o: In function `scanhash_sse2_64':
sha256_sse2_amd64.c:98: undefined reference to `CalcSha256_x64'
sha256_sse2_amd64.c:99: undefined reference to `CalcSha256_x64'
collect2: ld returned 1 exit status

 ??? ??? ???


Title: Re: New demonstration CPU miner available
Post by: chromicant on March 21, 2011, 10:41:42 AM
Why sse2_amd64 algorithm did not compiling? My system is ubuntu 10.04 64 bit and Core2Duo P8400 cpu.

As I can see in miner.h there is a definition WANT_X8664_SSE2, with checking sse2 support. But checking don't passing. When i comment this checking and try to 'make' there is an error:

Don't do that. There's a reason the check is failing.

If you looked at config.log, it probably says your version of yasm is 0.8.0. You need 1.1.0. For Ubuntu, you either compile it yourself or get the right version from Debian's repository.


Title: Re: New demonstration CPU miner available
Post by: Arceny on March 21, 2011, 02:42:07 PM
Thanks, yasm 1.1 fix my problem.


Title: Re: cpuminer v0.8 released
Post by: adv on March 21, 2011, 04:22:30 PM
- Suport --user/--pass options (and "user" and "pass" in config file), as an alternative to the current --userpass
Minor typo in usage help:
Code:
        { "pass PASSWORD",
          "(-p USERNAME) Password for bitcoin JSON-RPC server "
          "(default: " DEF_RPC_PASSWORD ")" },
must be "(-p PASSWORD)".

BTW, may be you want get manpage SGML template from my source deb and put it into your source package? It's under GPL.
For build man from SGML i use docbook-to-man:
Code:
docbook-to-man debian/btc-cpuminer.sgml > debian/btc-cpuminer.1
Link to source deb: http://home.agalakov.spb.ru/debian/pool/main/b/btc-cpuminer/btc-cpuminer_0.8-2.debian.tar.gz
Or I can send it to you in some other way.


Title: Re: New demonstration CPU miner available
Post by: FnuGk on March 21, 2011, 04:54:19 PM
for a complete newb how do i go around to make this work on mac OSx 10.6?


Title: Re: New demonstration CPU miner available
Post by: Patches on March 21, 2011, 07:44:38 PM
for a complete newb how do i go around to make this work on mac OSx 10.6?
As far as I know no one has been able to easily compile and get this to run on OS X natively. However, you can run the miner (unfortunately without ufasoft's sse2 optimizations) using the following steps:

1) Install MacPorts (here:http://www.macports.org/install.php). This software will allow you to easily install various linux packages on your Mac.
2) Open up the terminal, and run 'sudo port -v selfupdate' to get the latest package info and then 'sudo port install wine'. This will install wine, an application that will let you run windows programs.
3) Download the windows installer of the miner (from here: http://bitcointalk.org/index.php?topic=1925.msg24217#msg24217) and unzip it. Run it in the terminal with 'wine cpuminer-installer.exe' and make sure to choose a directory you will remember (I just made one on the desktop). If you aren't sure the full path to cpuminer-installer.exe, just drag the file from the finder window to the terminal window and terminal will add it.
4) Run the miner in the terminal with 'wine /yourdirectory/minerd.exe --help' or with whatever command line options you decide. I found the cryptopp_asm32 algorithm to give my MacPro the highest hashing rates.

Happy mining.



Title: Re: New demonstration CPU miner available
Post by: chromicant on March 21, 2011, 07:50:47 PM
As far as I know no one has been able to easily compile and get this to run on OS X natively. However, you can run the miner (unfortunately without ufasoft's sse2 optimizations) using the following steps:

Urm. Have you tried to compile it natively using XCode on OSX 10.6 on a machine that can handle SSE2? I'd like to see some bug reports as to why it won't compile. I don't think there's anything super specific that would prevent a build from happening. I've seen nothing on what sort of compile errors one gets on OSX. Also remember, I crafted the SSE2 code in jgarzik's miner to require the 64-bit mode of Intel/AMD chips. So if you're running a 32-bit kernel/userspace, you won't be able to use it.

(I'd try myself, but my Mac is in little bits...and it's just a CoreDuo, so I couldn't test the SSE2 code if I wanted to)

I do know my SSE2 WILL NOT WORK in win64, since the calling ABI is different.

The one place where there probably is a problem is I used ELF64 as the output for yasm. That should be Mach-O for OSX...but it may also just work.


Title: Re: New demonstration CPU miner available
Post by: Patches on March 21, 2011, 07:57:46 PM
As far as I know no one has been able to easily compile and get this to run on OS X natively. However, you can run the miner (unfortunately without ufasoft's sse2 optimizations) using the following steps:

Urm. Have you tried to compile it natively using XCode on OSX 10.6 on a machine that can handle SSE2? I'd like to see some bug reports as to why it won't compile. I don't think there's anything super specific that would prevent a build from happening. I've seen nothing on what sort of compile errors one gets on OSX. Also remember, I crafted the SSE2 code in jgarzik's miner to require the 64-bit mode of Intel/AMD chips. So if you're running a 32-bit kernel/userspace, you won't be able to use it.

(I'd try myself, but my Mac is in little bits...and it's just a CoreDuo, so I couldn't test the SSE2 code if I wanted to)

I do know my SSE2 WILL NOT WORK in win64, since the calling ABI is different.

The one place where there probably is a problem is I used ELF64 as the output for yasm. That should be Mach-O for OSX...but it may also just work.

I have only spent a couple minutes playing with it but I got stuck at the same byteswap.h problem described previously in this thread (see: http://bitcointalk.org/index.php?topic=1925.msg48679#msg48679). I am sure it is possible so I'll give it another go when I have some time.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on March 21, 2011, 08:07:43 PM
I have only spent a couple minutes playing with it but I got stuck at the same byteswap.h problem described previously in this thread (see: http://bitcointalk.org/index.php?topic=1925.msg48679#msg48679). I am sure it is possible so I'll give it another go when I have some time.

Those with the ability to test can add

     AC_CHECK_HEADERS(byteswap.h)

to configure.ac, and then check

     #ifdef HAVE_BYTESWAP_H
     ... current code ...
     #else
     ... OSX code ...
     #endif

after running ./autogen.sh with proper autoconf/libcurl/etc. build dependencies, to regenerate configure.



Title: Re: New demonstration CPU miner available
Post by: chromicant on March 21, 2011, 08:07:54 PM
I have only spent a couple minutes playing with it but I got stuck at the same byteswap.h problem described previously in this thread (see: http://bitcointalk.org/index.php?topic=1925.msg48679#msg48679). I am sure it is possible so I'll give it another go when I have some time.

Hmm. Looks like it'll be a 5 line patch to fix that. Something like (the 5 lines plus the rest of the define):

Code:
#if defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define bswap_16 OSSwapInt16
#define bswap_32 OSSwapInt32
#define bswap_64 OSSwapInt64
#elif ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
#define WANT_BUILTIN_BSWAP
#else
#include <byteswap.h>
#endif

Taken from XOrg, which had the same problem on OSX.

...and I think jgarzik's solution needs to be massaged into the OSX code above for maximum cleanliness!


Title: Re: New demonstration CPU miner available
Post by: jgarzik on March 21, 2011, 08:51:51 PM
I think byte swapping is simple enough that we can afford to create compat/byteswap.h, and include inline versions of byteswap macros for the case where the OS does not provide.  This seems like an area of breakage that we could solve permanently.

#ifdef __APPLE__ is fine, but we should provide fallbacks nonetheless.

Volunteers?   :)



Title: Re: New demonstration CPU miner available
Post by: Patches on March 21, 2011, 09:53:32 PM
Ok... I added chromicant's 5 line patch for byteswap.h which seems to have worked (as far as I can tell), but I then ran into a libcurl problem shown here:

Code:
checking for curl-config... /sw2/bin/curl-config
checking for the version of libcurl... 7.21.2
checking for libcurl >= version 7.10.1... yes
checking whether libcurl is usable... no
configure: error: Missing required libcurl >= 7.10.1

As far as I can tell libcurl was install correctly, but I reinstalled it from fink (http://pdb.finkproject.org/pdb/package.php/libcurl4?rel_id=10.6-x86_64-current-stable) and when that didn't work, I rebuilt it from the latest source (7.21.4; http://curl.haxx.se/download.html). I am not sure if there is something strange or broken about this machine so I will try to compile on another, fresher Mac tomorrow. Curl -v gives:

Code:
curl 7.21.2 (i386-apple-darwin10.6.0) libcurl/7.21.2 OpenSSL/0.9.8l zlib/1.2.3 c-ares/1.7.3 libssh2/1.2.7 librtmp/2.3


Title: Re: cpuminer v0.8 released
Post by: jgarzik on March 22, 2011, 02:33:58 AM
- Suport --user/--pass options (and "user" and "pass" in config file), as an alternative to the current --userpass

--user/--pass is broken in version 0.8.  Either obtain the latest -git for a fix, or continue to use --userpass until the next release.



Title: Re: New demonstration CPU miner available
Post by: Patches on March 22, 2011, 08:54:01 AM
So I tried to compile on my newer MacBook Pro (Intel i7; OS 10.6.6) with Xcode (and YASM 1.1.0) installed using the tarball version 0.8 of cpuminer with chromicant's patch. Indeed, the previous issue I had with libcurl seems to be machine-specific thing, but I ran into another problem. The configure runs fine but I run into a "in x86_64/libx8664.a, file was built for unsupported file format which is not the architecture being linked (x86_64)" error while trying to make amd2_sse64 module.    
Here is the output after running make:

Code:
make  all-recursive
Making all in compat
Making all in jansson
gcc -DHAVE_CONFIG_H -I. -I../..     -O3 -Wall -msse2 -MT dump.o -MD -MP -MF .deps/dump.Tpo -c -o dump.o dump.c
mv -f .deps/dump.Tpo .deps/dump.Po
gcc -DHAVE_CONFIG_H -I. -I../..     -O3 -Wall -msse2 -MT hashtable.o -MD -MP -MF .deps/hashtable.Tpo -c -o hashtable.o hashtable.c
mv -f .deps/hashtable.Tpo .deps/hashtable.Po
gcc -DHAVE_CONFIG_H -I. -I../..     -O3 -Wall -msse2 -MT load.o -MD -MP -MF .deps/load.Tpo -c -o load.o load.c
mv -f .deps/load.Tpo .deps/load.Po
gcc -DHAVE_CONFIG_H -I. -I../..     -O3 -Wall -msse2 -MT strbuffer.o -MD -MP -MF .deps/strbuffer.Tpo -c -o strbuffer.o strbuffer.c
mv -f .deps/strbuffer.Tpo .deps/strbuffer.Po
gcc -DHAVE_CONFIG_H -I. -I../..     -O3 -Wall -msse2 -MT utf.o -MD -MP -MF .deps/utf.Tpo -c -o utf.o utf.c
mv -f .deps/utf.Tpo .deps/utf.Po
gcc -DHAVE_CONFIG_H -I. -I../..     -O3 -Wall -msse2 -MT value.o -MD -MP -MF .deps/value.Tpo -c -o value.o value.c
mv -f .deps/value.Tpo .deps/value.Po
rm -f libjansson.a
ar cru libjansson.a dump.o hashtable.o load.o strbuffer.o utf.o value.o
ranlib libjansson.a
make[3]: Nothing to be done for `all-am'.
Making all in x86_64
/usr/local/bin/yasm -f elf64 sha256_xmm_amd64.asm
rm -f libx8664.a
ar cru libx8664.a sha256_xmm_amd64.o
ranlib libx8664.a
ranlib: warning for library: libx8664.a the table of contents is empty (no object file members in the library define global symbols)
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson   -DHAS_YASM -O3 -Wall -msse2 -MT cpu-miner.o -MD -MP -MF .deps/cpu-miner.Tpo -c -o cpu-miner.o cpu-miner.c
mv -f .deps/cpu-miner.Tpo .deps/cpu-miner.Po
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson   -DHAS_YASM -O3 -Wall -msse2 -MT util.o -MD -MP -MF .deps/util.Tpo -c -o util.o util.c
mv -f .deps/util.Tpo .deps/util.Po
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson   -DHAS_YASM -O3 -Wall -msse2 -MT sha256_generic.o -MD -MP -MF .deps/sha256_generic.Tpo -c -o sha256_generic.o sha256_generic.c
mv -f .deps/sha256_generic.Tpo .deps/sha256_generic.Po
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson   -DHAS_YASM -O3 -Wall -msse2 -MT sha256_4way.o -MD -MP -MF .deps/sha256_4way.Tpo -c -o sha256_4way.o sha256_4way.c
mv -f .deps/sha256_4way.Tpo .deps/sha256_4way.Po
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson   -DHAS_YASM -O3 -Wall -msse2 -MT sha256_via.o -MD -MP -MF .deps/sha256_via.Tpo -c -o sha256_via.o sha256_via.c
mv -f .deps/sha256_via.Tpo .deps/sha256_via.Po
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson   -DHAS_YASM -O3 -Wall -msse2 -MT sha256_cryptopp.o -MD -MP -MF .deps/sha256_cryptopp.Tpo -c -o sha256_cryptopp.o sha256_cryptopp.c
mv -f .deps/sha256_cryptopp.Tpo .deps/sha256_cryptopp.Po
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson   -DHAS_YASM -O3 -Wall -msse2 -MT sha256_sse2_amd64.o -MD -MP -MF .deps/sha256_sse2_amd64.Tpo -c -o sha256_sse2_amd64.o sha256_sse2_amd64.c
mv -f .deps/sha256_sse2_amd64.Tpo .deps/sha256_sse2_amd64.Po
gcc -DHAS_YASM -O3 -Wall -msse2 -pthread  -o minerd cpu-miner.o util.o sha256_generic.o sha256_4way.o sha256_via.o sha256_cryptopp.o sha256_sse2_amd64.o -lcurl compat/jansson/libjansson.a -lpthread x86_64/libx8664.a
ld: warning: in x86_64/libx8664.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols:
  "_CalcSha256_x64", referenced from:
      _scanhash_sse2_64 in sha256_sse2_amd64.o
      _scanhash_sse2_64 in sha256_sse2_amd64.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [minerd] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Any ideas? If I make without the sse2_amd64 module it builds and runs fine using the original algorithms as you may have guessed.




Title: Re: New demonstration CPU miner available
Post by: geebus on March 22, 2011, 09:39:10 AM
BitcoinPool.com was updated to add support for jgarzik's CPU miner's long polling requests.

From the client side, Long Polling should be using GET method instead of POST method. That is, for it to be an actual "comet-style" long poll.

Either way though, we now support both GET and POST to long polling side channels.

...and to answer your question (jgarzik) in a completely late fashion, and in a different thread... our pool is "based on" your pool server in the sense that I used your pool as a reference when I wrote my own. However, we're running on a completely different framework, and not using sqlite3.

Great miner btw. :)


Title: Re: New demonstration CPU miner available
Post by: chromicant on March 22, 2011, 01:30:15 PM
So I tried to compile on my newer MacBook Pro (Intel i7; OS 10.6.6) with Xcode (and YASM 1.1.0) installed using the tarball version 0.8 of cpuminer with chromicant's patch. Indeed, the previous issue I had with libcurl seems to be machine-specific thing, but I ran into another problem. The configure runs fine but I run into a "in x86_64/libx8664.a, file was built for unsupported file format which is not the architecture being linked (x86_64)" error while trying to make amd2_sse64 module.    
Here is the output after running make:

Code:
Making all in x86_64
/usr/local/bin/yasm -f elf64 sha256_xmm_amd64.asm
rm -f libx8664.a
ar cru libx8664.a sha256_xmm_amd64.o
ranlib libx8664.a
ranlib: warning for library: libx8664.a the table of contents is empty (no object file members in the library define global symbols)

Any ideas? If I make without the sse2_amd64 module it builds and runs fine using the original algorithms as you may have guessed.

Try replacing "-f elf64" with "-f macho64" in the x86_64/Makefile as a workaround. Also, you need to make sure you're producing a 64-bit binary while you're compiling. Can't remember how to do that with XCode, but if you don't, the SSE2 code as written will fail. The code uses the added registers that come with the x86_64 architecture to prevent reading/writing to memory.


Title: Re: New demonstration CPU miner available
Post by: Patches on March 22, 2011, 02:49:09 PM
Try replacing "-f elf64" with "-f macho64" in the x86_64/Makefile as a workaround. Also, you need to make sure you're producing a 64-bit binary while you're compiling. Can't remember how to do that with XCode, but if you don't, the SSE2 code as written will fail. The code uses the added registers that come with the x86_64 architecture to prevent reading/writing to memory.

No dice. I ran the configure with the arch x86_64 command like this:
Code:
CFLAGS="-O3 -Wall -msse2 -arch x86_64" ./configure

then edited the x86_64/Makefile as you suggested (elf -> macho). I still get the similar error shown here:

Code:
make  all-recursive
Making all in compat
Making all in jansson
make[3]: Nothing to be done for `all'.
make[3]: Nothing to be done for `all-am'.
Making all in x86_64
make[2]: Nothing to be done for `all'.
gcc -DHAS_YASM -O3 -Wall -msse2 -arch x86_64 -pthread  -o minerd cpu-miner.o util.o sha256_generic.o sha256_4way.o sha256_via.o sha256_cryptopp.o sha256_sse2_amd64.o -lcurl compat/jansson/libjansson.a -lpthread x86_64/libx8664.a
ld: warning: in x86_64/libx8664.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols:
  "_CalcSha256_x64", referenced from:
      _scanhash_sse2_64 in sha256_sse2_amd64.o
      _scanhash_sse2_64 in sha256_sse2_amd64.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [minerd] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Seems like something, perhaps gcc (Version: i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)) , doesn't like the file x86_64/libx8664.a? That or I am not forcing a proper 64bit build for the confused Mac compiler.

For interest, I installed Debian on a virtual machine on my MacBook Pro and compiled cpuminer with SSE2_64 there with no problem. In fact, it runs quite well in the VM - over 3600 hashes/core/sec on the mobile i7, and over 3000 hashes/core/sec on the older Xeons in the MacPro.




Title: Re: New demonstration CPU miner available
Post by: richy_rich on March 22, 2011, 03:46:12 PM
I just compiled and ran this on OS X 10.6.6 by creating a byteswap.h and using no more than ./configure and make.  (No special options etc.)

Obviously you'll need the OS X developer tools installed but aside from that I did nothing funky.

Just create a file called byteswap.h with the following 4 lines in it in the same directory as everything else.

Code:
#include <libkern/OSByteOrder.h>
#define bswap_16(x) OSSwapInt16(x)
#define bswap_32(x) OSSwapInt32(x)
#define bswap_64(x) OSSwapInt64(x)

As far as I can see this is working fine, still testing though but no build probs after that.

Edit : Ah, just saw chromicants patch, that's probably a better way to bundle it into the build :)  Still, hope this helps someone.


Title: Re: New demonstration CPU miner available
Post by: Patches on March 22, 2011, 03:58:49 PM
I just compiled and ran this on OS X 10.6.6 by creating a byteswap.h and using no more than ./configure and make.  (No special options etc.)

Obviously you'll need the OS X developer tools installed but aside from that I did nothing funky.

Just create a file called byteswap.h with the following 4 lines in it in the same directory as everything else.

Code:
#include <libkern/OSByteOrder.h>
#define bswap_16(x) OSSwapInt16(x)
#define bswap_32(x) OSSwapInt32(x)
#define bswap_64(x) OSSwapInt64(x)

As far as I can see this is working fine, still testing though but no build probs after that.

Edit : Ah, just saw chromicants patch, that's probably a better way to bundle it into the build :)  Still, hope this helps someone.

Hi rich_rich. Does your compiled version have the sse2_64 algorithm as an option? If you don't install YASM, the compiler doesn't even try to make the sse2_64 so it works, albeit without sse2_64. If you have YASM however, you get the errors I described earlier in the thread. Still, using one of the other algorithm is a better option for mining than official client.


Title: Re: New demonstration CPU miner available
Post by: richy_rich on March 22, 2011, 05:01:44 PM
Hi, no it doesn't.  I've really only just started playing with it and looking at it tbh, if I get a chance I'll have a bash with yasm and report back :)


Title: cpuminer v0.8.1 released
Post by: jgarzik on March 22, 2011, 06:16:08 PM
Version 0.8.1 released.  Some non-critical bugfixes, and one feature (User-Agent) that assists pool server operators in isolating problems to specific miner clients.

Changes:
- Make --user, --pass actually work

- Add User-Agent HTTP header to requests, so that server operators may
  more easily identify the miner client.

- Fix minor bug in example JSON config file

SHA1: 0e60652fb0d29c6d20ed40bfce721bcd7a231b51  cpuminer-installer-0.8.1.zip
MD5: cc42cf0ff88958325dfedbd199f71a9e  cpuminer-installer-0.8.1.zip


Title: ubuntu problem
Post by: cdnbcguy on March 22, 2011, 09:58:47 PM
I am running Ubuntu 10.10 on an AMD Athlon X2 64 bit laptop

When I follow the instructions and do

   CFLAGS="-O3 -Wall -msse2" ./configure
   make

it runs fine and produces minerd as an executable.

But when I run it I get this

cdnbcguy@hiscomputer:~/cpuminer-0.8.1$ minerd
No command 'minerd' found, did you mean:
 Command 'mined' from package 'mined' (universe)
minerd: command not found

What the problem, please?


Title: Re: ubuntu problem
Post by: TurdHurdur on March 22, 2011, 11:34:49 PM
I am running Ubuntu 10.10 on an AMD Athlon X2 64 bit laptop

When I follow the instructions and do

   CFLAGS="-O3 -Wall -msse2" ./configure
   make

it runs fine and produces minerd as an executable.

But when I run it I get this

cdnbcguy@hiscomputer:~/cpuminer-0.8.1$ minerd
No command 'minerd' found, did you mean:
 Command 'mined' from package 'mined' (universe)
minerd: command not found

What the problem, please?
What'd "make install" output?


Title: Re: ubuntu problem
Post by: chromicant on March 23, 2011, 02:50:24 AM
cdnbcguy@hiscomputer:~/cpuminer-0.8.1$ minerd
No command 'minerd' found, did you mean:
 Command 'mined' from package 'mined' (universe)
minerd: command not found

What the problem, please?
Try ./minerd since . is traditionally not on your path.


Title: Re: New demonstration CPU miner available
Post by: cdnbcguy on March 23, 2011, 06:05:43 AM
Got it. What an embarrassing error.  ;D

Thank you.


Title: Re: New demonstration CPU miner available
Post by: Danzotron on March 23, 2011, 10:14:41 AM
Ok guys,
Question with bitcoins as reward for good info.

I have a Sun Fire V880 with 8 UltraSPARC III Cpus @ 1200mhz at my disposal. This thing is a beast. Surely there is a way for me to get some decent hashing going on with it?

I've noticed there's not really much of a port, or anything that's been moved over doesn't get decent speeds.

Can someone give me the hot tip on how I can start really utilising this machine?


Title: Re: New demonstration CPU miner available
Post by: dbitcoin on March 23, 2011, 10:47:33 AM
v0.8.1 use full long polling url for posting.

Long polling url header for btcmine.com:

'X-Long-Polling', 'http://btcmine.com:8332/lp'

Request from poclbm:

POST /lp

Request from minerd:

POST /http://btcmine.com:8332/lp


In my configuration, such request processed anyway, but I not sure about other servers and configurations.



Title: Re: New demonstration CPU miner available
Post by: Patches on March 23, 2011, 11:42:54 AM
Ok guys,
Question with bitcoins as reward for good info.

I have a Sun Fire V880 with 8 UltraSPARC III Cpus @ 1200mhz at my disposal. This thing is a beast. Surely there is a way for me to get some decent hashing going on with it?

I've noticed there's not really much of a port, or anything that's been moved over doesn't get decent speeds.

Can someone give me the hot tip on how I can start really utilising this machine?

I think there are no reports because it probably isn't possible. Knowing nothing about the UltraSPARC III architecture, it would seem to me that without SSE2 or some built-in SHA256 hashing optimization in the CPUs you won't get more than a few hundred khashes/sec/CPU, perhaps a 1000 with the right algorithm. A single modern dual-core Intel chip using the sse2_64 algorithm would beat all 8 of the SPARC CPUs making mining with the V880 probably not worth the electricity.

If it's fully at your disposal sell it and by some ATI GPUs for some actually efficient mining. Otherwise, download and compile jgarzik's miner (http://yyz.us/bitcoin/) and test each of the included algorithms to see which runs best on your architecture but I wouldn't bet on eking out more than a couple thousand khashes/sec. Better than nothing I guess.

Good luck!


Title: Re: New demonstration CPU miner available
Post by: chromicant on March 23, 2011, 12:17:38 PM
Ok guys,
Question with bitcoins as reward for good info.

I have a Sun Fire V880 with 8 UltraSPARC III Cpus @ 1200mhz at my disposal. This thing is a beast. Surely there is a way for me to get some decent hashing going on with it?

I've noticed there's not really much of a port, or anything that's been moved over doesn't get decent speeds.

Can someone give me the hot tip on how I can start really utilising this machine?

Use a good compiler and the C code?

The UltraSPARC III is just a standard RISC 64-bit CPU. The UltraSPARC III does have "MMX Like" instructions (VIS), but the ISA doesn't even have a bit rotate if I recall, which makes it useless for trying SIMD tricks to speed up SHA-anything.

You may get something with some hand assembly, but I don't think it'll hold a candle to the tuned SSE2 code that's in some of the miners out there on modern hardware.


Title: Re: New demonstration CPU miner available
Post by: adv on March 23, 2011, 01:25:42 PM
Question with bitcoins as reward for good info.
Unfortunately, my info is not as good as we would like. :^)

I have a Sun Fire V880 with 8 UltraSPARC III Cpus @ 1200mhz at my disposal. This thing is a beast. Surely there is a way for me to get some decent hashing going on with it?

I've noticed there's not really much of a port, or anything that's been moved over doesn't get decent speeds.

Can someone give me the hot tip on how I can start really utilising this machine?
I build Jgarzik miner for spark, and I saw a few things:
1. Algorithms. Forget about VIA, or asm algorithms: they are for x86. Available only "c" and "cryptopp". It's not so bad, but no SSE2-fantastics.
2. It may be possible to optimize C and cryptopp. I'm going to study this possibility, when I have spare time.

P.S.
Thanx @ Mtve, who doing some interessed speed tests and found infos about this theme: http://bitcointalk.org/index.php?topic=1925.msg63526#msg63526


Title: Re: New demonstration CPU miner available
Post by: Lardie on March 25, 2011, 02:12:09 AM
I'm having trouble getting decent speeds out of Jgarzik's miner on Ubuntu 10.10 (Phenom II X4 920). I'm only getting 125 kh/s per thread (4 threads), which drops to 50 kh/s with 4way enabled.

The same computer does 10+ mh/s using ufasoft's Win SSE2 miner.
Can someone please enlighten me as to how I can get the same performance under Linux.


Title: Re: New demonstration CPU miner available
Post by: lfm on March 25, 2011, 09:49:27 PM
I'm having trouble getting decent speeds out of Jgarzik's miner on Ubuntu 10.10 (Phenom II X4 920). I'm only getting 125 kh/s per thread (4 threads), which drops to 50 kh/s with 4way enabled.

The same computer does 10+ mh/s using ufasoft's Win SSE2 miner.
Can someone please enlighten me as to how I can get the same performance under Linux.

try "-a 4way" command line switch


Title: Re: New demonstration CPU miner available
Post by: chromicant on March 25, 2011, 10:22:38 PM
I'm having trouble getting decent speeds out of Jgarzik's miner on Ubuntu 10.10 (Phenom II X4 920). I'm only getting 125 kh/s per thread (4 threads), which drops to 50 kh/s with 4way enabled.

The same computer does 10+ mh/s using ufasoft's Win SSE2 miner.
Can someone please enlighten me as to how I can get the same performance under Linux.

If you do a ./minerd --help, is sse2_64 listed as a valid algorithm to use? If not, you need a copy of yasm 1.1 from Debian and use that. That'll compile the SSE2 code. You also need to be running a 64-bit version of Ubuntu.

The SSE2 code is not well-tuned for some AMD architectures, it seems.


Title: Re: New demonstration CPU miner available
Post by: SawEfDir on March 27, 2011, 12:36:45 PM
I'm having troubles getting the new sse2_amd64 algo compiled on my amd64 debian unstable system. I'm using the source from the git repo, commit 69529c38594f7bd56b50b9effed5a45125ccba3e
Though .configure seems to find yasm, make doesn't seem to compile it properly like shown in other forum posts. Trying minerd --algo sse_amd64 fails with minerd displaying the help page. Other algos seem to work ok. Debian unstable uses gcc-4.5 by default.

Unfortunately, the forum won't let me attach any files because the upload folder is full, and I don't want to clutter the post with long log file outputs.

Is there any extra option must set for ./configure in order to get the sse2_amd64 compiled in?


Title: Re: New demonstration CPU miner available
Post by: chromicant on March 27, 2011, 12:45:03 PM
You can use a pastebin for the logs. Need them to help you out.


Title: Re: New demonstration CPU miner available
Post by: SawEfDir on March 27, 2011, 02:31:04 PM
Oh indeed, thanks for the hint:

config.log: http://pastebin.com/stxRvch7 (http://pastebin.com/stxRvch7)
configure stdout: http://pastebin.com/dbLQsjzF (http://pastebin.com/dbLQsjzF)
make stdout: http://pastebin.com/dTV252An (http://pastebin.com/dTV252An)


Title: Re: New demonstration CPU miner available
Post by: chromicant on March 27, 2011, 04:03:30 PM
Ok. Took a look at the logs. Seems like configure is not doing the yasm test correctly. Can you run yasm --version and open an issue on my Github page for cpuminer?

https://github.com/chromicant/cpuminer/issues (https://github.com/chromicant/cpuminer/issues)


Title: Re: New demonstration CPU miner available
Post by: hazzey on March 27, 2011, 07:17:43 PM
I just went through the installation of minerd on Ubuntu 10.10.  I have one request for the maintainers.
Could you put in the README or INSTALL a list of the packages that will be required for the "configure" to complete.  I was able to get most of the required packages right away, but the libcurl one threw me for a while.  I had installed libcurl, but the configure script was not happy.  I finally had to install the libcurl-dev package.  This wasn't apparent from the error message that the configure script gave.  The error just says that libcurl needs to be of a certain version, not that you needed to install the dev package.

The packages that I remember installing were: yasm, libcurl-dev, automake, and gcc.

This might help future users wanting to install a cpu miner on linux.

Thanks,

hazzey


Title: Re: New demonstration CPU miner available
Post by: jgarzik on March 27, 2011, 07:34:04 PM
I just went through the installation of minerd on Ubuntu 10.10.  I have one request for the maintainers.
Could you put in the README or INSTALL a list of the packages that will be required for the "configure" to complete.  I was able to get most of the required packages right away, but the libcurl one threw me for a while.  I had installed libcurl, but the configure script was not happy.  I finally had to install the libcurl-dev package.  This wasn't apparent from the error message that the configure script gave.  The error just says that libcurl needs to be of a certain version, not that you needed to install the dev package.

The dependencies are listed in README.

The need for a "-dev" package is just required general knowledge:  to build any source code, not just minerd, you must install each -dev package required by that source code.





Title: Re: New demonstration CPU miner available
Post by: hazzey on March 28, 2011, 12:11:04 AM

The dependencies are listed in README.

The need for a "-dev" package is just required general knowledge:  to build any source code, not just minerd, you must install each -dev package required by that source code.


That does make sense, but like I said, it isn't immediately obvious, especially to someone who isn't used to compiling programs.

Now this might not be that big of a deal since most people who go through the trouble of download/compiling are well versed in it, but there may also be others like me who could benefit from a little more verbose documentation.

Well, even if nothing changes, someone might be helped just from my post.

Thanks,

hazzey


Title: Re: New demonstration CPU miner available
Post by: chromicant on March 28, 2011, 02:25:04 AM
Ok. Took a look at the logs. Seems like configure is not doing the yasm test correctly. Can you run yasm --version and open an issue on my Github page for cpuminer?

https://github.com/chromicant/cpuminer/issues (https://github.com/chromicant/cpuminer/issues)

And to talk to myself...I think I found the problem. Let me see if I can quickly fix it.

Edit

Fixed pushed to http://github.com/chromicant/cpuminer (http://github.com/chromicant/cpuminer) on the sse2 branch. Can people can pull from it and test to make sure it builds on other machines? It works on mine Ubuntu 10.10 x86_64 box with YASM 1.1.0.2352.

It also contains a minor update to the assembly code to remove the few pipeline stalls. I was playing with a profiler, and looking at some data people posted here, and made some minor fixes. Don't really see any noticeable speedup, but it should be there in theory. And we know how well theory is in practice.


Title: Re: New demonstration CPU miner available
Post by: eideteker on March 28, 2011, 05:40:51 AM
I just noticed this - the date reads a month in the past in the CPU miner.  Is this a problem on my end?  My computer's date/time are set correct.


Title: Re: New demonstration CPU miner available
Post by: SawEfDir on March 30, 2011, 05:02:33 PM
Ok. Took a look at the logs. Seems like configure is not doing the yasm test correctly. Can you run yasm --version and open an issue on my Github page for cpuminer?

https://github.com/chromicant/cpuminer/issues (https://github.com/chromicant/cpuminer/issues)
It seems the yasm version installed on my system was to old. I've thought I've installed version 1.1.0, but it actually was 0.8.0.
Debian unstable does only provide yasm 0.8.0. One can install 1.1.0 using the debian-multimedia.org repositories, though.

Thanks for you help.


Title: Re: New demonstration CPU miner available
Post by: Tolkien on March 30, 2011, 05:45:10 PM
I was looking at the cpu-miner's code (cpu-miner.c) and found in
static void *miner_thread(void *userdata) a few lines that look like this:
Quote
rc = (rc4 == -1) ? false : true;
and rc isn't initialized at declaration..
I'm a C++ (among other languages) programmer, not C, but I know a WTF (http://thedailywtf.com/) when I see one..
I'd love to hear the reason as to why this wasn't simply
Quote
bool rc = false;
(some code) ...
if (rc4 != -1) {
  rc = true;
}

I'd say that's 10,000x more readable and it's one less uninitialized variable, and less code.

I don't mean to sound grumpy, it's just.. so.... obvious...

Also, what's with the aversion to C++ and Boost (http://www.boost.org/) everyone seems to have? Macro abuse should be a thing of the past with template metaprogramming (http://www.boost.org/doc/libs/release/libs/mpl). I'm not saying don't use assembly (especially), macros or C-specific things at all, I'm just saying you can get rid of a tonne of macro abuse by combining template metaprogramming with Boost's Preprocessor (http://www.boost.org/doc/libs/release/libs/preprocessor/doc/) library correctly to hide compilation details behind a layer that abstracts away algorithmic details from general program flow with no impact on generated output.

This wasn't initially meant as a rant or anything with a harsh sounding tone btw, I'm just hungry and looking forward to pressing submit before I go eat. :S


Title: Re: New demonstration CPU miner available
Post by: LMGTFY on March 30, 2011, 05:48:40 PM
I'd love to hear the reason as to why this wasn't simply
Quote
bool rc = false;
(some code) ...
if (rc4 != -1) {
  rc = true;
}
I'm not a C/C++ programmer, but wouldn't...
Code:
rc = (rc4 != -1);
...be even more readable?


Title: Re: New demonstration CPU miner available
Post by: Tolkien on March 30, 2011, 05:56:48 PM
I'd love to hear the reason as to why this wasn't simply
Quote
bool rc = false;
(some code) ...
if (rc4 != -1) {
  rc = true;
}
I'm not a C/C++ programmer, but wouldn't...
Code:
rc = (rc4 != -1);
...be even more readable?

It would be if it were correct but it's not, the program flow would change regardless of whether or not rc were initialized.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on March 30, 2011, 06:00:51 PM
I'm not a C/C++ programmer, but wouldn't...
Code:
rc = (rc4 != -1);
...be even more readable?

It would be if it were correct but it's not, the program flow would change regardless of whether or not rc were initialized.

LMGTFY's code is correct, and you are mistaken (about not only this, but macro abuse etc. also)





Title: Re: New demonstration CPU miner available
Post by: LMGTFY on March 30, 2011, 06:04:45 PM
I'd love to hear the reason as to why this wasn't simply
Quote
bool rc = false;
(some code) ...
if (rc4 != -1) {
  rc = true;
}
I'm not a C/C++ programmer, but wouldn't...
Code:
rc = (rc4 != -1);
...be even more readable?

It would be if it were correct but it's not, the program flow would change regardless of whether or not rc were initialized.
Sorry, I wasn't suggesting replace all your code, obviously the initialisation and the (some code) block would be retained. It's just the if {} block I meant.


Title: Re: New demonstration CPU miner available
Post by: Tolkien on March 30, 2011, 06:07:54 PM
I'm not a C/C++ programmer, but wouldn't...
Code:
rc = (rc4 != -1);
...be even more readable?

It would be if it were correct but it's not, the program flow would change regardless of whether or not rc were initialized.

LMGTFY's code is correct, and you are mistaken (about not only this, but macro abuse etc. also)

Really? Double checking myself. 0.o I'd disagree about the macro abuse though. The unrelated code I'm working on has quite a bit of macro usage removed with the help of template metaprogramming.

Edit: After double checking I can safely and easily say I was wrong indeed
Quote
rc = (rc4 != -1);
is right. My mind must be playing tricks on me sorry. :S Now to go eat!


Title: Re: New demonstration CPU miner available
Post by: Tolkien on March 30, 2011, 06:13:40 PM
I'd love to hear the reason as to why this wasn't simply
Quote
bool rc = false;
(some code) ...
if (rc4 != -1) {
  rc = true;
}
I'm not a C/C++ programmer, but wouldn't...
Code:
rc = (rc4 != -1);
...be even more readable?

It would be if it were correct but it's not, the program flow would change regardless of whether or not rc were initialized.
Sorry, I wasn't suggesting replace all your code, obviously the initialisation and the (some code) block would be retained. It's just the if {} block I meant.

That was taken for granted, yeah. ;)


Title: Re: New demonstration CPU miner available
Post by: jkminkov on March 30, 2011, 08:02:52 PM
moving from http://bitcointalk.org/index.php?topic=3889.msg75264#msg75264 till end of page #24


http://bayimg.com/KaEgHaADl

win xp sp3 32bit

Q9550 @ 2,83Ghz

tuned all threads affinity with task manager to one core


Title: Re: New demonstration CPU miner available
Post by: jgarzik on March 30, 2011, 08:11:32 PM
moving from http://bitcointalk.org/index.php?topic=3889.msg75264#msg75264 till end of page #24


http://bayimg.com/KaEgHaADl

win xp sp3 32bit

This is expected.  As mentioned, sse2_64 only works on 64-bit Linux at the moment, so this high speed is not available under Windows.



Title: Re: New demonstration CPU miner available
Post by: enigmatic on March 30, 2011, 08:47:03 PM
I just downloaded bitcoin a few days ago and since I have MinGW and MSYS installed and built some programs from source before, I downloaded and built all of the prerequisite libraries and statically compiled the latest git revision of this miner. It requires no DLLs or other external files and it's only 609KB compressed with UPX. I tried attaching it to this post, but there's a 128KB limit.

To build a static minerd.exe for Windows:
1. Get MSYS and MinGW. I couldn't get autoconf to work so I just used the ./configure from minerd version 0.8.1.
2. Download libiconv, libidn, libssh2, openssl, zlib, curl, and pthreads-w32 sources.
3. Build libiconv, libidn, zlib, and openssl first (with "./configure --enable-static --disable-shared" and then "make").
4. Install (with "make install") each of those libraries.
5. Build and install libssh2 (same process as before), which should detect the libcrypto and libssl from openssl and the other things.
6. Build and install libcurl (same process as before), which should detect the previous libraries.
7. Build pthreads using "make clean GC-static" and then copy pthread.h, sched.h, and semaphore.h to your "include" folder and rename libpthreadGC2.a to libpthread.a and copy it to your lib folder.
8. Edit the ./configure from minerd 0.8.1 and change "libcurl_cv_lib_curl_usable=no" to "libcurl_cv_lib_curl_usable=yes" which is needed because of a bug in the ./configure script.
8. Use ./configure --host=i686-w64-mingw32 (or whatever your MinGW is called) to configure the CPU miner.
9. After ./configuring the CPU miner, edit the makefile and add "-DCURL_STATICLIB -DPTW32_STATIC_LIB -DHAVE_STRUCT_TIMESPEC=1 -msse2" to the end of the "CFLAGS =" line.
10. Edit cpu-miner.c and add "ptw32_processInitialize();" just before the "pthread_mutex_init(&time_lock, NULL);" in the main() function.
11. Then make it, and if all worked well there should be a file called minerd.exe.
12. Use "strip minerd.exe" to remove unused code and labels from the EXE which will greatly reduce its size.
13. Optionally compress the EXE using UPX.

I might have forgotten a few steps but the EXE that I made works and contributes shares to slush's pool. The good thing is that you only need to do steps 10-13 if you want to update it since the libraries are installed already. Maybe an "#ifdef PTW32_STATIC_LIB" for the "ptw32_processInitialize();" call would make things easier.


Title: Re: New demonstration CPU miner available
Post by: chromicant on March 30, 2011, 09:08:01 PM
This is expected.  As mentioned, sse2_64 only works on 64-bit Linux at the moment, so this high speed is not available under Windows.

For those who want to take on a challenge, what you need to do to allow sse2_64 to run on Win64 boxes is to change the assembly to handle the Windows ABI for x86_64.

This is a useful starting point:
https://secure.wikimedia.org/wikipedia/en/wiki/X86_calling_conventions#Table_of_x86_Calling_Conventions.5B1.5D (https://secure.wikimedia.org/wikipedia/en/wiki/X86_calling_conventions#Table_of_x86_Calling_Conventions.5B1.5D)
Since I don't do Windows development, I'm not going to port it. However, I'll look at pull requests on my SSE2 branch.


Title: Re: New demonstration CPU miner available
Post by: adv on April 01, 2011, 02:33:11 AM
Default user/password dont work in 0.8.1.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on April 01, 2011, 03:30:23 AM
Default user/password dont work in 0.8.1.

You're not really supposed to use the default name/password...  :)



Title: Re: New demonstration CPU miner available
Post by: adv on April 01, 2011, 05:21:25 AM
Default user/password dont work in 0.8.1.
You're not really supposed to use the default name/password...  :)
I do not see much point in using a password for mining. What can an attacker? Solve instead of me a couple of blocks? :^)
Another thing that bitkoin's bad design allows the machine that has access to getwork use the rest of the RPC-calls. So I use a simple proxy, which transmits to bitcoin only specified calls.

P.S.
Also short options -u and -p dont work in my build.
Code:
btc-cpuminer --url http://aaa:bbb@localhost:8334 -u ccc --pass ddd
btc-cpuminer: invalid option -- 'u'

P.P.S.
Generally speaking curl supports the standard pattern of URI and you just can use user name and password directly in the URL like "http://user:pass@example.net/some/page". And you can remove the unnecessary handling of the three options from the program. : ^)
Seriously I think is worth preserving the opportunity specify the user name and password are separate options, but must also be able to omit them and use specified in the URL. And in this case "userpass" option dont need totally.


Title: Re: New demonstration CPU miner available
Post by: pedropants on April 03, 2011, 08:56:21 PM
Try replacing "-f elf64" with "-f macho64" in the x86_64/Makefile as a workaround.

Unfortunately, sha256_xmm_amd64.asm will not assemble into a macho64 binary, with this error:

Code:
$ yasm -f macho64 sha256_xmm_amd64.asm
sha256_xmm_amd64.asm:106: error: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers.


And even though it assembles to an ELF64 binary just fine, the mac linker can't handle ELF objects.

Googling that yasm error shows some promising hits, but sadly I  do not know assembly at all, so I'm out of my league trying to fix it.



Title: Re: New demonstration CPU miner available
Post by: lfm on April 05, 2011, 05:57:11 AM
the "-algo cryptopp_asm32" just seg faults for me on linux 32bit, via C7 cpu.

It seems it dosen't even build on linux64 (hence the name)

Has anyone run this algo successfully?



Title: Re: New demonstration CPU miner available
Post by: ancow on April 11, 2011, 09:21:46 PM
I just noticed this - the date reads a month in the past in the CPU miner.  Is this a problem on my end?  My computer's date/time are set correct.
Actually it seems like an off-by-one error in the code. If memory serves me right (and it has been a few years since my last brush with C), tm_mon is zero-based, so the following diff should be applied to util.c:
Code:
--- cpuminer-git/util.c 2011-04-11 21:12:43.469374001 +0200
+++ cpuminer-compile/util.c     2011-04-11 21:22:49.149374000 +0200
@@ -80,7 +80,7 @@
                f = alloca(len);
                sprintf(f, "[%d-%02d-%02d %02d:%02d:%02d] %s\n",
                        tm.tm_year + 1900,
-                       tm.tm_mon,
+                       tm.tm_mon + 1,
                        tm.tm_mday,
                        tm.tm_hour,
                        tm.tm_min,


Title: Re: New demonstration CPU miner available
Post by: xf2_org on April 11, 2011, 09:51:52 PM
Good spotting.  Pushed off-by-one fix into git.


Title: Re: New demonstration CPU miner available
Post by: lfm on April 11, 2011, 09:53:53 PM
I just noticed this - the date reads a month in the past in the CPU miner.  Is this a problem on my end?  My computer's date/time are set correct.
Actually it seems like an off-by-one error in the code. If memory serves me right (and it has been a few years since my last brush with C), tm_mon is zero-based, so the following diff should be applied to util.c:
Code:
--- cpuminer-git/util.c 2011-04-11 21:12:43.469374001 +0200
+++ cpuminer-compile/util.c     2011-04-11 21:22:49.149374000 +0200
@@ -80,7 +80,7 @@
                f = alloca(len);
                sprintf(f, "[%d-%02d-%02d %02d:%02d:%02d] %s\n",
                        tm.tm_year + 1900,
-                       tm.tm_mon,
+                       tm.tm_mon + 1,
                        tm.tm_mday,
                        tm.tm_hour,
                        tm.tm_min,


should just use strftime() instead! something like :

     strftime(f, len, "[%F %T]", &tm);



Title: Re: New demonstration CPU miner available
Post by: xf2_org on April 11, 2011, 10:56:56 PM
Yeah, strftime can help, but must be certain of the format string being supported in Windows.


Title: Re: New demonstration CPU miner available
Post by: Zenitur on May 06, 2011, 09:59:52 AM
the "-algo cryptopp_asm32" just seg faults for me on linux 32bit, via C7 cpu.

It seems it dosen't even build on linux64 (hence the name)

Has anyone run this algo successfully?

I successfuly started this algo with 64-bit Gentoo and was Segmentation fault with 32-bit Kanotix LiveUSB. Same problem.

Update: tried latest GIT and saw same error.


Title: Re: New demonstration CPU miner available
Post by: singpolyma on May 06, 2011, 01:53:48 PM
As an interesting data point: 4way with 3 threads gave me 700 khash/s, whereas the normal c impl gets me 930khash/s


Title: Re: New demonstration CPU miner available
Post by: walidzohair on May 07, 2011, 12:06:08 PM
Why sse2_amd64 algorithm did not compiling? My system is ubuntu 10.04 64 bit and Core2Duo P8400 cpu.

As I can see in miner.h there is a definition WANT_X8664_SSE2, with checking sse2 support. But checking don't passing. When i comment this checking and try to 'make' there is an error:

Don't do that. There's a reason the check is failing.

If you looked at config.log, it probably says your version of yasm is 0.8.0. You need 1.1.0. For Ubuntu, you either compile it yourself or get the right version from Debian's repository.

I have yasm 1.1 and it shows it is ok on ubuntu natty but still no 4way in the compiled minderd.

any help ?



Title: Re: New demonstration CPU miner available
Post by: walidzohair on May 07, 2011, 12:07:55 PM
As an interesting data point: 4way with 3 threads gave me 700 khash/s, whereas the normal c impl gets me 930khash/s

So which algo is the fastest on teh same intel CPU ?

c or crpto or arypto_asm32 or 4way ?


Title: Re: New demonstration CPU miner available
Post by: xf2_org on May 10, 2011, 02:17:57 AM
Version 1.0 release.  See top post for URLs.

Changes:
- jansson 2.0 compatibility
- correct off-by-one in date (month) display output
- fix platform detection
- improve yasm configure bits
- support full URL, in X-Long-Polling header


Title: Re: New demonstration CPU miner available
Post by: Spoddy on May 10, 2011, 09:42:38 AM
Configure runs ok, but I'm getting a make error, .

sha256_4way.c:51: sorry, unimplemented: inlining failed in call to ‘ROTR’: function body not available
sha256_4way.c:458: sorry, unimplemented: called from here
sha256_4way.c:51: sorry, unimplemented: inlining failed in call to ‘ROTR’: function body not available
sha256_4way.c:458: sorry, unimplemented: called from here
sha256_4way.c:51: sorry, unimplemented: inlining failed in call to ‘ROTR’: function body not available
sha256_4way.c:458: sorry, unimplemented: called from here
make[1]: *** [sha256_4way.o] Error 1
make[1]: Leaving directory `/home/spoddy/cpuminer-1.0'
make: *** [install-recursive] Error 1
spoddy@bob:~/cpuminer-1.0$ cd ../bitcoin-0.3.21/


I'm a *nix newbie so any help would be appreciated.


Title: Re: New demonstration CPU miner available
Post by: walidzohair on May 10, 2011, 11:28:12 AM
If anybody is interested, this is the assembly code from Intel Compiler which gives me the fastest 4way code on AMD K10. 1.13 GH/s MH/s per 1 GHz per physical core.
https://gist.github.com/853566
Compile cpuminer-0.7.1, download the above code, issue:
gcc -c sha256_4way.s
and do make again to link the object file to the executable.  It's about 7% faster than the gcc version.

That is what I get

sha256_4way.s:11221: Error: bad register name `%rbp'
sha256_4way.s:11223: Error: bad register name `%rbx'
sha256_4way.s:11225: Error: bad register name `%r15'
sha256_4way.s:11227: Error: bad register name `%r14'
sha256_4way.s:11229: Error: bad register name `%r13'
sha256_4way.s:11231: Error: bad register name `%r12'

a lot of this when i tried

gcc -c sha256_4way.s


Title: Re: New demonstration CPU miner available
Post by: walidzohair on May 10, 2011, 11:40:28 AM
A new CPU miner is now available, making use of the new 'getwork' RPC command.

In the beginning, this is intended largely to demonstrate a 'getwork' miner.  It is written in straight C, with minimal dependencies (libcurl, jansson).

It has successfully generated blocks on testnet, mainnet and almost all pools.

Linux/BSD release tarball: http://yyz.us/bitcoin/cpuminer-1.0.tar.gz
Windows installer: http://yyz.us/bitcoin/cpuminer-installer-1.0.zip
git repository: git://github.com/jgarzik/cpuminer.git

Contributions welcomed!  (GPL v2 license)




anyway to support sse2 on ubuntu ?


Title: Re: New demonstration CPU miner available
Post by: xf2_org on May 10, 2011, 03:22:09 PM
sha256_4way.c:51: sorry, unimplemented: inlining failed in call to ‘ROTR’: function body not available
sha256_4way.c:458: sorry, unimplemented: called from here
sha256_4way.c:51: sorry, unimplemented: inlining failed in call to ‘ROTR’: function body not available

Use a newer compiler.



Title: Re: New demonstration CPU miner available
Post by: xf2_org on May 10, 2011, 03:22:46 PM
anyway to support sse2 on ubuntu ?

Do you mean 4way or sse2_64 algorithm?

sse2_64 requires yasm, and a 64-bit machine.



Title: Re: New demonstration CPU miner available
Post by: Spoddy on May 10, 2011, 06:36:04 PM
Thanks xf2_org, I'm now up to gcc 4.3.3

gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.3-5ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4)


but now I get

 make
make  all-recursive
make[1]: Entering directory `/home/spoddy/cpuminer-1.0'
Making all in compat
make[2]: Entering directory `/home/spoddy/cpuminer-1.0/compat'
Making all in jansson
make[3]: Entering directory `/home/spoddy/cpuminer-1.0/compat/jansson'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/spoddy/cpuminer-1.0/compat/jansson'
make[3]: Entering directory `/home/spoddy/cpuminer-1.0/compat'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/spoddy/cpuminer-1.0/compat'
make[2]: Leaving directory `/home/spoddy/cpuminer-1.0/compat'
make[2]: Entering directory `/home/spoddy/cpuminer-1.0'
gcc  -O3 -Wall -msse2 -pthread  -o minerd cpu-miner.o util.o sha256_generic.o sha256_4way.o sha256_via.o sha256_cryptopp.o sha256_sse2_amd64.o -lcurl -Wl,-Bsymbolic-functions -lgssapi_krb5 compat/jansson/libjansson.a -lpthread 
cpu-miner.o: In function `miner_thread':
cpu-miner.c:(.text+0xb2e): undefined reference to `ScanHash_4WaySSE2'
collect2: ld returned 1 exit status
make[2]: *** [minerd] Error 1
make[2]: Leaving directory `/home/spoddy/cpuminer-1.0'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/spoddy/cpuminer-1.0'
make: *** [all] Error 2


Is this still a gcc version issue? And what version have others managed to compile on?

Thanks


Title: Re: New demonstration CPU miner available
Post by: metonymous on May 10, 2011, 06:49:08 PM
OSX CPU Miner Binary (https://github.com/downloads/metonymous/cpuminer/minerd)

donations welcome @ 1MBBi4ZXrRaLZWFNrfHSSfTA8S9ZUBeUFD (http://bitcoin:1MBBi4ZXrRaLZWFNrfHSSfTA8S9ZUBeUFD)


Title: Re: New demonstration CPU miner available
Post by: ancow on May 11, 2011, 08:26:42 AM
sha256_4way.c:51: sorry, unimplemented: inlining failed in call to ‘ROTR’: function body not available
sha256_4way.c:458: sorry, unimplemented: called from here
sha256_4way.c:51: sorry, unimplemented: inlining failed in call to ‘ROTR’: function body not available

Use a newer compiler.
Shouldn't the configure script be checking for that, then?


Title: Re: New demonstration CPU miner available
Post by: Tarion on May 11, 2011, 11:49:55 AM
Code:
root@vs1028:/home/tarion/apps/cpuminer# apt-cache show libcurl3
Package: libcurl3
Priority: optional
Section: libs
Installed-Size: 444
Maintainer: Domenico Andreoli <cavok@debian.org>
Architecture: i386
Source: curl
Version: 7.18.2-8lenny4

But configure gives me:
Code:
checking whether libcurl is usable... no
configure: error: Missing required libcurl >= 7.10.1

Any Idea what is wrong?


Title: Re: New demonstration CPU miner available
Post by: Tarion on May 11, 2011, 11:58:08 AM
Found it on another page in this thread:

Quote
sudo apt-get install libcurl4-openssl-dev

Works! :)


Title: Re: New demonstration CPU miner available
Post by: tuxsoul on May 12, 2011, 02:23:07 AM
Hi, I like to give some news about the not oficial debian/ubuntu package of bitcoin-cpuminer:

* You can find the version 0.8.1 in ubuntu and debian, only in ubuntu (maverick, natty, oneiric) have SSE2_64 enable.
* If not exist any issue in the last version 1.0, i will create a package in a couple days.
* If possible this package get in the next ubuntu release, please check: https://bugs.launchpad.net/ubuntu/+bug/780258, give you comment's or any feedback.

* @jgarzik: In ubuntu revu get this comment
http://revu.ubuntuwire.com/p/bitcoin-cpuminer

Quote
@sikon: I’m not sure about the binary name "minerd". It sounds too generic, not specific to BitCoin. Could it be renamed?

what you think @jgarzik ?

read more ...
http://bitcointalk.org/index.php?topic=2207.msg115320#msg115320


Title: Re: New demonstration CPU miner available
Post by: xf2_org on May 12, 2011, 04:39:15 AM
Quote
@sikon: I’m not sure about the binary name "minerd". It sounds too generic, not specific to BitCoin. Could it be renamed?

A rename will only be considered if a conflict exists with an existing, real-world program.

Otherwise, you're already looking at a program that's seen six months of heavy use on Windows and Linux, using the "minerd" name.  A rename would create pointless churn, with zero value for existing cpuminer users.



Title: Re: New demonstration CPU miner available
Post by: edanite on May 13, 2011, 08:53:18 PM
I got Mach-O x86_64 SSE2 to work (Mac OS 10.6.7). Here's the list of everything I did:

1. I got the file libcurl.m4 from a curl source tarball and stuck it in an m4 directory.

2. I installed the gnulib byteswap module into the cpuminer directory and updated build scripts as necessary.

3. When configuring, I had to use both "-arch x86_64" in CFLAGS and the '--build=x86_64-apple-darwin10.7.0' flag, since it seems to detect that my kernel is 32 bit rather than that my processor is 64 bit.

4. To assemble sha256_xmm_amd64.asm, I set "-f macho64" in the Makefile (todo: integrate this into configure)

5. To fix the assembly failures, I applied the patch here: <https://gist.github.com/971291>.

It fixes the 32-bit offset by using another register to hold the current target, which is then used directly and updated as necessary. This adds one extra line of assembly (I'm not sufficiently familiar with x86_64 assembly to know whether or not it actually adds an extra _instruction_, but it probably does) to the main loop as well as a push and a pop to save and restore the values of the register I used (r8). The assembly already uses r10 without doing a save and restore, but I'm not sure how to check that r8 is unused, so this might be unnecessary. It also fixes a problem where my gcc apparently adds leading underscores to all of the names.

This is the least clean section because it probably breaks the build on Linux. Nobody said assembly was supposed to be portable...


Title: Re: New demonstration CPU miner available
Post by: chromicant on May 13, 2011, 10:16:23 PM
Sorry I've missed most of the recent discussion...busy with a new addition...

The r10 "trick" of letting it get clobbered requires you know something about the calling convention of the OS in use. The Linux SSE2 code for x86_64 will completely break on Windows, since there's a different set of registers saved between function calls. Depending on what OSX does with r8, you may be able to let it get clobbered, saving you a cycle or two.

I never really found any docs on how the calling convention works under Darwin/Mac OSX. I'm sure reading the GCC source code would enlighten someone. But I also like my sanity.


Title: Re: New demonstration CPU miner available
Post by: gkolt on May 14, 2011, 06:39:51 PM
I have a bitcoind server running and accepting connections aswell (rpcallowip=*).

I have tried to run minerd connecting to my bitcoind server, but all I got is:

# ./minerd -c miner.cfg
[2011-05-14 20:24:41] 8 miner threads started, using SHA256 'sse2_64' algorithm.
[2011-05-14 20:33:41] PROOF OF WORK RESULT: false (booooo)
[2011-05-14 20:34:16] PROOF OF WORK RESULT: false (booooo)

Also, the hash meter on the other side (bitcoind) did not increase at all.
Shouldn't the bitcoind (server) hash meter increase aswell ?

Am I missing something ? Am I 'pooling' wrong ?
I'm running openSUSE 11.3, kernel 2.6.34.8-0.2, i7 930.

Thanks in advance.


Title: Re: New demonstration CPU miner available
Post by: xf2_org on May 15, 2011, 02:57:30 AM

Version 1.0.1 is released.

The only change is the addition of OSX build support.  FreeBSD is also reported to be working out of the box.

There is no Windows build for this release (no need).



Title: Re: New demonstration CPU miner available
Post by: Amelios on May 15, 2011, 04:37:47 PM
I'm still getting this when trying to compile 1.0.1 on OSX:
Code:
ld: warning: in x86_64/libx8664.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols:
  "_CalcSha256_x64", referenced from:
      _scanhash_sse2_64 in sha256_sse2_amd64.o
      _scanhash_sse2_64 in sha256_sse2_amd64.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [minerd] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2


Title: Re: New demonstration CPU miner available
Post by: General-Beck on May 15, 2011, 09:06:51 PM
Ubuntu 11.04 Natty AMD64 make problems
Code:
general-beck@gblive:/userdata/Bitcoin/cpuminer-1.0.1$ 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 a thread-safe mkdir -p... /bin/mkdir -p
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 whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
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 ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking whether gcc needs -traditional... no
checking whether gcc and cc understand -c and -o together... yes
checking for ranlib... ranlib
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 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 json_loads in -ljansson... yes
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
checking for gawk... (cached) gawk
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... yes
checking for curl_free... 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 cpuminer-config.h
config.status: cpuminer-config.h is unchanged
config.status: executing depfiles commands
general-beck@gblive:/userdata/Bitcoin/cpuminer-1.0.1$ make
make  all-recursive
make[1]: Вход в каталог `/userdata/Bitcoin/cpuminer-1.0.1'
Making all in compat
make[2]: Вход в каталог `/userdata/Bitcoin/cpuminer-1.0.1/compat'
make[3]: Вход в каталог `/userdata/Bitcoin/cpuminer-1.0.1/compat'
make[3]: Цель `all-am' не требует выполнения команд.
make[3]: Выход из каталога `/userdata/Bitcoin/cpuminer-1.0.1/compat'
make[2]: Выход из каталога `/userdata/Bitcoin/cpuminer-1.0.1/compat'
Making all in x86_64
make[2]: Вход в каталог `/userdata/Bitcoin/cpuminer-1.0.1/x86_64'
make[2]: Цель `all' не требует выполнения команд.
make[2]: Выход из каталога `/userdata/Bitcoin/cpuminer-1.0.1/x86_64'
make[2]: Вход в каталог `/userdata/Bitcoin/cpuminer-1.0.1'
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing    -DHAS_YASM -O3 -Wall -msse2 -MT cpu-miner.o -MD -MP -MF .deps/cpu-miner.Tpo -c -o cpu-miner.o cpu-miner.c
cpu-miner.c: In function ‘parse_arg’:
cpu-miner.c:736:3: warning: passing argument 2 of ‘json_load_file’ makes integer from pointer without a cast
/usr/include/jansson.h:221:9: note: expected ‘size_t’ but argument is of type ‘struct json_error_t *’
cpu-miner.c:736:3: error: too few arguments to function ‘json_load_file’
/usr/include/jansson.h:221:9: note: declared here
make[2]: *** [cpu-miner.o] Ошибка 1
make[2]: Выход из каталога `/userdata/Bitcoin/cpuminer-1.0.1'
make[1]: *** [all-recursive] Ошибка 1
make[1]: Выход из каталога `/userdata/Bitcoin/cpuminer-1.0.1'
make: *** [all] Ошибка 2


Title: Re: New demonstration CPU miner available
Post by: xf2_org on May 15, 2011, 10:00:03 PM
I'm still getting this when trying to compile 1.0.1 on OSX:

Avoid yasm.



Title: Re: New demonstration CPU miner available
Post by: xf2_org on May 15, 2011, 10:00:26 PM
Ubuntu 11.04 Natty AMD64 make problems

Use jansson that ships with cpuminer.



Title: Re: New demonstration CPU miner available
Post by: Amelios on May 15, 2011, 11:58:34 PM
I'm still getting this when trying to compile 1.0.1 on OSX:

Avoid yasm.



Recommendations on what to use instead?


Title: Re: New demonstration CPU miner available
Post by: xf2_org on May 16, 2011, 12:30:00 AM
I'm still getting this when trying to compile 1.0.1 on OSX:

Avoid yasm.



Recommendations on what to use instead?

There is no alternative.  It does not work for cpuminer on OSX.



Title: Re: New demonstration CPU miner available
Post by: Amelios on May 16, 2011, 12:37:54 AM
I'm still getting this when trying to compile 1.0.1 on OSX:

Avoid yasm.



Recommendations on what to use instead?

There is no alternative.  It does not work for cpuminer on OSX.



So there's no way to use cpuminer on OSX, then?  I was a little thrown off by the OSX build support message...


Title: Re: New demonstration CPU miner available
Post by: xf2_org on May 16, 2011, 01:39:14 AM
So there's no way to use cpuminer on OSX, then?  I was a little thrown off by the OSX build support message...

Remove yasm and everything works fine on OSX.



Title: Failed work product problem
Post by: khaki54 on May 19, 2011, 07:53:48 PM
Running minerd on a server with 2 six-core opterons.

"minerd --url http://xxxxxxxxx.com:8332 --userpass xxxxxxxxxxxx -t 12 -a 4way -q"

I have 435 of these after running it for 20 hours
PROOF OF WORK RESULT: false (booooo)

And no "true"

Is this normal?

EDIT:
Here's what my speed looks like--

[xxxx@fw cpuminer-1.0.1]$ minerd --url http://xxxx:8332 --userpass xxxxx -t 12 -a 4way
[2011-05-19 19:56:14] thread 2: 11484672 hashes, 2729.72 khash/sec
[2011-05-19 19:56:14] PROOF OF WORK RESULT: false (booooo)
[2011-05-19 19:56:15] thread 0: 16777216 hashes, 2599.12 khash/sec
[2011-05-19 19:56:16] thread 1: 16777216 hashes, 2521.49 khash/sec
[2011-05-19 19:56:17] thread 3: 16777216 hashes, 2589.44 khash/sec
[2011-05-19 19:56:19] thread 4: 16777216 hashes, 2495.23 khash/sec
[2011-05-19 19:56:19] thread 5: 16777216 hashes, 2612.37 khash/sec
[2011-05-19 19:56:20] 12 miner threads started, using SHA256 '4way' algorithm.
[2011-05-19 19:56:20] thread 2: 14355840 hashes, 2608.22 khash/sec
[2011-05-19 19:56:20] thread 1: 11983744 hashes, 2717.19 khash/sec
[2011-05-19 19:56:20] thread 0: 13981024 hashes, 2729.22 khash/sec
[2011-05-19 19:56:20] thread 6: 16777216 hashes, 2595.14 khash/sec
[2011-05-19 19:56:21] thread 7: 16777216 hashes, 2637.12 khash/sec
[2011-05-19 19:56:22] thread 8: 16777216 hashes, 2730.15 khash/sec
[2011-05-19 19:56:23] thread 3: 13981024 hashes, 2612.74 khash/sec
[2011-05-19 19:56:23] thread 9: 16777216 hashes, 2614.99 khash/sec
[2011-05-19 19:56:24] thread 4: 11983744 hashes, 2534.44 khash/sec
[2011-05-19 19:56:24] thread 10: 16777216 hashes, 2724.20 khash/sec
[2011-05-19 19:56:25] thread 2: 11963200 hashes, 2611.13 khash/sec
[2011-05-19 19:56:25] thread 5: 13981024 hashes, 2564.46 khash/sec
[2011-05-19 19:56:26] thread 11: 16777216 hashes, 2626.98 khash/sec


Title: Re: Failed work product problem
Post by: xf2_org on May 19, 2011, 07:56:29 PM
Running minerd on a server with 2 six-core opterons.

"minerd --url http://xxxxxxxxx.com:8332 --userpass xxxxxxxxxxxx -t 12 -a 4way -q"

I have 435 of these after running it for 20 hours
PROOF OF WORK RESULT: false (booooo)

And no "true"

Is this normal?

What is the network/pool target?

It's certainly very normal for the mainnet, with its huge difficulty.



Title: Re: Failed work product problem
Post by: khaki54 on May 19, 2011, 08:01:10 PM
What is the network/pool target?
It's certainly very normal for the mainnet, with its huge difficulty.

I'm running it solo pointing it to another server so I can improve the compilation and just test the overall feasibility of running this on several.


Title: Re: New demonstration CPU miner available
Post by: soupdiver on May 20, 2011, 03:15:16 PM
Hey,
im using minderd on my mac.... with the default algo i got 100%cpu usage as i aspected but when i change the algo to 4way (i think it should be faster or am i wrong?) i hav no cpu usage...
so whats the differecnce between the algos?

greetz


Title: Re: New demonstration CPU miner available
Post by: ancow on May 20, 2011, 05:19:15 PM
when i change the algo to 4way (i think it should be faster or am i wrong?)
You need to experiment, but on my father's MacBook, the default c implementation was the fastest by far.


Title: Re: New demonstration CPU miner available
Post by: nosacky on May 23, 2011, 03:34:38 PM
Ubuntu 11.04 Natty AMD64 make problems
Code:
general-beck@gblive:/userdata/Bitcoin/cpuminer-1.0.1$ CFLAGS="-O3 -Wall -msse2" ./configure
...


I think the problem is that the first option in cflags should be 03 (with a zero) NOT O3 (with the letter 'o'). Hope that helps.


Title: Re: New demonstration CPU miner available
Post by: ancow on May 23, 2011, 07:43:17 PM
Ubuntu 11.04 Natty AMD64 make problems
Code:
general-beck@gblive:/userdata/Bitcoin/cpuminer-1.0.1$ CFLAGS="-O3 -Wall -msse2" ./configure
...


I think the problem is that the first option in cflags should be 03 (with a zero) NOT O3 (with the letter 'o'). Hope that helps.
Nope, that should be -O3 (as in oh three). It's optimisation level three.


Title: Re: New demonstration CPU miner available
Post by: juliohm on May 25, 2011, 10:28:14 AM
Is it possible to use this behind an HTTP or SOCKS proxy?


Title: Re: New demonstration CPU miner available
Post by: earthmeLon on May 25, 2011, 05:39:06 PM
I am having troubles with ./configure detecting LIBCURL on Centos 5

Code:
Package curl-7.15.5-9.el5_6.2.x86_64 already installed and latest version
Package curl-7.15.5-9.el5_6.2.i386 already installed and latest version
Package curl-devel-7.15.5-9.el5_6.2.x86_64 already installed and latest version
Package curl-devel-7.15.5-9.el5_6.2.i386 already installed and latest version

Code:
/usr/lib/libcurl.a
/usr/lib/libcurl.so
/usr/lib/libcurl.so.3
/usr/lib/libcurl.so.3.0.0
/usr/lib/pkgconfig/libcurl.pc
/usr/lib64/libcurl.a
/usr/lib64/libcurl.so
/usr/lib64/libcurl.so.3
/usr/lib64/libcurl.so.3.0.0
/usr/lib64/pkgconfig/libcurl.pc

I noticed a previous reply saying that it's caused by ./autogen.sh's failure to detect it's location, but I've opened autogen.sh and cannot figure out what needs to be done.

Code:
$ CFLAGS="-O3 -Wall -msse2" ./configure

...
./configure: line 4598: syntax error near unexpected token `,'
./configure: line 4598: `LIBCURL_CHECK_CONFIG(, 7.10.1, ,'

Thanks in advance :D


Title: Re: New demonstration CPU miner available
Post by: xf2_org on May 25, 2011, 06:19:27 PM
I noticed a previous reply saying that it's caused by ./autogen.sh's failure to detect it's location, but I've opened autogen.sh and cannot figure out what needs to be done.

Code:
$ CFLAGS="-O3 -Wall -msse2" ./configure

...
./configure: line 4598: syntax error near unexpected token `,'
./configure: line 4598: `LIBCURL_CHECK_CONFIG(, 7.10.1, ,'

Yes, this is a FAQ.  Use the tarball, not git repo, for building.



Title: Re: New demonstration CPU miner available
Post by: ancow on May 30, 2011, 06:18:19 AM
I just got this backtrace from a self-compiled, up-to-date version of minerd, mining on deepbit.net (with quite a few long-polling exceptions due to the recent DDOS):

Code:
*** longjmp causes uninitialized stack frame ***: minerd terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7f62e00b1537]
/lib/libc.so.6(+0xff4c9)[0x7f62e00b14c9]
/lib/libc.so.6(__longjmp_chk+0x33)[0x7f62e00b1433]
/usr/lib/libcurl.so.4(+0xe3a5)[0x7f62e05603a5]
/lib/libpthread.so.0(+0xfb40)[0x7f62e0344b40]
/lib/libpthread.so.0(pthread_join+0x115)[0x7f62e033d285]
minerd[0x402384]
/lib/libc.so.6(__libc_start_main+0xfe)[0x7f62dffd0d8e]
minerd[0x401889]
======= Memory map: ========
00400000-0041e000 r-xp 00000000 08:06 3320889                            /home/reini/root/bin/minerd
0061d000-0061e000 r-xp 0001d000 08:06 3320889                            /home/reini/root/bin/minerd
0061e000-0061f000 rwxp 0001e000 08:06 3320889                            /home/reini/root/bin/minerd
00664000-006a6000 rwxp 00000000 00:00 0                                  [heap]
7f62d4000000-7f62d4021000 rwxp 00000000 00:00 0
7f62d4021000-7f62d8000000 ---p 00000000 00:00 0
7f62daa67000-7f62daa7c000 r-xp 00000000 08:03 293839                     /lib/libgcc_s.so.1
7f62daa7c000-7f62dac7b000 ---p 00015000 08:03 293839                     /lib/libgcc_s.so.1
7f62dac7b000-7f62dac7c000 r-xp 00014000 08:03 293839                     /lib/libgcc_s.so.1
7f62dac7c000-7f62dac7d000 rwxp 00015000 08:03 293839                     /lib/libgcc_s.so.1
7f62dac7d000-7f62dac7e000 ---p 00000000 00:00 0
7f62dac7e000-7f62db47e000 rwxp 00000000 00:00 0
7f62db47e000-7f62db483000 r-xp 00000000 08:03 1118114                    /lib/libnss_dns-2.12.1.so
7f62db483000-7f62db682000 ---p 00005000 08:03 1118114                    /lib/libnss_dns-2.12.1.so
7f62db682000-7f62db683000 r-xp 00004000 08:03 1118114                    /lib/libnss_dns-2.12.1.so
7f62db683000-7f62db684000 rwxp 00005000 08:03 1118114                    /lib/libnss_dns-2.12.1.so
7f62db684000-7f62db686000 r-xp 00000000 08:03 293879                     /lib/libnss_mdns4_minimal.so.2
7f62db686000-7f62db885000 ---p 00002000 08:03 293879                     /lib/libnss_mdns4_minimal.so.2
7f62db885000-7f62db886000 r-xp 00001000 08:03 293879                     /lib/libnss_mdns4_minimal.so.2
7f62db886000-7f62db887000 rwxp 00002000 08:03 293879                     /lib/libnss_mdns4_minimal.so.2
7f62db887000-7f62db893000 r-xp 00000000 08:03 1118384                    /lib/libnss_files-2.12.1.so
7f62db893000-7f62dba92000 ---p 0000c000 08:03 1118384                    /lib/libnss_files-2.12.1.so
7f62dba92000-7f62dba93000 r-xp 0000b000 08:03 1118384                    /lib/libnss_files-2.12.1.so
7f62dba93000-7f62dba94000 rwxp 0000c000 08:03 1118384                    /lib/libnss_files-2.12.1.so
7f62dba94000-7f62dba95000 ---p 00000000 00:00 0
7f62dba95000-7f62dc295000 rwxp 00000000 00:00 0
7f62dc295000-7f62dc296000 ---p 00000000 00:00 0
7f62dc296000-7f62dca96000 rwxp 00000000 00:00 0
7f62dca96000-7f62dca97000 ---p 00000000 00:00 0
7f62dca97000-7f62dd297000 rwxp 00000000 00:00 0
7f62dd297000-7f62dd29a000 r-xp 00000000 08:03 294183                     /lib/libgpg-error.so.0.8.0
7f62dd29a000-7f62dd499000 ---p 00003000 08:03 294183                     /lib/libgpg-error.so.0.8.0
7f62dd499000-7f62dd49a000 r-xp 00002000 08:03 294183                     /lib/libgpg-error.so.0.8.0
7f62dd49a000-7f62dd49b000 rwxp 00003000 08:03 294183                     /lib/libgpg-error.so.0.8.0
7f62dd49b000-7f62dd50f000 r-xp 00000000 08:03 293841                     /lib/libgcrypt.so.11.5.3
7f62dd50f000-7f62dd70f000 ---p 00074000 08:03 293841                     /lib/libgcrypt.so.11.5.3
7f62dd70f000-7f62dd710000 r-xp 00074000 08:03 293841                     /lib/libgcrypt.so.11.5.3
7f62dd710000-7f62dd713000 rwxp 00075000 08:03 293841                     /lib/libgcrypt.so.11.5.3
7f62dd713000-7f62dd723000 r-xp 00000000 08:03 1185893                    /usr/lib/libtasn1.so.3.1.9
7f62dd723000-7f62dd922000 ---p 00010000 08:03 1185893                    /usr/lib/libtasn1.so.3.1.9
7f62dd922000-7f62dd923000 r-xp 0000f000 08:03 1185893                    /usr/lib/libtasn1.so.3.1.9
7f62dd923000-7f62dd924000 rwxp 00010000 08:03 1185893                    /usr/lib/libtasn1.so.3.1.9
7f62dd924000-7f62dd926000 r-xp 00000000 08:03 293855                     /lib/libkeyutils.so.1.3
7f62dd926000-7f62ddb25000 ---p 00002000 08:03 293855                     /lib/libkeyutils.so.1.3
7f62ddb25000-7f62ddb26000 r-xp 00001000 08:03 293855                     /lib/libkeyutils.so.1.3
7f62ddb26000-7f62ddb27000 rwxp 00002000 08:03 293855                     /lib/libkeyutils.so.1.3
7f62ddb27000-7f62ddb29000 r-xp 00000000 08:03 1118423                    /lib/libdl-2.12.1.so
7f62ddb29000-7f62ddd29000 ---p 00002000 08:03 1118423                    /lib/libdl-2.12.1.so
7f62ddd29000-7f62ddd2a000 r-xp 00002000 08:03 1118423                    /lib/libdl-2.12.1.so
7f62ddd2a000-7f62ddd2b000 rwxp 00003000 08:03 1118423                    /lib/libdl-2.12.1.so
7f62ddd2b000-7f62ddd32000 r-xp 00000000 08:03 1185882                    /usr/lib/libkrb5support.so.0.1
7f62ddd32000-7f62ddf31000 ---p 00007000 08:03 1185882                    /usr/lib/libkrb5support.so.0.1
7f62ddf31000-7f62ddf32000 r-xp 00006000 08:03 1185882                    /usr/lib/libkrb5support.so.0.1
7f62ddf32000-7f62ddf33000 rwxp 00007000 08:03 1185882                    /usr/lib/libkrb5support.so.0.1
7f62ddf33000-7f62ddf36000 r-xp 00000000 08:03 293812                     /lib/libcom_err.so.2.1
7f62ddf36000-7f62de135000 ---p 00003000 08:03 293812                     /lib/libcom_err.so.2.1
7f62de135000-7f62de136000 r-xp 00002000 08:03 293812                     /lib/libcom_err.so.2.1
7f62de136000-7f62de137000 rwxp 00003000 08:03 293812                     /lib/libcom_err.so.2.1
7f62de137000-7f62de15b000 r-xp 00000000 08:03 1183367                    /usr/lib/libk5crypto.so.3.1
7f62de15b000-7f62de35b000 ---p 00024000 08:03 1183367                    /usr/lib/libk5crypto.so.3.1
7f62de35b000-7f62de35c000 r-xp 00024000 08:03 1183367                    /usr/lib/libk5crypto.so.3.1
7f62de35c000-7f62de35d000 rwxp 00025000 08:03 1183367                    /usr/lib/libk5crypto.so.3.1
7f62de35d000-7f62de416000 r-xp 00000000 08:03 1185719                    /usr/lib/libkrb5.so.3.3
7f62de416000-7f62de615000 ---p 000b9000 08:03 1185719                    /usr/lib/libkrb5.so.3.3
7f62de615000-7f62de61e000 r-xp 000b8000 08:03 1185719                    /usr/lib/libkrb5.so.3.3
7f62de61e000-7f62de61f000 rwxp 000c1000 08:03 1185719                    /usr/lib/libkrb5.so.3.3

I'm pretty sure I've had this or a similar trace before, but it's been a few weeks.


Title: Re: New demonstration CPU miner available
Post by: bcbc on June 02, 2011, 05:40:00 PM
How do I disable SSE? Or is it supposed to work an Intel Mac?
I am trying to compile on a OSX,, and I get

Code:
Making all in x86_64
/opt/local/bin/yasm -f elf64 sha256_xmm_amd64.asm
rm -f libx8664.a
ar cru libx8664.a sha256_xmm_amd64.o
ranlib libx8664.a
ranlib: warning for library: libx8664.a the table of contents is empty (no object file members in the library define global symbols)
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson   -DHAS_YASM -g -O2 -MT cpu-miner.o -MD -MP -MF .deps/cpu-miner.Tpo -c -o cpu-miner.o cpu-miner.c
mv -f .deps/cpu-miner.Tpo .deps/cpu-miner.Po
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson   -DHAS_YASM -g -O2 -MT util.o -MD -MP -MF .deps/util.Tpo -c -o util.o util.c
mv -f .deps/util.Tpo .deps/util.Po
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson   -DHAS_YASM -g -O2 -MT sha256_generic.o -MD -MP -MF .deps/sha256_generic.Tpo -c -o sha256_generic.o sha256_generic.c
mv -f .deps/sha256_generic.Tpo .deps/sha256_generic.Po
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson   -DHAS_YASM -g -O2 -MT sha256_4way.o -MD -MP -MF .deps/sha256_4way.Tpo -c -o sha256_4way.o sha256_4way.c
mv -f .deps/sha256_4way.Tpo .deps/sha256_4way.Po
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson   -DHAS_YASM -g -O2 -MT sha256_via.o -MD -MP -MF .deps/sha256_via.Tpo -c -o sha256_via.o sha256_via.c
mv -f .deps/sha256_via.Tpo .deps/sha256_via.Po
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson   -DHAS_YASM -g -O2 -MT sha256_cryptopp.o -MD -MP -MF .deps/sha256_cryptopp.Tpo -c -o sha256_cryptopp.o sha256_cryptopp.c
mv -f .deps/sha256_cryptopp.Tpo .deps/sha256_cryptopp.Po
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson   -DHAS_YASM -g -O2 -MT sha256_sse2_amd64.o -MD -MP -MF .deps/sha256_sse2_amd64.Tpo -c -o sha256_sse2_amd64.o sha256_sse2_amd64.c
mv -f .deps/sha256_sse2_amd64.Tpo .deps/sha256_sse2_amd64.Po
gcc -DHAS_YASM -g -O2 -pthread -L/opt/local/lib -o minerd cpu-miner.o util.o sha256_generic.o sha256_4way.o sha256_via.o sha256_cryptopp.o sha256_sse2_amd64.o -L/opt/local/lib -lcurl -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -lidn -lssl -lcrypto -lssl -lcrypto -lz -lz compat/jansson/libjansson.a -lpthread x86_64/libx8664.a
ld: warning: in x86_64/libx8664.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols:
  "_CalcSha256_x64", referenced from:
      _scanhash_sse2_64 in sha256_sse2_amd64.o
      _scanhash_sse2_64 in sha256_sse2_amd64.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [minerd] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2


Title: Re: New demonstration CPU miner available
Post by: xf2_org on June 02, 2011, 06:35:07 PM
How do I disable SSE? Or is it supposed to work an Intel Mac?
I am trying to compile on a OSX,, and I get

The ugly fix is to hide yasm.  yasm produces something that the compiler does not like, on OSX.



Title: Re: New demonstration CPU miner available
Post by: jncraton on June 02, 2011, 08:01:34 PM
I'm having problems getting the sse2_64 mode working on Ubuntu. I've read through this thread, and it seems that the major hangups are either having yasm < 1.01 or not actually being on a 64bit OS.

I've installed yasm 1.1 and confirmed that manually using 'yasm --version'. I've also confirmed that my architecture is 64bit using 'uname -m'.

When I run configure using 'CFLAGS="-O3 -Wall -msse2" ./configure' everything appears to go just fine. It detects the yasm version properly.

I am then able to run make, and everything appears to build correctly. Unfortunately, I don't seem to have the option to use the sse2_64 mode. Am I missing something? It even looks to me like it is linking the sse2_64 code into the binary. Here's the last line:

gcc -DHAS_YASM -O3 -Wall -msse2 -pthread  -o minerd cpu-miner.o util.o sha256_generic.o sha256_4way.o sha256_via.o sha256_cryptopp.o sha256_sse2_amd64.o -lcurl compat/jansson/libjansson.a -lpthread x86_64/libx8664.a



Title: Re: New demonstration CPU miner available
Post by: ancow on June 02, 2011, 08:37:10 PM
I'm having problems getting the sse2_64 mode working on Ubuntu. I've read through this thread, and it seems that the major hangups are either having yasm < 1.01 or not actually being on a 64bit OS.

I've installed yasm 1.1 and confirmed that manually using 'yasm --version'. I've also confirmed that my architecture is 64bit using 'uname -m'.

When I run configure using 'CFLAGS="-O3 -Wall -msse2" ./configure' everything appears to go just fine. It detects the yasm version properly.

I am then able to run make, and everything appears to build correctly. Unfortunately, I don't seem to have the option to use the sse2_64 mode. Am I missing something? It even looks to me like it is linking the sse2_64 code into the binary. Here's the last line:

gcc -DHAS_YASM -O3 -Wall -msse2 -pthread  -o minerd cpu-miner.o util.o sha256_generic.o sha256_4way.o sha256_via.o sha256_cryptopp.o sha256_sse2_amd64.o -lcurl compat/jansson/libjansson.a -lpthread x86_64/libx8664.a
If you run:
Code:
minerd --help | grep sse2_64
Do you see any output? It seems to work for me on my 10.10.


Title: Re: New demonstration CPU miner available
Post by: jncraton on June 02, 2011, 08:40:42 PM
I get no output on that command.

I'm testing this out on a Linode. It's one that I have used for all sorts testing in the past, so it might just be time to blow it away and start over.


Title: Re: New demonstration CPU miner available
Post by: ancow on June 02, 2011, 09:15:56 PM
Well, just because sha256_sse2_amd64.o is being linked in doesn't mean it will be available as an algorithm (it's basically a dummy object if it doesn't think it can be compiled). You could try adding "-DWANT_X8664_SSE2" to CFLAGS to see whether that helps/produces an error that will help you track this down.
Looking at miner.h, it seems like the only dependencies are a 64-bit environment, SSE2 and yasm, though, so you may want to double-check the output of configure...


Title: Re: New demonstration CPU miner available
Post by: djinfected on June 03, 2011, 04:01:51 AM
Code:
F:\CPU-miner>cd "F:\CPU-miner"

F:\CPU-miner>minerd.exe --user djinfected --pass dji12406btio --url http://minin
g.bitcoin.cz/ --algo 4way
[2011-06-03 00:00:51] 1 miner threads started, using SHA256 '4way' algorithm.
[2011-06-03 00:00:53] JSON decode failed(1): '[' or '{' expected near '<'
[2011-06-03 00:00:53] json_rpc_call failed, retry after 30 seconds
I don't understand what this means. I get this with the default algo too.


Title: Re: New demonstration CPU miner available
Post by: ancow on June 03, 2011, 04:13:04 AM
It looks to me like you're getting an HTML response instead of a JSON one. Something to ask your pool admin about (or double-check the URL you're passing, especially if the pool doesn't use the standard port).


Title: Re: New demonstration CPU miner available
Post by: anunknownmouse on June 03, 2011, 04:17:27 AM
Hi,

I downloaded the 1.0 Windows binary installer.

No matter what options I set, it gives me the help message

Code:
PS C:\CPU-miner> .\minerd.exe --algo c  --url btcguild.com:8332 --userpass 123:456

Is this a bug?

Or did I miss something?


Title: Re: New demonstration CPU miner available
Post by: djinfected on June 03, 2011, 04:26:24 AM
It looks to me like you're getting an HTML response instead of a JSON one. Something to ask your pool admin about (or double-check the URL you're passing, especially if the pool doesn't use the standard port).
I added :8332 and it worked (and I changed my pw so that one I posted won't work)


Title: Re: New demonstration CPU miner available
Post by: ancow on June 03, 2011, 04:54:26 AM
Code:
PS C:\CPU-miner> .\minerd.exe --algo c  --url btcguild.com:8332 --userpass 123:456
I'm pretty sure the url argument needs a protocol set, so try
Code:
--url http://btcguild.com:8332

The thread for your pool might provide more concrete details, like the exact command line you need to run.


Title: Re: New demonstration CPU miner available
Post by: deti on June 03, 2011, 09:52:33 AM
Hi!

1. can you tell me what is the difference running 10 threads or 100? The hash-rate is not significantly different using 10 or 100 (in the sum of all threads of each).

2. I use the config.json file as follows.
Code:
{
"_comment1"  : "(-a XXX) Specify sha256 implementation:",
"_comment1a" : "         c          Linux kernel sha256, implemented in C (default)",
"_comment1b" : "         4way       tcatm's 4-way SSE2 implementation",
"_comment1c" : "         via        VIA padlock implementation",
"_comment1d" : "         cryptopp   Crypto++ C/C++ implementation",
"algo" : "4way",


"_comment2" : "(-q) Disable per-thread hashmeter output (default: off)",
"quiet" : false,


"_comment3" : "(-D) Enable debug output (default: off)",
"debug" : true,


"_comment4" : "Disable X-Long-Polling support (default: enabled)",
"no-longpoll" : false,


"_comment5" : "(-P) Verbose dump of protocol-level activities (default: off)",
"protocol-dump" : false,


"_comment8" : "(-s N) Upper bound on time spent scanning current work, in seconds. (default: 5)",
"scantime" : "5",


"_comment6" : "(-r N) Number of times to retry, if JSON-RPC call fails (default: 10; use -1 for 'never')",
"retries" : "30",


"_comment7" : "(-R N) Number of seconds to pause, between retries (default: 30)",
"retry-pause" : "10",


"_comment9" : "Use system log for output messages (default: standard error)",
"_comment9a" : "'syslog' : '?????'",


"_comment10" : "(-t N) Number of miner threads (default: 1)",
"threads" : "10",


"_comment11" : "URL for bitcoin JSON-RPC server (default: http://127.0.0.1:8332/)",
"url" : "http://btcguild.com:8332",


"_comment12" : "(-u USERNAME) Username for bitcoin JSON-RPC server (default: rpcuser)",
"user" : "abcxyz",


"_comment13" : "(-p PASSWORD) Password for bitcoin JSON-RPC server (default: rpcpass)",
"pass" : "123456"
}

2.1. What can I write into to the value of 'syslog' (see "_comment9a" at the moment) if I want to send it to "standard output"?
2.1. Is the value 'false' correct? It runs, but I get the following output (using 'off' doesn't work):
Quote
[2011-06-03 11:11:53] JSON option no-longpoll invalid
[2011-06-03 11:11:53] JSON option protocol-dump invalid
[2011-06-03 11:11:53] JSON option quiet invalid

3. Can you please tell me the exact function of 'scantime'? It looks that it only makes a difference when setting 'no-longpoll' to true!?!

Thanks and regards

deti


Title: Re: New demonstration CPU miner available
Post by: ancow on June 03, 2011, 10:27:26 AM
1. can you tell me what is the difference running 10 threads or 100? The hash-rate is not significantly different using 10 or 100 (in the sum of all threads of each).
Creating and maintaining a thread has a (pretty small) overhead, so for every thread you create, your mining is getting a tiny bit slower. I don't think setting the amount of threads to higher than the amount of logical cores (or perhaps logical cores + 1) is very useful.

2.1. What can I write into to the value of 'syslog' (see "_comment9a" at the moment) if I want to send it to "standard output"?
Nothing - it'll be printed to standard output when syslog isn't set. (Also, messing with stuff you don't understand is generally not advisable - did you read the help output properly?)

2.1. Is the value 'false' correct? It runs, but I get the following output (using 'off' doesn't work):
Quote
[2011-06-03 11:11:53] JSON option no-longpoll invalid
[2011-06-03 11:11:53] JSON option protocol-dump invalid
[2011-06-03 11:11:53] JSON option quiet invalid
I've noticed those, too. Apparently the claim that all config options are also supported in the JSON config file is false.

3. Can you please tell me the exact function of 'scantime'? It looks that it only makes a difference when setting 'no-longpoll' to true!?!
Hmm, again: read the docu?
Basically, there are two conflicting criteria by which minerd can stop working on the current work unit:
  • when a timeout occurs while searching for a share
  • when the server sends new work via the long polling spec
The first criterion is used when the server doesn't support long polling or if it's manually disabled via the config, otherwise the second is used.


Title: Re: New demonstration CPU miner available
Post by: deti on June 03, 2011, 11:09:30 AM
Thanks for quick response!!!

Creating and maintaining a thread has a (pretty small) overhead, so for every thread you create, your mining is getting a tiny bit slower. I don't think setting the amount of threads to higher than the amount of logical cores (or perhaps logical cores + 1) is very useful.
Hmmm, I can't confirm this. I experienced around increasing and decreasing the amount of thread and came to the conclusion that the highest sum of hash rate I get with 10 threads, although my server is running at full speed with only 2 threads already.

Nothing - it'll be printed to standard output when syslog isn't set. (Also, messing with stuff you don't understand is generally not advisable - did you read the help output properly?)
??? If I write nothing it will be send to standard error not standard output!!! So what do I write if I want it to standard output (it's a file in my case)?

Hmm, again: read the docu?
Where is it? I only red the 'help'.


Title: Re: New demonstration CPU miner available
Post by: ancow on June 03, 2011, 04:50:44 PM
Creating and maintaining a thread has a (pretty small) overhead, so for every thread you create, your mining is getting a tiny bit slower. I don't think setting the amount of threads to higher than the amount of logical cores (or perhaps logical cores + 1) is very useful.
Hmmm, I can't confirm this. I experienced around increasing and decreasing the amount of thread and came to the conclusion that the highest sum of hash rate I get with 10 threads, although my server is running at full speed with only 2 threads already.
Since it's measuring in khash/s, and there is a huge variance compared to the overhead, you wouldn't notice unless you started a *really* large amount of threads.

Nothing - it'll be printed to standard output when syslog isn't set. (Also, messing with stuff you don't understand is generally not advisable - did you read the help output properly?)
??? If I write nothing it will be send to standard error not standard output!!! So what do I write if I want it to standard output (it's a file in my case)?
I kinda assumed you'd know this, but how about?:
Code:
minderd <options> 2>&1
(IOW, whether the output is on stderr or stdout is somewhat of an arbitrary choice, and redirecting is a non-job, anyway; why bother handling another special case just for this? Anyhow, this sort of question is really easily handled by a look into the code, even I understand most of it ;))

Hmm, again: read the docu?
Where is it? I only red the 'help'.
This is why I shouldn't answer such a long post less than 5 minutes before I have to leave... :-[
That info came from some sort of discussion around long polling, but I can't for the life of me remember where exactly. Sorry, and I hope the answer was somewhat helpful, anyway.


Title: Re: New demonstration CPU miner available
Post by: deti on June 03, 2011, 05:28:43 PM
I kinda assumed you'd know this, ...

OK I got it now. Writing
Code:
"syslog" : true,
in the config.json file, makes it write in the system log file, with it set to 'false' writes the output in the 'standard error'.

Sorry for the little confusion I made.  :)

If someone knows something about the docu ... appreciated!


Title: Re: New demonstration CPU miner available
Post by: SixQa on June 03, 2011, 08:14:55 PM
Download links not working for me... can some one upload to rapidshare or sth? tnx


Title: Re: New demonstration CPU miner available
Post by: xf2_org on June 03, 2011, 09:24:39 PM
The download links work just fine, from multiple locations.


Title: Re: New demonstration CPU miner available
Post by: lucky on June 04, 2011, 09:55:54 AM
So there's no way to use cpuminer on OSX, then?  I was a little thrown off by the OSX build support message...

Remove yasm and everything works fine on OSX.



Could you please explain how to do this?


Title: Re: New demonstration CPU miner available
Post by: PPCMac on June 04, 2011, 10:25:48 PM
Hello, this is a great CPU miner, which succesfully runs on my server.
Now I am trying to get it working on my old PowerPC Mac (G5) with Mac OS X 10.5.
It compiles fine and runs but it seems the calculations  come out wrong.
What could it be? (Im a programmer but not familiar with c/c++).

Error messages:
Code:
[2011-06-04 09:18:58] thread 0: 2848100 hashes, 570.07 khash/sec
[2011-06-04 09:19:02] thread 1: 2943039 hashes, 554.77 khash/sec
[2011-06-04 09:19:03]  Proof: 000000006700fcb54908d3af4fae82fa4717d57ee44c05755f7b617031acca89
Target: 00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
TrgVal? YES (hash < target)
[2011-06-04 09:19:03] thread 0: 2341254 hashes, 547.98 khash/sec
[2011-06-04 09:19:03] DBG: sending RPC call: {"method": "getwork", "params": [ "0000000140778d36387004c7b8ac705f96a406579072c8d7c63421e500001dd100000000bc7a60c5d7decb85a368e889616c602945657ecaa1a263b0c457a9a6af140a4c4de9dc5b1a2694210023b986000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000" ], "id":1}

[2011-06-04 09:19:03] JSON-RPC call failed: {
   "code": -1,
   "message": "Wrong data: checkWork: checkHash wrong"
}
[2011-06-04 09:19:03] submit_upstream_work json_rpc_call failed
[2011-06-04 09:19:03] ...retry after 30 seconds
[2011-06-04 09:19:07] thread 1: 2943039 hashes, 611.45 khash/sec
[2011-06-04 09:19:33] DBG: sending RPC call: {"method": "getwork", "params": [ "0000000140778d36387004c7b8ac705f96a406579072c8d7c63421e500001dd100000000bc7a60c5d7decb85a368e889616c602945657ecaa1a263b0c457a9a6af140a4c4de9dc5b1a2694210023b986000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000" ], "id":1}

[2011-06-04 09:19:33] JSON-RPC call failed: {
   "code": -1,
   "message": "Wrong data: checkWork: this nonce already completed"
}
[2011-06-04 09:19:33] submit_upstream_work json_rpc_call failed
[2011-06-04 09:19:33] ...retry after 30 seconds


Title: Re: New demonstration CPU miner available
Post by: bitcoinafrica on June 06, 2011, 09:08:08 PM
Anyone having any luck with this miner on Vista? When I try to run it from the command line, I get the whole "minerd.exe has stopped working"

UAC is off and I've tried running as an Administrator.

Any ideas? Thanks.



Title: Re: New demonstration CPU miner available
Post by: dserrano5 on June 06, 2011, 09:55:43 PM
Just for the record, with minerd 1.0.1 I get:

Intel(R) Core(TM) i3 CPU M350 @2.27GHz:
790 khash/s/core with 4way (actually running at 930 MHz due to high temperature).

Intel(R) Xeon(R) CPU E5420 @2.50GHz:
1680 khash/s/core with sse2_64.

Quad-Core AMD Opteron(tm) Processor 2376:
2480 khash/s/core with 4way.

Intel(R) Xeon(TM) CPU 3.00GHz:
630 khash/s/core with sse2_64.

Intel(R) Core(TM) i3 CPU 530 @ 2.93GHz:
1220 khash/s/core with 4way (yasm is too old in this machine to have sse2_64).


Edit: added Xeon 3GHz and i3 2.93GHz


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 08, 2011, 07:24:56 AM
Running into this problem:

make  all-recursive
make[1]: Entering directory `/home/d337z/Desktop/bitcoin-cpuminer'
Making all in compat
make[2]: Entering directory `/home/d337z/Desktop/bitcoin-cpuminer/compat'
make[3]: Entering directory `/home/d337z/Desktop/bitcoin-cpuminer/compat'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/d337z/Desktop/bitcoin-cpuminer/compat'
make[2]: Leaving directory `/home/d337z/Desktop/bitcoin-cpuminer/compat'
Making all in x86_64
make[2]: Entering directory `/home/d337z/Desktop/bitcoin-cpuminer/x86_64'
/usr/bin/yasm -f elf64 sha256_xmm_amd64.asm
rm -f libx8664.a
ar cru libx8664.a sha256_xmm_amd64.o
ranlib libx8664.a
make[2]: Leaving directory `/home/d337z/Desktop/bitcoin-cpuminer/x86_64'
make[2]: Entering directory `/home/d337z/Desktop/bitcoin-cpuminer'
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing    -DHAS_YASM -march=native -O3 -pipe -fomit-frame-pointer -Wall -MT cpu-miner.o -MD -MP -MF .deps/cpu-miner.Tpo -c -o cpu-miner.o cpu-miner.c
cpu-miner.c: In function ‘parse_arg’:
cpu-miner.c:726:3: warning: passing argument 2 of ‘json_load_file’ makes integer from pointer without a cast
/usr/local/include/jansson.h:221:9: note: expected ‘size_t’ but argument is of type ‘struct json_error_t *’
cpu-miner.c:726:3: error: too few arguments to function ‘json_load_file’
/usr/local/include/jansson.h:221:9: note: declared here
make[2]: *** [cpu-miner.o] Error 1
make[2]: Leaving directory `/home/d337z/Desktop/bitcoin-cpuminer'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/d337z/Desktop/bitcoin-cpuminer'
make: *** [all] Error 2


I configured with -march=native (Core2) -O3 -pipe -fomit-frame-pointer -Wall.  With -mtune and -mcpu, I get the exact same errors.  Could someone tell me what's going wrong here?  I'm on Ubuntu 11.04 trying to compile this.  I've also tried removing yasm as a means to mitigate against any common errors that may exist between Ubuntu and Mac's setups. So far, no good.


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 08, 2011, 12:18:19 PM
Hi. I've made some minor modifications to cpuminer that are x86_64 linux specific.

Here's the list of changes:
- Linux x86_64 tweaked version
- Uses sse2_64 algo by default
- Detects CPUs and sets threads accordingly
- Uses CPU affinity for each thread where appropriate
- Sets scheduling policy to lowest possible
- Minor performance tweaks

The changes aren't entirely portable but Jeff you might be interested in some or all of them.

Grab the source here:
http://ck.kolivas.org/apps/cpuminer-1.0.1a.tar.bz2 (http://ck.kolivas.org/apps/cpuminer-1.0.1a.tar.bz2)


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 08, 2011, 01:36:18 PM
Code:
make  all-recursive
make[1]: Entering directory `/home/d337z/Desktop/cpuminer-1.0.1a'
Making all in compat
make[2]: Entering directory `/home/d337z/Desktop/cpuminer-1.0.1a/compat'
make[3]: Entering directory `/home/d337z/Desktop/cpuminer-1.0.1a/compat'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/d337z/Desktop/cpuminer-1.0.1a/compat'
make[2]: Leaving directory `/home/d337z/Desktop/cpuminer-1.0.1a/compat'
Making all in x86_64
make[2]: Entering directory `/home/d337z/Desktop/cpuminer-1.0.1a/x86_64'
/usr/bin/yasm -f elf64 sha256_xmm_amd64.asm
rm -f libx8664.a
ar cru libx8664.a sha256_xmm_amd64.o
ranlib libx8664.a
make[2]: Leaving directory `/home/d337z/Desktop/cpuminer-1.0.1a/x86_64'
make[2]: Entering directory `/home/d337z/Desktop/cpuminer-1.0.1a'
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing    -DHAS_YASM -march=native -O3 -msse -mmmx -msse2 -msse3 -pipe -fomit-frame-pointer -MT cpu-miner.o -MD -MP -MF .deps/cpu-miner.Tpo -c -o cpu-miner.o cpu-miner.c
cpu-miner.c: In function ‘parse_arg’:
cpu-miner.c:761:3: warning: passing argument 2 of ‘json_load_file’ makes integer from pointer without a cast
/usr/include/jansson.h:221:9: note: expected ‘size_t’ but argument is of type ‘struct json_error_t *’
cpu-miner.c:761:3: error: too few arguments to function ‘json_load_file’
/usr/include/jansson.h:221:9: note: declared here
make[2]: *** [cpu-miner.o] Error 1
make[2]: Leaving directory `/home/d337z/Desktop/cpuminer-1.0.1a'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/d337z/Desktop/cpuminer-1.0.1a'
make: *** [all] Error 2
Same prob with the newer version.


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 08, 2011, 01:40:39 PM
It's the same thing while only using the suggested settings BTW; I know I showed using mmx, sse, sse2, sse3 and a few other specific settings.  But this problem remains.


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 08, 2011, 10:55:18 PM
I'm sorry the timing in relation to your bug report was coincidence. I wasn't trying to fix your problem.

It is of course the recommended settings hard coded in, but you'll see there was more mentioned in the changelog. It detects the number of CPUs and sets threads accordingly, it only runs the actual mining threads at lower priority (and not the master or work gathering threads), it sets the CPU affinity now which can improve throughput, it utilises the lower priority scheduling policies wherever possible (by trying to set SCHED_IDLE first and then if it fails, SCHED_BATCH before dropping back to just nice 19) and it has some minor optimisations.


Title: Re: New demonstration CPU miner available
Post by: xf2_org on June 08, 2011, 11:40:08 PM
Welcome, fellow kernel dev :)

Any chance you can turn those changes into a pull request?

OS-specific tweaks are fine, as long as the other platforms continue to build and work.



Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 08, 2011, 11:43:18 PM
Hi Jeff ;)

Yeah I'll get more organised and do so tonight.


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 09, 2011, 01:52:21 AM
Hi Jeff ;)

Yeah I'll get more organised and do so tonight.

Done. Pull request generated. I've modified the code accordingly to try and build still elsewhere. Please check the changes as I can't compile test on other OSs.


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 09, 2011, 03:00:25 AM
Yeah, I figured you were just doing some optimizations.  But I've learned that sometimes things get accidentally fixed while meaning to change something else.  So wanted to cover that base.  I'm about to attempt a compilation with MinGW to see if I can get a better compile than I already have by playing around with some options such as removing frame pointers, enabling other SSE specific optimizations and the like.  I hope to end with a 64-bit Windows compatible compile, but who knows.  I was also contemplating a different method of calculating the hashes by having two or more cores working on the same hash and giving each a specific job to complete.  By breaking it down, I'm hoping it might put the cpu/gpu's memory to good use while decreasing latency between instructions.  The main issue I know of is having one task taking longer than another and needing to optimize the timings of when one core should help another to fill the buffer and then switch back to its task.  A sort of CPU/GPU buffer under run protection so to speak.  But the biggest issue is I have no idea how to start coding it.  It screams assembly.


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 09, 2011, 03:08:06 AM
This is why I started hacking on jgarzik's one instead. The c code in it is much more what I'm familiar with and I've dealt with Jeff before :) The other cpuminer is the one with the assembly code.


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 09, 2011, 03:47:04 AM
Yeah, but what I'm talking about is a different approach I believe.  Mine actually depends on multiple cores or hyperthreading doing different tasks to work as opposed to multiple threads doing the same thing.  If one core falls behind in its work, the other paired core will begin to assist it until the buffer is around 50% before returning to its own task.  But I don't think I can code it.  I know what I want it to do, I just don't know how to tell it if that makes sense.


Title: Re: New demonstration CPU miner available
Post by: xf2_org on June 09, 2011, 03:58:34 AM
Yeah, but what I'm talking about is a different approach I believe.  Mine actually depends on multiple cores or hyperthreading doing different tasks to work as opposed to multiple threads doing the same thing.  If one core falls behind in its work, the other paired core will begin to assist it until the buffer is around 50% before returning to its own task.  But I don't think I can code it.  I know what I want it to do, I just don't know how to tell it if that makes sense.

There is no buffer.  Mining is updating a single 32-bit value, and then restarting sha256(sha256(data)) algorithm

You can get 1 work, and tell multiple threads to work on that if you'd like.  It would reduce load on the upstream server a bit, but seems like too much complexity for too little gain.



Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 09, 2011, 04:37:43 AM
I'm not actually certain that the gain would be so small.  If you look at the process of loading and unloading data and how many instruction sets are sent and processed by each core separately, it could offer a modest improvement in speed.  It could also speed-up confirmation times and get smaller results back to the RPC quicker for verification.  It shifts the focus from trying to get multiple results done in time to be sent before the next block, to ensuring that each result gets done and sent quickly giving yourself the possible edge in time.
And it could be that I'm misunderstanding how mining occurs exactly, but all ideas have some value even if they're a bad one.


Title: Re: New demonstration CPU miner available
Post by: xf2_org on June 09, 2011, 05:32:35 AM
It is open source.  Nobody said you were not free to experiment :)


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 09, 2011, 06:28:52 AM
JG if you comment out the sysconf for windows you'll have to set a default value for opt_n_threads on windows since it's now zero.


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 09, 2011, 11:22:40 AM
Yeah, I'll have to experiment with it once I get a few books to help me figure out how.  But first I have to get the original source code working.  Any ideas on what's going wrong above?


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 09, 2011, 11:26:49 AM
Yeah, I'll have to experiment with it once I get a few books to help me figure out how.  But first I have to get the original source code working.  Any ideas on what's going wrong above?

You have jansson installed and it's an incompatible version with what cpuminer uses? You don't need jansson installed to make it build since it's included in the cpuminer code tarball. Try uninstalling your own version of jansson.


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 09, 2011, 01:03:31 PM
Yeah, I'll have to experiment with it once I get a few books to help me figure out how.  But first I have to get the original source code working.  Any ideas on what's going wrong above?

You have jansson installed and it's an incompatible version with what cpuminer uses? You don't need jansson installed to make it build since it's included in the cpuminer code tarball. Try uninstalling your own version of jansson.
Actually, it's not my own version, I used the repository that Jansson setup.  But I'll give it a try without Jansson installed to see if any similar errors should arise.  Thank you!  I'll keep you posted.


Title: Re: New demonstration CPU miner available
Post by: blap on June 09, 2011, 01:06:04 PM
 ;D


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 09, 2011, 01:30:17 PM
Code:
make  all-recursive
make[1]: Entering directory `/home/d337z/Desktop/cpuminer-1.0.1a'
Making all in compat
make[2]: Entering directory `/home/d337z/Desktop/cpuminer-1.0.1a/compat'
make[3]: Entering directory `/home/d337z/Desktop/cpuminer-1.0.1a/compat'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/d337z/Desktop/cpuminer-1.0.1a/compat'
make[2]: Leaving directory `/home/d337z/Desktop/cpuminer-1.0.1a/compat'
Making all in x86_64
make[2]: Entering directory `/home/d337z/Desktop/cpuminer-1.0.1a/x86_64'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/d337z/Desktop/cpuminer-1.0.1a/x86_64'
make[2]: Entering directory `/home/d337z/Desktop/cpuminer-1.0.1a'
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing    -DHAS_YASM -g -O3 -msse2 -MT cpu-miner.o -MD -MP -MF .deps/cpu-miner.Tpo -c -o cpu-miner.o cpu-miner.c
cpu-miner.c:27:21: fatal error: jansson.h: No such file or directory
compilation terminated.
make[2]: *** [cpu-miner.o] Error 1
make[2]: Leaving directory `/home/d337z/Desktop/cpuminer-1.0.1a'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/d337z/Desktop/cpuminer-1.0.1a'
make: *** [all] Error 2

Now it just won't find it.


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 09, 2011, 01:37:31 PM
Wait!  We have win!  I entered the Jansson directory I first used to compile with and ran "sudo make uninstall" and it seems to have done the trick.  Thank you!


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 09, 2011, 01:46:05 PM
Words to the wise, CPUminer is incompatible with Jansson 2.0.1 so use what's included and hope it works.  ^_^


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 09, 2011, 01:57:35 PM
Yeah when I said your own version, I hadn't really envisioned that you'd programmed your own jansson library ;)

Glad to see you got it going. Now see how you go :)


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 09, 2011, 02:19:37 PM
Oh, I meant self-compiled vs. precompiled.  The repository version is 2.0.1 as of now under synaptic (when you add the repository to the list).  So the problem is either with 2.0.1 or updating the code to allow for 2.0.1 to be used.  It looks like jansson was wanting some extra commands that weren't required previously or just had a different syntax.  But it's unimportant since a compatible version is included with cpuminer anyway.
On a semi-related note, I'm achieving an entire Mhash/sec higher than I was in Windows using bitcoinminer which appeared to have the fastest rate on a Winbox via CPU usage at the time.  I don't know what effects including -march=core2 -mmmx -msse -msse3 -mssse3 and -fomit-frame-pointer has had on my compilation, but the program is working flawlessly so far.  I'll try a comparison to see if there's any difference in hashes/sec with different options outside of -march=native/core2.


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 09, 2011, 02:26:00 PM
Is this with the version I posted? The CPU affinity that I added can have quite strong effects on certain hardware and kernels (comparing different linux kernels and windows especially) if the kernels aren't particularly good at soft affinity effects. Having spent most of my spare time coding CPU schedulers I obsess about these things...


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 09, 2011, 04:35:37 PM
Actually, yes it was.  However, I noticed very little difference in the speeds of the two.  But kudos!  It compiles and runs.


Title: Re: New demonstration CPU miner available
Post by: ancow on June 09, 2011, 05:45:07 PM
The new changes seem to work rather well on my 64bit linux. However, since some of the usage texts are now incorrect, I'd like to suggest the following patch:
Code:
--- cpuminer-git/cpu-miner.c    2011-06-09 16:58:43.137777002 +0200
+++ cpuminer_build/cpu-miner.c  2011-06-09 19:25:52.087777001 +0200
@@ -140,24 +140,28 @@
          "(-h) Display this help text" },
 
        { "config FILE",
-         "(-c FILE) JSON-format configuration file (default: none)\n"
+         "(-c FILE) JSON-format configuration file (default: none)\n\t"
          "See example-cfg.json for an example configuration." },
 
        { "algo XXX",
          "(-a XXX) Specify sha256 implementation:\n"
-         "\tc\t\tLinux kernel sha256, implemented in C (default)"
+#ifdef WANT_X8664_SSE2
+         "\t\tc\t\tLinux kernel sha256, implemented in C"
+#else
+         "\t\tc\t\tLinux kernel sha256, implemented in C (default)"
+#endif
 #ifdef WANT_SSE2_4WAY
-         "\n\t4way\t\ttcatm's 4-way SSE2 implementation"
+         "\n\t\t4way\t\ttcatm's 4-way SSE2 implementation"
 #endif
 #ifdef WANT_VIA_PADLOCK
-         "\n\tvia\t\tVIA padlock implementation"
+         "\n\t\tvia\t\tVIA padlock implementation"
 #endif
-         "\n\tcryptopp\tCrypto++ C/C++ implementation"
+         "\n\t\tcryptopp\tCrypto++ C/C++ implementation"
 #ifdef WANT_CRYPTOPP_ASM32
-         "\n\tcryptopp_asm32\tCrypto++ 32-bit assembler implementation"
+         "\n\t\tcryptopp_asm32\tCrypto++ 32-bit assembler implementation"
 #endif
 #ifdef WANT_X8664_SSE2
-         "\n\tsse2_64\t\tSSE2 implementation for x86_64 machines"
+         "\n\t\tsse2_64\t\tSSE2 implementation for x86_64 machines (default)"
 #endif
          },
 
@@ -191,7 +195,11 @@
 #endif
 
        { "threads N",
+#ifdef WIN32
          "(-t N) Number of miner threads (default: 1)" },
+#else
+         "(-t N) Number of miner threads (default: #available cpus)" },
+#endif
 
        { "url URL",
          "URL for bitcoin JSON-RPC server "
@@ -753,7 +761,7 @@
                struct option_help *h;
 
                h = &options_help[i];
-               printf("--%s\n%s\n\n", h->name, h->helptext);
+               printf("--%s\n\t%s\n\n", h->name, h->helptext);
        }
 
        exit(1);

Summary of changes:
  • tabs before description items to improve readability
  • the default algorithm is now marked correctly
  • on Linux, it now says "default: #available cpus" instead of just "default: 1" (if anyone knows how to insert the actual numer here, be my guest)


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 09, 2011, 05:58:58 PM
I agree with your changes.  I think the default should be the maximum number of CPUs on board.  The default wasn't the SSE2_64?  Hmm, good thing I set that then.
But I don't think I've ever seen Via padlock not crash the program on start.  Does it actually have a use?  If no, it could be edited out until then.


Title: Re: New demonstration CPU miner available
Post by: ancow on June 09, 2011, 06:16:47 PM
I agree with your changes.  I think the default should be the maximum number of CPUs on board.  The default wasn't the SSE2_64?  Hmm, good thing I set that then.
But I don't think I've ever seen Via padlock not crash the program on start.  Does it actually have a use?  If no, it could be edited out until then.
I only changed the usage text, no "proper" code. SSE2_64 is default on 64bit Linux since the last commit, therefore the usage text was wrong, so I wrote a patch to amend that.


Title: Re: New demonstration CPU miner available
Post by: xf2_org on June 09, 2011, 06:46:44 PM
Actually Con's patch is rather simplified -- you want the number of cores, not the total number of processors (which might include HyperThread siblings).

If you use all cores + HT, then your hash performance is slower than cores alone.



Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 09, 2011, 09:00:01 PM
Actually Con's patch is rather simplified -- you want the number of cores, not the total number of processors (which might include HyperThread siblings).

If you use all cores + HT, then your hash performance is slower than cores alone.



I tested total threads vs total cores and got slightly more with total threads on i7. Plus there is no particularly easy and reliable way to detect cores versus threads. So total "processors" actually generated more in my testing.


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 09, 2011, 09:21:46 PM
Actually that's not quite true. There was one more complex setup that produced higher throughput. If I set the number of mining threads to the total number of cores only, and then bound each worker thread to all the logical CPUs that shared cache, the throughput was a bit better again. However which cores shares threads is even harder to detect reliably without digging around in /sys and the format has changed between kernels. Furthermore, on my i7, the shared caches aren't even sequential numbers so binding threads to sequential logical CPUs was worse (i.e. CPUs 0 and 2 shared caches and 1 and 3 and so on).


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 10, 2011, 12:40:01 PM
I believe there is one i7 processor out there that doesn't have a shared cache.  Each core on it has its own dedicated 2M cache.  However, if you could detect the shared cache, you could also detect the unshared cache and end up with what I suggested above that I had no idea how to start coding for a similar reason.  But anyhow, if you're worried about the kernels having sys information in different locations, it's a simple if-else-else statement that you'll be using to find or not find it.
But, as I suggested, using the two cores sharing the same cache, you can have each core perform different portions of the same work.  While one has completed half of the equations, you can send the work off to the next core for completion and get the next work.  With each core doing a specific task, you can simplify the code for unrolled loops and pass fewer instructions to the processor I believe.  Fewer instructions generally means less overhead.
So a part of the problem is the first getwork.  Half as many threads will be running until half of the work is completed and passed to the next core.  I don't know a way around it since I would think the SHA equation to only be done according to the order of operations (Parenthesis, exponents, multiple/divide...).  Actually, now that I think about it, if a matrix calculation comes into play, that would have its own unique optimizations...eep digressing!  But yeah, how to split the cores to keep them from doing redundant work is the biggest issue here.


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 10, 2011, 12:45:13 PM
Bouncing work from one CPU to another will decrease throughput a fair amount. The cost of that should not be discounted. Anyway feel free to try...


Title: Re: New demonstration CPU miner available
Post by: rocksalt on June 10, 2011, 04:28:05 PM
is there a working flag for outputting to a log file for this using the windows binaries?

I've tried
--f
-f
>

with full path, just a file name, with extension, without ext, with "" "" and also without.

I think i've worn my fingers out doing this


Title: Re: New demonstration CPU miner available
Post by: ancow on June 10, 2011, 05:22:46 PM
You need to redirect stderr. According to http://www.techtalkz.com/windows-xp/27452-redirect-stdout-stderr-windows-shell.html, "2>" will do that.


Title: Re: New demonstration CPU miner available
Post by: rocksalt on June 11, 2011, 06:24:28 AM
Im now discovering a different issue :P

minerd.exe --algo cryptopp_asm32 --s 2 --url http://btcguild.com/ --userpass xxxx:xxx this runs when i tried it on deepbit, local miner and a few others....

however on btcguild i get the following error

[2011-06-12 10:02:16] 1 miner threads started, using SHA256 'cryptopp_asm32' algorithm.
[2011-06-12 10:02:20] JSON decode failed(1): '[' or '{' expected near '<'
[2011-06-12 10:02:20] json_rpc_call failed, retry after 30 seconds


its only happening with btcguild though, not any of the other mining pools i tested with.

anyone come accross this before ??

Win7
Intel Dual Core
Nvidia GTX470OC


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 11, 2011, 03:41:35 PM
Hi Jeff, et al.

I've made some modifications to the output to generate a total throughput counter since there was confusion with the multiple threads issue, cleaned up the output a little, and added a solution counter. I also dropped a lot of output when only one thread is in use. Please pull the changes into your tree if you agree with the changes.

it now looks like this:

[2011-06-12 01:37:26] [Total: 8.40 Mhash/sec] [thread 3: 109989796 hashes, 3075 khash/sec] [Solved: 0]
[2011-06-12 01:37:26] PROOF OF WORK RESULT: true (yay!!!)
[2011-06-12 01:37:47] [Total: 8.45 Mhash/sec] [thread 0: 183024176 hashes, 3090 khash/sec] [Solved: 1]
[2011-06-12 01:37:48] [Total: 9.89 Mhash/sec] [thread 1: 183024176 hashes, 3085 khash/sec] [Solved: 1]
[2011-06-12 01:37:48] [Total: 11.31 Mhash/sec] [thread 2: 183024176 hashes, 3082 khash/sec] [Solved: 1]
[2011-06-12 01:38:27] [Total: 9.72 Mhash/sec] [thread 3: 183316328 hashes, 3019 khash/sec] [Solved: 1]
[2011-06-12 01:38:50] [Total: 9.54 Mhash/sec] [thread 0: 186126280 hashes, 2969 khash/sec] [Solved: 1]
[2011-06-12 01:38:50] [Total: 10.52 Mhash/sec] [thread 1: 186126280 hashes, 2989 khash/sec] [Solved: 1]
[2011-06-12 01:38:51] [Total: 11.50 Mhash/sec] [thread 2: 186126280 hashes, 3007 khash/sec] [Solved: 1]

Thanks.


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 11, 2011, 04:06:32 PM
Hmm perhaps "solved" isn't quite the right word there for accepted blocks.


Title: Re: New demonstration CPU miner available
Post by: dserrano5 on June 11, 2011, 04:20:36 PM
As a user I would expect that total Mhash/s were the sum of the khash/s of all threads—in your example it would be always around 12 Mhash/s (since each thread works at a consistent pace of nearly 3000 khash/s). That's not the case, so I guess the algorithm is different.


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 11, 2011, 04:22:25 PM
As a user I would expect that total Mhash/s were the sum of the khash/s of all threads—in your example it would be always around 12 Mhash/s (since each thread works at a consistent pace of nearly 3000 khash/s). That's not the case, so I guess the algorithm is different.

That was the miner just starting up. After a while it converges more and more.


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 12, 2011, 11:42:39 PM
Now that I've got a meaningful total throughput counter, I can confirm that running number of threads == number of logical processors on i7 is actually faster than even carefully bound number of threads == number of physical cores. This means that the default behaviour of minerd with my modifications which chooses how many threads to start up will give you the highest throughput.

My cumulative changes are here till jgarzik pulls them if anyone's interested:
https://github.com/ckolivas/cpuminer (https://github.com/ckolivas/cpuminer)


Title: Re: New demonstration CPU miner available
Post by: hugolp on June 13, 2011, 02:58:04 PM
Im getting this error in Ubuntu 10.04 LTS when running autogen.sh:

~/cpuminer$ sh autogen.sh
configure.ac:15: installing `./compile'
configure.ac:4: installing `./config.guess'
configure.ac:4: installing `./config.sub'
configure.ac:6: installing `./install-sh'
configure.ac:6: installing `./missing'
compat/jansson/Makefile.am: installing `./depcomp'
Makefile.am: installing `./INSTALL'
configure.ac:96: error: possibly undefined macro: AC_MSG_ERROR
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.

Any suggestion?


Title: Re: New demonstration CPU miner available
Post by: RaTTuS on June 13, 2011, 03:19:47 PM
try :-
./configure


Title: Re: New demonstration CPU miner available
Post by: hugolp on June 13, 2011, 03:31:25 PM
try :-
./configure

I actually tried ./configure just for the sake of it and does nothing as expected. Autogen is failing.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on June 13, 2011, 05:07:09 PM
Im getting this error in Ubuntu 10.04 LTS when running autogen.sh:

~/cpuminer$ sh autogen.sh
configure.ac:15: installing `./compile'
configure.ac:4: installing `./config.guess'
configure.ac:4: installing `./config.sub'
configure.ac:6: installing `./install-sh'
configure.ac:6: installing `./missing'
compat/jansson/Makefile.am: installing `./depcomp'
Makefile.am: installing `./INSTALL'
configure.ac:96: error: possibly undefined macro: AC_MSG_ERROR
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.

Any suggestion?

Standard advice -- your autotools installation is old or broken.  Use release tarball.



Title: Re: New demonstration CPU miner available
Post by: hugolp on June 13, 2011, 06:30:17 PM
Im getting this error in Ubuntu 10.04 LTS when running autogen.sh:

~/cpuminer$ sh autogen.sh
configure.ac:15: installing `./compile'
configure.ac:4: installing `./config.guess'
configure.ac:4: installing `./config.sub'
configure.ac:6: installing `./install-sh'
configure.ac:6: installing `./missing'
compat/jansson/Makefile.am: installing `./depcomp'
Makefile.am: installing `./INSTALL'
configure.ac:96: error: possibly undefined macro: AC_MSG_ERROR
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.

Any suggestion?

Standard advice -- your autotools installation is old or broken.  Use release tarball.



Its a server with Ubuntu 10.04 LTS. I guess its "old". Ill try the tarball, thanks.

EDIT: The tarball worked.


Title: Re: New demonstration CPU miner available
Post by: c_k on June 14, 2011, 03:03:00 AM
I can get the tarball 1.0.1 to compile OK however the source from github gives the following problem when compiling on debian 6 (amd64):

Quote
me@machine:~$ git clone git://github.com/jgarzik/cpuminer.git
Cloning into cpuminer...
remote: Counting objects: 633, done.
remote: Compressing objects: 100% (273/273), done.
remote: Total 633 (delta 404), reused 575 (delta 356)
Receiving objects: 100% (633/633), 138.30 KiB | 196 KiB/s, done.
Resolving deltas: 100% (404/404), done.
me@machine:~$ cd cpuminer
me@machine:~/cpuminer$ ./autogen.sh
configure.ac:15: installing `./compile'
configure.ac:4: installing `./config.guess'
configure.ac:4: installing `./config.sub'
configure.ac:6: installing `./install-sh'
configure.ac:6: installing `./missing'
compat/jansson/Makefile.am: installing `./depcomp'
Makefile.am: installing `./INSTALL'
me@machine:~/cpuminer$ 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 a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
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 ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking whether gcc needs -traditional... no
checking whether gcc and cc understand -c and -o together... yes
checking for ranlib... ranlib
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 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 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... no
configure: yasm is required for the sse2_64 algorithm. It will be skipped.
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for gawk... (cached) mawk
checking for curl-config... /usr/bin/curl-config
checking for the version of libcurl... 7.21.0
checking for libcurl >= version 7.10.1... yes
checking whether libcurl is usable... yes
checking for curl_free... 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 cpuminer-config.h
config.status: executing depfiles commands
me@machine:~/cpuminer$ make
make  all-recursive
make[1]: Entering directory `/home/me/cpuminer'
Making all in compat
make[2]: Entering directory `/home/me/cpuminer/compat'
Making all in jansson
make[3]: Entering directory `/home/me/cpuminer/compat/jansson'
gcc -DHAVE_CONFIG_H -I. -I../..     -O3 -Wall -msse2 -MT dump.o -MD -MP -MF .deps/dump.Tpo -c -o dump.o dump.c
mv -f .deps/dump.Tpo .deps/dump.Po
gcc -DHAVE_CONFIG_H -I. -I../..     -O3 -Wall -msse2 -MT hashtable.o -MD -MP -MF .deps/hashtable.Tpo -c -o hashtable.o hashtable.c
mv -f .deps/hashtable.Tpo .deps/hashtable.Po
gcc -DHAVE_CONFIG_H -I. -I../..     -O3 -Wall -msse2 -MT load.o -MD -MP -MF .deps/load.Tpo -c -o load.o load.c
mv -f .deps/load.Tpo .deps/load.Po
gcc -DHAVE_CONFIG_H -I. -I../..     -O3 -Wall -msse2 -MT strbuffer.o -MD -MP -MF .deps/strbuffer.Tpo -c -o strbuffer.o strbuffer.c
mv -f .deps/strbuffer.Tpo .deps/strbuffer.Po
gcc -DHAVE_CONFIG_H -I. -I../..     -O3 -Wall -msse2 -MT utf.o -MD -MP -MF .deps/utf.Tpo -c -o utf.o utf.c
mv -f .deps/utf.Tpo .deps/utf.Po
gcc -DHAVE_CONFIG_H -I. -I../..     -O3 -Wall -msse2 -MT value.o -MD -MP -MF .deps/value.Tpo -c -o value.o value.c
mv -f .deps/value.Tpo .deps/value.Po
rm -f libjansson.a
ar cru libjansson.a dump.o hashtable.o load.o strbuffer.o utf.o value.o
ranlib libjansson.a
make[3]: Leaving directory `/home/me/cpuminer/compat/jansson'
make[3]: Entering directory `/home/me/cpuminer/compat'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/me/cpuminer/compat'
make[2]: Leaving directory `/home/me/cpuminer/compat'
make[2]: Entering directory `/home/me/cpuminer'
gcc -DHAVE_CONFIG_H -I. -pthread -fno-strict-aliasing -I./compat/jansson    -O3 -Wall -msse2 -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
cpu-miner.c: In function ‘drop_policy’:
cpu-miner.c:43: error: ‘SCHED_IDLE’ undeclared (first use in this function)
cpu-miner.c:43: error: (Each undeclared identifier is reported only once
cpu-miner.c:43: error: for each function it appears in.)
make[2]: *** [minerd-cpu-miner.o] Error 1
make[2]: Leaving directory `/home/me/cpuminer'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/me/cpuminer'
make: *** [all] Error 2

I get the same error with the code from ckolivas' repo :-\


Title: Re: New demonstration CPU miner available
Post by: jgarzik on June 14, 2011, 04:06:16 AM
cpu-miner.c:43: error: ‘SCHED_IDLE’ undeclared (first use in this function)

Your OS needs to update /usr/include/sched.h to include this definition.

If you add
   #include <linux/sched.h>

does it fix the problem for you?



Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 14, 2011, 04:12:03 AM
I added some ifdefs to cope with distributions that still have older headers so if you grab my latest git tree (from the master branch) it should build for you.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on June 14, 2011, 06:47:21 AM
Version 1.0.2 released.

Changes:

Christian Ludwig (2):
      Fix libcurl include path
      configure.ac: Beautify yasm test output

Jeff Garzik (3):
      only read processor count via sysconf on non-Windows platforms
      Fix number-of-threads init logic on Windows
      Version 1.0.2.

ckolivas (2):
      Linux + x86_64 optimisations.
      Cope with older linux kernel headers that don't have the newer scheduling



Title: Re: New demonstration CPU miner available
Post by: hugolp on June 14, 2011, 07:28:06 AM
I added some ifdefs to cope with distributions that still have older headers so if you grab my latest git tree (from the master branch) it should build for you.

Thanks. Git branch is working now. A small contribution is going your way.


Title: Re: New demonstration CPU miner available
Post by: c_k on June 14, 2011, 07:30:32 AM
Success!

I can now compile the latest code, thank you so much for your swift fix there team :)

Is the 4way algorithm still the best?


Title: Re: New demonstration CPU miner available
Post by: hugolp on June 14, 2011, 07:43:37 AM
Success!

I can now compile the latest code, thank you so much for your swift fix there team :)

Is the 4way algorithm still the best?

Im trying it with an Atom 330 that is reported to have SS2, but I get better results with c and cryptopp (almost identical results with both).


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 14, 2011, 09:22:10 AM
I added some ifdefs to cope with distributions that still have older headers so if you grab my latest git tree (from the master branch) it should build for you.

Thanks. Git branch is working now. A small contribution is going your way.
Sweet, I appreciate the gesture and it makes me want to work on the code more, thanks!


Title: Re: New demonstration CPU miner available
Post by: rocksalt on June 14, 2011, 10:22:24 AM
hi all... im experimenting with using this on a few different types on machines and i havn't found anything for the following question:

is there a way to throttle the minderd.exe process to say take only 35% of cpu when busy? and maybe 90% when idle ?
is there a switch?? i can open numbers of threads, but i can't actually find a away of controlling those threads.

The reason is i'd like to deploy this on a lot of workstations im looking after, roughly about 5k of them, but i need to keep control over what and how they are utilising the cpu usage.


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 14, 2011, 10:29:18 AM
hi all... im experimenting with using this on a few different types on machines and i havn't found anything for the following question:

is there a way to throttle the minderd.exe process to say take only 35% of cpu when busy? and maybe 90% when idle ?
is there a switch?? i can open numbers of threads, but i can't actually find a away of controlling those threads.

The reason is i'd like to deploy this on a lot of workstations im looking after, roughly about 5k of them, but i need to keep control over what and how they are utilising the cpu usage.

No there is not... yet(?) The threads run at ultra-low priority and should not have any impact on the machine at all except in terms of power usage and heat generation. Of course they may be issues in their own right. Is there really a demand for this?


Title: Re: New demonstration CPU miner available
Post by: dserrano5 on June 14, 2011, 11:03:42 AM
[...] power usage and heat generation. Of course they may be issues in their own right. Is there really a demand for this?

I for one would like to have it. I would have been a long time user of BOINC if it weren't for this.


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 14, 2011, 11:10:00 AM
[...] power usage and heat generation. Of course they may be issues in their own right. Is there really a demand for this?

I for one would like to have it. I would have been a long time user of BOINC if it weren't for this.

Yeah but you do realise that at the current level of difficulty (which will increase soon), it would take a modern cpu over 50 years to solve one block successfully? Slow it down even more and it's... never. Of course you could use them to add MH/s but even then 1GHz of modern CPU adds about 1MH/s, so a throttled 3Ghz machine would only give you just 1 MH/s per core. Which really is... nothing by today's standards and will be even less as time goes on.

Now if that doesn't deter you, then sure there are ways I can implement this crudely on linux. I haven't got a clue how to do it for other OSs, nor do I care to figure it out.


Title: Re: New demonstration CPU miner available
Post by: rocksalt on June 14, 2011, 11:27:31 AM
[...] power usage and heat generation. Of course they may be issues in their own right. Is there really a demand for this?

I for one would like to have it. I would have been a long time user of BOINC if it weren't for this.

Yeah but you do realise that at the current level of difficulty (which will increase soon), it would take a modern cpu over 50 years to solve one block successfully? Slow it down even more and it's... never. Of course you could use them to add MH/s but even then 1GHz of modern CPU adds about 1MH/s, so a throttled 3Ghz machine would only give you just 1 MH/s per core. Which really is... nothing by today's standards and will be even less as time goes on.

Now if that doesn't deter you, then sure there are ways I can implement this crudely on linux. I haven't got a clue how to do it for other OSs, nor do I care to figure it out.

I was more thinking that even at a low hash rate, 5k of PC's all connecting to one or two pools, would equate out to maybe about 300GH/s... kind of like distributed processing. Not only does this happen, but at a low cpu usage, it can run all the time in the background and the users won't be affected.


Title: Re: New demonstration CPU miner available
Post by: ancow on June 14, 2011, 11:31:00 AM
Now if that doesn't deter you, then sure there are ways I can implement this crudely on linux. I haven't got a clue how to do it for other OSs, nor do I care to figure it out.
Personally, I don't think building throttling into the program is the best way to do this, especially on Linux. You can use frequency scaling and CPU throttling. Also, you can set your frequency governor to ignore niced processes (at least for ondemand and conservative), keeping the CPU speed down when nothing else needs the higher frequency. Works quite well for me.

Also, at least with some distros, there's a tool called "cpulimit" that will periodically put your process to sleep and then wake it again that could achieve the desired effect.


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 14, 2011, 11:53:34 AM
I agree with ancow. The tools to do this exist already. Since cpuminer will run idle and niced priority, setting an ondemand cpu frequency governor with ignore nice load will do precisely what you want.


Title: Re: New demonstration CPU miner available
Post by: hugolp on June 14, 2011, 12:13:55 PM
I was more thinking that even at a low hash rate, 5k of PC's all connecting to one or two pools, would equate out to maybe about 300GH/s... kind of like distributed processing. Not only does this happen, but at a low cpu usage, it can run all the time in the background and the users won't be affected.

But your electric bill will.

Unless of course you are doing it at work or something like that.


Title: Re: New demonstration CPU miner available
Post by: dserrano5 on June 14, 2011, 12:23:49 PM
Also, you can set your frequency governor to ignore niced processes (at least for ondemand and conservative), keeping the CPU speed down when nothing else needs the higher frequency. Works quite well for me.

Ah, didn't know this. Will look into it, thank you!


Title: Re: New demonstration CPU miner available
Post by: dserrano5 on June 14, 2011, 07:53:59 PM
I just downloaded and built cpuminer-1.0.2. I expected to see some improvements thanks to ckolivas' affinity changes (assuming they have made it into the release), but I'm surprised to find I'm getting the same speed:

Code:
$ grep CFLAGS_value */config.log
cpuminer-1.0.1/config.log:ac_cv_env_CFLAGS_value='-O3 -Wall -msse2'
cpuminer-1.0.2/config.log:ac_cv_env_CFLAGS_value='-O3 -Wall -msse2'
$ tail */my-log
==> cpuminer-1.0.1/my-log <==
[2011-06-14 18:57:05] thread 5: 161767000 hashes, 2694.78 khash/sec
[2011-06-14 18:58:00] thread 1: 160434868 hashes, 2684.82 khash/sec
[2011-06-14 18:58:00] thread 4: 162531240 hashes, 2694.68 khash/sec
[2011-06-14 18:58:05] thread 2: 160738332 hashes, 2678.31 khash/sec
[2011-06-14 18:58:05] thread 3: 162845920 hashes, 2687.02 khash/sec
[2011-06-14 18:58:06] thread 6: 161633936 hashes, 2691.05 khash/sec
[2011-06-14 18:58:06] thread 0: 162323744 hashes, 2687.43 khash/sec
[2011-06-14 18:58:06] thread 5: 161767000 hashes, 2694.55 khash/sec
[2011-06-14 18:59:00] thread 1: 160434868 hashes, 2693.92 khash/sec
[2011-06-14 18:59:01] thread 4: 162531240 hashes, 2684.48 khash/sec

==> cpuminer-1.0.2/my-log <==
[2011-06-14 21:30:10] thread 0: 40046392 hashes, 2687.31 khash/sec
[2011-06-14 21:30:10] thread 2: 32207448 hashes, 2687.27 khash/sec
[2011-06-14 21:30:10] thread 1: 49517220 hashes, 2687.39 khash/sec
[2011-06-14 21:31:12] thread 4: 158828460 hashes, 2687.11 khash/sec
[2011-06-14 21:31:12] thread 6: 161129456 hashes, 2679.90 khash/sec
[2011-06-14 21:31:13] thread 3: 164484744 hashes, 2686.09 khash/sec
[2011-06-14 21:31:13] thread 0: 160185568 hashes, 2685.15 khash/sec
[2011-06-14 21:31:14] thread 2: 161037240 hashes, 2685.64 khash/sec
[2011-06-14 21:31:14] thread 5: 164770840 hashes, 2687.16 khash/sec
[2011-06-14 21:31:16] thread 1: 165057400 hashes, 2684.58 khash/sec
$ grep -vE 'url|user|pass' cpuminer-1.0.2/cfg.json
{
    "algo" : "sse2_64",
    "threads" : "7",
    "retry-pause" : "25"
}
$ diff -u cpuminer-1.0.*/cfg.json
$ _

I tried removing the line that specifies 7 threads but that makes no difference (except for the log messages "Binding thread %d to cpu %d"). Am I omitting some step? The CPU is a "Intel(R) Xeon(R) CPU E5420 @2.50GHz". This is the layout of the CPUs/cores:

Code:
$ grep -E '^processor|^physical|^core.id|^$' /proc/cpuinfo
processor       : 0
physical id     : 0
core id         : 0

processor       : 1
physical id     : 1
core id         : 0

processor       : 2
physical id     : 0
core id         : 2

processor       : 3
physical id     : 1
core id         : 2

processor       : 4
physical id     : 0
core id         : 1

processor       : 5
physical id     : 1
core id         : 1

processor       : 6
physical id     : 0
core id         : 3

processor       : 7
physical id     : 1
core id         : 3

"siblings" and "cpu cores" both have the value 4 in all entries.


Title: Re: New demonstration CPU miner available
Post by: ancow on June 14, 2011, 08:33:49 PM
Just to make sure you understand this, specifying the amount of threads will disable the CPU affinity stuff (as I understand the code).


Title: Re: New demonstration CPU miner available
Post by: dserrano5 on June 14, 2011, 10:25:13 PM
I suspected it, and saw it confirmed when I didn't specify number of threads and read the lines in the log file. Nothing new here but thanks for pointing it out anyway ;).


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 14, 2011, 10:40:37 PM
I just downloaded and built cpuminer-1.0.2. I expected to see some improvements thanks to ckolivas' affinity changes (assuming they have made it into the release), but I'm surprised to find I'm getting the same speed:

Code:
processor       : 7
physical id     : 1
core id         : 3

"siblings" and "cpu cores" both have the value 4 in all entries.

Indeed the changes are unlikely to make any sort of drastic throughput improvement. The advantage of the new build is it automatically detects the number of processors and set the threads accordingly, chooses the best algorithm by default and then binds the threads to each CPU. CPU affinity does not have drastic effects on throughput unless you have a complicated cache arrangement in your hardware (such as NUMA or multiple physical CPUs) and the workload has a large cache footprint. sha256 calculations (which is all that mining is) do not have a large cache footprint. However you do realise that when it says processor 7, it means processors 0-7 which means you have 8? I didn't realise that jgarzik didn't incorporate the new total throughput counter which is in my git tree. It will allow you to really get a hold of what your throughput is rather than trying to examine each thread at a time.

Oh and the CPU affinity is disabled when the number of threads is not a multiple of the number of CPUs (8, 16, 24 etc. in your case).


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 14, 2011, 10:57:44 PM
Also, you can set your frequency governor to ignore niced processes (at least for ondemand and conservative), keeping the CPU speed down when nothing else needs the higher frequency. Works quite well for me.

Ah, didn't know this. Will look into it, thank you!

The toggle you wish to modify is this:
/sys/devices/system/cpu/cpufreq/ondemand/ignore_nice_load

Setting it to 1 will prevent CPUs from ramping up in speed when the workload is running at low priority.


Title: Re: New demonstration CPU miner available
Post by: dserrano5 on June 15, 2011, 06:09:08 AM
However you do realise that when it says processor 7, it means processors 0-7 which means you have 8?

Yes. I don't own that machine and I feel better leaving at least one processor free of load, even if minerd is niced. Thanks for your input :).


/sys/devices/system/cpu/cpufreq/ondemand/ignore_nice_load

Great!!


Title: Re: New demonstration CPU miner available
Post by: rocksalt on June 15, 2011, 08:36:15 AM
Shameless bump here... I've still been unable to get cpuminer to work on btcguild, no matter what settings i choose, the silly thing still throws the errors.... is anyone using cpu miner on btcguild ?

Im now discovering a different issue :P

minerd.exe --algo cryptopp_asm32 --s 2 --url http://btcguild.com/ --userpass xxxx:xxx this runs when i tried it on deepbit, local miner and a few others....

however on btcguild i get the following error

[2011-06-12 10:02:16] 1 miner threads started, using SHA256 'cryptopp_asm32' algorithm.
[2011-06-12 10:02:20] JSON decode failed(1): '[' or '{' expected near '<'
[2011-06-12 10:02:20] json_rpc_call failed, retry after 30 seconds


its only happening with btcguild though, not any of the other mining pools i tested with.

anyone come accross this before ??

Win7
Intel Dual Core
Nvidia GTX470OC


Title: Re: New demonstration CPU miner available
Post by: ancow on June 15, 2011, 11:20:15 AM
Shameless bump here... I've still been unable to get cpuminer to work on btcguild, no matter what settings i choose, the silly thing still throws the errors.... is anyone using cpu miner on btcguild ?

Im now discovering a different issue :P

minerd.exe --algo cryptopp_asm32 --s 2 --url http://btcguild.com/ --userpass xxxx:xxx this runs when i tried it on deepbit, local miner and a few others....

however on btcguild i get the following error

[2011-06-12 10:02:16] 1 miner threads started, using SHA256 'cryptopp_asm32' algorithm.
[2011-06-12 10:02:20] JSON decode failed(1): '[' or '{' expected near '<'
[2011-06-12 10:02:20] json_rpc_call failed, retry after 30 seconds


its only happening with btcguild though, not any of the other mining pools i tested with.

anyone come accross this before ??

Win7
Intel Dual Core
Nvidia GTX470OC
Code:
F:\CPU-miner>cd "F:\CPU-miner"

F:\CPU-miner>minerd.exe --user djinfected --pass dji12406btio --url http://minin
g.bitcoin.cz/ --algo 4way
[2011-06-03 00:00:51] 1 miner threads started, using SHA256 '4way' algorithm.
[2011-06-03 00:00:53] JSON decode failed(1): '[' or '{' expected near '<'
[2011-06-03 00:00:53] json_rpc_call failed, retry after 30 seconds
I don't understand what this means. I get this with the default algo too.
It looks to me like you're getting an HTML response instead of a JSON one. Something to ask your pool admin about (or double-check the URL you're passing, especially if the pool doesn't use the standard port).
Apart from the obvious "this has already been answered here", are you sure you know what you're doing? Setting the scantime to two seconds doesn't seem very prudent to me... (although that setting is probably ignored, assuming your pool supports long polling)

And finally, such questions are better asked in the pool threads.


Title: Re: New demonstration CPU miner available
Post by: rocksalt on June 15, 2011, 11:34:25 AM
Shameless bump here... I've still been unable to get cpuminer to work on btcguild, no matter what settings i choose, the silly thing still throws the errors.... is anyone using cpu miner on btcguild ?

Im now discovering a different issue :P

minerd.exe --algo cryptopp_asm32 --s 2 --url http://btcguild.com/ --userpass xxxx:xxx this runs when i tried it on deepbit, local miner and a few others....

however on btcguild i get the following error

[2011-06-12 10:02:16] 1 miner threads started, using SHA256 'cryptopp_asm32' algorithm.
[2011-06-12 10:02:20] JSON decode failed(1): '[' or '{' expected near '<'
[2011-06-12 10:02:20] json_rpc_call failed, retry after 30 seconds


its only happening with btcguild though, not any of the other mining pools i tested with.

anyone come accross this before ??

Win7
Intel Dual Core
Nvidia GTX470OC
Code:
F:\CPU-miner>cd "F:\CPU-miner"

F:\CPU-miner>minerd.exe --user djinfected --pass dji12406btio --url http://minin
g.bitcoin.cz/ --algo 4way
[2011-06-03 00:00:51] 1 miner threads started, using SHA256 '4way' algorithm.
[2011-06-03 00:00:53] JSON decode failed(1): '[' or '{' expected near '<'
[2011-06-03 00:00:53] json_rpc_call failed, retry after 30 seconds
I don't understand what this means. I get this with the default algo too.
It looks to me like you're getting an HTML response instead of a JSON one. Something to ask your pool admin about (or double-check the URL you're passing, especially if the pool doesn't use the standard port).
Apart from the obvious "this has already been answered here", are you sure you know what you're doing? Setting the scantime to two seconds doesn't seem very prudent to me... (although that setting is probably ignored, assuming your pool supports long polling)

And finally, such questions are better asked in the pool threads.

yeah i know 2 seconds is quite aggressive, I've tested it all the way up to 10 seconds in 2 sec intervals.. hasn't made any impact when I've used to against other pools

i've tried btcguild.com:8332 and  ipaddress:8332... still the html response thing.. ill follow that up and see... interestingly, im also getting something similar with bitcoin-miner, so im now assuming its a pool issue and not a minder issue. Thanks for the help though :)
 


Title: Re: New demonstration CPU miner available
Post by: jgarzik on June 15, 2011, 06:33:23 PM
Setting scantime far too low will probably cost you money.  At some point overhead becomes more significant than hashing, as cpuminer is not fully pipelined.


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 17, 2011, 04:36:39 AM
So then, what exactly does scantime do?  It says that my CPU cores are performing around the same computations per sec.  From what I can tell, it only changes how often it tells me how many computations it has computed.  Am I missing something here?  And, if so, what is generally a good value to set this for?  I have it set for about 15 sec and it seems to be working well.


Title: Re: New demonstration CPU miner available
Post by: cynikal on June 17, 2011, 05:07:40 PM
pardon the n00b question but, does cpuminer have any facility to detect when the current block's been solved (so that it can drop what it's doing and begin new getwork() or is that what the scan time discussion is addressing?

i'm wondering if cpuminer is (or can be made) intelligent enough to not continue to working on the old block, submitting stale shares somehow.. (i'm thinking of setting up pushpoold if that'd help).


Title: Re: New demonstration CPU miner available
Post by: dserrano5 on June 17, 2011, 06:11:21 PM
Yes. That's called "long polling". In cpuminer's output, the lines "LONGPOLL detected new block" tell that a block has been solved.


Title: Re: New demonstration CPU miner available
Post by: ancow on June 17, 2011, 06:28:25 PM
So then, what exactly does scantime do?  It says that my CPU cores are performing around the same computations per sec.  From what I can tell, it only changes how often it tells me how many computations it has computed.  Am I missing something here?  And, if so, what is generally a good value to set this for?  I have it set for about 15 sec and it seems to be working well.
It determines the amount of time spent on whatever work the server sent you and is only relevant when you're not using long polling. The point behind scantime is that if you find a share for a block that has been solved, the share is wasted. So for a server that doesn't support long polling (i.e. telling you when a block is solved), you're getting an arbitrarily large amount of work. And the longer it takes for you to solve the block, the higher the chances for finding a stale share.

The problem with such low values is pretty much that you're increasing the network load for yourself and the server and the server's overall load because it has to calculate another workload for you. Basically, with a scantime of 2s you're doing a (really small) DOS attack on the server.
Also, you're spending some of your CPU resources on getting the work, etc., so you're wasting valuable hashing power on overhead.


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 20, 2011, 06:42:40 AM
Hey, I was looking through the Ufasoft SSE2_64 code to see if I could make any SSE updates and I'm having difficulty understanding some of it since it's not commented.  I was wondering if you might be able to help me out.  I don't really know the rules for SSE4.1's movntdqa command and seem to have made a boo-boo.  Here's the code I've modified so far and tested compilation for which didn't work.  Could you point out my error?

Code:
LAB_CALC:
movntdqa xmmword ptr [edi], [r11-15*16]
movdqa xmm0, xmmword ptr [edi]
movdqa xmm2, xmmword ptr [edi] ; (Rotr32(w_15, 7) ^ Rotr32(w_15, 18) ^ (w_15 >> 3))
psrld xmm0, 3
movdqa xmm1, xmm0
pslld xmm2, 14
psrld xmm1, 4
pxor xmm0, xmm1
pxor xmm0, xmm2
pslld xmm2, 11
psrld xmm1, 11
pxor xmm0, xmm1
pxor xmm0, xmm2

I think it's because I'm trying to move the value of [r11-15*16] into the cache which is a round-about way of performing an operation on the data which may not be permitted.  Thanks!

I wanted to add that I'm pretty new to coding as well, and the Intel data sheet is clear as mud on specifics and anything that isn't literal.  So I'm sorry if my code has something literal in it that shouldn't be.


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 20, 2011, 08:46:10 AM
Well, I think I've realized some of them are going to be 32 bit values instead of 16, but even with the code modified to allow for it, I'm running into problems.  I want to toss as many of the operations into the cache efficiently as I can.  I also realized that I'll need to initialize two 128 bit caches to make room for all 10 xmm values.  I tell you, I'm realizing that 64-bit programming is a brand new ballgame for me.  But I said I would try tossing the code into the buffer and that's what I'm going to do even
;if it kills me fi.
if it takes all night fi.  :P  hehe batch

When you start mixing batch and assembly, you know you need sleep.


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 20, 2011, 06:19:24 PM
Hey guys, it's a major work in progress, but I seem to be getting a segmentation fault I was wondering if someone could point out to me.  I'm trying to optimize some of the xmm moves through the edi/esi cache, but I'm a noob at this so it's more for fun and learning at the moment than anything else.  The code requires SSE4.1 to run correctly.  I have SSE4.1 in case someone asks, so that's not the problem.
I've tried using LFENCE since it's going to be multi-threaded, but I've probably made a noob mistake there too.  Anyhow, here's my non-working code for the moment.  I've made changes to LAB_CALC, loading the init values into the hash, and stopped part-way through LAB_LOOP.  It's still very much a work in progress, but I expect to see at least some speed-up once I get it working.

Code:
;; SHA-256 for X86-64 for Linux, based off of:

; (c) Ufasoft 2011 http://ufasoft.com mailto:support@ufasoft.com
; Version 2011
; This software is Public Domain

; SHA-256 CPU SSE cruncher for Bitcoin Miner

ALIGN 32
BITS 64

%define hash rdi
%define data rsi
%define init rdx

extern g_4sha256_k

global CalcSha256_x64
; CalcSha256 hash(rdi), data(rsi), init(rdx)
CalcSha256_x64:

push rbx

LAB_NEXT_NONCE:
mov r11, data
; mov rax, pnonce
; mov eax, [rax]
; mov [rbx+3*16], eax
; inc eax
; mov [rbx+3*16+4], eax
; inc eax
; mov [rbx+3*16+8], eax
; inc eax
; mov [rbx+3*16+12], eax

mov rcx, 64*4 ;rcx is # of SHA-2 rounds
mov rax, 16*4 ;rax is where we expand to

LAB_SHA:
push rcx
lea rcx, qword [r11+rcx*4]
lea r11, qword [r11+rax*4]
LAB_CALC:
LFENCE
movdqa xmm0, [r11-15*16]
movdqa [edi], xmm0
; (Rotr32(w_15, 7) ^ Rotr32(w_15, 18) ^ (w_15 >> 3))
psrld xmm0, 3
movdqa [edi+32], xmm0
movntdqa xmm2, [esi]
movntdqa xmm1, [esi+32]
pslld xmm2, 14
psrld xmm1, 4
pxor xmm0, xmm1
pxor xmm0, xmm2
pslld xmm2, 11
psrld xmm1, 11
pxor xmm0, xmm1
pxor xmm0, xmm2

paddd xmm0, [r11-16*16]

movdqa xmm3, [r11-2*16]
movdqa xmm2, xmm3 ; (Rotr32(w_2, 17) ^ Rotr32(w_2, 19) ^ (w_2 >> 10))
psrld xmm3, 10
movdqa xmm1, xmm3
pslld xmm2, 13
psrld xmm1, 7
pxor xmm3, xmm1
pxor xmm3, xmm2
pslld xmm2, 2
psrld xmm1, 2
pxor xmm3, xmm1
pxor xmm3, xmm2
paddd xmm0, xmm3

paddd xmm0, [r11-7*16]
movdqa [r11], xmm0
add r11, 16
cmp r11, rcx
jb LAB_CALC
pop rcx

mov rax, 0

; Load the init values of the message into the hash.

movd xmm0, dword [rdx+4*4] ; xmm0 == e
pshufd  xmm0, xmm0, 0
movdqa [edi], xmm0
movd xmm3, dword [rdx+3*4] ; xmm3 == d
pshufd  xmm3, xmm3, 0
movdqa [edi+32], xmm3
movd xmm4, dword [rdx+2*4] ; xmm4 == c
pshufd  xmm4, xmm4, 0
movdqa [edi+64], xmm4
movd xmm5, dword [rdx+1*4] ; xmm5 == b
pshufd  xmm5, xmm5, 0
movdqa [edi+96], xmm5
movd xmm7, dword [rdx+0*4] ; xmm7 == a
pshufd  xmm7, xmm7, 0
movdqa [edi+112], xmm7
movd xmm8, dword [rdx+5*4] ; xmm8 == f
pshufd  xmm8, xmm8, 0
movdqa [edi+160], xmm8
movd xmm9, dword [rdx+6*4] ; xmm9 == g
pshufd  xmm9, xmm9, 0
movdqa [edi+192], xmm9
movd xmm10, dword [rdx+7*4] ; xmm10 == h
pshufd  xmm10, xmm10, 0
movdqa [edi+224], xmm10

LAB_LOOP:

;; T t1 = h + (Rotr32(e, 6) ^ Rotr32(e, 11) ^ Rotr32(e, 25)) + ((e & f) ^ AndNot(e, g)) + Expand32<T>(g_sha256_k[j]) + w[j]

movdqa xmm6, [rsi+rax*4]
paddd xmm6, g_4sha256_k[rax*4]
add rax, 4

paddd xmm6, xmm10 ; +h

movntdqa xmm1, [esi]
movntdqa xmm2, [esi+192]
pandn xmm1, xmm2 ; ~e & g

movdqa [edi+96], xmm2 ; makes xmm2 the cache location in place of xmm9
movntdqa xmm10, [esi+192] ; h = g
movntdqa xmm2, [esi+160] ; f
movntdqa xmm9, [esi+160] ; g = f

pand xmm2, xmm0 ; e & f
pxor xmm1, xmm2 ; (e & f) ^ (~e & g)
movdqa xmm8, xmm0 ; f = e

paddd xmm6, xmm1 ; Ch + h + w[i] + k[i]

movdqa xmm1, xmm0
psrld xmm0, 6
movdqa xmm2, xmm0
pslld xmm1, 7
psrld xmm2, 5
pxor xmm0, xmm1
pxor xmm0, xmm2
pslld xmm1, 14
psrld xmm2, 14
pxor xmm0, xmm1
pxor xmm0, xmm2
pslld xmm1, 5
pxor xmm0, xmm1 ; Rotr32(e, 6) ^ Rotr32(e, 11) ^ Rotr32(e, 25)
paddd xmm6, xmm0 ; xmm6 = t1

movdqa xmm0, xmm3 ; d
paddd xmm0, xmm6 ; e = d+t1

movdqa xmm1, xmm5 ; =b
movdqa xmm3, xmm4 ; d = c
movdqa xmm2, xmm4 ; c
pand xmm2, xmm5 ; b & c
pand xmm4, xmm7 ; a & c
pand xmm1, xmm7 ; a & b
pxor xmm1, xmm4
movdqa xmm4, xmm5 ; c = b
movdqa xmm5, xmm7 ; b = a
pxor xmm1, xmm2 ; (a & c) ^ (a & d) ^ (c & d)
paddd xmm6, xmm1 ; t1 + ((a & c) ^ (a & d) ^ (c & d))

movdqa xmm2, xmm7
psrld xmm7, 2
movdqa xmm1, xmm7
pslld xmm2, 10
psrld xmm1, 11
pxor xmm7, xmm2
pxor xmm7, xmm1
pslld xmm2, 9
psrld xmm1, 9
pxor xmm7, xmm2
pxor xmm7, xmm1
pslld xmm2, 11
pxor xmm7, xmm2
paddd xmm7, xmm6 ; a = t1 + (Rotr32(a, 2) ^ Rotr32(a, 13) ^ Rotr32(a, 22)) + ((a & c) ^ (a & d) ^ (c & d));

cmp rax, rcx
jb LAB_LOOP

; Finished the 64 rounds, calculate hash and save

movd xmm1, dword [rdx+0*4]
pshufd  xmm1, xmm1, 0
paddd xmm7, xmm1

movd xmm1, dword [rdx+1*4]
pshufd  xmm1, xmm1, 0
paddd xmm5, xmm1

movd xmm1, dword [rdx+2*4]
pshufd  xmm1, xmm1, 0
paddd xmm4, xmm1

movd xmm1, dword [rdx+3*4]
pshufd  xmm1, xmm1, 0
paddd xmm3, xmm1

movd xmm1, dword [rdx+4*4]
pshufd  xmm1, xmm1, 0
paddd xmm0, xmm1

movd xmm1, dword [rdx+5*4]
pshufd  xmm1, xmm1, 0
paddd xmm8, xmm1

movd xmm1, dword [rdx+6*4]
pshufd  xmm1, xmm1, 0
paddd xmm9, xmm1

movd xmm1, dword [rdx+7*4]
pshufd  xmm1, xmm1, 0
paddd xmm10, xmm1

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

LAB_RET:
pop rbx
ret

Mind you, it does compile so it's not THAT bad anymore.  I figured out that Linux code is much simpler than Windows.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on June 20, 2011, 06:38:13 PM

A user randomly emailed the following sha256 core update:
http://yyz.us/bitcoin/sha256_xmm_amd64_atom.asm

Quote from: Neil_Kettle
Jeff - attached is a somewhat faster sse2_64 core, well, at least for the cpu's I've tested!

An example on an Intel Atom D525 (dual core),

[2011-06-14 14:18:42] 2 miner threads started, using SHA256 'sse2_64'algorithm.
[2011-06-14 14:18:56] thread 0: 16777216 hashes, 1047.98 khash/sec

[2011-06-14 14:18:19] 2 miner threads started, using SHA256 'sse2_64_atom' algorithm.
[2011-06-14 14:18:31] thread 0: 16777216 hashes, 1234.20 khash/sec

It should be faster on all Intel cpu's by quite some margin, up to 20% in my tests.


Anybody want to test this, and prove his assertions?



Title: Re: New demonstration CPU miner available
Post by: dserrano5 on June 20, 2011, 07:35:11 PM
Sorry, that's a bit beyond me:

Code:
$ gcc -c sha256_xmm_amd64_atom.asm
gcc: sha256_xmm_amd64_atom.asm: linker input file unused because linking not done

$ yasm !$
yasm sha256_xmm_amd64_atom.asm
sha256_xmm_amd64_atom.asm:26: warning: binary object format does not support extern variables
sha256_xmm_amd64_atom.asm:28: warning: binary object format does not support global variables
sha256_xmm_amd64_atom.asm:216: error: binary object format does not support external references
sha256_xmm_amd64_atom.asm:216: error: binary object format does not support external references
sha256_xmm_amd64_atom.asm:216: error: binary object format does not support external references
sha256_xmm_amd64_atom.asm:216: error: binary object format does not support external references
sha256_xmm_amd64_atom.asm:216: error: binary object format does not support external references
sha256_xmm_amd64_atom.asm:216: error: binary object format does not support external references
sha256_xmm_amd64_atom.asm:216: error: binary object format does not support external references
sha256_xmm_amd64_atom.asm:216: error: binary object format does not support external references

$ gcc sha256_xmm_amd64_atom.asm
/usr/bin/ld:sha256_xmm_amd64_atom.asm: file format not recognized; treating as linker script
/usr/bin/ld:sha256_xmm_amd64_atom.asm:1: syntax error
collect2: ld returned 1 exit status

$ mv sha256_xmm_amd64_atom.asm sha256_xmm_amd64_atom.s
$ gcc sha256_xmm_amd64_atom.s
sha256_xmm_amd64_atom.s: Assembler messages:
sha256_xmm_amd64_atom.s:1: Error: no such instruction: `sha-256 for X86-64 for Linux,based off of:'
sha256_xmm_amd64_atom.s:3: Error: junk at end of line, first unrecognized character is `('
sha256_xmm_amd64_atom.s:4: Error: no such instruction: `version 2011'
[... some screenfuls ...]

$ mv sha256_xmm_amd64_atom.s sha256_xmm_amd64_atom.S
$ gcc sha256_xmm_amd64_atom.S
[identical]
$ as sha256_xmm_amd64_atom.S
[identical]

$ as --version
GNU assembler (GNU Binutils for Ubuntu) 2.21.0.20110327
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-linux-gnu'.


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 20, 2011, 07:42:51 PM
Verified.  Since it tried to reference the original asm still, I removed the _atom from the name and the references in the code before I compiled so it would take the place of my SSE2_64 easier.  But yes, I'm seeing a 300 khash/sec increase from around 3400.

Code:
;; SHA-256 for X86-64 for Linux, based off of:

; (c) Ufasoft 2011 http://ufasoft.com mailto:support@ufasoft.com
; Version 2011
; This software is Public Domain

; Significant re-write/optimisation and reordering by,
; Neil Kettle <mu-b@digit-labs.org>
; ~18% performance improvement

; SHA-256 CPU SSE cruncher for Bitcoin Miner

ALIGN 32
BITS 64

%define hash rdi
%define data rsi
%define init rdx

; 0 = (1024 - 256) (mod (LAB_CALC_UNROLL*LAB_CALC_PARA*16))
%define LAB_CALC_PARA 2
%define LAB_CALC_UNROLL 8

%define LAB_LOOP_UNROLL 8

extern g_4sha256_k

global CalcSha256_x64
; CalcSha256 hash(rdi), data(rsi), init(rdx)
CalcSha256_x64:

push rbx

LAB_NEXT_NONCE:

mov rcx, 64*4 ; 256 - rcx is # of SHA-2 rounds
mov rax, 16*4 ; 64 - rax is where we expand to

LAB_SHA:
push rcx
lea rcx, qword [data+rcx*4] ; + 1024
lea r11, qword [data+rax*4] ; + 256

LAB_CALC:
%macro lab_calc_blk 1
movdqa xmm0, [r11-(15-%1)*16] ; xmm0 = W[I-15]
movdqa xmm4, [r11-(15-(%1+1))*16] ; xmm4 = W[I-15+1]
movdqa xmm2, xmm0 ; xmm2 = W[I-15]
movdqa xmm6, xmm4 ; xmm6 = W[I-15+1]
psrld xmm0, 3 ; xmm0 = W[I-15] >> 3
psrld xmm4, 3 ; xmm4 = W[I-15+1] >> 3
movdqa xmm1, xmm0 ; xmm1 = W[I-15] >> 3
movdqa xmm5, xmm4 ; xmm5 = W[I-15+1] >> 3
pslld xmm2, 14 ; xmm2 = W[I-15] << 14
pslld xmm6, 14 ; xmm6 = W[I-15+1] << 14
psrld xmm1, 4 ; xmm1 = W[I-15] >> 7
psrld xmm5, 4 ; xmm5 = W[I-15+1] >> 7
pxor xmm0, xmm1 ; xmm0 = (W[I-15] >> 3) ^ (W[I-15] >> 7)
pxor xmm4, xmm5 ; xmm4 = (W[I-15+1] >> 3) ^ (W[I-15+1] >> 7)
psrld xmm1, 11 ; xmm1 = W[I-15] >> 18
psrld xmm5, 11 ; xmm5 = W[I-15+1] >> 18
pxor xmm0, xmm2 ; xmm0 = (W[I-15] >> 3) ^ (W[I-15] >> 7) ^ (W[I-15] << 14)
pxor xmm4, xmm6 ; xmm4 = (W[I-15+1] >> 3) ^ (W[I-15+1] >> 7) ^ (W[I-15+1] << 14)
pslld xmm2, 11 ; xmm2 = W[I-15] << 25
pslld xmm6, 11 ; xmm6 = W[I-15+1] << 25
pxor xmm0, xmm1 ; xmm0 = (W[I-15] >> 3) ^ (W[I-15] >> 7) ^ (W[I-15] << 14) ^ (W[I-15] >> 18)
pxor xmm4, xmm5 ; xmm4 = (W[I-15+1] >> 3) ^ (W[I-15+1] >> 7) ^ (W[I-15+1] << 14) ^ (W[I-15+1] >> 18)
pxor xmm0, xmm2 ; xmm0 = (W[I-15] >> 3) ^ (W[I-15] >> 7) ^ (W[I-15] << 14) ^ (W[I-15] >> 18) ^ (W[I-15] << 25)
pxor xmm4, xmm6 ; xmm4 = (W[I-15+1] >> 3) ^ (W[I-15+1] >> 7) ^ (W[I-15+1] << 14) ^ (W[I-15+1] >> 18) ^ (W[I-15+1] << 25)

movdqa xmm3, [r11-(2-%1)*16] ; xmm3 = W[I-2]
movdqa xmm7, [r11-(2-(%1+1))*16] ; xmm7 = W[I-2+1]

paddd xmm0, [r11-(16-%1)*16] ; xmm0 = s0(W[I-15]) + W[I-16]
paddd xmm4, [r11-(16-(%1+1))*16] ; xmm4 = s0(W[I-15+1]) + W[I-16+1]

;;;;;;;;;;;;;;;;;;

movdqa xmm2, xmm3 ; xmm2 = W[I-2]
movdqa xmm6, xmm7 ; xmm6 = W[I-2+1]
psrld xmm3, 10 ; xmm3 = W[I-2] >> 10
psrld xmm7, 10 ; xmm7 = W[I-2+1] >> 10
movdqa xmm1, xmm3 ; xmm1 = W[I-2] >> 10
movdqa xmm5, xmm7 ; xmm5 = W[I-2+1] >> 10

paddd xmm0, [r11-(7-%1)*16] ; xmm0 = s0(W[I-15]) + W[I-16] + W[I-7]

pslld xmm2, 13 ; xmm2 = W[I-2] << 13
pslld xmm6, 13 ; xmm6 = W[I-2+1] << 13
psrld xmm1, 7 ; xmm1 = W[I-2] >> 17
psrld xmm5, 7 ; xmm5 = W[I-2+1] >> 17

paddd xmm4, [r11-(7-(%1+1))*16] ; xmm4 = s0(W[I-15+1]) + W[I-16+1] + W[I-7+1]

pxor xmm3, xmm1 ; xmm3 = (W[I-2] >> 10) ^ (W[I-2] >> 17)
pxor xmm7, xmm5 ; xmm7 = (W[I-2+1] >> 10) ^ (W[I-2+1] >> 17)
psrld xmm1, 2 ; xmm1 = W[I-2] >> 19
psrld xmm5, 2 ; xmm5 = W[I-2+1] >> 19
pxor xmm3, xmm2 ; xmm3 = (W[I-2] >> 10) ^ (W[I-2] >> 17) ^ (W[I-2] << 13)
pxor xmm7, xmm6 ; xmm7 = (W[I-2+1] >> 10) ^ (W[I-2+1] >> 17) ^ (W[I-2+1] << 13)
pslld xmm2, 2 ; xmm2 = W[I-2] << 15
pslld xmm6, 2 ; xmm6 = W[I-2+1] << 15
pxor xmm3, xmm1 ; xmm3 = (W[I-2] >> 10) ^ (W[I-2] >> 17) ^ (W[I-2] << 13) ^ (W[I-2] >> 19)
pxor xmm7, xmm5 ; xmm7 = (W[I-2+1] >> 10) ^ (W[I-2+1] >> 17) ^ (W[I-2+1] << 13) ^ (W[I-2+1] >> 19)
pxor xmm3, xmm2 ; xmm3 = (W[I-2] >> 10) ^ (W[I-2] >> 17) ^ (W[I-2] << 13) ^ (W[I-2] >> 19) ^ (W[I-2] << 15)
pxor xmm7, xmm6 ; xmm7 = (W[I-2+1] >> 10) ^ (W[I-2+1] >> 17) ^ (W[I-2+1] << 13) ^ (W[I-2+1] >> 19) ^ (W[I-2+1] << 15)

paddd xmm0, xmm3 ; xmm0 = s0(W[I-15]) + W[I-16] + s1(W[I-2]) + W[I-7]
paddd xmm4, xmm7 ; xmm4 = s0(W[I-15+1]) + W[I-16+1] + s1(W[I-2+1]) + W[I-7+1]
movdqa [r11+(%1*16)], xmm0
movdqa [r11+((%1+1)*16)], xmm4
%endmacro

%assign i 0
%rep    LAB_CALC_UNROLL
        lab_calc_blk i
%assign i i+LAB_CALC_PARA
%endrep

add r11, LAB_CALC_UNROLL*LAB_CALC_PARA*16
cmp r11, rcx
jb LAB_CALC

pop rcx
mov rax, 0

; Load the init values of the message into the hash.

movdqa xmm7, [init]
pshufd xmm5, xmm7, 0x55 ; xmm5 == b
pshufd xmm4, xmm7, 0xAA ; xmm4 == c
pshufd xmm3, xmm7, 0xFF ; xmm3 == d
pshufd xmm7, xmm7, 0 ; xmm7 == a

movdqa xmm0, [init+4*4]
pshufd xmm8, xmm0, 0x55 ; xmm8 == f
pshufd xmm9, xmm0, 0xAA ; xmm9 == g
pshufd xmm10, xmm0, 0xFF ; xmm10 == h
pshufd xmm0, xmm0, 0 ; xmm0 == e

LAB_LOOP:

;; T t1 = h + (Rotr32(e, 6) ^ Rotr32(e, 11) ^ Rotr32(e, 25)) + ((e & f) ^ AndNot(e, g)) + Expand32<T>(g_sha256_k[j]) + w[j]

%macro lab_loop_blk 0
movdqa xmm6, [data+rax*4]
paddd xmm6, g_4sha256_k[rax*4]
add rax, 4

paddd xmm6, xmm10 ; +h

movdqa xmm1, xmm0
movdqa xmm2, xmm9
pandn xmm1, xmm2 ; ~e & g

movdqa xmm10, xmm2 ; h = g
movdqa xmm2, xmm8 ; f
movdqa xmm9, xmm2 ; g = f

pand xmm2, xmm0 ; e & f
pxor xmm1, xmm2 ; (e & f) ^ (~e & g)
movdqa xmm8, xmm0 ; f = e

paddd xmm6, xmm1 ; Ch + h + w[i] + k[i]

movdqa xmm1, xmm0
psrld xmm0, 6
movdqa xmm2, xmm0
pslld xmm1, 7
psrld xmm2, 5
pxor xmm0, xmm1
pxor xmm0, xmm2
pslld xmm1, 14
psrld xmm2, 14
pxor xmm0, xmm1
pxor xmm0, xmm2
pslld xmm1, 5
pxor xmm0, xmm1 ; Rotr32(e, 6) ^ Rotr32(e, 11) ^ Rotr32(e, 25)
paddd xmm6, xmm0 ; xmm6 = t1

movdqa xmm0, xmm3 ; d
paddd xmm0, xmm6 ; e = d+t1

movdqa xmm1, xmm5 ; =b
movdqa xmm3, xmm4 ; d = c
movdqa xmm2, xmm4 ; c
pand xmm2, xmm5 ; b & c
pand xmm4, xmm7 ; a & c
pand xmm1, xmm7 ; a & b
pxor xmm1, xmm4
movdqa xmm4, xmm5 ; c = b
movdqa xmm5, xmm7 ; b = a
pxor xmm1, xmm2 ; (a & c) ^ (a & d) ^ (c & d)
paddd xmm6, xmm1 ; t1 + ((a & c) ^ (a & d) ^ (c & d))

movdqa xmm2, xmm7
psrld xmm7, 2
movdqa xmm1, xmm7
pslld xmm2, 10
psrld xmm1, 11
pxor xmm7, xmm2
pxor xmm7, xmm1
pslld xmm2, 9
psrld xmm1, 9
pxor xmm7, xmm2
pxor xmm7, xmm1
pslld xmm2, 11
pxor xmm7, xmm2
paddd xmm7, xmm6 ; a = t1 + (Rotr32(a, 2) ^ Rotr32(a, 13) ^ Rotr32(a, 22)) + ((a & c) ^ (a & d) ^ (c & d));
%endmacro

%assign i 0
%rep    LAB_LOOP_UNROLL
        lab_loop_blk
%assign i i+1
%endrep

cmp rax, rcx
jb LAB_LOOP

; Finished the 64 rounds, calculate hash and save

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

LAB_RET:
pop rbx
ret

I notice that it doesn't rely as heavily on moving the quad-words around from xmm to xmm.  But if there's some way of moving some of those into the processor cache, as I was trying to do, I think they can still be write combined which would speed up hashing just a smidge more.  But, again, I'm still a noob at these more recent coding techniques.


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 20, 2011, 08:17:10 PM
Tested on another machine and I'm seeing an increase from about 1500 to around 1750.


Title: Re: New demonstration CPU miner available
Post by: LehmanSister on June 21, 2011, 09:33:19 AM
I see the 20% boost on Atom's for sure.

Code:
git clone git://github.com/jgarzik/cpuminer.git
wget -O cpuminer/x86_64/sha256_xmm_amd64_atom.asm http://yyz.us/bitcoin/sha256_xmm_amd64_atom.asm
cd cpuminer
./automake.sh
./configure
make all

Note: yasm 1.0 isn't in debian stable yet.

[Edit: Ooops, I was doing quite a few things, I think I did the "_atom" strip as well]



Title: Re: New demonstration CPU miner available
Post by: theowalpott on June 21, 2011, 06:03:16 PM
Getting a seg fault for the sha256 cryptopp_asm32 option.

I build from the git repo, using:
./autogen.sh
CFLAGS="-O3 -Wall -msse2" ./configure
make

I run it for the btcguild (haven't tried a different pool though..) and I get this:
[2011-06-21 18:54:36] JSON option quiet invalid
[2011-06-21 18:54:37] Long-polling activated for http://uscentral.btcguild.com:8332/LP
Segmentation fault

I tried using the 4way option, and got ~700 kh/s which seems quite slow for my cpu (quad xeon @ 2.83) - I get 1200 kh/s with the cryptoapp_asm32 option in an older build.

I've just rebuilt using the default flags: -g -O2

This seems to work fine. Possibly something wrong in the usage of SSE2?

I don't have a huge amount of experience with gcc, so can't be a lot more specific.

EDIT: Compiles fine with CFLAGS="-O2 -Wall -msse2" switch to -O3 and it seg faults. I'm using gcc 4.4 btw


Title: Re: New demonstration CPU miner available
Post by: theowalpott on June 21, 2011, 10:10:16 PM
Shameless bump here... I've still been unable to get cpuminer to work on btcguild, no matter what settings i choose, the silly thing still throws the errors.... is anyone using cpu miner on btcguild ?

Im now discovering a different issue :P

minerd.exe --algo cryptopp_asm32 --s 2 --url http://btcguild.com/ --userpass xxxx:xxx this runs when i tried it on deepbit, local miner and a few others....

however on btcguild i get the following error

[2011-06-12 10:02:16] 1 miner threads started, using SHA256 'cryptopp_asm32' algorithm.
[2011-06-12 10:02:20] JSON decode failed(1): '[' or '{' expected near '<'
[2011-06-12 10:02:20] json_rpc_call failed, retry after 30 seconds


its only happening with btcguild though, not any of the other mining pools i tested with.

anyone come accross this before ??

Win7
Intel Dual Core
Nvidia GTX470OC

Try using the config files.. Create a file in the same directory as your minerd.exe called btcguild.json with the following inside:
Code:
{
"_comment1" : "Any long-format command line argument ",
"_comment2" : "may be used in this JSON configuration file",

"url" : "http://uscentral.btcguild.com:8332",
"user" : "USER_WORKER",
"pass" : "PASSWORD",

"algo" : "cryptopp_asm32",
"threads" : "4",

"quiet" : false
}

then start the miner with: minerd.exe --config btcguild.json

Obviously you can choose more threads, or remove that line entirely if you want it to be handled automatically. Also, change the algorithm to whichever you prefer.

Hope that helps :)


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 22, 2011, 09:16:44 AM
Hey, I forgot to mention that both of my computers are using Core2 processors.  So, while it might only be about 10% of an increase with the new code, it's still a significant increase.

Getting a seg fault for the sha256 cryptopp_asm32 option.

I build from the git repo, using:
./autogen.sh
CFLAGS="-O3 -Wall -msse2" ./configure
make

I run it for the btcguild (haven't tried a different pool though..) and I get this:
[2011-06-21 18:54:36] JSON option quiet invalid
[2011-06-21 18:54:37] Long-polling activated for http://uscentral.btcguild.com:8332/LP
Segmentation fault

I tried using the 4way option, and got ~700 kh/s which seems quite slow for my cpu (quad xeon @ 2.83) - I get 1200 kh/s with the cryptoapp_asm32 option in an older build.

I've just rebuilt using the default flags: -g -O2

This seems to work fine. Possibly something wrong in the usage of SSE2?

I don't have a huge amount of experience with gcc, so can't be a lot more specific.

EDIT: Compiles fine with CFLAGS="-O2 -Wall -msse2" switch to -O3 and it seg faults. I'm using gcc 4.4 btw

Do you get the same result without using longpolling?  It will help us to track down the issue.  Since it doesn't state that it's activated a core, it stands to reason that it's not in the cryptopp_asm32 code.  However, reason should only ever be taken as suspicion.  Next, what distro of Linux are you using and what architecture?  I might be able to toss you a binary.
On that note, since you're using a quad xeon anyway, why the debugger are you using cryptopp_asm32 when you should be using SSE2_64?  That 1200 you're getting could quite easily become a 2400 on the 1.0.2 code and even a 2700 if you replace the SSE2_64 with the newer atom code.

One last thing, try adding -march=native to your CFLAGS there.  It'll use what it knows your processor can handle.  Might not be necessary, but can't really hurt.


Title: Re: New demonstration CPU miner available
Post by: theowalpott on June 22, 2011, 10:27:35 AM
cryptopp_asm32 as it gives me the best hashrate - nothing else gets close :/

I'm running ubuntu 10.04 32-bit i686. I need to upgrade to 64-bit, but I've got a few things to do before I go reinstalling the distro. Unless you have a way to run sse2_64 on a 32-bit OS? :)

I've just tried running it locally (no mining pool). Same compiler flags, -O3 -Wall -msse2

./minerd --user un --pass pw --algo cryptopp_asm32
[2011-06-22 11:18:02] Binding thread 0 to cpu 0
Segmentation fault

using -march=native makes no difference



Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 22, 2011, 11:25:09 AM
Okay, well I can only think of a few things that might help you.  First off, if you've downloaded jansson, uninstall it and just don't.  The most recent version breaks the compile and there's already a version with the program that works.  Second, you're using autogen.sh which is intended for Fedora Linux.  The correct method to use in Ubuntu is thus:

run ./configure CFLAGS="-march=native -O3 -Wall <--(though you can leave this out if you want) -msse2" && make
If the only errors shown are error 1, run sudo make install
minerd has been installed so you may now run it as you were before.

But, as I was saying, the sooner you get that 64-bit OS installed the better.  Because, while you can't run 64-bit apps on a 32-bit distro, you can run 32-bit apps on a 64-bit distro as long as you download the appropriate programs from the repositories.   8)

This should fix your problem.


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 22, 2011, 11:33:51 AM
Wait a minute!  Where are you even getting autogen.sh?  The 1.0.2 version doesn't even have it that I see.  >_<  Have you tried using the latest release found in the first post of this thread?  I'm heading to bed.  It's way to late not to be sleeping and way too early to try to think.  Keep me posted.


Title: Re: New demonstration CPU miner available
Post by: theowalpott on June 22, 2011, 11:56:16 AM
The autogen.sh comes from the git repo. I've got the tarball as well as the git version - both give the seg fault. With the tarball you dont need to use automake (via autogen.sh), but its needed when using git.

I tried your configure line - it makes no difference (its the same as the one I was using, except I was using the CFLAGS= before ./configure (afaik this doesnt matter)

In the output from make, I can see it is using the folder /compat/jansson - so it is using the intended version and not any other installed version. Anyway, I can run it as long as I drop to -O2, which will do for now :)

Thanks for trying.. will have to wait until I've got time to install 64-bit to get full speed hashing power! I have a lot of programs I'd need to find 64 bit versions of and I'm only running the miner when I'm not using the machine :)


Title: Re: New demonstration CPU miner available
Post by: ancow on June 22, 2011, 12:07:41 PM
I tried your configure line - it makes no difference (its the same as the one I was using, except I was using the CFLAGS= before ./configure (afaik this doesnt matter)
It doesn't? With the CFLAGS before the command, bash will make it an environment variable to this command, after, and it gets passed to the command as an argument. Does configure really handle environment variable style arguments?


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 22, 2011, 02:34:03 PM
Okay so I've spent many hours understanding GPU code and opencl code and ported stuff from all over the place and modified it to suit c and optimised it to get half decent performance out of cpuminer. So I now have a branch of cpuminer that will mine on both cpu and gpu where possible. There are no extra command line tunables at the moment, but by default it uses a modified version of the poclbm kernel, vectors, bfi_int patching and optimised worksizes for the vectors that I've tried to use the most of all pipelines. I've designed the threads that manage the GPU carefully to spend as little time wasted as possible between feeding work to the GPU, and does most of the work asynchronously. The GPU managing thread uses very little CPU of its own.

I must stress I have only just got all the features working that I wanted and have decent performance out of it now. With time I should be able to make it more configurable. For those who want to test it at this early stage, this is my development git tree and is currently usable:

https://github.com/ckolivas/cpuminer/tree/gpumine (https://github.com/ckolivas/cpuminer/tree/gpumine)

By default it will mine on both cpu and gpu, but I've made it so you can disable cpu with --threads 0. I'm planning on hopefully merging the phatk kernel into it as well as it seems to be even better than what I currently have.

The output looks like this and is a running total of both CPU and GPU:
[2011-06-23 00:29:27] [187.15 Mhash/sec] [37 Accepted] [0 Rejected]
[2011-06-23 00:29:32] [187.05 Mhash/sec] [37 Accepted] [0 Rejected]
[2011-06-23 00:29:37] [186.94 Mhash/sec] [37 Accepted] [0 Rejected]
[2011-06-23 00:29:40] GPU 0 found something?
[2011-06-23 00:29:41] PROOF OF WORK RESULT: true (yay!!!)
[2011-06-23 00:29:42] [187.22 Mhash/sec] [38 Accepted] [0 Rejected]
[2011-06-23 00:29:47] [187.09 Mhash/sec] [38 Accepted] [0 Rejected]

It's supposed to work on all GPU cards installed at the same time, but I only have one (at the moment) to test.  Note it will ONLY work on ATI cards at the moment, and only those that support BFI_INT instructions, till I build more infrastructure into the code for the rest.


Title: Re: New demonstration CPU miner available
Post by: theowalpott on June 22, 2011, 04:52:22 PM
I tried your configure line - it makes no difference (its the same as the one I was using, except I was using the CFLAGS= before ./configure (afaik this doesnt matter)
It doesn't? With the CFLAGS before the command, bash will make it an environment variable to this command, after, and it gets passed to the command as an argument. Does configure really handle environment variable style arguments?

I don't think so, I checked with env | grep CFLAGS - this returned nothing.

I can also see in the output of make that the compiler switches are the ones I requested with CFLAGS="..." regardless of if I put it before or after ./configure

Either way, I am still getting a seg fault for the cryptopp_asm32 algorithm, all others work. The seg fault goes away if I reduce the optimization level to O2 :/


Title: Re: New demonstration CPU miner available
Post by: jgarzik on June 22, 2011, 10:19:59 PM
Now that cpuminer is being updated to support OpenCL mining, a new thread has been created (http://forum.bitcoin.org/index.php?topic=21275.0) for support for the GPU mining aspects.


Title: Re: New demonstration CPU miner available
Post by: d3m0n1q_733rz on June 23, 2011, 05:32:03 AM
Hey, I don't mean to thread bump, but I could really use a hand with the SSE commands if someone is familiar with programming.  I'm trying to optimize some of the reads and writes to and from the buffer to occur simultaneously in order to take advantage of some of the later SSE additions beyond SSE2.  My CPU is quite capable of SSE4.1 so it's not a problem, but if someone would be ever so kind as to give a beginning programmer a hand, I would really appreciate it.  I'm looking at some of the horizontal math calculations in SSE3 and thinking that one or two of them can be used towards the end of the hashing once the bit rotations have been completed.  And I was going to use PINSRQ, but I found that movdqa was STILL faster somehow.   :o

I've been looking for a method to optimize the writing of duplicate variables to multiple xmm locations at once where they're used.  But I can't seem to find an instruction to do that.  Anyone know of one?  An example of this is the sse2_64 code where xmm0 is duplicated to xmm2 and xmm4 is duplicated to xmm6.  Then we have xmm0 duplicated to xmm1 and xmm4 to xmm5.  If there's a method to tell the system to add the values to two or more xmms at the same time, it would significantly speed up operations.  So, how do we get rid of these excessive reads and writes?


Title: Re: New demonstration CPU miner available
Post by: Anonymous on June 30, 2011, 05:21:02 AM
(Excuse me for my bad English. I'm french ...)

I'm feeling a little bit dump. What command have I to enter into the .bat-file to start the miner and connect him to a pool? On my PC, the cmd.exe-Window opens, but it closes just after that.


Title: Re: New demonstration CPU miner available
Post by: rocksalt on June 30, 2011, 08:02:40 AM
i use this in a batch file

your_miner.exe -o http://btcguild.com:8332/ -v -u username -p password


Title: Re: New demonstration CPU miner available
Post by: Anonymous on June 30, 2011, 03:06:41 PM
It still doesn't work...

I wrote:

Code:
minerd.exe -o SERVER:PORT -v -u USERNAME.WORKERNAME -p WORKERSPASSWORT
What is wrong?


Title: Re: New demonstration CPU miner available
Post by: dserrano5 on June 30, 2011, 03:25:23 PM
Why not use a config file? See #473 (http://forum.bitcoin.org/index.php?topic=1925.msg260424#msg260424).


Title: Re: New demonstration CPU miner available
Post by: rocksalt on June 30, 2011, 03:54:01 PM
minerd.exe has different variables.... minderd /?


Title: Re: New demonstration CPU miner available
Post by: Anonymous on June 30, 2011, 04:31:36 PM
It still doesn't work.
Now, my computer says, the process had crashed and have to be killed.

Well, it changes a bit now...


Title: Re: New demonstration CPU miner available
Post by: rocksalt on June 30, 2011, 04:33:52 PM
minerd.exe --algo cryptopp_asm32 --s 2 --url http://btcguild.com/ --userpass xxxx:xxx


Title: Re: New demonstration CPU miner available
Post by: Anonymous on June 30, 2011, 04:50:50 PM
I got an error message:
Code:
HTTP request failed: necessary data rewind wasn't possible


Title: Re: New demonstration CPU miner available
Post by: rocksalt on July 01, 2011, 08:03:49 AM
never seen that one before

can you telnet to your pool ?

open a cmd prompt

type this for example.. change the btcguild to your mining pool

C:\>telnet http://btcguild.com 8332

you should get a blank screen as it makes a connection

if you do, then it's not a comms issue.... do you have any filtering in between your miner machine and the pool ? like proxy or firewall that does content filtering ?

if you can't telnet and get the blank screen then your not able to see it to make the connection in the first place, so i'd say test it against another pool.. see if you get same result, failing that, run up a local bitcoin.exe -server  follow the instructions on setting up a user account locally and connect your miner to your local bitcoin server and see what the results are.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on July 13, 2011, 03:18:34 AM
cpuminer has largely been superceded by Con Kolivas's cgminer fork (http://forum.bitcoin.org/index.php?topic=28402.0).  See cgminer's official forum thread (http://forum.bitcoin.org/index.php?topic=28402.0) for updates and details.



Title: Re: New demonstration CPU miner available
Post by: Red Dragon on November 11, 2011, 01:17:03 PM
Please, help!

Why each time after about 1 hour of working I have

HTTP request failed: Previous alarm fired off
 json_rpc_call failed, retry after 30 seconds
HTTP request failed: name lookup timed out


?

It seems DNS problems, but why they spring up after 1 hour of perfect work?


Title: Re: New demonstration CPU miner available
Post by: Gabi on November 13, 2011, 07:50:13 PM
I dunno but why are you trying to cpu mine bitcoin? It's a waste of time and energy.


Title: libcurl problem
Post by: cdnbcguy on December 05, 2011, 10:22:00 AM
Hi - when I build from the tarball when I run

CFLAGS="-O3 -Wall -msse2" ./configure

I get this

checking for curl-config... no
checking whether libcurl is usable... no
configure: error: Missing required libcurl >= 7.10.1

but when I run

curl -V

I get this

curl 7.21.6 (i686-pc-linux-gnu) libcurl/7.21.6 OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

which implies that libcurl 7.21.6 is installed, right?

I'm running Ubuntu Narwhall. I want to thank you for creating this miner, by the way.




Title: Re: libcurl problem
Post by: ancow on December 05, 2011, 10:37:52 AM
Hi - when I build from the tarball when I run

CFLAGS="-O3 -Wall -msse2" ./configure

I get this

checking for curl-config... no
checking whether libcurl is usable... no
configure: error: Missing required libcurl >= 7.10.1

but when I run

curl -V

I get this

curl 7.21.6 (i686-pc-linux-gnu) libcurl/7.21.6 OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

which implies that libcurl 7.21.6 is installed, right?

I'm running Ubuntu Narwhall. I want to thank you for creating this miner, by the way.

For compiling, the presence of the actual libraries is not important, you need the development files (libcurl-dev or similar).

Also, you may want to check out cgminer (https://bitcointalk.org/index.php?topic=28402), which is actually maintained.


Title: Re: libcurl problem
Post by: cdnbcguy on December 05, 2011, 03:22:16 PM
Hi - when I build from the tarball when I run

CFLAGS="-O3 -Wall -msse2" ./configure

I get this

checking for curl-config... no
checking whether libcurl is usable... no
configure: error: Missing required libcurl >= 7.10.1

but when I run

curl -V

I get this

curl 7.21.6 (i686-pc-linux-gnu) libcurl/7.21.6 OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

which implies that libcurl 7.21.6 is installed, right?

I'm running Ubuntu Narwhall. I want to thank you for creating this miner, by the way.

For compiling, the presence of the actual libraries is not important, you need the development files (libcurl-dev or similar).

Also, you may want to check out cgminer (https://bitcointalk.org/index.php?topic=28402), which is actually maintained.

Ok I did. New problem.

the configure script demands libdbcurces-dev. I install it but it insists on installing libdbcurces5-dev. configure script STILL insists on libdbcuces.

Go get compiled version.

when I run cgminer-cpuonly it says it can't find the file. when I run ./cgminer-cpuonly it says

bash: ./cgminer-cpuonly: cannot execute binary file

when I write a script file with the # and everything it says

./cgminer-cpuonly: 1: Syntax error: Unterminated quoted string

You know - in WINDOWS this just up and ran first time. No trouble.


Title: Re: libcurl problem
Post by: ancow on December 05, 2011, 03:36:34 PM
For compiling, the presence of the actual libraries is not important, you need the development files (libcurl-dev or similar).

Also, you may want to check out cgminer (https://bitcointalk.org/index.php?topic=28402), which is actually maintained.

Ok I did. New problem.

the configure script demands libdbcurces-dev. I install it but it insists on installing libdbcurces5-dev. configure script STILL insists on libdbcuces.

Go get compiled version.

when I run cgminer-cpuonly it says it can't find the file. when I run ./cgminer-cpuonly it says

bash: ./cgminer-cpuonly: cannot execute binary file

when I write a script file with the # and everything it says

./cgminer-cpuonly: 1: Syntax error: Unterminated quoted string

You know - in WINDOWS this just up and ran first time. No trouble.
[/quote]

If you really want an answer, you should head over to the thread I pointed you to, that is where cgminer discussion & development is happening.

I can't really help you with ubuntu package names, since I use debian. However, the configure script shouldn't depend on a package version as much as the files in that package. Also, did you misspell the package name? The required packages should be:
FAQ:
What dependencies do I need on linux to build it?
libncurses, libncurses-dev, libcurl, libcurl-dev AMD ATI SDK.

Cgminer comes with a README, which contains detailed instructions on how to build it.


Title: Re: New demonstration CPU miner available
Post by: romanticon on December 20, 2011, 10:00:40 AM
Hi,

Sorry for a newbie question: but how do I
run that miner on the testnet ?

P.S. on the prod it works fine for me
with that script:

./minerd --threads $cpus --algo sse2_64 --url http://deepbit.net:8332/ --userpass [user]:[pw]


Thanks in advance.


Title: Re: New demonstration CPU miner available
Post by: mcorlett on December 20, 2011, 10:03:38 AM
Hi,

Sorry for a newbie question: but how do I
run that miner on the testnet ?

P.S. on the prod it works fine for me
with that script:

./minerd --threads $cpus --algo sse2_64 --url http://deepbit.net:8332/ --userpass [user]:[pw]


Thanks in advance.
The testnet RPC port is 18332 by default, so:

Code:
./minerd --threads $cpus --algo sse2_64 --url http://deepbit.net:18332/ --userpass [user]:[pw]


Title: Re: New demonstration CPU miner available
Post by: romanticon on December 20, 2011, 10:13:34 AM
Just tried it and it doesn't seems to work ,
should I use the usame u/p from the prod,
or I have to create a new account ?


Title: Re: New demonstration CPU miner available
Post by: mcorlett on December 20, 2011, 10:15:15 AM
Just tried it and it doesn't seems to work ,
should I use the usame u/p from the prod,
or I have to create a new account ?
As far as I know Deepbit doesn't mine on the testnet. You'll have to mine against a local instance of the Bitcoin daemon.


Title: Re: New demonstration CPU miner available
Post by: romanticon on December 20, 2011, 10:26:28 AM
Lets see if I do understand:

First, I should download and install a bitcoin client , e.g.

http://downloads.sourceforge.net/project/bitcoin/Bitcoin/bitcoin-0.5.1/bitcoin-0.5.1-linux.tar.gz

Then to run it on the testnet.

afterwards to run the miner without pool URL specified

./minerd --threads $cpus --algo sse2_64  --userpass [user]:[pw]


Is that correct ?






Title: Re: New demonstration CPU miner available
Post by: mcorlett on December 20, 2011, 10:43:34 AM
Lets see if I do understand:

First, I should download and install a bitcoin client , e.g.

http://downloads.sourceforge.net/project/bitcoin/Bitcoin/bitcoin-0.5.1/bitcoin-0.5.1-linux.tar.gz

Then to run it on the testnet.

afterwards to run the miner without pool URL specified

./minerd --threads $cpus --algo sse2_64  --userpass [user]:[pw]


Is that correct ?
  • Download and install a client, personally I prefer the command-line daemon (bitcoind), but you can go with the graphical version as well.
  • Compile it if you've downloaded the source.
  • Launch with (add "-daemon" if you're using the daemon):
Code:
./bitcoin -testnet -server -rpcuser=username -rpcpassword=password
          (set username and password to your liking)
  • Now you may mine against that, by using 127.0.0.1 (localhost) as your "pool URL". Like this:
Code:
./minerd --threads $cpus --algo sse2_64 --url http://127.0.0.1:18332/ --userpass username:password
    (setting username and password to the values you set above)


Title: Re: New demonstration CPU miner available
Post by: romanticon on December 20, 2011, 11:10:23 AM
Doesn't seems that bitcoind opens any port on 18332 for that command:

Code:
./bitcoind -testnet -server -rpcuser=romantest -rpcpassword=romantest


Title: Re: New demonstration CPU miner available
Post by: mcorlett on December 20, 2011, 11:47:38 AM
Doesn't seems that bitcoind opens any port on 18332 for that command:

Code:
./bitcoind -testnet -server -rpcuser=romantest -rpcpassword=romantest
Try passing it manually:
Code:
-rpcport=18332


Title: Re: New demonstration CPU miner available
Post by: romanticon on December 20, 2011, 12:20:33 PM
Finally got it to work with the .conf file. Let's see how much time will take to generate a block on a testnet.

Thanks a lot !!!


Title: Re: New demonstration CPU miner available
Post by: mcorlett on December 20, 2011, 12:24:54 PM
Finally got it to work with the .conf file. Let's see how much time will take to generate a block on a testnet.

Thanks a lot !!!
It's probably not even worth trying assuming Gavin's testnet difficulty calculation changes aren't live yet.

Try Testnet in a box (https://bitcointalk.org/index.php?topic=4483.0). You can "use CPU mining to create blocks every 10 minutes as normal or a GPU miner for blocks every few seconds".


Title: Re: New demonstration CPU miner available
Post by: romanticon on December 20, 2011, 12:50:48 PM
Yep , great feature, but I am dying to generate my first block shown
on the blockexplorer event if it is only on the test net.


Title: Re: New demonstration CPU miner available
Post by: pooler on April 03, 2012, 10:36:25 PM
I started a fork of jgarzik's miner a few months ago. The original goal was to provide an optimized miner for Litecoin, an alternative chain that uses a completely different hashing algorithm from Bitcoin. Over time, however, I have also added a number of new features and bugfixes. You can find a complete list of all important changes in the NEWS file; they include:

  • Optimized work handling, resulting in a much better getwork efficiency.
  • Support for HTTP and SOCKS proxies.
  • Support for many different operating systems and architectures, including big-endian ones. The miner has been reported to build successfully on Linux, FreeBSD, Solaris, Mac OS X and Windows (using mingw).
  • Clear --help output. (Please read it before using the miner!)

Now for the reason I'm writing this here.
Starting with version 2.2 of this fork, I have re-included support for Bitcoin mining, writing a new implementation of the hashing algorithm. This implementation is different in that the single --algo=sha256d option should provide the best performance on all systems.
On K10-based processors (such as the Phenom) this fork is only slightly faster than the old "4way" algorithm, but on all other systems you should notice a significant increase in mining speed. The miner is also capable of using AVX and XOP instructions on CPUs that support them, resulting in an even greater speedup.

Here's a link to the git repository:
https://github.com/pooler/cpuminer
Under the "Downloads" tab you will also find a source tarball and a couple Windows binaries.

I don't know if anybody is still interested in CPU mining. The main reason why I want to maintain this miner is because I enjoy coding; also, I like jgarzik's miner because, unlike many others, it conforms to the KISS (http://en.wikipedia.org/wiki/KISS_principle) design principle.
Given that CPU mining support has been discontinued for cgminer, I hope that people will find this fork useful.


Title: Re: New demonstration CPU miner available
Post by: jgarzik on April 04, 2012, 02:44:23 AM
Given that CPU mining support has been discontinued for cgminer, I hope that people will find this fork useful.

Really?

Maybe we should reactive jgarzik/cpuminer then. and start merging pull requests.



Title: Re: New demonstration CPU miner available
Post by: pooler on April 04, 2012, 12:43:03 PM
Given that CPU mining support has been discontinued for cgminer, I hope that people will find this fork useful.

Really?

I'd say so, judging from this post:

I'd say the votes are pretty conclusive. Thanks everyone for your input. For simplicity I'll be making it a compile time selection for now, default off. This has already been committed to the git tree and will be in the next version. I will no longer be releasing binaries with CPU mining support built in and if it proves innocuous in this fashion, it will be left that way. Should issues arrive, it will be deprecated entirely in a future version.


Maybe we should reactive jgarzik/cpuminer then. and start merging pull requests.

Honestly I don't think this is necessary, since very few people still mine Bitcoin on CPU. In addition, cgminer has never been the only miner with CPU support (there's Ufasoft's miner, for instance).
I also think that, as a core Bitcoin developer, your time would probably be best spent elsewhere.
All this to say: I would be more than happy to take this project over, especially considering that I've rewritten a lot of the old code already. :D


Title: Re: New demonstration CPU miner available
Post by: Gabi on April 05, 2012, 09:00:56 PM
Given that CPU mining support has been discontinued for cgminer, I hope that people will find this fork useful.

Really?

Maybe we should reactive jgarzik/cpuminer then. and start merging pull requests.



Seriously, CPU mining is useless


Title: Re: New demonstration CPU miner available
Post by: mcorlett on April 06, 2012, 04:56:28 AM
Given that CPU mining support has been discontinued for cgminer, I hope that people will find this fork useful.

Really?

Maybe we should reactive jgarzik/cpuminer then. and start merging pull requests.
Seriously, CPU mining is useless
Because the only reason we're here is because of money!


Title: Re: New demonstration CPU miner available
Post by: Gabi on April 07, 2012, 04:25:15 PM
It's useless even for security purposes.


Title: Re: New demonstration CPU miner available
Post by: luicon on July 29, 2012, 04:28:34 PM
this program crash when i open it


Title: Re: New demonstration CPU miner available
Post by: Gabi on July 30, 2012, 10:28:14 PM
Then it work in the correct way: cpu mining today is useless  :D


Title: Re: New demonstration CPU miner available
Post by: jgarzik on July 31, 2012, 01:23:34 AM

Pull requests for cpuminer are still welcomes.

cpuminer is definitely used on testnet and various other alt-coin scenarios.



Title: Re: New demonstration CPU miner available
Post by: ssateneth on July 31, 2012, 07:16:56 AM

Pull requests for cpuminer are still welcomes.

cpuminer is definitely used on testnet and various other alt-coin scenarios.



And botnets :P


Title: Re: New demonstration CPU miner available
Post by: dmatthewstewart on April 30, 2013, 10:19:32 PM
What other coins can be mined using CPU Miner? I cant seem to find a list anywhere and really cant look through 30 pages of posts


Title: Re: New demonstration CPU miner available
Post by: postcd on June 26, 2013, 10:05:47 AM
I cant find Linux installation guide for this miner  :-[


Title: Re: New demonstration CPU miner available
Post by: Remember remember the 5th of November on June 26, 2013, 10:07:09 AM
I cant find Linux installation guide for this miner  :-[
Trust me, you don't need it. Plus, you are better off compiling cgminer with CPU support as it has faster algorithms I believe.


Title: Re: New demonstration CPU miner available
Post by: ckolivas on June 26, 2013, 10:15:57 AM
I cant find Linux installation guide for this miner  :-[
Trust me, you don't need it. Plus, you are better off compiling cgminer with CPU support as it has faster algorithms I believe.
cgminer lost its CPU mining code a long time ago now.


Title: Re: New demonstration CPU miner available
Post by: Amph on June 26, 2013, 02:23:26 PM
ahhhh the good old days..


Title: Re: New demonstration CPU miner available
Post by: SirMintALot on June 27, 2013, 04:06:10 PM
I cant find Linux installation guide for this miner  :-[
Trust me, you don't need it. Plus, you are better off compiling cgminer with CPU support as it has faster algorithms I believe.
For Litecoin Mining it is still nice and it's easy to compile.