-
Notifications
You must be signed in to change notification settings - Fork 41
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
Out of Memory At Unlinearizing Exposure Step #727
Comments
I allocated 256 GB of memory and was able to get farther before running into a different issue |
I've got a memory test running that will (hopefully) shed a little light on this. It's slow going for testing though. Within obs_generator.py, everything is in a loop (over dark current files), so if you made it through 3 segments before having trouble, then there must be a memory leak somewhere. The unlinearize functions are clunky and memory intensive, but all the memory they use should be freed up after they finish each time. |
OK, thanks for investigating! Now that I run mirage TSO sims on a high performance computer and allocate 256 GB, I have not run into any problems but I imagine some people someday will want to run this on desktop or laptop that has 16 GB to 32 GB. If it's of any use to you, I have watched the machine's memory usage at times and it sometimes goes up to ~170 GB**, then down to something smaller like ~130 GB** so it is probably freeing up some of the memory but not all. **working off my brain's memory here so it could be overloaded/leaking too and I don't recall the exact values. |
Hi, I was wondering if there were any results on the memory testing? I am trying to run this program but the best computer setup I have access to currently is capped at ~60GB RAM, so I'm hoping there was a leak found that might help me be able to run the TSO with my current resources. |
I haven't found any obvious memory leaks yet in my testing. Unless python isn't cleaning up after functions complete. I'll keep digging into it. |
Hi folks, Just coming to this discussion to tell you that we (@hover2pi and I) found initially similar problems with SOSS even before merging How we managed at the end on the SOSS simulator is to create integrations in reasonable (~50) chunks (< 1 GB each), and then explicitly deleting the most memory intensive arrays. That works for us now and we are able to generate ~thousands of integrations in a common laptop. Perhaps the same ought to be implemented for the NIRCam simulator. Just a thought! N. |
Thanks @nespinoza! Mirage does do something similar for TSO simulations, where the data are broken into multiple segments once the numbers of groups/ints gets too large. I had been assuming when looping over each segment that all of the memory in the re-used variables would be freed up at each iteration of the loop. I'll try following SOSS's lead and explicitly delete those variables to see if it helps. |
Hi everyone, I am currently experiencing a similar issue when running the NIRISS SOSS example. I have found that clearing my cache and restarting my laptop helped the simulation run a little bit further but not enough to complete the simulation. I have also updated all of my Python packages to meet the requirements. The error that comes up each time that I run the code is as follows: I have also attached the log file in case anyone notices something that I have missed. mirage_latest(unlinearizedexposures).log And these are my laptop's specifications: Is it possible that my Mac simply cannot run Mirage because of a memory issue? Or is it an issue with Python forgetting to free up memory? Are there any suggestions for how I might resolve this? |
It looks like the failure is happening when trying to unlinearize the exposure. @hover2pi have you ever run into this when creating a SOSS exposure? To find the location of this file: Then the constants file will be in the utils subdirectory under the path listed there. Another option that might be useful depending on exactly what data you are looking for would be to work from the linearized data and skip the unlinearization. That can be done by going into the yaml file and changing the Output:datatype entry to 'linear'. In the meantime, I'll keep trying to figure out why the memory use seems to get so large for these large observations. Sorry about this. I haven't had much time in the last couple months to delve into Mirage. |
Yeah, the line is right here: mirage/mirage/soss_simulator.py Line 365 in 0483e70
I have it hardcoded to 50 frames but I can definitely make that a SossSim.create keyword argument so users can adjust it to their needs. 50 worked for large numbers of integrations on my laptop but we definitely didn't test it for all possible scenarios. My guess is that this would fix it.
I'll open a PR to fix it and we can see if that works for @emma-miles use case. |
PR is here #775 ! |
@bhilbert4 @hover2pi thank you both for getting back to me on this! I have taken into consideration all of your solutions. There no longer appears to be a memory issue where I was experiencing it previously but another issue has arisen. I had changed the yaml file to only take in the linearized dark files but for some reason, it expects a raw output for the seed image after segment 1 is complete. I was trying to read the soss_simulator.py code where the error appears but I can't quite make sense of why this might be happening. I'm not sure if this was an issue previously as the code has never run this far for me. Is there any way around this? Cheers, |
I think this I know what this is. I'll check it out and push a fix for it ASAP. |
This should be fixed when #775 is merged. |
@hover2pi I have incorporated your fix but the same error seems to be occurring. Do you have any other solutions for this? |
I am using the
grism_tso_simulator.py
and running into memory problems at the unlinearize step. I allocated 128 GB for the job and it got killed by an out-of-memory handler. The script got through 3 of 6 segments before running out of memory. So, perhaps the previous finished segments are not getting cleared out of memory? FYI, each_linear.fits
file is 6.1 GB.The text was updated successfully, but these errors were encountered: