Using remote matlab on a cluster: Lost connection but job keeps calculating. How to reopen matlab gui?
9 views (last 30 days)
Show older comments
Just lost connection while a script on matlab was running remotely on a linux cluster. I was running it from the remote matlab GUI just like I would do locally. Suddently I lost connection and that window closed, but reconnecting again to the cluster I can see the script keeps running with "top" command. Is there any way to reopen the matlab GUI just where I left it and keep seeing progress on the console?
3 Comments
Bjorn Gustavsson
on 4 Jun 2020
For future work, I suggest you start running matlab either with vnc-server-viewer (for the full gui-experience) or simply through screen running in an x-term. Those methods work well for interuption-sensitive connections.
Good luck this time!
Accepted Answer
Jason Ross
on 4 Jun 2020
The short answer: you can't get it back. It sounds like it's using X forwarding to send the GUI from the remote machine to your local machine.
As Bjorn Gustavsson says, if you are on a connection that has a high chance of dropping out or being ended somehow, you need to keep the display at the remote end if you want to keep this workflow. For Linux that means VNC (or something very much like it) if you want the GUI, or something like screen (or tmux) if you just want it in the terminal session.
Other approaches that may work:
- Use one of the support packages / add-ins for the different cluster types we integrate with, installed on your local machine. This assumes that your cluster admins have means of supporting this, and a bunch of other things. Most importantly it moves the network connection out of the "job" of updating display -- only the submit/status/data comes back over the wire. As I mentioned earlier, this assumes a number of things about your environment, setup, etc. So it may not be workable for you.
- Instead of running an interactive job from the console, submit jobs using the batch command. This will submit a job to the cluster whose results you can retrieve later. If you lose connection to the cluster you can reconnect/restart and then find the job and check the results.
2 Comments
Jason Ross
on 4 Jun 2020
You might ask the cluster admins what their recommended approaches are, I can imagine this is a relatively common question they get -- X forwarding has been around a long time (and I remember thinking how cool it was the first time I saw it) but it has a number of deficiencies like the one you saw. There are plenty of solutions that have been developed in the meantime, it's just a question of what your admins support/recommend.
More Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!