fireice-uk / xmr-stak

Free Monero RandomX Miner and unified CryptoNight miner
GNU General Public License v3.0
4.05k stars 1.79k forks source link

Hashrate Inconsistency with CPU #1440

Closed cphine closed 6 years ago

cphine commented 6 years ago

Hello. This has been a recurring issue for me and it is getting worse over time. I have asked all over Reddit, but while others experience the same, nobody seems to have an answer. Now I'm turning to the experts.

Using XMR-Stak 2.4.2 to mine Monero7, my GTX 1060 mines consistently at 522 h/s. My CPU, an I5-8600K lightly overclocked to 4.5 ghz, will achieve as high as 320 h/s, but connecting at this rate has become an hour long process of starting and stopping the program.

I will mostly connect at either 120 or just over 200 h/s, as shown at the bottom of this post. The speed it starts with will fluctuate a little, but remain close over time. After constant restarts I will finally get a hashrate of over 300, at which point it will continue at this speed until I am forced to restart my computer or stop the miner for some reason. I don't understand why this connection speed seems completely random and why while it used to take just a few restarts to get back to 300, these days it can take literally hundreds.

My CPU settings are as follows:

"cpu_thread_num": 3,
"cpu_threads_conf" :
[
    { "low_power_mode" : true, "no_prefetch" : true, "affine_to_cpu" : false },
    { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : false },
    { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : false },  
],

My processor has 9MB of L3, so this setup uses 8. I have tried setting "affine to cpu" to various combinations with no effect. Again, I know this setup will achieve my desired hashrate, the question is why it doesn't achieve it consistently.

What I find odd in the screen print below from one of the failed connections is that core 0, the one that I believe is set to low power mode, is actually lower than core 2. When I do finally get my 300 plus hashrate, the numbers look more like 140, 80, and 80.

Any help or explanations would be tremendously appreciated. I have come to dread the computer restart because I know doing so will set me up for an hour or more of trying to get the miner to connect right again.

Thanks in advance.

HASHRATE REPORT - CPU | ID | 10s | 60s | 15m | ID | 10s | 60s | 15m | | 0 | 69.0 | 69.8 | (na) | 1 | 54.1 | 55.3 | (na) | | 2 | 85.4 | 86.1 | (na) | Totals (CPU): 208.4 211.3 0.0 H/s

Simaex commented 6 years ago

I do not have i5-8600K handy but from the overall guidelines I'll suggest to use 4 threads without low-power mode, with affine to CPU set to TRUE. You have 6 cores and 9M of cache, so you can run 4 threads fixed with CPU core and have two cores and a good bit of cache for OS overhead. This is for monero7 algo. Light7 algo and 6 threads may be much better to fully utilise you CPU potential (no affinity in this case).

JayWalker512 commented 6 years ago

You should definitely use the affine_to_cpu settings; it's possible miner threads are being scheduled for the same core (or constantly moving around) and this will cause performance degradation.

cphine commented 6 years ago

Thank you both very much for your responses.

Using 4 threads without low-power mode will, on occasion, provide a slightly superior hashrate at the expense of utilizing 67% of my CPU power vs 51% at 3 threads with LPM. Also, higher temperatures. I've gotten as high as 335 h/s using 4 vs my high of about 320 with 3. That said, the same issue of connecting at that speed arises. For example, I just now tried it and received these numbers:

HASHRATE REPORT - CPU
| ID |    10s |    60s |    15m | ID |    10s |    60s |    15m |
|  0 |   31.7 |   (na) |   (na) |  1 |   31.7 |   (na) |   (na) |
|  2 |   32.1 |   (na) |   (na) |  3 |   32.0 |   (na) |   (na) |
Totals (CPU):   127.5    0.0    0.0 H/s  

I know from experience letting it sit won't improve the numbers any.

As far as setting the affinity, I tried changing "false" to "true", but the miner connected saying "no affinity". I did think that numbers were necessary, not simply "true". That said, when I apply numbers (such as 0,1,2) I don't notice any change in connection speed. It will continue to connect at between 120 and 200 the majority of the time with the outlier being a connection of over 300 which I'll then let mine for as long as possible. Perhaps I'm not fully understanding the proper utilization of the affinity settings?

Also, when I set affinity, those particular cores are shown at 100% in Hwinfo64. When I don't use affinity, the load is spread out among all the cores. Are you suggesting that "spreading out" could be a part of the consistency issue? Is it safe to be utilizing a core at 100% for days at a time?

Again, thank you both for your responses. I really hope we can figure this out.

Cheers.

JayWalker512 commented 6 years ago

Can you please post your complete system info including both CPU and GPU config files using the template you get when posting a new issue? Having that info here will help us give you a better answer.

cphine commented 6 years ago

Certainly. Sorry about that. I don't know anything about compiling, so I've left that info blank. I just download the zip file and run the executable.

Please provide as much as possible information to reproduce the issue.

Basic information

Intel I5-8600K MSI GTX 1060 OC 3GB

Compile issues

Issue with the execution

AMD OpenCl issue

  run `clinfo` and add the output here

Stability issue

Yes, the CPU is lightly overclocked to 4.5 ghz utilizing the A-Tuning program for my Asrock z370 Killer sli/ac motherboard. My issue occurs with or without this overclocking, just with lower numbers.

Here are the config files. I'm currently using the 4 core settings because after posting the results in my previous post, I tried connecting a couple more times and finally got the 335 h/s...so I'm just going to let that sit awhile.

cpu.txt nvidia.txt

Is this all the information you were asking for? Sorry I don't understand the compiling questions...

JayWalker512 commented 6 years ago

Try these configs: CPU

"cpu_thread_num": 4,
"cpu_threads_conf" :
[
    { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 0 },
    { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 1 },
    { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 2 },
    { "low_power_mode" : false, "no_prefetch" : true, "affine_to_cpu" : 3 },  
],

GPU

"gpu_threads_conf" :
[
  // gpu: GeForce GTX 1060 3GB architecture: 61
  //      memory: 2490/3072 MiB
  //      smx: 9
  { "index" : 0,
    "threads" : 26, "blocks" : 27,
    "bfactor" : 8, "bsleep" :  100,
    "affine_to_cpu" : 4, "sync_mode" : 3,
  },

],

The CPU affinity is a number which tells the thread which core it should "stick" to. You don't want multiple threads on the same core (this includes the thread that runs the GPU, which is why I tweaked the affinity there as well).

To answer you other question, running computers at 100% full load 24/7 is perfectly fine as long as your temperatures aren't out of control. I have several computers running for months on end (including laptops) with no problems.

cphine commented 6 years ago

Thanks again for working for me. Really appreciated.

OK, so I changed the settings to as you suggested. My attempts at setting affinity in the past haven't yielded any positive results, but I had never also set the GPU affinity.

My first several attempts to connect with these settings yielded the following:

HASHRATE REPORT - CPU
| ID |    10s |    60s |    15m | ID |    10s |    60s |    15m |
|  0 |   40.2 |   39.6 |   (na) |  1 |   46.3 |   45.7 |   (na) |
|  2 |   47.3 |   46.7 |   (na) |  3 |   88.2 |   87.7 |   (na) |
Totals (CPU):   222.0  219.7    0.0 H/s

Again, a typical "low" connection.

On about my 6th try, I got this:

HASHRATE REPORT - CPU
| ID |    10s |    60s |    15m | ID |    10s |    60s |    15m |
|  0 |   81.1 |   79.0 |   (na) |  1 |   82.7 |   80.8 |   (na) |
|  2 |   87.0 |   85.5 |   (na) |  3 |   84.5 |   82.6 |   (na) |
Totals (CPU):   335.3  327.9    0.0 H/s

So again, the inconsistency is present, but it took fewer restarts to get it up and going. That could show improvement, but I won't know until I try it several times.

It's just odd that the GPU connection speed is always on target. I can tweek OC settings in Afterburner and get a predictable result in hashrate each and every time. With the CPU, trying to tweak settings is hard because I can try something and not notice the impact at all, or have a negative impact until restarting multiple times. Because of this inconsistency, it's hard to pinpoint the "best" setting or how my settings actually impact speed.

Simaex commented 6 years ago

You can write a simple script that will restart mining if hashrate is lower then a predefined target. It will also be useful for automatic restart. Check that no unnecessary software is running. It may cause similar performance issues. Are you running XMR-STAK in elevated mode? Do you properly setup huge memory pages? It can affect performance a lot.

cphine commented 6 years ago

While I understand basic web programming, writing such scripts is beyond my area of expertise. What programming language would I need to learn in order to create something like that? That said, it seems more of a work around to the problem rather than a fix of the problem. It would still be a time saver until a fix is figured out though.

No unnecessary software is running. I only have Afterburner and my anti-virus program running at startup. I have tried without the anti-virus loading and it didn't affect the hashrate.

Yes, I setup support for huge memory. I don't have Windows Pro, but I found a "hack" to let me edit that in gpedit in my home edition. It did increase the hashrate nicely and ended that error when I start the miner.

Could you explain "elevated mode"? I just double click on XMR stak executable and it opens in a black DOS looking command prompt window. In the previous version I had to "run as administrator", but this version doesn't seem to require (or allow) that.

Thanks.

Simaex commented 6 years ago

Elevated mode - I mean "run as administrator". I'll try to run without Afterburner and antivirus and check if it have some effect for your issue. A script I mean a shell script that will kill a running app (TASKKILL /f XMR-STAK.EXE) and start it again when a certain condition is met. Something like IF %hashrate% -LT 300 DO ( TASKKILL /F XMR-STAK.EXE CALL XMR-STAK.EXE ) You have to get %hashrate% from miner http interface prior to checking the condition.

cphine commented 6 years ago

Unfortunately, running without Afterburner or the antivirus program has no effect on the issue.

I've been mining at 335 h/s all day long, and now that I try to re-connect to test that, I'm at 129. Going by averages, I'll be spending the next hour starting and stopping the miner.

As you can see, I have all the settings for the cpu set as you guys recommended.

[2018-04-18 20:52:56] : Mining coin: monero7
[2018-04-18 20:52:56] : WARNING: No AMD OpenCL platform found. Possible driver issues or wrong vendor driver.
[2018-04-18 20:52:56] : WARNING: backend AMD disabled.
[2018-04-18 20:52:56] : Starting 1x thread, affinity: 0.
[2018-04-18 20:52:56] : hwloc: memory pinned
[2018-04-18 20:52:56] : Starting 1x thread, affinity: 1.
[2018-04-18 20:52:56] : hwloc: memory pinned
[2018-04-18 20:52:56] : Starting 1x thread, affinity: 2.
[2018-04-18 20:52:56] : hwloc: memory pinned
[2018-04-18 20:52:56] : Starting 1x thread, affinity: 3.
[2018-04-18 20:52:56] : hwloc: memory pinned
[2018-04-18 20:52:56] : Fast-connecting to us-east.cryptonight-hub.miningpoolhub.com:20580 pool ...
[2018-04-18 20:52:57] : TLS fingerprint [us-east.cryptonight-hub.miningpoolhub.com:20580] SHA256:1MSzz8JiJQj1CB4szMPW9cXQy4Jgidgi9z+KRqUBNdI=
[2018-04-18 20:52:57] : Pool us-east.cryptonight-hub.miningpoolhub.com:20580 connected. Logging in...
[2018-04-18 20:52:59] : Difficulty changed. Now: 40000.
[2018-04-18 20:52:59] : Pool logged in.
[2018-04-18 20:53:29] : New block detected.
HASHRATE REPORT - CPU
| ID |    10s |    60s |    15m | ID |    10s |    60s |    15m |
|  0 |   31.1 |   (na) |   (na) |  1 |   33.0 |   (na) |   (na) |
|  2 |   33.2 |   (na) |   (na) |  3 |   32.6 |   (na) |   (na) |
Totals (CPU):   129.9    0.0    0.0 H/s 

Thanks for the script description, but please understand I'm not a programmer. I have no idea what to do with what you provided. That said, that's on me to learn how to do it and not on you to give me step by step instructions.

I just can't believe I'm the only person who has this issue and that it has followed me from my previous computer to the new one I just built. There has got to be an easy explanation!! There has got to be a way to figure this out.

I do appreciate your assistance. Any more ideas?

JayWalker512 commented 6 years ago

Out of curiosity, what happens if you just let it run for a while and don't touch anything?

On Wed, Apr 18, 2018, 21:07 cphine notifications@github.com wrote:

Unfortunately, running without Afterburner or the antivirus program has no effect on the issue.

I've been mining at 335 h/s all day long, and now that I try to re-connect to test that, I'm at 129. Going by averages, I'll be spending the next hour starting and stopping the miner.

As you can see, I have all the settings for the cpu set as you guys recommended.

[2018-04-18 20:52:56] : Mining coin: monero7 [2018-04-18 20:52:56] : WARNING: No AMD OpenCL platform found. Possible driver issues or wrong vendor driver. [2018-04-18 20:52:56] : WARNING: backend AMD disabled. [2018-04-18 20:52:56] : Starting 1x thread, affinity: 0. [2018-04-18 20:52:56] : hwloc: memory pinned [2018-04-18 20:52:56] : Starting 1x thread, affinity: 1. [2018-04-18 20:52:56] : hwloc: memory pinned [2018-04-18 20:52:56] : Starting 1x thread, affinity: 2. [2018-04-18 20:52:56] : hwloc: memory pinned [2018-04-18 20:52:56] : Starting 1x thread, affinity: 3. [2018-04-18 20:52:56] : hwloc: memory pinned [2018-04-18 20:52:56] : Fast-connecting to us-east.cryptonight-hub.miningpoolhub.com:20580 pool ... [2018-04-18 20:52:57] : TLS fingerprint [us-east.cryptonight-hub.miningpoolhub.com:20580] SHA256:1MSzz8JiJQj1CB4szMPW9cXQy4Jgidgi9z+KRqUBNdI= [2018-04-18 20:52:57] : Pool us-east.cryptonight-hub.miningpoolhub.com:20580 connected. Logging in... [2018-04-18 20:52:59] : Difficulty changed. Now: 40000. [2018-04-18 20:52:59] : Pool logged in. [2018-04-18 20:53:29] : New block detected. HASHRATE REPORT - CPU | ID | 10s | 60s | 15m | ID | 10s | 60s | 15m | | 0 | 31.1 | (na) | (na) | 1 | 33.0 | (na) | (na) | | 2 | 33.2 | (na) | (na) | 3 | 32.6 | (na) | (na) | Totals (CPU): 129.9 0.0 0.0 H/s

Thanks for the script description, but please understand I'm not a programmer. I have no idea what to do with what you provided. That said, that's on me to learn how to do it and not on you to give me step by step instructions.

I just can't believe I'm the only person who has this issue and that it has followed me from my previous computer to the new one I just built. There has got to be an easy explanation!! There has got to be a way to figure this out.

I do appreciate your assistance. Any more ideas?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fireice-uk/xmr-stak/issues/1440#issuecomment-382576836, or mute the thread https://github.com/notifications/unsubscribe-auth/ABarlu9woBnjevN9c6oV_8Bb-Eq6yvtqks5tp-NrgaJpZM4TXkTz .

cphine commented 6 years ago

When I start the miner, the rate it connects at first will be what it stays with over the long term, plus or minus 10-20 h/s . When I finally connect at the proper over 300, I've let it sit for days at this level with no degradation. A lower connect in the 120's won't ever reach above 130 something. This is why I'm forced to stop and start repetitively until it connects right, and then pray I don't have a Windows update come in over night and restart my computer! LOL.

Simaex commented 6 years ago

You can try to set up fresh copy of Windows 10 Pro to be certain that it is not Home edition that affect performance. Another option is to use pre-configured Linux for mining. For example HIVE OS https://the.hiveos.farm allow free use up to three rigs, is easy to setup and use and have lots of miners avalable including XMR-STAK. If I'll write complete script later I'll publish it here. Really it is a half-an-hour work for a programmer but I am also not a programmer so I need much more to get it working. The fragment I published should be run in a batch file that is called from shcheduling task after reboot. But you need to figure how to pass miner hashrate to the variable.

iJUK3 commented 6 years ago

I have been having this exact same issue on ubuntu w/ i7 3770K overclocked to 4.9ghz - no gpu... I do the exact same thing ( restart the computer / miner ) until it finally connects at the rate 370h/s. Sometimes I get lucky and it will connect at that rate first try, but lately it has been harder and harder to get it exactly right. I have tried different versions of Linux, no matter what, if i stop the miner for any reason and start it again, I get low hashrate. Then it's a long process to get it back to where it should be. I don't have this problem with my CPU/GPU Windows 10 setup using the same version of XMR-STAK 2.4.3 I wonder why its like this for me only on Linux. I've tried other miners before the April 6th fork and didn't have low hashrates. I'm getting pretty frustrated at the inconsistency, one night I went to bed with it hashing at 227h/s because I was fed up with the restarts and waiting for it to connect to the pool and produce a hand full of shares before checking the hashrate.. I thought it was just me on Linux with the issue but OP is on Win 10 so idk. plz help

edit two days later: after much more reading, i think my hugepages settings weren't staying saved. i manually saved the setting to the /etc/sysctl.conf - restarted the machine and ran the miner, this time instead of "mmap failed" i got "mlock failed"... ran the miner as sudo (admin) and everything is fixed. my hashrate is even higher than before. now on my i7 3770K 3.5ghz (overclocked to 4.9ghz) i pull in 386.6H/s ....

@cphine maybe check the "hack" you did on windows 10 to get the hugepages set? it might not be working like you think it is. also try running the miner as admin (right click on it, then "run as admin") - on my windows 10 machine i run the miner as admin w/ no problems. getting 194H/s out of my i5-7400 3Ghz (can't overclock it so i have all cores running at the same "max" speed)... if that doesn't work maybe try running it on linux/ubuntu 16.04?

just trying to help!