Clear Filters
Clear Filters

system(command) execution of software fail on MatLab R2020b

14 views (last 30 days)
Hello,
I am trying to execute these operations In MS windows 10:
1) in a MatLab script, open the command prompt (CMD)
2) navigate to directory "D" (pre-defined in the script)
3) launch the program SU2_CFD in parallel mode with NP processors with configurations "script.cfg" using the command "mpiexec -n NP SU2_CFD script.cfg" in CMD
I have run the command in "3)" directly from the CMD and it works perfectly; I have run with the same script on MatLab R2017 and R2020a in MS win10 and Ubuntu and the command worked perfectly, but now I am trying to use it on Matlab R2020b and I get this error:
Error while connecting to host, Impossibile stabilire la connessione. Rifiuto persistente del computer di destinazione. (10061)
Connect on sock (host=DESKTOP-9QTV4NT, port=8676) failed, exhaused all end points
Unable to connect to 'DESKTOP-9QTV4NT:8676',
sock error: Error = -1 "
here you can find my piece of code:
command1 = ['cd ',D];
command2='mpiexec -n 8 SU2_CFD script.cfg'; % here NP=8
status = system([command1 '&&' command2]);
Please consider that D is predefined in the code and script.cfg was created before using the same code (so, when I call CMD, everything exists).
Thanks beforehand. Kind regards
Kevin

Answers (1)

Pratik
Pratik on 27 Jun 2024
Hi Kevin,
A possible reason for the error you are facing is that Matlab prioritizes its own mpiexec over Microsoft's. To verify if this is the case the following code snippet can be executed:
[~,cmd] = system('where mpiexec')
If the first path in the cmd variable is of the Matlab's mpiexec then the above assumption stands correct.
A workaround to this is to rename the Matlab's mpiexec file temporarily, please note that this may cause other problems,like Parallel computing built-in Matlab if not reverted back.
Following MATLAB Answer's post can be referred for another workaround:
I hope this helps!

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!