-
Notifications
You must be signed in to change notification settings - Fork 192
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
🐛 FIX: max_memory_kb
usage for direct scheduler
#4825
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4825 +/- ##
===========================================
+ Coverage 79.51% 79.52% +0.02%
===========================================
Files 519 519
Lines 37089 37083 -6
===========================================
- Hits 29487 29486 -1
+ Misses 7602 7597 -5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
thanks @eimrek 😄 |
aiida/schedulers/plugins/direct.py
Outdated
''.format((job_tmpl.max_memory_kb)) | ||
) | ||
lines.append(f'ulimit -v {virtual_memory_kb}') | ||
self.logger.info('Physical memory limiting is not supported by the direct scheduler.') |
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.
I think this should be a warning - the user is requesting something that is not supported.
thanks @eimrek I agree that having a stricter requirement for the direct scheduler (by limiting virtual memory as limiting physical memory seems difficult) than for all other schedulers (that only limit physical memory) is not ideal. At the same time, it might be useful to be able to limit memory consumption also for the direct scheduler. If I understand correctly, then your PR is driven by the use case of wanting to transfer a job's memory settings between an hpc scheduler and the direct one unchanged. One could also argue for keeping the virtual-memory-based implementation for the direct scheduler; combined with an "info" log message informing the user that this is limiting virtual memory, not physical memory. However, I haven't been affected by this issue and I can see both sides; I'll let @chrisjsewell and @giovannipizzi decide |
Thanks for the comments @ltalirz True, it would be useful to be able to limit memory consumption for the direct scheduler. However, limiting virtual memory can be quite tricky and not intuitively match the real memory usage. To illustrate: when I run a small tiny test Gaussian calculation, the physical memory usage can be practically negligible (in the order of 10 MB) but the virtual memory usage is at least 1.5 GB due to large amount of different libraries available to gaussian (and most of them are not used). Additionally, if the code you're running uses a different set of libraries in another version (or perhaps is compiled differently), then the virtual memory usage will vary as well. This makes it quite difficult to limit the real memory usage through the In principle, currently the implementation is not too restrictive for my use and I could just clear the Another option we can consider is to define an additional input called something like |
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.
I agree that it's difficult to think of a use case for wanting to limit virtual memory (and I've not heard from users who need this).
I support this change.
Fixed another bug that caught my eye near my proposed changes. It's very tiny so I thought I could just include it with this PR. In case we don't merge this PR, I can open another one just for that. |
max_memory_kb
usage for direct scheduler
cheers |
Hi,
I am proposing my solution to the issue I raised a while ago #4526.
The changes are the following:
In all scheduler plugins I just renamed
virtual_memory_kb
tophysical_memory_kb
to avoid confusion.In the Direct scheduler, the
max_memory_kb
limit is ignored now and just a message is printed to logger. The justification behind this is that the previously usedulimit -v
did impose a virtual memory limit (as opposed to a physical memory limit that all the other schedulers do) and therefore it's inequivalent (as a result, I always have to treat the direct scheduler differently in my workflows). There doesn't seem to be a straightforward standard way to limit the physical memory usage of a process in linux, so I decided just to ignore this variable.