Run SSH (remote simulation) from Octave in Linux

How to use openEMS. Discussion on examples, tutorials etc

Moderator: thorsten

Post Reply
lebedevalexey
Posts: 11
Joined: Tue 05 May 2015, 15:28

Run SSH (remote simulation) from Octave in Linux

Post by lebedevalexey » Sun 09 Aug 2015, 14:12

Hello, Thorsten!

I tried to run remotely openEMS calculation from a client machine working under Linux Mint. Of course it needs specific set-ups in comparison with Windows. When I run openEMS via SSH connection from Matlab there is no problem. But when I do the same in Octave - Octave hangs on the line 'RunOpenEMS(Sim_Path,Sim_CSX, '', Settings);'. Do you have any idea which parameters I must write in 'Settings' structure to launch connection correctly?

thorsten
Posts: 1406
Joined: Mon 27 Jun 2011, 12:26

Re: Run SSH (remote simulation) from Octave in Linux

Post by thorsten » Sun 09 Aug 2015, 14:33

Hi,

I would not expect different settings for Octave vs. Matlab. But I confess that I only ever tried remote simulation using Matlab.
I will have a look.

What is your sever running on? Linux too? What are your current settings??

regards
Thorsten

thorsten
Posts: 1406
Joined: Mon 27 Jun 2011, 12:26

Re: Run SSH (remote simulation) from Octave in Linux

Post by thorsten » Sun 09 Aug 2015, 14:41

Hi,

I just did a run. It worked, but Octave does not print the ssh output. Thus you think it hangs, while it is actually running on the host.
I have to find a way to make Octave show the output...

regards
Thorsten

thorsten
Posts: 1406
Joined: Mon 27 Jun 2011, 12:26

Re: Run SSH (remote simulation) from Octave in Linux

Post by thorsten » Sun 09 Aug 2015, 14:56

Hi again,

replace line 151 in RunOpenEMS.m:

Code: Select all

status = unix([ssh_command ' ' ssh_options ' ' Settings.SSH.host ' "cd ' ssh_work_path ' && ' Settings.SSH.bin ' ' Sim_File ' ' opts '"' append_unix]);
with:

Code: Select all

status = system([ssh_command ' ' ssh_options ' ' Settings.SSH.host ' "cd ' ssh_work_path ' && ' Settings.SSH.bin ' ' Sim_File ' ' opts '"' append_unix]);
That is replace "unix" with "system". That makes Octave plot the system call output immediately.

BTW, I have configured Octave (using .octaverc) with:

Code: Select all

disp('disable recursive rmdir confirmation')
confirm_recursive_rmdir(0);

disp('set page screen output to 0 and immediate output to 1')
page_screen_output(0);
page_output_immediately(1);
Maybe if you do not have this, it will still page the output, making it look like hanging...

I will need to check if this is ok for Matlab too and make a commit.. Thanks for the feedback.

regards
Thorsten

lebedevalexey
Posts: 11
Joined: Tue 05 May 2015, 15:28

Re: Run SSH (remote simulation) from Octave in Linux

Post by lebedevalexey » Mon 10 Aug 2015, 13:36

Hi, Thorsten!

Thank you so much for such a quick answer. Because you already solved the problem of shh output in Octave, I think it is not necessary to write my settings here right now. I will do it later when I also test Octave with set-ups you gave. By the way, I use Linux Mint 17.2 as a client and Linux Ubuntu 14.04 LTS. And thank you again, Thorsten, you helped a lot!

lebedevalexey
Posts: 11
Joined: Tue 05 May 2015, 15:28

Re: Run SSH (remote simulation) from Octave in Linux

Post by lebedevalexey » Mon 10 Aug 2015, 18:58

Hi again, Thorsten!

So, I changed 'unix' by 'system' in line 151 of RunOpenEMS.m and now it works. I testet it in Matlab and Octave, there is no problem. According to your advice I added initialization commands into .octaverc and now Octave even manages to show the name of a temporary directory on a remote server.

As I guess a public key for SSH in Linux Mint is so to say 'globaly' known for ssh-service therefore I specify only in my matlab file the following parameters:

Code: Select all

Settings.SSH.host = 'alexeylebedev@141.60.191.101'; % lab PC
Settings.SSH.bin = '/opt/openEMS/bin/openEMS.sh';
That's all.

thorsten
Posts: 1406
Joined: Mon 27 Jun 2011, 12:26

Re: Run SSH (remote simulation) from Octave in Linux

Post by thorsten » Mon 10 Aug 2015, 21:40

Hi,

yes there would have been no need for further informations as the problem has been found.

And yes, the ssh password less login is independent of Octave or Matlab. You can no always login to your lab PC without a password. Please be aware that if someone gets access to your PC (and private keys) they have access to your lab-PC as well...

regards
Thorsten

Post Reply