title: Intel MPI mpirun does not terminate using java Process.destroy()
body: <p>My Intel MPI version is impi/5.0.2.044/intel64 installed on a RHEL machine.</p>
  
  <p>I am using java to invoke an MPI program using the following code:</p>
  
  <pre><code>ProcessBuilder builder = new ProcessBuilder();
  builder.command("mpirun ./myProgram");
  builder.redirectError(Redirect.to(new File("stderr")));
  builder.redirectOutput(Redirect.to(new File("stdout")));
  Process p = null;
  try {
      p = builder.start();
  } catch (IOException e) {
      e.printStackTrace();
  }
  // Process has started here
  p.destroy();
  try {
      // i = 143
      int i = p.exitValue();
  } catch( IllegalThreadStateException e){
  }
  </code></pre>
  
  <p>But even after the <code>exitValue()</code> is known without throwing exception, <code>ps aux</code> still shows a bunch of <code>./myProgram</code>, and the program is still writing result files as if it is not being killed, terminating only after it finishes all its calculation.</p>
  
  <p>Currently, the only way I find successful to terminate <code>./myProgram</code> is to terminate the java using <code>Ctrl+C</code> in the console to the java program.</p>
  
  <p>My intention is to stop the calculation immediately and let the java program schedule some other calculation. Is there any walkaround to force all mpi instances to terminate, or at least guarantee a termination in small, definite amount of time (e.g. 30s or 1 min of polling)?</p>