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

Improved warning messages #862

Merged
merged 16 commits into from
Oct 21, 2024
Merged

Conversation

mikibonacci
Copy link
Member

@mikibonacci mikibonacci commented Oct 14, 2024

This fixes #859

  • refactoring of the warnings and suggestions
  • comparison also with the cpus_count()

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:

Screenshot from 2024-10-14 14-11-24

3: run on localhost but asking more than half of the available CPUs
Screenshot from 2024-10-14 14-11-45

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

- refactoring of the warnings and suggestions
- comparison also with the cpus_count()
Copy link

codecov bot commented Oct 18, 2024

Codecov Report

Attention: Patch coverage is 86.36364% with 3 lines in your changes missing coverage. Please review.

Project coverage is 67.15%. Comparing base (48076af) to head (dfe96dc).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/aiidalab_qe/app/submission/__init__.py 86.36% 3 Missing ⚠️
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     
Flag Coverage Δ
python-3.11 67.15% <86.36%> (+0.06%) ⬆️
python-3.9 67.18% <86.36%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@superstar54 superstar54 left a 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>",
Copy link
Member

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.

src/aiidalab_qe/app/submission/__init__.py Outdated Show resolved Hide resolved

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()
Copy link
Member

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?

Copy link
Member Author

@mikibonacci mikibonacci Oct 18, 2024

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.

mikibonacci and others added 4 commits October 18, 2024 10:25
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.
@superstar54 superstar54 self-requested a review October 21, 2024 14:23
Copy link
Member

@superstar54 superstar54 left a 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.

src/aiidalab_qe/app/submission/__init__.py Outdated Show resolved Hide resolved
src/aiidalab_qe/app/submission/__init__.py Outdated Show resolved Hide resolved
@mikibonacci mikibonacci merged commit 4087ea2 into aiidalab:main Oct 21, 2024
8 checks passed
@mikibonacci mikibonacci deleted the fix/warnings branch October 21, 2024 15:15
edan-bainglass added a commit to edan-bainglass/aiidalab-qe that referenced this pull request Oct 24, 2024
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.

Improvement on warning for long/large calcs
2 participants