-
Notifications
You must be signed in to change notification settings - Fork 2
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
Octree converter #3
Conversation
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.
Generally looks good to me, but I think there's a memory leak? I haven't been able to pin it down, but here's a little test script:
# mem_leak_test.py
import sys
import numpy as np
from yt_experiments.octree.converter import OctTree
if __name__ == '__main__':
xyz = np.array(
[
[0.375, 0.125, 0.125],
[0.125, 0.125, 0.125],
[0.375, 0.375, 0.375],
[0.75, 0.75, 0.75],
],
)
levels = np.array([2, 2, 2, 1], dtype=np.int32)
for _ in range(int(sys.argv[1])):
octree = OctTree.from_list(xyz, levels, check=True)
del octree
running with python mem_leak_test 1000000
(need a large number of iterations since the number of nodes is small), memory usage grows continuously. Ends up using close to 400 Mb before finishing the iterations.
oh! one more suggestion -- would be good to add |
Co-authored-by: Chris Havlin <[email protected]>
There was indeed a memory leak (I didn't implement a deallocate step). I've just checked with your code snippet, and the memory use is now constant. Thanks for the thorough review! |
Great! Ya, I thought you needed a |
This adds the ability to convert a list of positions (x, y, z) with levels into an octree that can be loaded by yt.load_octree.