-
Notifications
You must be signed in to change notification settings - Fork 27
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
BUG: Mac memory error #115
Comments
This issue seems to alternate at random between a bus error, segmentation fault, and producing nan output. The following is output from repeatedly running a short test program without any changes. Test program:
Output:
|
To debug, I added the
Running the resulting program generates the following runtime error:
This refers to Line 51 in a1e2ce6
|
Perhaps if we address all the warnings upon compilation that will reduce potential memory leaks. |
One problem was an indexing error related extrapolating IGRF 5 years into the future. Some arrays were not being allocated large enough to accommodate this extra epoch but then were be indexed for it. This has been addressed by expanding the epoch array. |
I agree. I'm also trying to implement some stricter compiler flags in the Makefile at least so it does a better job warning us of anything sloppy that may cause issues down the road. |
There is potentially an issue with using apexpy for the future extrapolated epochs that are not part of the normal IGRF set of coefficients (currently anything between 2020-2025). These use fewer basis (8 vs 13), which may cause precision errors that are not handled well. Noteably, running the fortran text program will compute the coefficients for all epochs up to 2020 without issue, but produces a series of warnings about an imprecise fit for 2025.
If you increase the number of iterations in apex.f90 L577, there are fewer errors but they don't go away completely. When running the test script that generates NaN output, apexpy throws the warning
only for years in the most recent epoch window. It is possible these two are related and the output NaNs are comming from an imprecise fit such that apexpy thinks the coordinate system is undefined. |
I think the original indexing problem for extrapolated years was the main issue. The NaN output went away after I updated |
I recently added a new test for "today", but it'd be a good idea to add a test that uses the end of the current extrapolation era. |
Some of my initial speculation about this problem was incorrect. It seems to have boiled down to three main things:
All these points should be addressed in #117. |
Is this what you're referring to? apexpy/apexpy/tests/test_Apex.py Lines 111 to 116 in 8436e3f
If so, I believe initialization always worked fine for me, I only ran into issue when you actually try to use the object for conversions, so I'm not surprised that wasn't triggered. |
That's it. Good point about the limits of the test, something to change now. |
@ljlamarche is this good to close now? |
Yes, this is fixed with #117. |
One further note: This article was helpful for understanding what exactly the secular variation code was trying to do. https://earth-planets-space.springeropen.com/articles/10.1186/s40623-021-01507-z |
Describe the bug
Upon initializing an
Apex
object, python crashes with a memory error (usually either bus error or a segmentation fault). This may be related to #84 , but it shows up in a slightly different way, and the installation flag that solved that issue doesn't seem to change this one.To Reproduce
Apex
objectExpected behavior
Successful creation of
Apex
object.Computer
Please provide the following information:
The text was updated successfully, but these errors were encountered: