-
Notifications
You must be signed in to change notification settings - Fork 44
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
Better Garbage Collection when Loading hdf5 Data #439
Comments
Thanks. We're just wrapping up a big data structure reorganization, we'll check if this is still an issue and fix it in the next release. |
Hi @zeyueN, we just merged our very comprehensive refactor of the tidy3d data structures #425 into the |
@tylerflex note however that if a user has one big monitor data, and does something like
They will still have two copies of the data in memory. If we want to fix that, I think we should just normalize the data when loading from file, rather than returning a normalized copy. Similarly we should make sure that |
Describe the bug
Currently, running
SimulationData.from_file
to read a hdf5 file consumes 3 times the RAM it should. This causes OOM when loading large files, especially on our cloud instances where RAM is limited (10GB max) when loading ~4GB dataTo Reproduce
Load a simulation data hdf5 and monitor the RAM usage with a profiler/debugger/htop.
Expected behavior
RAM usage being around the data size.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Potential fixes
There seems to be 2 places that are causing this RAM over usage:
monitor_data_dict
hanging around after being used and not garbage collected, here..normalize()
makes a copy of itself, here.1 is fairly easy to fix, either explicitly garbage collect the
monitor_data_dict
variable, or not assigning it to a variable and directly pass it to thecls()
call below.2 perhaps involves more changes design-wise, but a short term fix would be great, something like having the option for not doing the copy.
The text was updated successfully, but these errors were encountered: