Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a sleep mechanism for slowing down mining process #3475

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

James4Ever0
Copy link

This pull request provides a configurable environmental variable called XMRIG_SLEEP_NANOSECONDS which value is default to zero.

One can configure it to slow down the mining process, effectively eliminate the issue of utilizing a single thread 100% at all the time, thereby increase the overall system stability and lower the thermo pressure.

Fix #1322

Add library
Add attribute sleepNanoSeconds
Parse value from the environment variable named as XMRIG_SLEEP_NANOSECONDS
Add the effective line which enables slowing down the mining process by sleeping for given nanoseconds
@SChernykh
Copy link
Contributor

This is a weird place to put sleep into. If anything, it should be in the main CPU mining loop, next to already existing yield (with the similar purpose): https://github.com/xmrig/xmrig/blob/master/src/backend/cpu/CpuWorker.cpp#L357

@James4Ever0
Copy link
Author

Now I have made some progress here. I make the dataset preparation process single threaded in ASM mode (because I cannot figure out how to sleep in assembly code in PIE compilation mode), throttled in non-ASM mode but taking ages to prepare so therefore out of major concern, and finally throttled hash functions.

@SChernykh
Copy link
Contributor

SChernykh commented May 5, 2024

Honestly, this PR is a bunch of hacks on top of each other, and there is 0% probability it will be merged. It's fine for your own purposes, I guess.

@SChernykh
Copy link
Contributor

https://xmrig.com/docs/miner/command-line-options
--randomx-init=N thread count to initialize RandomX dataset

@James4Ever0
Copy link
Author

James4Ever0 commented May 5, 2024

That being said, I think it is possible to create some better mechanism for controlling thread occupation, by first measuring the average time to perform a single loop in hash function, then sleep accordingly to the measured time, so that the user will only have to provide a value ranging from 1 to 99 in percentage, simplifying the guesswork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to change intensity and worksize in v5.0.1?
2 participants