01 function MPI_Abort()
02 % MPI_Abort - Aborts any currently running MatlabMPI sessions.
03 %
04 % MPI_Abort()
05 %
06 % Will abort any currently running MatlabMPI sessions.
07 % by looking for leftover Matlab jobs and killing them.
08 % Cannot be used after MatMPI_Deleta_all.
09 %
10
11 % Get possibly user defined settings.
12 machine_db_settings = MatMPI_Comm_settings ;
13
14 % Get list of pid files.
15 pid_files = dir('MatMPI / pid. *. *') ;
16 s = size(pid_files) ;
17 n_files = s(1) ;
18
19 % Create single qoute.
20 q = strrep(' '' ' ,' ' ,'') ;
21
22 % Check if there are any files
23 if (n_files < 1)
24 disp('No pid files found') ;
25 else
26
27 % Loop over each file.
28 for i_file = 1:n_files
29
30 % Get file name.
31 file_name = pid_files(i_file).name ;
32
33 % Check if there is a directory appended.
34 dir_sep = findstr(file_name ,'.') ;
35 if (dir_sep)
36
37 % Parse file name.
38 machine = file_name(1 ,(dir_sep(1) + 1):(dir_sep(end) - 1)) ;
39 pid = file_name(1 ,(dir_sep(end) + 1):end) ;
40
41 % Kill process.
42 % To use ssh, change 'rsh ' to 'ssh ' in line below.
43 % unix_command = ['rsh ' machine ' ' q 'kill -9 ' pid q];
44 unix_command = [ machine_db_settings.remote_launch machine ' ' q 'kill - 9 ' pid q] ;
45 disp(unix_command) ;
46 unix(unix_command) ;
47 end
48
49 end
50
51 end
52
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 % MatlabMPI
55 % Dr. Jeremy Kepner
56 % MIT Lincoln Laboratory
57 % kepner@ll.mit.edu
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59 % Copyright 2002 Massachusetts Institute of Technology
60 %
61 % Permission is herby granted, without payment, to copy, modify, display
62 % and distribute this software and its documentation, if any, for any
63 % purpose, provided that the above copyright notices and the following
64 % three paragraphs appear in all copies of this software. Use of this
65 % software constitutes acceptance of these terms and conditions.
66 %
67 % IN NO EVENT SHALL MIT BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
68 % SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
69 % THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF MIT HAS BEEN ADVISED OF THE
70 % POSSIBILITY OF SUCH DAMAGE.
71 %
72 % MIT SPECIFICALLY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING,
73 % BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
74 % FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
75 %
76 % THIS SOFTWARE IS PROVIDED "AS IS," MIT HAS NO OBLIGATION TO PROVIDE
77 % MAINTENANCE, SUPPORT, UPDATE, ENHANCEMENTS, OR MODIFICATIONS.
78
79
|