Home:ALL Converter>How to execute mpirun or mpiexec command from a python script?

How to execute mpirun or mpiexec command from a python script?

Ask Time:2022-10-14T05:10:39         Author:Alireza Olama

Json Formatter

I have an MPI application written in C++. When I run the application using mpirun or mpiexec on my local machine shell, it works fine. The problem is that the mpi application should be executed after a request from the network (e.g. HTTP request) is received. Assuming that the application server is written in python, how can I execute the mpi application using mpiexec command from a python script? I used subprocesses.run() command but nothing happens.

My general question: What is the best way to run an MPI application in client/server architecture?

Thank you

Author:Alireza Olama,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/74061836/how-to-execute-mpirun-or-mpiexec-command-from-a-python-script
CSEngiNerd :

What options did you use with subprocess.run()? If you are trying to execute a shell command then you need to use shell=True\nsubprocess.run('ls', shell=True)\n\nYou would replace 'ls' with your mpiexec or mpirun command.",
2022-10-13T21:23:57
yy