Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

add --cuda-usleep flag to optionally usleep between search iterations #2281

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jonreiter
Copy link

No description provided.

Copy link
Contributor

@aloisklink aloisklink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hiya, I just wanted to thank you for adding this feature! I'll probably use it in my personal fork, since I've been wanting the same thing.

Unfortunately, this repo is pretty unmaintained, so it's unlikely for this PR to get merged, but I thought I'd add my recommended changes, just in case some fork wants to pick up this feature. I remember https://github.com/no-fee-ethereum-mining/nsfminer was a new fork that looked pretty promising, but unfortunately that's archived now.

Comment on lines +347 to +348
app.add_option("--cuda-usleep,--cu-usleep", m_CUSettings.usleep, "", true)
->check(CLI::Range(-1, 1000000));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably worth improving the documentation on this, just to make it more clear what this actually does.

Suggested change
app.add_option("--cuda-usleep,--cu-usleep", m_CUSettings.usleep, "", true)
->check(CLI::Range(-1, 1000000));
// adds an optional usleep between batches. Can be used to slow down mining.
app.add_option("--cuda-usleep,--cu-usleep", m_CUSettings.usleep, "Sleep time in μs between batches (default: no sleep)", true)
->check(CLI::Range(-1, 1000000));

@@ -101,6 +101,7 @@ struct CUSettings : public MinerSettings
unsigned schedule = 4;
unsigned gridSize = 8192;
unsigned blockSize = 128;
int usleep = -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C and C++ are annoying languages, and even though int is usually 32-bits large, on some platforms, it can be 16-bits, so it's better to use one of the types in <cstdint> instead.

The following should work if you include #include <cstdint> at the top of the file. Alternatively, you could replace the CLI::Range(-1, 1000000)) to a smaller range that will fit in a int16 like CLI::Range(-1, 10000)).

Suggested change
int usleep = -1;
int_fast32_t usleep = -1;

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

Successfully merging this pull request may close these issues.

2 participants