I'm using mip4py and I am able to run my code from the command prompt using mpiexec -n 4 python myfile.py. I want to use the 'run' button in Spyder to do the same, how do I go about integrating my custom run command (or mpi) with Spyder run?

1 Answers

0
Carlos Cordoba On

(Spyder maintainer here) You can run your file with our Run button by putting the following code in a different file:

from IPython import get_ipython
ip = get_ipython()
ip.run_cell("!mpiexec -n 4 python myfile.py")

Note: It's very important that you use a different file to not cause an infinite recursion while evaluating the above code.