-
Notifications
You must be signed in to change notification settings - Fork 25
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
Printing messages in parallel runs #937
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #937 +/- ##
=======================================
Coverage 99.27% 99.27%
=======================================
Files 60 60
Lines 2753 2760 +7
=======================================
+ Hits 2733 2740 +7
Misses 20 20 ☔ View full report in Codecov by Sentry. |
Hi @jhdark !
Sorry, but I don't. Maybe, we could search for a way somewhere? By the way, all Error/Warning messages are printed by each node when running in parallel, no? |
Yes this is true, but error messages are exceptional cases, so might not be completely necessary. |
I agree with @jhdark errors shouldn't occur in a normal situation so that is not worth rewriting eveyrthing. |
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.
@jhdark should we add a function
def festim_print(msg):
if MPI.comm_word.rank == 0:
print(msg)
Can do, might make the script a little easier to read. And just apply it to the changes that have been made? |
Yes |
Proposed changes
Due to the way printing in python has been used within festim means that print messages are shown on every node, which in practice means printing the message repeatedly by the number of processors defined. For instance running the following script:
running this in parallel using
mpirun -np 4 python mwe.py
with 4 processors would produce the following:With these changes, the printing message is only done on the master process (or rank 0 process). Meaning printed messages will only appear once, no matter the number of processors used.
resulting in:
making printed messaged much cleaner and easier for users to understand.
@KulaginVladimir don't suppose you know of anyway we could test this? I imagine it may have to be at the github actions level in order to run the test scripts in parallel. Which itself could open up a new can of worms as we should really be testing in parallel too.
Types of changes
What types of changes does your code introduce to FESTIM?
Checklist
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...