Host connection error when running via Matlab on Win 10

Moderators: cyao, michael_borland

Post Reply
Björklund
Posts: 84
Joined: 19 May 2016, 07:14

Host connection error when running via Matlab on Win 10

Post by Björklund » 08 Jun 2016, 09:08

Hi,

I'm currently running Pelegant on a 64 bit Win 10 machine - I have until today been running just elegant and have run it from inside Matlab, where I also do my plotting and data analysis. I have a .bat file from which I run elegant/Pelegant and convert the output .sdds files to .txt which works perfectly with both elegant and Pelegant when I just run the .bat file on its own from within the main elegant directory (with .ele and .lte files, etc.).

My problem is that when I try to run the .bat file for Pelegant from inside Matlab, I get the following error message:
Error while connecting to host, No connection could be made because the target machine actively refused it. (10061)
Connect on sock (host=*computer name*, port=8676) failed, exhaused all end points
Unable to connect to '*computer name*:8676',
sock error: Error = -1


I have checked all my paths and such, and they are indeed the same between running in Matlab and running in cmd. I have also tried running Matlab with administrator priviliges and giving Matlab different firewall permissions and even turning the firewall off. I have no clue whatsoever how to solve this.

//Jonas

soliday
Posts: 390
Joined: 28 May 2008, 09:15

Re: Host connection error when running via Matlab on Win 10

Post by soliday » 10 Jun 2016, 10:51

Do you have Microsoft MPI v7 installed?
https://www.microsoft.com/en-us/downloa ... x?id=49926

Can you also verify that C:\Program Files\Microsoft MPI\Bin\mpiexec.exe is mpiexec that you are using and not some other mpiexec that you may have installed from MPICH or OPENMPI?

From my google search, the port 8676 is related to MPI which is used by Pelegant.

Björklund
Posts: 84
Joined: 19 May 2016, 07:14

Re: Host connection error when running via Matlab on Win 10

Post by Björklund » 10 Jun 2016, 11:34

Hi,

Yes, I have the MS MPI v7. I can run Pelegant, with and without my .bat file, with no issues, the error occurs when I try to run my .bat file (which calls mpiexec plus some sddsconvert and stuff) from Matlab. It doesn't even start pelegant, all it shows is the error message.

I haven't installed any other mpi's, so it must be the correct mpiexec. I wouldn't know how to verify this in some other way, though, if you know a way I could check it.

Regards
Jonas

soliday
Posts: 390
Joined: 28 May 2008, 09:15

Re: Host connection error when running via Matlab on Win 10

Post by soliday » 13 Jun 2016, 13:27

Check that Matlab isn't clearing out the MPI environment variable values. You should have:
MSMPI_BIN
MSMPI_INC
MSMPI_LIB32
MSMPI_LIB64

My guess is that Matlab is clearing out the MSMPI_BIN environment variable.

Björklund
Posts: 84
Joined: 19 May 2016, 07:14

Re: Host connection error when running via Matlab on Win 10

Post by Björklund » 14 Jun 2016, 02:35

Hi,

Where are these variables located? I'm not very experienced with this type of stuff...

//Jonas

soliday
Posts: 390
Joined: 28 May 2008, 09:15

Re: Host connection error when running via Matlab on Win 10

Post by soliday » 14 Jun 2016, 09:28

This link will show you all the environment variables in Windows 10
http://www.computerhope.com/issues/ch000549.htm

For Matlab I would try the setenv and getenv commands:
http://www.mathworks.com/help/matlab/ref/setenv.html
I don't know if the values would be passed into the dos() command you are probably using to execute the .bat file. I don't have Matlab for Windows, so I can't test it.

tiansk
Posts: 39
Joined: 16 Mar 2012, 22:01

Re: Host connection error when running via Matlab on Win 10

Post by tiansk » 09 Aug 2017, 02:44

Dear Björklund:

I met the same problem,do you solve the problem? If you do,can you submit the solution or sent me a email:tiansk@ihep.ac.cn?

Regards
Tiansk

tiansk
Posts: 39
Joined: 16 Mar 2012, 22:01

Re: Host connection error when running via Matlab on Win 10

Post by tiansk » 09 Aug 2017, 03:08

Hi,

I find a solution to this error:

Windows mpiexec default path:C/Program Files/Microsoft MPI/Bin/mpiexec.exe
while another mpiexec.exe file in:
C:\Program Files\MATLAB\R2017a\bin\win64\mpiexec.exe

When we call the command mpiexec in Matlab,the matlab default calling the mpiexec:
C:\Program Files\MATLAB\R2017a\bin\win64\mpiexec.exe

what I do is rename the C:\Program Files\MATLAB\R2017a\bin\win64\mpiexec.exe to mpiexec_matlab.exe,so when we call command mpiexec.exe,the Matlab execute the mpiexec.exe command in the direction:C/Program Files/Microsoft MPI/Bin/mpiexec.exe.
Such changes may lead to other problems,like Parallel computing built-in Matlab!

Tiansk

Post Reply