-
Notifications
You must be signed in to change notification settings - Fork 30
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
Memory access errors #22
base: py35_compat
Are you sure you want to change the base?
Memory access errors #22
Conversation
Hi @jsenellart , Regarding unittest fail, here's what I see: A 1-D "Circular" optical waveguide (ie. like an optical fiber but no "length") is generated, and 20 waveguide modes calculated. L36:
And you can see there's some slack in the comparison using To investigate further,
This is a critical check, as the accuracy of these 1-D modesolves affects every other complex calculation one may do with CAMFR. –––––– Some things to investigate here:
I hope that provides some useful leads. |
@jsenellart I've added you as a collaborator to this repo - please feel free to merge pull requests as you deem fit. I'm happy to comment and help where I can, won't be contributing much code unless it's in Python - I'm an engineer (photonics and semiconductor mfg.) with only end-goal type of programming interests, so can't delve nearly as deep as you can into Cpp and such! I do have a vested interest in improving CAMFR though, and would be thrilled if we can get this Py3x compatible. |
Thanks for the explanation for the fail test, I will compile on another OS to check if it is a portability issue, and will try also to understand where it goes wrong.
Thanks for your trust, I have no problem helping out on the programming issues and as soon as this remaining issue is handled, will look at the other open issues and help for the packaging.
Regarding crashes, I handled all of the problems triggered in the tests - if you have any other one that you can randomly reproduce, I will be able to have a look too ! |
Issue #23 shows a memory error and possible trigger. Any idea if that is related to these fixes? |
I'm also getting failures on There are also two tests that are disabled - PhC_splitter, which passes and stack2, which fails. So, on their own, all tests except stack2 and backward pass, but when run together with the standard unittest toolkit, more of them seem to fail. |
@jsenellart Maybe other ways to remedy the memory leaks, by finding out where they occurred in the first place. Here were my suggestion on that tack:
|
Hello @demisjohn, thanks for the pointers, I actually came back to the code base recently to fix few issues, and add the support of Python 3.11 that was not working, before commit I will have another review pass based on your comments and the observation from @kitchenknif. I will be back to this soon (normally before end of March). |
Hello @demisjohn !
When running the test cases on ARM - I have found several memory access errors using clang AddressSanitizer that do not seem to be related at all to the python 3 port - maybe the ARM compilation being more strict and revealing them. Technically I am using clang AddressSanitizer to find these problems.
this PR fixes all these issues mainly due to missing boundary checks, but also deprecated numpy interface.
There is a little bit of logic change in
patterson_z_n
but it seems to be working well.There is one location where I am a bit puzzled:
https://github.com/demisjohn/CAMFR/pull/22/files#diff-310bd0d7c8ef36392b1780e6ea45c0b716feece1deb267c7e0521f3770a45a69R86-R89
I fixed the actual boundary check - but wonder about the idx calculation (it is as it was before).
now - all the tests are running without any crash - and the boundary checks added have necessarily improved the determinism of the results :).
One single unit test is failing now:
but I don't have a clue what is wrong here - need help from an expert.
To close on the py35_compat branch and completely merge the code, I think this test unit should be fixed, and I can clean-up a bit more on my side the setup.py which is using deprecated python.