Bitcoin Forum
April 20, 2024, 02:58:27 AM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 ... 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 [53] 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 »
  Print  
Author Topic: An (even more) optimized version of cpuminer (pooler's cpuminer, CPU-only)  (Read 1958262 times)
pooler (OP)
Hero Member
*****
Offline Offline

Activity: 838
Merit: 507


View Profile
July 04, 2014, 06:39:04 AM
 #1041

1) a sharelog
cpuminer runs with debug output, however, the output are often not captured
a share log is needed, i.e. for the shares submitted to a mining pool it would be helpful to log the
- time
- disposition (accept or reject)
- target
- hash
- data

and perhaps some other info in a text sharelog file. this would help with verifying from historical submitted entries if there are issues
As I've already said, this could indeed be useful, but the changes required to implement it properly are nontrivial (cpuminer does not currently keep track of submitted shares). I don't have much free time in this period, but I will put this on my to-do list.

2) a GUI
There was a Qt GUI that interfaced with cpuminer, and it worked quite well. The project is now abandoned, but its source code is still available under the MIT license for anybody to fork.
https://bitcointalk.org/index.php?topic=62414.0

BTC: 15MRTcUweNVJbhTyH5rq9aeSdyigFrskqE · LTC: LTCPooLqTK1SANSNeTR63GbGwabTKEkuS7
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
ag123
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
July 04, 2014, 01:12:40 PM
Last edit: July 04, 2014, 02:58:12 PM by ag123
 #1042

1) a sharelog
cpuminer runs with debug output, however, the output are often not captured
a share log is needed, i.e. for the shares submitted to a mining pool it would be helpful to log the
- time
- disposition (accept or reject)
- target
- hash
- data

and perhaps some other info in a text sharelog file. this would help with verifying from historical submitted entries if there are issues
As I've already said, this could indeed be useful, but the changes required to implement it properly are nontrivial (cpuminer does not currently keep track of submitted shares). I don't have much free time in this period, but I will put this on my to-do list.

hi pooler,

thanks much for the quick response, here is some codes i'm not sure if this is optimum but the changes are something like this:

i moved struct work into miner.h and added hash field which is the winning hash that scanhash has found

struct work {
   uint32_t data[32];
   uint32_t target[8];
   uint32_t hash[8]; // <-- new field

   char job_id[128];
   size_t xnonce2_len;
   unsigned char xnonce2[32];
};

i modified scanhash* function so that scanhash can pass the winning hash back
e.g.
 miner_thread calls scanhash as such:
      /* scan nonces for a proof-of-work hash */
      switch (opt_algo) {
      case ALGO_SCRYPT:
         rc = scanhash_scrypt(thr_id, work.data, scratchbuf, work.target,
                              max_nonce, &hashes_done, work.hash);
         break;
...

then in scanhash:
int scanhash_scrypt(int thr_id, uint32_t *pdata,
   unsigned char *scratchbuf, const uint32_t *ptarget,
   uint32_t max_nonce, unsigned long *hashes_done,
   uint32_t *phash); {

...
      for (i = 0; i < throughput; i++) {

         if (hash[i * 8 + 7] <= Htarg && fulltest(hash + i * 8, ptarget)) {
            *hashes_done = n - pdata[19] + 1;
            pdata[19] = data[i * 20 + 19];
            memcpy(phash, hash + i * 8, 32); // <- copy the winning hash into struct work
            return 1;
         }
      }


that goes back to miner_thread, which calls submit_work
that in turns gets picked up by workio_thread -> workio_submit_work -> submit_upstream_work

then i modify submit_upstream_work

if (have_stratum) {

   .... codes that build that rpc call ...

      /* place work in the queue for share_result*/
      pwork = malloc(sizeof(struct work));
      if (!pwork)
         goto err_out;
      memcpy(pwork, work, sizeof(struct work));
      if (!tq_push(tq_result_work, pwork))
         goto err_out;

                /* existing code
      if (unlikely(!stratum_send_line(&stratum, s))) {
         applog(LOG_ERR, "submit_upstream_work stratum_send_line failed");
         goto out;
      }
} else { // no stratum

              again before that rpc call

      /* place work in the queue for share_result*/
      pwork = malloc(sizeof(struct work));
      if (!pwork)
         goto err_out;
      memcpy(pwork, work, sizeof(struct work));
      if (!tq_push(tq_result_work, pwork))
         goto err_out;

      /* build JSON-RPC request */
      sprintf(s,
         "{\"method\": \"getwork\", \"params\": [ \"%s\" ], \"id\":1}\r\n",
         str);

      /* issue JSON-RPC request */
      val = json_rpc_call(curl, rpc_url, rpc_userpass, s, false, false, NULL);
      if (unlikely(!val)) {
         applog(LOG_ERR, "submit_upstream_work json_rpc_call failed");
         goto out;
      }

tq_result_work is actually a "thread queue" in util.c i.e.

struct thread_q *tq_result_work;

i simply make tq_result_work a global variable in cpu-miner.c and let the mutexes in thread_q co-ordinate access to that data
- not sure if a deadlock is possible

it is initialised shortly after workio thread is initialised in main
   /* init workio thread info */
   work_thr_id = opt_n_threads;
   thr = &thr_info[work_thr_id];
   thr->id = work_thr_id;
   thr->q = tq_new();
   if (!thr->q)
      return 1;
   /* init work result q
    * used to pass work between workio - submit_upstream_work and
    * and share_result*/
   tq_result_work = tq_new();
   if (!tq_result_work)
      return 1;


i simply make a copy of struct work in submit_upstream work and push the struct work into tq_result_work queue. this queue is used to pass work to share_result as follows:

when stratum_thread process the return results it calls share_result

then i modify share_result
static void share_result(int result, const char *reason)
{
   char s[345];
   double hashrate;
   int i;
   struct work *pwork;

   hashrate = 0.;
   pthread_mutex_lock(&stats_lock);
   for (i = 0; i < opt_n_threads; i++)
      hashrate += thr_hashrates;
   result ? accepted_count++ : rejected_count++;
   pthread_mutex_unlock(&stats_lock);
   
   sprintf(s, hashrate >= 1e6 ? "%.0f" : "%.2f", 1e-3 * hashrate);
   applog(LOG_INFO, "accepted: %lu/%lu (%.2f%%), %s khash/s %s",
         accepted_count,
         accepted_count + rejected_count,
         100. * accepted_count / (accepted_count + rejected_count),
         s,
         result ? "(yay!!!)" : "(booooo)");

   /* retrieve work from queue from submit_upstream_work  and log share to a file*/
   pwork = tq_pop(tq_result_work, NULL);
   if (pwork && opt_sharelog) {
         share_log(result ? "accept" : "reject", pwork);

      free(pwork);
   }

   if (opt_debug && reason)
      applog(LOG_DEBUG, "DEBUG: reject reason: %s", reason);

   return;

then i create the supporting functions for share_log:

void sharelog_init(char *filename) {
   pthread_mutex_init(&sharelog_lock, NULL);
   sharelog_file = fopen(filename, "a");
     if (!sharelog_file)
    applog(LOG_ERR, "Failed to open %s for share log", filename);
}


void share_log(const char*disposition, const struct work *pwork)
{
   char *target, *hash, *data;
   unsigned long int t;
   struct pool *pool;
   char s[1024];
   size_t ret;

   char ts[50];
   int len;
   time_t now;
   struct tm tm, *tm_p;

   uint32_t hash_be[8], target_be[8];

   //sharelog file stream cannot be null
   if (!sharelog_file)
      return;

   time(&now);

   pthread_mutex_lock(&sharelog_lock);
   tm_p = localtime(&now);
   memcpy(&tm, tm_p, sizeof(tm));

   sprintf(ts, "%d-%02d-%02d %02d:%02d:%02d", tm.tm_year + 1900,
         tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);


   for (int i = 0; i < 8; i++) {
      be32enc(hash_be + i, pwork->hash[7 - i]);
      be32enc(target_be + i, pwork->target[7 - i]);
   }

   target = bin2hex((unsigned char *) target_be, sizeof(pwork->target));
   hash = bin2hex((unsigned char *) hash_be, sizeof(pwork->hash));
   data = bin2hex((unsigned char *) pwork->data, sizeof(pwork->data));

   // timestamp,disposition,target,sharehash,sharedata
   len = sprintf(s, "%s,%s,%s,%s,%s\n", ts, disposition, target,
         hash, data);
   free(target);
   free(hash);
   free(data);

   fwrite(s, 1, len, sharelog_file);
   fflush(sharelog_file);
   ret = ferror(sharelog_file);
   pthread_mutex_unlock(&sharelog_lock);

   if (ret)
      applog(LOG_ERR, "sharelog fwrite error");
}

the remaining is to create the opt_sharelog
   case 'L':
      free(opt_sharelog);
      opt_sharelog = strdup(arg);
      applog(LOG_DEBUG, "logging to sharelog: %s", opt_sharelog);
      sharelog_init(opt_sharelog);
      break;

static struct option const options[] = {
...
   { "sharelog", 1, NULL, 'L' },
...
and to update the help text

note that this is more of a 'hack' than a proper solution as the request-response protocol for submit work (e.g. stratum) needs to be strictly honoured. there is no error handling such as if a response is missing or some other permutations occurs, that'd throw things out of order. perhaps a more robust solution may need some re-design to be done in stratum_thread or workio_thread e.g. for one of them to handle the request / response of submit work rather than currently for stratum the request is send in workio_thread but response processed in stratum_thread

hopes the above  may be useful
 

There was a Qt GUI that interfaced with cpuminer, and it worked quite well. The project is now abandoned, but its source code is still available under the MIT license for anybody to fork.
https://bitcointalk.org/index.php?topic=62414.0

thanks for the link ! Smiley

thanks and cheers Smiley
dicser
Full Member
***
Offline Offline

Activity: 179
Merit: 100


View Profile
July 04, 2014, 03:43:47 PM
 #1043

Hello I write from Italy who knows settings and procedure mining groundwater stratum + tcp :/ / www.crypthash.fr:3334-u-py ser.x
dicser
Full Member
***
Offline Offline

Activity: 179
Merit: 100


View Profile
July 04, 2014, 03:46:58 PM
 #1044

 stratum+tcp://www.crypthash.fr:3334 -u ser.x -p y
dicser
Full Member
***
Offline Offline

Activity: 179
Merit: 100


View Profile
July 04, 2014, 03:48:15 PM
 #1045

I have a cpu athlon fx 8320
junky998
Newbie
*
Offline Offline

Activity: 16
Merit: 0


View Profile
July 04, 2014, 09:05:54 PM
 #1046

What's the "-s" in command line used for?
Thanks.
junky998
Newbie
*
Offline Offline

Activity: 16
Merit: 0


View Profile
July 05, 2014, 06:39:22 AM
 #1047

What's the "-s" in command line used for?
Thanks.

anyone can help on this?  Grin
Thank you.
PSL
Member
**
Offline Offline

Activity: 166
Merit: 10


View Profile
July 05, 2014, 07:43:26 AM
 #1048

What's the "-s" in command line used for?
Thanks.

anyone can help on this?  Grin
Thank you.
  -s, --scantime=N      upper bound on time spent scanning current work when long polling is unavailable, in seconds (default: 5)
DELTA9
Member
**
Offline Offline

Activity: 102
Merit: 10


View Profile
August 02, 2014, 06:10:01 AM
 #1049

Can someone please upload latest windows binaries
Master One
Full Member
***
Offline Offline

Activity: 238
Merit: 100


Wanna buy a Tesla? Visit TeslaBargain.com first!


View Profile WWW
August 06, 2014, 10:56:47 AM
 #1050

Hi guy,

I'm a total newbie to mining, and just stumbled over cpuminer and this thread, because I was looking for info on what's possible with an Intel Core i7 920 @ 2.67GHz / 8GB RAM that's running here 24/7 mostly idle anyway. It only has nVidia Corporation G72 [GeForce 7500 LE] graphics, so GPU mining is out of question, and I can't connect anything USB, so no ASIC neither.

I can see that CPU mining is considered to be dead, but on the other side what the heck.

Can someone please point out what would make most sense to mine with such low specs?

  • Bitcoin or Litecoin?
  • Pool, P2Pool or Solo?
  • If Pool, does it make any difference which pool with such low specs?

Any hint highly appreciated.

Greetings,

M.

Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
August 06, 2014, 12:36:41 PM
 #1051

Hi guy,

I'm a total newbie to mining, and just stumbled over cpuminer and this thread, because I was looking for info on what's possible with an Intel Core i7 920 @ 2.67GHz / 8GB RAM that's running here 24/7 mostly idle anyway. It only has nVidia Corporation G72 [GeForce 7500 LE] graphics, so GPU mining is out of question, and I can't connect anything USB, so no ASIC neither.

I can see that CPU mining is considered to be dead, but on the other side what the heck.

Can someone please point out what would make most sense to mine with such low specs?

  • Bitcoin or Litecoin?
  • Pool, P2Pool or Solo?
  • If Pool, does it make any difference which pool with such low specs?

Any hint highly appreciated.

Greetings,

M.
Neither Litecoin, especially not Bitcoin.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
Master One
Full Member
***
Offline Offline

Activity: 238
Merit: 100


Wanna buy a Tesla? Visit TeslaBargain.com first!


View Profile WWW
August 06, 2014, 12:55:34 PM
 #1052

Can someone please point out what would make most sense to mine with such low specs?
  • Bitcoin or Litecoin?
  • Pool, P2Pool or Solo?
  • If Pool, does it make any difference which pool with such low specs?
Any hint highly appreciated.
Neither Litecoin, especially not Bitcoin.

Well, any recommendation then?

What do you guys do with cpuminer?

usao
Legendary
*
Offline Offline

Activity: 1109
Merit: 1000



View Profile
August 06, 2014, 01:26:01 PM
 #1053

Can someone please point out what would make most sense to mine with such low specs?
  • Bitcoin or Litecoin?
  • Pool, P2Pool or Solo?
  • If Pool, does it make any difference which pool with such low specs?
Any hint highly appreciated.
Neither Litecoin, especially not Bitcoin.

Well, any recommendation then?

What do you guys do with cpuminer?
Take a look at coinwarz.com and whattomine...
Look for coins with fairly quick block times.
Since you aren't going to make any real money anytime soon, I would suggest coins with high block payouts, just to you can visually see coin values with fewer leading zeros...
If you like pools, my personal favorites are:
coinmine.pw - very nice GUI.
nicehash.com - Pays out in BTC directly so you don't have to worry about getting the best prices at the exchange.
Master One
Full Member
***
Offline Offline

Activity: 238
Merit: 100


Wanna buy a Tesla? Visit TeslaBargain.com first!


View Profile WWW
August 06, 2014, 03:09:51 PM
 #1054

What do you guys do with cpuminer?
Take a look at coinwarz.com and whattomine...
Look for coins with fairly quick block times.
Since you aren't going to make any real money anytime soon, I would suggest coins with high block payouts, just to you can visually see coin values with fewer leading zeros...
If you like pools, my personal favorites are:
coinmine.pw - very nice GUI.
nicehash.com - Pays out in BTC directly so you don't have to worry about getting the best prices at the exchange.

I've taken a look at coinwarz & whattomine, I've played around with different sortings, but I don't really have a clue where this is leading me. So a low block time + high block reward is the key?

Any specific recommendations?

It really would be interesting to know what others here are using their cpuminer for, after all it's still being actively developed and obviously used, so someone hopefully can share a little more info.

I know this may be completely pointless, after more reading I'm considering to buy an Antminter S3 for getting starting with something making more sense, but my thought was that mentioned server with Intel Core i7 920 @ 2.67GHz is running 24/7 at little load anyway and it does not cost my anything, so why not using it for some mining?

usao
Legendary
*
Offline Offline

Activity: 1109
Merit: 1000



View Profile
August 06, 2014, 03:20:34 PM
 #1055

What do you guys do with cpuminer?
Take a look at coinwarz.com and whattomine...
Look for coins with fairly quick block times.
Since you aren't going to make any real money anytime soon, I would suggest coins with high block payouts, just to you can visually see coin values with fewer leading zeros...
If you like pools, my personal favorites are:
coinmine.pw - very nice GUI.
nicehash.com - Pays out in BTC directly so you don't have to worry about getting the best prices at the exchange.

I've taken a look at coinwarz & whattomine, I've played around with different sortings, but I don't really have a clue where this is leading me. So a low block time + high block reward is the key?

Any specific recommendations?

It really would be interesting to know what others here are using their cpuminer for, after all it's still being actively developed and obviously used, so someone hopefully can share a little more info.

I know this may be completely pointless, after more reading I'm considering to buy an Antminter S3 for getting starting with something making more sense, but my thought was that mentioned server with Intel Core i7 920 @ 2.67GHz is running 24/7 at little load anyway and it does not cost my anything, so why not using it for some mining?
Well, the Antminer is a SHA ASIC, which is completely different from a Scrypt CPU miner...
For Scrypt/CPU, I just pulled-up coinwarz and very few coins are paying better than LTC.
So, you could mine LTC with cpuminer at a pool such as www.wemineltc.com. You will get a very small payout, but you can do it fairly easily.
If you don't mind playing with the exchanges and trading coins, then coinwarz is (currently) showing EMD, CAP, KGC, USDe as possible coins.
None of them are very stable though, so if you want to mine and not have to chase the coins, LTC would be better choice.
I wouldn't recommend solo-mining with a CPU, so look for a pool which has some of these coins.
If that's too much hastle for the small reward, then just go for LTC in a straight pool.
Good info on LTC pools can be found at: https://litecoin.info/Mining_pool_comparison
Master One
Full Member
***
Offline Offline

Activity: 238
Merit: 100


Wanna buy a Tesla? Visit TeslaBargain.com first!


View Profile WWW
August 07, 2014, 05:05:38 PM
 #1056

Thanks a lot, usao, that was of great help.

I've cpuminer already in use on WeMineLTC, which I chose because they have their own CPU Mining Server. It seems to be working as supposed to:

Code:
[2014-08-07 18:59:05] thread 1: 144492 hashes, 2.89 khash/s
[2014-08-07 18:59:06] Stratum requested work restart
[2014-08-07 19:00:05] stratum_recv_line failed
[2014-08-07 19:00:05] Stratum connection interrupted
[2014-08-07 19:00:05] thread 7: 168804 hashes, 2.91 khash/s
[2014-08-07 19:00:05] thread 5: 169020 hashes, 2.92 khash/s
[2014-08-07 19:00:05] thread 1: 164748 hashes, 2.84 khash/s
[2014-08-07 19:00:05] thread 0: 165708 hashes, 2.86 khash/s
[2014-08-07 19:00:05] thread 3: 166056 hashes, 2.86 khash/s
[2014-08-07 19:00:05] thread 2: 165300 hashes, 2.85 khash/s
[2014-08-07 19:00:05] thread 6: 168156 hashes, 2.90 khash/s
[2014-08-07 19:00:05] thread 4: 168804 hashes, 2.91 khash/s
[2014-08-07 19:00:05] Stratum requested work restart
[2014-08-07 19:00:40] thread 6: 98880 hashes, 2.92 khash/s
[2014-08-07 19:00:40] accepted: 30/30 (100.00%), 23.07 khash/s (yay!!!)

I can see such Stratum requested work restart, stratum_recv_line failed and Stratum connection interrupted quite frequently, but I guess that's normal?

pooler (OP)
Hero Member
*****
Offline Offline

Activity: 838
Merit: 507


View Profile
August 07, 2014, 05:10:47 PM
 #1057

I can see such Stratum requested work restart, stratum_recv_line failed and Stratum connection interrupted quite frequently, but I guess that's normal?

"Stratum requested work restart" is totally normal, and should happen every time a new block appears on the network.
"Stratum connection interrupted", on the other hand, is not normal. It indicates a network failure, which could be due to your Internet connection or to the remote server.

BTC: 15MRTcUweNVJbhTyH5rq9aeSdyigFrskqE · LTC: LTCPooLqTK1SANSNeTR63GbGwabTKEkuS7
Master One
Full Member
***
Offline Offline

Activity: 238
Merit: 100


Wanna buy a Tesla? Visit TeslaBargain.com first!


View Profile WWW
August 07, 2014, 05:29:23 PM
 #1058

I can see such Stratum requested work restart, stratum_recv_line failed and Stratum connection interrupted quite frequently, but I guess that's normal?
"Stratum requested work restart" is totally normal, and should happen every time a new block appears on the network.
"Stratum connection interrupted", on the other hand, is not normal. It indicates a network failure, which could be due to your Internet connection or to the remote server.

Seems to be the remote server, I've tested it with Crypto Miner on my LG G2 and have seen the same error there.

kisrap
Full Member
***
Offline Offline

Activity: 126
Merit: 100

A FIDUS ACHATE, STAYS LOST IN FLIGHT


View Profile
August 08, 2014, 10:31:41 AM
 #1059

i have tried to run it on my windows but it says mining termitted

kisrap
Full Member
***
Offline Offline

Activity: 126
Merit: 100

A FIDUS ACHATE, STAYS LOST IN FLIGHT


View Profile
August 08, 2014, 10:34:48 AM
 #1060

i have tried to run it on my windows but it says mining termitted
it says unsupported non-option argument miner, any help

Pages: « 1 ... 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 [53] 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 »
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!