Launching matlab remotely on windows via ssh? Impossible?

There are two undocumented hacks that reportedly fix a similar problem - they are not guarantied to solve your particular problem but they are worth a try. Both of them depend on modifying the java. Opts file : Dsun.

Java2d. Pmoffscreen=false Setting this option fixes a problem of extreme GUI slowness when launching Matlab on a remote Linux/Solaris computer Djava. Compiler=NONE This option disables the Java just-in-time compiler (JITC).

Note that it has no effect on the Matlab interpreter JITC. It has a similar effect to running Matlab with the '–nojvm' command-line option. Note that this prevents many of Matlab's GUI capabilities Unfortunately, in some cases there is no alternative.

For example, when running on a remote console or when running pre-2007 Matlab releases on Intel-based Macs In such cases, using the undocumented '-noawt' command-line option, which enables the JVM yet prevents JAVA GUI, is a suggested compromise.

There are two undocumented hacks that reportedly fix a similar problem - they are not guarantied to solve your particular problem but they are worth a try. Both of them depend on modifying the java. Opts file: -Dsun.

Java2d. Pmoffscreen=false Setting this option fixes a problem of extreme GUI slowness when launching Matlab on a remote Linux/Solaris computer. -Djava.

Compiler=NONE This option disables the Java just-in-time compiler (JITC). Note that it has no effect on the Matlab interpreter JITC. It has a similar effect to running Matlab with the '–nojvm' command-line option.

Note that this prevents many of Matlab's GUI capabilities. Unfortunately, in some cases there is no alternative. For example, when running on a remote console or when running pre-2007 Matlab releases on Intel-based Macs.In such cases, using the undocumented '-noawt' command-line option, which enables the JVM yet prevents JAVA GUI, is a suggested compromise.

Thanks for the reply, gave them a shot, unfortunately they don't seem to work. Here is a screenshot of the GUI that matlab brings up imgur. Com/naOyF.

Png – Bob E. Apr 18 '10 at 23:00 My current plan of attack is to write a python script and run it locally on the windows machines. The script will watch a directory for files to be created.

When a file is submitted to that directory remotely over ssh, the local python script will read the file and parse out the matlab command, and launch that command locally, GUI and all, but it will at least be automated. – Bob E. Apr 18 '10 at 23:02 Bob - read my reply carefully: you need to place the -D options in your java.

Opts file - they are not command-line options. Also see Mike's response in his blog today: blogs.mathworks. Com/desktop/2010/02/22/… – Yair Altman Apr 19 '10 at 17:57.

Long story: I think you're fundamentally out of luck if you want to interact with it, but this should work if you just want to batch jobs up. Matlab on Windows is a GUI application, not a console application, and won't interact with character-only remote connectivity. But you can still launch the process.

Matlab will actually display the GUI - it will just be in a desktop session on the remote computer that you have no access to. But if you can get it to do your job without further input, this can be made to work, for some value of "work". Your "-r script" switch is the right direction.

But realize that on Windows, Matlab's "-r" behavior is to finish the script and then go back to the GUI, waiting for further input. You need to explicitly include an "exit()" call to get your job to finish, and add try/catches to make sure that exit() gets reached. Also, you should use a "-logfile" switch to capture a copy of all the command window output to a log file so you can see what it's doing (since you can't see the GUI) and have a record of prior runs.

Also, matlab. Exe is asynchronous by default. Your ssh call will launch Matlab and return right away unless you add the "-wait" switch.

Check the processes on the machine you're sshing to; Matlab may actually be running. Add -wait if you want it to block until finished. One way to do this stuff just use -r to call to a standard job wrapper script that initializes your libraries and paths, runs a job, and does cleanup and exit.

You'll also want to make a . Bat wrapper that sets up the -logfile switch to point to a file with the job name, timestamp, and other info in it. Something like this at the M-code level.

Function run_batch_job(jobname) try init_my_matlab_library(); % By calling classpath(), javaclasspath(), etc feval(jobname); % assumes jobname is an M-file on the path catch err warning('Error occurred while running job %s: %s', jobname, err. Message) end try exit(); catch err % Yes, exit() can throw errors java.lang.System. Exit(1); % Scuttle the process hard to make sure job finishes end % If your code makes it to here, your job will hang I've set up batch job systems using this style in Windows Scheduler, Tidal, and TWS before.

I think it should work the same way under ssh or other remote access. A Matlab batch system on Windows like this is brittle and hard to manage. Matlab on Windows is fundamentally not built to be a headless batch execution system; assumptions about an interactive GUI are pervasive in it and hard to work around.

Low-level errors or license errors will pop up modal dialog boxes and hang your job. The Matlab startup sequence seems to have race conditions. You can't set the exit status of MATLAB.exe.

There's no way of getting at the Matlab GUI to debug errors the job throws. The log file may be buffered and you lose output near hangs and crashes. And so on.

Seriously consider porting to Linux. Matlab is much more suitable as a batch system there. If you have the money or spare licenses, you could also use the Matlab Distributed Computing toolbox and server to run code on remote worker nodes.

This can work for parallelization or for remote batch jobs.

TeamViewer Download it & Use it for free (personal-use). Allows U to remote-login and access your Desktop GUI. (Optimised for low-bandwidth connections) teamviewer.com/index.aspx.

Thanks for the response. The machines all already have Microsoft Remote Desktop installed and that is how I access them remotely for the most part. The problem is how to automate and launch matlab to perform batch computations remotely, and unfortunately, I can't think of how to do that using neither TeamViewer or Remote Desktop.

– Bob E. Apr 18 '10 at 16:57.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions