-
Notifications
You must be signed in to change notification settings - Fork 26
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
Octave support #74
Comments
Most of the core interaction in transplant should work without issue in Octave. The problem is the communication channel. Transplant uses zeromq as its socket implementation, and calls into libzmq using If you'd like to take a stab at this and re-implement ZMQ.m for Octave, I'd be grateful for a pull request! As long as the signature of ZMQ.m is not changed, I suspect the rest of Transplant would work with few modifications. But I am not a user of Octave, and probably won't find the time to do it myself. |
I'll check it out. Thank you |
I checked and it seemed that the main issue against implementing loadlibrary in Octave is not there anymore, so I opened a Matlab compatibility issue in Octave to see if an official implementation of the function could be possible (https://savannah.gnu.org/bugs/index.php?56176). Are there other things that need to be adapted in addition to loadlibrary? |
But there's an Octave Forge |
(BTW, Transplant looks like a cool library. I've added it to my public list of interesting FLOSS Matlab projects.) |
Oh, cool! The zeromq package on Octave Forge should do the trick! It would probably be easiest to make ZMQ.m Octave-aware, and have a special code path in Octave that uses the zeromq package. |
I installed the zeromq package.
Sounds like the way to go... I never used zeromq before, but will try...
what do you mean by special code path in Octave? (sorry if this is obvious) |
My idea is to have all Octave-specific code confined to ZMQ.m if possible. So we would have to modify ZMQ.m to have two code-paths, one using Would you like to take a stab at this? I'd be really grateful for a pull request! |
Are you aware of this: https://github.com/esromneb/zeromq-octave <https://github.com/esromneb/zeromq-octave> ?
and this: https://stackoverflow.com/questions/18877353/is-there-an-implementation-of-zmq-in-octave <https://stackoverflow.com/questions/18877353/is-there-an-implementation-of-zmq-in-octave>
May be helpful
Regards
Rob
… On 21/04/2019, at 23:11, Bastian Bechtold ***@***.***> wrote:
My idea is to have all Octave-specific code confined to ZMQ.m if possible. So we would have to modify ZMQ.m to have two code-paths, one using loadlibrary for Matlab, and one using the zeromq package for Octave. Both code paths (essentially ifs) should be able to co-exist in the same file.
Would you like to take a stab at this? I'd be really grateful for a pull request!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#74 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABRNQJXICC7O55GHDSGE2FTPRRDWDANCNFSM4HGUATNQ>.
|
Sure |
I started with it, but found out that zeromq package does not support zmq_ctx_new and zmq_ctx_term. I think it may be ok, but wanted to check it out, as I am a zmq newbie :) Beyond that, there are issues in the arguments to pass to Matlab vs. Octave. Octave does not support -nojvm and -nodesktop (there is --no-window-system and --no-gui, though), and -r functionality is accomplished with --eval. I have a way to distinguish matlab from octave in m-code (in the context of ZMQ.m), but we will need of sth similar in python (in the context of transplant_master.py). What do you think would be a good way to add this?I guess we can add a transplant input argument to specify matlab vs. octave... |
Mmm, I'm stacked with this:
Octave's zero_mq does not support zmq_msg_* functions, only zmq_recv... :/ EDIT: not a problem, octave forge package simplifies all this complexity (context and msg functions are internal) |
True, I hadn't thought of that. We'll have to start a different binary, too. I think the simplest way to do this would be a subclass of |
I implemented this the easy way, simply adding an argument called backend to the Matlab class, which defaults to "matlab" (vs. "octave"). And then a simple conditional sets the proper arguments. I hope it is ok. This is sth that can be improved later if you are not convinced about it. |
We'll have a look at the API once it actually works. For now, this is perfectly fine. (I am a strong believer in "tracer bullets": prototype implementations that solve the central problem, but none of the edge cases. Once a prototype is known to work, I like to iterate on the surrounding API. But I find it wasted effort to focus too much on the API while still working on the core algorithms; Too many things still change at that stage, to concern oneself with such details.) |
I get the following errors in Octave in comparison to Matlab: Matlab:
Octave:
And then Octave gets stuck forever in there.... There are errors while sending info coming from transplant_remote.m when calling the "what" and "idx". The first exists in Octave but there should be some sort of compatibility issue. Not sure what is going on with "idx". This is getting trickier as the mcode does not seem octave compatible... EDIT: I confused "message" with "idx", fixed. |
I'm a bit lost with those errors, if you know how to deal with that, please let me know... |
I guess the original issue is that Octave is not able to send this message:
|
I think it first gets lost in parsejson.m. Can you try and see if parsejson works in octave at all? |
Wow, you have a whole JSON decoder in there! You might not need that. Matlab R2016b and newer have |
In addition to parsejson, it seems there is sth else. When using msgpack, the messages look the same, however Matlab properly ends communication whereas Octave gets stuck: Matlab:
Octave:
|
It does indeed, but the official implementation is slower for long strings than my implementation, and uses |
@kupiqu, could you print the decoded messages instead of the binary blobs? At least it is heartening to see that my msgpack parser seems to work fine in Octave. |
Unfortunately Octave crashes when I try to do so, that's why I displayed binary data:
Actually, not sure it's octave that crashes here or just python :/ |
Unfortunately I don't have much time at the moment to continue digging, and even if I had some I am not sure how to proceed further. I attach the two files I changed (ZMQ.m and transplant_master.py), with the hope that you, or somebody else, can fix the remaining issues. |
Thank you very much for your efforts! If anyone else wants to take a stab at this, I would be grateful! |
The message "UnicodeDecodeError: 'utf-8' codec can't decode byte 0x.." reminded me of something I encountered about 2 years ago in relation to a similar error in SMOP: |
Just found some old notes on the UnicodeDecodeError: 'utf-8' issue. It's possible that the affected python code has been fixed since kupiqu ran his tests in 2019 and that there is nothing to repair in Transplant. One can always hope! |
wondering whether it would be hard to support octave, given that oct2py does not seem to be developed anymore (last release was ~2 years ago)
The text was updated successfully, but these errors were encountered: