-
Notifications
You must be signed in to change notification settings - Fork 26
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
Sparse mmap()s are counted as fully allocated from the start, which can be very misleading #308
Comments
So far I have compiled code locally, and compared to last released version. Locally compiled Fil doesn't even show the import as using any memory at all (which... kinda makes sense, mostly it's an mmap of a file, with a few tiny allocations that should be filtered out). |
The reason for difference I was seeing, where sometimes NumPy is included and sometimes it isn't, is because of the threadpool changes. If So maybe we want to check for numexpr existence without importing it. Regardless, however, that doesn't explain the variability in report NumPy-import memory usage, so next step is figuring out why it sometimes has huge % when it shouldn't. |
I think I figured it out:
Thus depending on detected number of CPUs and BLAS version the reported memory usage for importing numpy can vary quite a bit. |
Of course, in theory there should only be a single thread when using Fil. So something is wrong with the threadpool-controlling code too, it seems (there were three of the above tracebacks when running under Conda). Update: |
It's not clear that current approach of limiting to one thread is correct (assuming it can be fixed). Zeroed out new mmap() doesn't actually use any memory, should we really be counting all of it? And if the user is using BLAS, the profiling will be ignoring potentially a large chunk of memory, especially on machines with high core count. Alternatives:
|
For alternative 3, checking how much of mmap is filled coudl be done whenever we check for a new peak, which should ... correctly catch peaks, I think. |
For alternative 3, looks like the info is available on macOS via the |
As a short-term workaround until alternative 3 above is implemented, I'm going to make sure |
Retrieving informationOn Linux, the data is in
|
The data structure representation for this is probably:
The problem with this is that retrieving 2 is likely to be expensive, so doing it on every One possible heuristic: only do the parse if there have been minor page faults in the interim since last check, presuming minor page faults are good indicator (need to check) and |
|
https://github.com/javierhonduco/bookmark reads /proc/self/pagemap |
Discussed in #297
Originally posted by fohria January 26, 2022
hey! thanks for this profiler, it looks very useful, if i can figure out how to use it :)
i have a short script that, in short, generates a bunch of data, and then plots it. depending on how much i generate, memory use can be many gigabytes. so i'd like to profile it so i can find out when and where i may have some dataframes hanging around from function calls that i can delete when they're not needed anymore, like after i have dumped it to a file.
however, running it with fil, i get this:
the light pink on the left are the plotting calls, but what does it mean that it says
<frozen importlib._bootstrap>
all over?tldr version of my code is:
(i've installed fil to the same conda env i use for the script, if that matters)
The text was updated successfully, but these errors were encountered: