-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Replace the 'threads' target property with the 'workers' and 'threading' properties #993
Conversation
I think we can either specify |
We don't know the number of available cores on the target machine. In fact, the same binary could be run on different machines. To quote from the comment in TargetConfig.java:
I think this is the most reasonable default and it is also what is currently implemented for C++ (and I think for Rust). For zero workers, the C++ runtime uses the number of hardware threads available on the executing machine. |
I don’t know any reliable method for this that works on all platforms for C. Do you happen to know any? Maybe CMake has something? |
No, I don't know. But it is also not needed to implement the exact same strategy for C. To me, the key is that |
Also adjust the tests to use the correct configuration
The code duplication in |
How about a default value EDIT: I hadn't noticed that @cmnrd already suggested the same solution. @Soroosh129, if you agree, could you push a fix to |
Is this just limited to tests? It occurs to me that this might not be the best default in general for the Python target. Maybe the same is true for the TypeScript target? |
We still have a weird case for federated execution. As mentioned before, the CGenerator attempts to adjust the number of workers to account for all the blocking network input control reactions (there should be at least one worker available for each at all times). This is simply done by adding the number of network inputs to the number of workers during code generation. The problem is that the C runtime will see a non-zero number of workers for federated programs, even if What do you think we should do here? The solution to this is not very clear to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Thanks!
This PR implements the solution discussed in #290.
I implemented the change for all the targets. However, there are some remaining issues that I don't know how to resolve.:
threading=true
andworkers=0
are the default. I don't know if the C runtime will interpretworkers=0
correctly, as before it was not possible to have the threaded runtime with zero workers configured.Since the default changed, this influences all the C tests that don't configure threads. Should we setthreading=false
in all tests that don't specify something else?Inorg.lflang.tests.Configurators
the methoduseFourThreads
reconfigures a test to use 4 workers. Should we force enable threading in this case?workers: N
entirely from all of our testsworkers
property (done in C and C++)Unrelated to the above, this PR also fixes #1020.