<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hello Kin Fai, in Intel® MPI Library</title>
    <link>https://community.intel.com/t5/Intel-MPI-Library/How-to-kill-MPI-program-programatically/m-p/1004396#M3826</link>
    <description>&lt;P&gt;Hello Kin Fai,&lt;/P&gt;

&lt;P&gt;You can try&amp;nbsp;'mpirun -cleanup' or I_MPI_HYDRA_CLEANUP environment variable. With this option the list of MPI processes is saved into a file. Then the processes can be cleaned up with 'mpicleanup' utility. I suppose there may be some limitations for spawned processes. See Intel® MPI Library for Linux* OS Reference Manual for details.&lt;/P&gt;

&lt;P&gt;Regarding to:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
	&lt;P&gt;Or is there any setting that will ensure signals like keyboard interrupt will propagate to processes related?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;As far as I know it should be propagated by default. Do you have any problems with the propagation?&lt;/P&gt;</description>
    <pubDate>Mon, 31 Aug 2015 11:50:21 GMT</pubDate>
    <dc:creator>Artem_R_Intel1</dc:creator>
    <dc:date>2015-08-31T11:50:21Z</dc:date>
    <item>
      <title>How to kill MPI program programatically</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/How-to-kill-MPI-program-programatically/m-p/1004395#M3825</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;

&lt;P&gt;I am having problem destroying Intel MPI program, the original problem is described at this thread.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/32222878/intel-mpi-mpirun-does-not-terminate-using-java-process-destroy" target="_blank"&gt;http://stackoverflow.com/questions/32222878/intel-mpi-mpirun-does-not-terminate-using-java-process-destroy&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I am using impi/5.0.2.044/intel64, and my program is launched with "mpirun -machinefile mymachinefile ./myprogram"&lt;/P&gt;

&lt;P&gt;I followed the suggestion to have the runtime executing "kill -&amp;lt;signal&amp;gt; &amp;lt;pid&amp;gt;", but doesn't work for signal 1, 2, 9, 15.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I have tried to used I_MPI_DEBUG=5 and still no pid get printed.&lt;/P&gt;

&lt;P&gt;Is there any environmental variable I can use to get ALL pids related to the current launch, so I can send a kill signal to each process?&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Or is there any setting that will ensure signals like keyboard interrupt will propagate to processes related?&lt;/P&gt;</description>
      <pubDate>Sun, 30 Aug 2015 01:31:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/How-to-kill-MPI-program-programatically/m-p/1004395#M3825</guid>
      <dc:creator>Kin_Fai_T_</dc:creator>
      <dc:date>2015-08-30T01:31:56Z</dc:date>
    </item>
    <item>
      <title>Hello Kin Fai,</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/How-to-kill-MPI-program-programatically/m-p/1004396#M3826</link>
      <description>&lt;P&gt;Hello Kin Fai,&lt;/P&gt;

&lt;P&gt;You can try&amp;nbsp;'mpirun -cleanup' or I_MPI_HYDRA_CLEANUP environment variable. With this option the list of MPI processes is saved into a file. Then the processes can be cleaned up with 'mpicleanup' utility. I suppose there may be some limitations for spawned processes. See Intel® MPI Library for Linux* OS Reference Manual for details.&lt;/P&gt;

&lt;P&gt;Regarding to:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
	&lt;P&gt;Or is there any setting that will ensure signals like keyboard interrupt will propagate to processes related?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;As far as I know it should be propagated by default. Do you have any problems with the propagation?&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2015 11:50:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/How-to-kill-MPI-program-programatically/m-p/1004396#M3826</guid>
      <dc:creator>Artem_R_Intel1</dc:creator>
      <dc:date>2015-08-31T11:50:21Z</dc:date>
    </item>
    <item>
      <title>Regarding to the incorrect</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/How-to-kill-MPI-program-programatically/m-p/1004397#M3827</link>
      <description>&lt;P&gt;Regarding to the incorrect signal propagation -&amp;nbsp;I've reproduced this&amp;nbsp;for mpirun. I'll submit an internal ticket to fix this.&lt;BR /&gt;
	You can use mpiexec.hydra launcher instead of mpirun - there should be correct signal propagation.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2015 12:35:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/How-to-kill-MPI-program-programatically/m-p/1004397#M3827</guid>
      <dc:creator>Artem_R_Intel1</dc:creator>
      <dc:date>2015-08-31T12:35:50Z</dc:date>
    </item>
    <item>
      <title>For your reference, I have</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/How-to-kill-MPI-program-programatically/m-p/1004398#M3828</link>
      <description>&lt;P&gt;For your reference, I have the following toy code in java you can check.&amp;nbsp;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;I've also noticed the same issue when using python.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;The returned Process from the runtime is actually a handle to something like "sh /$PATH_TO_MPIRUN/mpirun -np 6 ./a.out", so p.destroy(); actually destroy the shell, and mpirun may not be noticed of it. However, in the case of pressing CTRL+C in a terminal running mpirun, the interrupt can be propagated.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Anyway, thanks for your help, and I've solved my problem with the working workaround shown.&lt;/P&gt;

&lt;PRE class="brush:java;"&gt;package test;

import java.io.IOException;
import java.lang.reflect.Field;

public class TestMain {

	public static void main(String[] args) throws IOException, InterruptedException {
		Process p = Runtime.getRuntime().exec("mpirun -cleanup -tmpdir ./ -np 6 ./a.out");
		int pid = 0;
		if (p.getClass().getName().equals("java.lang.UNIXProcess")) {
			try {
				Field f = p.getClass().getDeclaredField("pid");
				f.setAccessible(true);
				System.out.println(pid = f.getInt(p));
			} catch (Throwable e) {
			}
		}
		Thread.sleep(10000);
		// p.destroy(); // Dosen't work
		Runtime.getRuntime().exec("mpicleanup -i mpiexec_kftse_" + pid + ".log"); // worked
	}
}
&lt;/PRE&gt;

&lt;PRE class="brush:cpp;"&gt;#include &amp;lt;mpi.h&amp;gt;

int main(int argc, char* argv[]){
 MPI_Init(&amp;amp;argc, &amp;amp;argv);
 while( true ){
 }
 MPI_Finalize();
}
&lt;/PRE&gt;

&lt;P&gt;Best,&lt;/P&gt;

&lt;P&gt;Kin Fai&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2015 13:46:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/How-to-kill-MPI-program-programatically/m-p/1004398#M3828</guid>
      <dc:creator>Kin_Fai_T_</dc:creator>
      <dc:date>2015-08-31T13:46:53Z</dc:date>
    </item>
  </channel>
</rss>

