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

fix: conditional variable definition in num_threads #896

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

Conversation

mdqst
Copy link

@mdqst mdqst commented Apr 4, 2025

I fixed a problem in the num_threads function. The original code used #[cfg(feature = "parallel")] let nt = rayon::current_num_threads();, which caused an issue because the variable nt would only be defined if the parallel feature was active. This led to a compilation error when the feature was disabled, as the compiler couldn't find nt.
Now, the function properly returns the correct value based on whether the parallel feature is enabled or not, avoiding the issue where the variable nt wasn't always available.

Copy link
Collaborator

@hero78119 hero78119 left a comment

Choose a reason for hiding this comment

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

Hi, thanks for the PR!

@@ -1,7 +1,13 @@
pub fn num_threads() -> usize {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Giving another similar TODO issue #861
I would suggest make this PR with slightly wider scope: remove this parallel.rs file and leverage plonky3 maybe-rayon to achieve the same functionality

Copy link
Author

Choose a reason for hiding this comment

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

hero78119, my solution is better.

Copy link
Collaborator

Choose a reason for hiding this comment

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

we will in favour of this solution instead #897, for parallel.rs is some previous left-over and we will clean it up eventually

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