-
Notifications
You must be signed in to change notification settings - Fork 17
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
Running multiarray with JyNI #6
Comments
Hello Lothar, The error message states it fails in the method The relation to gc is also an explanation to why it works in rare cases. I suppose it works if no
In this sense the term "static" refers to "not heap-allocated" in the sense of static opposed to dynamic. To continue digging I recommend to set up your own numpy-build, such that you can insert logging, Currently I am busy with designing new-style class and custom Java-PyObject support for native side. I suppose this will be needed anyway to fully support the Python-part of NumPy. So I won't invest much time into multiarray front before JyNI alpha 4 is released, but of course you are more than welcome to dig here, do preparational work or maybe even get it working already. |
I also recommend to remove the last part
from your test snippet until it reliably survives the import part, or does it already? |
Hi Stefan, thanks for your fast and detailed reply. It does actually finishes normal in 1% of the starts and outputs the given array. But the other cases it fails at different stages, but mostly with the posted error message. I will compile my own numpy version and go this direction with the additional background knowledge from your paper. Totally understand your priorities for new-style classes as it is clearly stated on the website as next goal. |
Hi Stefan, can you please take a look at the following function in gcmodule.c:
I think after the memory allocation of newNext, it is not guranteed that newNext->position is zero. So this variable is not initialized at that point. Inserting a newNext->position = 0; oder something similar should fix this. After this change the multiarray python snippet above seems to be running ok. But the topic you mentioned may still be an issue. I uncommented the line: |
Argh, right. Stuff like this was also main reason why JyNI did not work on OSX out of the box. Feel encouraged to file a pull request for this fix. Regarding the non-heap object warning: Check whether you restored the warning properly. The context is:
You might notice the out-commented "else", which indicates that when I removed the warning I also added the '!' to
(Yes (and sorry for that), code clean-up is overdue; I target this for beta-phase.) If you already did it this way, note that it is actually okay to explore non-heap objects as long as the macro There is no reliable way in C to detect whether a pointer points to heap or static memory. I thought about making |
The way of uncommenting was wrong, thanks for pointing that out! The warnings are now gone, but I will keep this open issue in general in my head. My setup is "openSUSE Leap 42.1 (x86_64)". As next step I will check, if the methods of multiarray work. |
Just an update on this. Multiarray seems to be working fine with the current release of multiarray in numpy, but the precompiled package in Suse Linux does not work together with JyNI. In the latter case severe memory crashes are happening at random locations. The origin (JyNI vs. numpy) for these could not be identified. Some broken strings might indicate that at some point string arrays might be handled with insufficient memory. An analysis with valgrind is confirming "conditional jump or move depends on uninitialized value(s)”. Since there are many other valgrind messages from the jvm, further analysis is not pursued until the errors are confirmed with a different setup. These topic seems to be independent of the multiarray library. Therefore one could close the issue regarding its original intend. |
So; finally I found time to actually focus on this issue. First note that "today's" JyNI incorporates some fixes (also regarding memory flaws) compared to the version you used some weeks ago. So it's actually a new game. On my system (LMDE2, 64 bit) importing the multiarray module from numpy from package management works fine. (There is an issue with datetime though, because it is statically linked into bundled Python 2. So I had to provide datetime.so form a self-built Python 2. Given that Python 2 distributions with statically linked datetime are around, maybe JyNI should link it statically too, but that's another story.) However the next line This essentially means support for PyMemoryView builtin type is required, which in turn isn't feasible without supporting the buffer protocol. We will get there, but it will target JyNI 2.7-alpha.5. Interesting that you didn't get that error. The package manager reports my installed NumPy as |
Just repeated it with self-built current NumPy cloned from github/numpy. |
The multiarray works the same way as before for me i.e. it is working with the self built NumPy version from github/numpy. |
Interesting. I investigated where
With this dummy implementation the demo script works fine. However I still started to trace where NumPy requires this method on my system and it is called indirectly from All of these methods contain various if/else etc branching statements so maybe on your system the call just doesn't happen for some reason. I think it's tedious to find the exact cause for this and I'd better spend my time on providing a proper implementation of |
See #9 (comment) for this issue too. |
Given that JyNI significantly changed since the last activity here and I cannot reproduce this issue any more for two months or so now, I will close it. |
Hi,
I am trying to import multiarray as a next step towards numpy support. As test I use the following snippet:
Running this script usually fails with something like the following besides some rare cases where it actually works: (I can also provide the hs_err files if needed.)
This looks like some side effect due to some memory, which is overwritten. It looks like this is caused in the _PyImport_LoadDynamicModuleJy, when the "dyn load func" is called. I would appreciate any hints about this before I dig deeper into this.
Thanks,
Lothar
The text was updated successfully, but these errors were encountered: