-
Notifications
You must be signed in to change notification settings - Fork 87
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
Python option sst.setThreadCount doesn't work #872
Comments
This is the expected behavior. Command line options should take precedence over options in python file. If setting the number of threads in the python script doesn’t work when the number of threads isn’t specified on the command line, that is a bug that needs to be looked at. |
But even without a command line option setting threads from Python doesn't work.
This makes it appear that you can decrease the number of threads from Python, but not increase. But the default is 1 thread (config.cc:587), so you can't ever get more than one thread without a command line arg. Even if that check where changed it still wouldn't work, as I explained above: the config value is consulted before the Python is executed, and never adjusted after that to see if Python has changed it. JSON doesn't have the reduce-only problem since it has no special API/tag for setting number of threads, just |
Thanks. This should be relatively easy to fix. I’ll take a look at it and get a PR ready. |
The more I think about this, the more I feel that setting the number of threads is not something that should be available in the input file and should be limited to the command line. That being said, I will leave it in for now and have fixed the issue with setting thread count in the python file and added a check to make sure that all ranks have the same number of threads set in the parallel load case (no way for them to be different for serial loads). I am also going to deprecate the setThreadCount() function as redundant to using setProgramOption(). I will close this once the new code gets merged. |
IMO it should be possible to set the number of threads from the input file. The input file describes the model. If the model performs best with a certain number of threads (which might depend on other model parameters, such as size), the only place to make that decision is in the input Python. Further, if a model is self-partitioned the input Python needs to assign Components to threads, using |
Understood. That’s why I went ahead and left it in and just added the check to make sure every rank has the same number of threads (we don’t test the case of different number of threads on the ranks, so I’m not sure it will work). I can also leave setThreadCount() in and not deprecate it if that’s your preferred method. I usually try to avoid redundancy, just for code maintenance reasons, but I looked at the code and while the python functionality is redundant, all the calls go back to the same underlying function eventually, so there isn’t a big code maintenance issue. |
I'm ok with deprecating/removing |
- Change command line option --num_threads to --num_threads. Fixes sstsimulator#871 - Fix setting of threads in the Python input file. Fixes sstsimulator#872
New Issue for sst-core
1 - Detailed description of problem or enhancement
Trying to set the thread count from Python doesn't work, using either of these calls:
2 - Describe how to reproduce the issue
a. Add one of those calls to any Phython script
b. Run the script with
c. The script will run with the number of threads from the command line (4), not what was set in the Python (2)
3 - What's happening
In
src/sst/core/main.cc
:cfg
world_size.thread
is set with the value from cfg, which at this point only has command line inputworld_size
[Edit: added the important word "never"]
The text was updated successfully, but these errors were encountered: