Sunday, January 29, 2012

Speeding up Matlab over X11 Forwarding

Running Matlab over ssh is handy. If one wants to use the GUI, X11 forwarding is possible, but it is painfully slow if both machines are not inside a local network.

I found information about how to speed it up after googling for a while. In the end I think it is worth it to summarize the steps here:
  • In the current folder where you are going to run matlab from, create a file name java.opts with the content 
                   "-Dsun.java2d.pmoffscreen=false" (without the double commas).
  • Use compression with ssh, by connecting to the server with
                      ssh -c arcfour,blowfish-cbc -Y -C username@server

The speed up obtained is particularly noticeable when changing focus between different windows in the Matlab GUI.

16 comments:

  1. Yesss! How great! Finally!
    Thank you so much!

    ReplyDelete
  2. Matlab over SSH was unusable for me before, now its not bad at all. Thank you!

    ReplyDelete
  3. Thanks very much!
    But I think "-c" is only encryption, right?
    Can you comment on the java.opts? What does it tell java?

    ReplyDelete
  4. -C is for compression, you can check with 'man ssh'

    about the java option, it is explained here http://docs.oracle.com/javase/1.5.0/docs/guide/2d/flags.html#pmoffscreen

    it seems to have to do with off-screen rendering, but I haven't looked at the details.

    ReplyDelete
  5. OMG how fast matlab is compared what is was. Can I marry you?

    ReplyDelete
  6. Thank you so much! This was awesome :)

    ReplyDelete
  7. Wow. That is not even funny how much the java.ops helps.
    THANK YOU!

    ReplyDelete
  8. Wow, thanks so much.

    ReplyDelete
  9. Needed this once again. Thanks again.

    ReplyDelete
  10. thanks! is still not super fast, but so much better! :)

    ReplyDelete
  11. Can't thank you enough :D

    ReplyDelete
  12. Makes ssh-Matlab great again o_O. Thanks!

    ReplyDelete