[padb-devel] [padb] r162 committed - Convert mpi-watch to use target_key_pair() to return data over the...
codesite-noreply at google.com
codesite-noreply at google.com
Wed Aug 26 11:43:56 BST 2009
Revision: 162
Author: apittman
Date: Wed Aug 26 03:43:13 2009
Log: Convert mpi-watch to use target_key_pair() to return data over the
network. Add a array_from_target_namespace() function to convert
from a target namespace to a array of values and call this from
show_mpi_watch. This should both reduce the amount of data mpi-watch
needs to pass around and also lower the CPU overhead required as well.
http://code.google.com/p/padb/source/detail?r=162
Modified:
/trunk/src/padb
=======================================
--- /trunk/src/padb Wed Aug 26 03:16:06 2009
+++ /trunk/src/padb Wed Aug 26 03:43:13 2009
@@ -2906,16 +2906,32 @@
}
printf("$l\n");
}
+
+# Convert back from a set of values (with ranges) in a namespace to a
array of
+# ranks containing the values. Assume that each rank only appears in the
+# namespace with one value.
+sub array_from_target_namespace {
+ my ($r) = @_;
+
+ my @all;
+ foreach my $value ( sort( keys( %{$r} ) ) ) {
+ while ( defined( my $rank = rng_shift( $r->{$value} ) ) ) {
+ $all[$rank] = $value;
+ }
+ }
+ return @all;
+}
sub show_mpi_watch {
my ( $handle, $lines ) = @_;
- my $s = "";
- foreach my $l ( sort { $a <=> $b } ( keys %{ $lines->{target_responce}
} ) )
- {
- $s .= $lines->{target_responce}{$l}{state};
- }
- print("$s\n");
+ my @all = array_from_target_namespace( $lines->{target_data}{state} );
+
+ my $o = "";
+ while ( defined( my $v = shift(@all) ) ) {
+ $o .= $v;
+ }
+ print("$o\n");
}
# Nicely format process information.
@@ -6456,7 +6472,6 @@
sub mpi_watch_all {
my ( $carg, $list ) = @_;
- my %res;
my $fns = mpi_watch_load($carg);
foreach my $proc ( @{$list} ) {
@@ -6466,7 +6481,7 @@
# Load the status now before we attach with GDB,
# otherwise we'll just see it as "T" (Stopped).
my $m = find_from_status( $pid, "State" );
- target_key_pair( $vp, "state", $m );
+ target_key_pair( $vp, "proc_state", $m );
if ( $m eq "R" ) {
$m = ",";
} elsif ( $m eq "S" ) {
@@ -6493,7 +6508,7 @@
my $pid = $proc->{pid};
if ( not defined $proc->{gdb} ) {
- $res{$vp}{state} = $proc->{state};
+ target_key_pair( $vp, "state", $proc->{state} );
next;
}
@@ -6536,7 +6551,7 @@
$mode = "m";
}
}
- $res{$vp}{state} = $mode;
+ target_key_pair( $vp, "state", $mode );
next;
}
@@ -6554,13 +6569,13 @@
}
if ( defined $fnmode ) {
- $res{$vp}{state} = $fns->{names}{$fnmode};
+ target_key_pair( $vp, "state", $fns->{names}{$fnmode} );
next;
}
# Fall through case.
- $res{$vp}{state} = $proc->{state};
+ target_key_pair( $vp, "state", $proc->{state} );
}
foreach my $proc ( @{$list} ) {
@@ -6570,7 +6585,6 @@
}
}
- return \%res;
}
sub maybe_show_pid {
More information about the padb-devel
mailing list