-
Notifications
You must be signed in to change notification settings - Fork 14
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
Improved warning messages #862
Conversation
- refactoring of the warnings and suggestions - comparison also with the cpus_count()
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #862 +/- ##
==========================================
+ Coverage 67.09% 67.15% +0.06%
==========================================
Files 51 51
Lines 4692 4707 +15
==========================================
+ Hits 3148 3161 +13
- Misses 1544 1546 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Hi @mikibonacci , thanks for the work! I added a few change request.
|
||
# List of possible suggestions for warnings: | ||
suggestions = { | ||
"more_resources": "<li>Increase the resources (CPUs should be equal or more than 4, if possible) </li>", |
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.
should be equal or more than 4
could mislead the user, and let the user think that 4 cpus is enough for a large system. Could you use a simple function to calculate the number of cpus based on the number of atoms and volume?
Assume the maximum number of computation time is ~ 5 days.
|
||
num_cpus = self.pw_code.num_cpus.value * self.pw_code.num_nodes.value | ||
on_localhost = ( | ||
orm.load_node(self.pw_code.value).computer.hostname == "localhost" | ||
) | ||
num_sites = len(self.input_structure.sites) | ||
volume = self.input_structure.get_cell_volume() | ||
localhost_cpus = len(os.sched_getaffinity(0)) # or os.cpu_count() |
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.
@unkcpz Could you check if this gives a correct number of CPUs in a docker container?
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.
just as a reference: getsentry/self-hosted#2126 (comment)
I added a fallback into os.cpu_count()
if the sched_getaffinity
is not available (it seems for some OS is the case), even if it can be not accurate.
I suppose to be able to run a relaxation with 5 scf cycles in 12 hours. This is no more than a rough estimation done with a localhost simulation on SiO2. Moreover, we limit the number of CPUs suggested to a maximum of 100.
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.
LGTM! Two small change requests.
Co-authored-by: Xing Wang <[email protected]>
…b-qe into fix/warnings
This fixes #859
Three cases:
1 (2): run (not) on localhost with large systems (more than 10 atoms or volume larges than 1000 Angstroms) and asking than 4 CPUs:
3: run on localhost but asking more than half of the available CPUs
Here is the code: https://github.com/mikibonacci/aiidalab-qe/blob/e6d94e1ac485521d36873ce53311751b6d7643f5/src/aiidalab_qe/app/submission/__init__.py#L241
the suggestions are contained in the
suggestions
variable, and the three messages are constructed with respect the logic conditions just below.Improvement on the messages and the conditions are more than welcome, @giovannipizzi and @cpignedoli !
PS: I will update the tests once we agree on the messages