-
Notifications
You must be signed in to change notification settings - Fork 113
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
pyAMG leaking memory #198
Comments
Thanks for this. I can reproduce in Python 3 as well. I've narrow the issue to relaxation. If I leave out pre/post smoothing then the memory stays bounded: In fact, just adding I'm using the following: from memory_profiler import profile
@profile
def prof():
import numpy as np
import pyamg
stencil = [ [-1,-1,-1],[-1,8,-1],[-1,-1,-1] ]
n = 25
A = pyamg.gallery.stencil_grid(stencil, (n,n), dtype=float, format='csr')
ml = pyamg.smoothed_aggregation_solver(A, max_levels=3)
b = np.random.randn(A.shape[0])
x = np.zeros(A.shape[0])
for i in range(50000):
print(i)
#solution = ml.solve(b)
pyamg.relaxation.relaxation.gauss_seidel(A, x, b)
if __name__ == '__main__':
prof() |
It may be the way we're binding with SWIG. I'll take a look. I'm also looking at using pybind11 going forward, which may help. |
Update. If I wrap gauss_seidel with pybind11, then the memory leak appears to be fixed. In addition, it's slightly faster: Pybind11: SWIG: It's unclear what is contributing to the memory leak with SWIG. Looking at moving all of |
Thanks for the update. Looking forward to the fix! |
@dionhaefner can you try the |
I am currently on vacation. Will try it out next week! |
@dionhaefner would you mind posting your test script? I agree it's minor but to "leak a little" is still worrisome 😁 |
I used the script from my opening post, I think. If you can't reproduce it let me know and I will try again. |
@jbschroder can you test? I pushed two scripts Then
|
Hi All,
Here are my results. Test_memory1 does not show a leak, but test_memory2
does show a small one (I think).
- Jacob
…On Thu, Oct 5, 2017 at 9:40 AM, Luke Olson ***@***.***> wrote:
@jbschroder <https://github.com/jbschroder> can you test?
I pushed two scripts testmemory.py and testmemory2.py in the amg_core
directory for lack of a better place.
Then
mprof run testmemory.py
mprof plot
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#198 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AEjD4zayGmAjYN3E4y9xQdT7FKDLW-myks5spQaUgaJpZM4NfSb2>
.
|
cycler==0.10.0 |
That's strange. Let me repeat my test during the weekend and then get back to you. |
Thanks. Keep us posted. I also added a |
I can confirm @jbschroder's findings. |
Closing this issue in 851b7b8 (probably should squash) |
Test script:
Running
mprof python test.py
andmprof plot
reveals a steady rise of memory consumption:Output of
pip freeze
:Output of
python --version
:I am running on Ubuntu 17.04.
The text was updated successfully, but these errors were encountered: