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

NUMA support #2374

Merged
merged 9 commits into from
Jan 3, 2024
Merged

NUMA support #2374

merged 9 commits into from
Jan 3, 2024

Conversation

nazar-pc
Copy link
Member

Still waiting for user feedback in https://forum.subspace.network/t/numa-support-is-coming/2299?u=nazar-pc, but otherwise this should be ready for review.

The first change here is thread pool manager. Instead of having per-farm thread pools for plotting and replotting, we now have global set of thread pools.

With thread pool manager, we can associate each thread pool with a set of logical CPU cores. Initially this PR tried to pin threads to cores, but performance degraded massively from that. So in later commit I changed that to pin all threads in thread pool to the same set of CPU cores, such that OS kernel is free to move threads between those cores if it sees benefit from doing so.

NUMA support is implemented with hwlocality library that I had to fix in a few places (all upstream already) and cross-compilation still doesn't work on macOS unfortunately (but it is also not immediately beneficial there). Farmer will check which CPU cores belong to which NUMA node and will create number of plotting and replotting thread pools that correspond to number of NUMA nodes present in the system.

NUMA support is introduced using enabled by default numa feature that has additional requirements to installed dependencies, see updated documentation and CI changes.

Lastly, mimalloc crate apparently has NUMA-aware memory allocation support that should further improve plotting performance on NUMA systems, but no one tested yet whether it helps or not, so it is currently behind NUMA_ALLOCATOR environment variable and will either be removed or enabled unconditionally in the future.

Overall this was a somewhat painful process in terms of debugging, but I hope it is worth it.

Along the way I fixed some documentation and CI bugs that affected builds in forks ever since we switched to self-hosted runners.

Code contributor checklist:

@nazar-pc nazar-pc mentioned this pull request Jan 1, 2024
1 task
vedhavyas
vedhavyas previously approved these changes Jan 3, 2024
Copy link
Member

@vedhavyas vedhavyas left a comment

Choose a reason for hiding this comment

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

Make sense to me!

# Conflicts:
#	.github/workflows/snapshot-build.yml
@nazar-pc nazar-pc enabled auto-merge January 3, 2024 11:17
@nazar-pc nazar-pc added this pull request to the merge queue Jan 3, 2024
Merged via the queue into main with commit e65a625 Jan 3, 2024
10 checks passed
@nazar-pc nazar-pc deleted the numa-support branch January 3, 2024 13:40
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.

2 participants