Page 1 of 1

Host connection error when running via Matlab on Win 10

Posted: 08 Jun 2016, 09:08
by Björklund
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

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

Posted: 10 Jun 2016, 10:51
by soliday
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.

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

Posted: 10 Jun 2016, 11:34
by Björklund
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

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

Posted: 13 Jun 2016, 13:27
by soliday
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.

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

Posted: 14 Jun 2016, 02:35
by Björklund
Hi,

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

//Jonas

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

Posted: 14 Jun 2016, 09:28
by soliday
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.

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

Posted: 09 Aug 2017, 02:44
by tiansk
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

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

Posted: 09 Aug 2017, 03:08
by tiansk
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