blur-network / blur

The Blur Network is a privacy-oriented peer-to-peer network, built upon the premise that privacy is incompatible with centralization. BLUR employs a custom mining algorithm called CryptoNight-Dynamic. Iterations adjust approximately once every five seconds, with a goal of maintaining CPU advantages over specialized mining hardware.
https://blur.cash
Other
44 stars 19 forks source link

Thread stack size seems too large. #58

Closed who-biz closed 5 years ago

who-biz commented 5 years ago

In src/cryptonote_config.h the macro for THREAD_STACK_SIZE is defaulted to 5*1024*1024 or 0x500000... This should probably be 0x80000 instead.

This may be the cause behind the the strange behavior w.r.t. to hashrate declining when we use more cores in larger processors. We should not be allocating 5.24 MB per thread

I'm sure boost::thread provides a way to allocate thread stack size in a way that is at least somewhat portable.

who-biz commented 5 years ago

@leto Since I'm not very familiar with threads, if you could just give your approval that this seems correct, i'll go ahead and make the changes. Alternatively, PR it yourself if you'd like to earn your full-fledged contributor badge (sorry we don't have real badges)

Consideration: Our algorithm uses a 1 MB scratchpad. Knowing that information, I'm unsure if 0x80000 or 0x40000 would be better here. Most likely the latter?

Note: This may be the source of the crash on unspent_outputs in CLI. I believe output selection uses threads as well.

who-biz commented 5 years ago

This has relevance to mining in code located here: https://github.com/blur-network/blur/blob/master/src/cryptonote_basic/miner.cpp#L352

leto commented 5 years ago

@who-biz this seems reasonable to me :+1:

who-biz commented 5 years ago

Should be fixed in https://github.com/blur-network/blur/commit/f9d535baa5453d6e5a67a46b6f1f0a21f8548771.