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

Thread Affinity #15

Open
KronXIII opened this issue Apr 25, 2018 · 2 comments
Open

Thread Affinity #15

KronXIII opened this issue Apr 25, 2018 · 2 comments

Comments

@KronXIII
Copy link

It'd be helpful to be able to specify in the config if the threads should be assigned to only some subset of cores, either explicitely pinning to cores A, B...N in tandem with the num_threads option, or as predefined "slots" for the bandit optimisation.
For instance, if I have 8 cores available on a home machine, and I want to mine while keeping cores 1 & 2 free for day to day things.
Does that sound doable here or would that mean rewriting a lot of things?

@Ragnaroek
Copy link
Owner

Ragnaroek commented Apr 25, 2018

Thread Affinity is definitely something I want to implement.
But it needs to be supported by Rust somehow. I did a very, very brief investigation on this, but didn't find anything.

The use-case was not trashing the CPU caches, though. I did not see the use-case leaving some CPUs idle :)

Could you share how want do configure something like this in cargo.toml?

It's definitely doable and should only touch the code that is starting the threads (so very local, I guess).

@KronXIII
Copy link
Author

I'll look into the thread spawning and work on integrating something, but I doubt I can contribute meaningfully. Frankly I know just enough Rust/Threading to be dangerous, so no promises.

For the config, optionaly specifying an array of coreids would do? Something like

# Default empty array falls back to existing num_thread strategy
# bind_to_cores = []

# Or non empty array flags the named cores for exclusive use
bind_to_cores = [4, 6, 8, 10]

I looked into rust support for this, and everything calls out to C at some point. This stood out to me while searching https://github.com/Elzair/core_affinity_rs

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

No branches or pull requests

2 participants