title: How to create a single process but multithreads MFC GUI application with MPI?
body: <p>All I need is just to write a simple MFC Windows application using MSMPI, but I don't want to launch multiple processes as my GUI application may need some user interaction before the multi-threading part. For instance, I'd like to create 2 threads after click a 'Run' button.</p>
  
  <p>I have tried to run my program using the command line: mpiexec.exe -n 2 myprogram.exe but this will create two processes and I will see two application windows.</p>
  
  <p>I have also tried the MPI cluster debugging option in Visual Studio 2010 but it creates two processes as well.</p>
  
  <p>This seems to be a very basic question but I find it difficult to find an answer in Google.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>To eliminate the confusion here, I have to clarify a few things:</p>
  
  <ol>
  <li>I have a very complicated and large codebase that already uses MS-MPI <em>to achieve parallelism</em> and I have to build a MFC GUI on top of it. For this reason, I <strong>cannot</strong> use any other parallelism mechanism such as std::thread because that will mean I have to rewrite a lot of things which is not affordable.</li>
  <li><strong>From my understanding, to launch a MPI program, I have to run the external program called mpiexec.exe in Windows. I haven't figured out if it is possible to launch the program by its own and still achieve MPI features.</strong> I'm quite new to MPI. I'm not so sure if it is possible to achieve what I'm asking for. If it is not, I would be very appreciated if anyone can let me know why and possible workaround. </li>
  </ol>
  
  <p>Simply put, I want to create a MFC GUI wrapper for a MPI enabled software and this has to be a multithreading program instead of  multiple instances (processes) of this GUI wrapped program (e.g. running this program by mpiexec -n 2 xxx.exe will just create 2 instances of the same program)</p>