[padb] r380 committed - Change to the message queue code, no longer have the output of minfo...

padb at googlecode.com padb at googlecode.com
Tue Dec 22 20:03:55 GMT 2009


Revision: 380
Author: apittman
Date: Tue Dec 22 12:03:45 2009
Log: Change to the message queue code, no longer have the output of minfo
reported directly to the user but rather have the interaction between
minfo and padb entirely private and have padb assemble the message
shown to the user.  This allows me to change the protocol without
affecting the output shown and as padb now knows the contents of the
message queues as datatypes opens the possibility of doing cleverer
things with the data.
Currently padb formats the output exactly the same as minfo did before
so there should be no user-visable change from this commit.

http://code.google.com/p/padb/source/detail?r=380

Modified:
  /trunk/src/minfo.c
  /trunk/src/padb

=======================================
--- /trunk/src/minfo.c	Mon Dec 21 11:57:07 2009
+++ /trunk/src/minfo.c	Tue Dec 22 12:03:45 2009
@@ -486,6 +486,11 @@
  	}
      }
  }
+
+void show_msg_op (char *name, int value)
+{
+    printf("Msg: %s:%d\n",name,value);
+}

  void show_op (mqs_pending_operation *op, int msgid, int type)
  {
@@ -494,36 +499,37 @@

      if ( type == mqs_pending_sends || op->status == mqs_st_matched ||  
op->status == mqs_st_complete )
  	all = 1;
-
-    printf("msg%d: Operation %d (%s) status %d (%s)\n",
-	   msgid,type,op_types[type],op->status,op_status[op->status]);
-    printf("msg%d: Rank local %d global %d\n",
-	   msgid,(int)op->desired_local_rank, (int)op->desired_global_rank);
-    if ( all )
-	printf("msg%d: Actual local %d global %d\n",
-	       msgid, (int)op->actual_local_rank, (int)op->actual_global_rank);
-    if ( all )
-	printf("msg%d: Size desired %d actual %d\n",
-	       msgid, (int)op->desired_length, (int)op->actual_length);
-    else
-	printf("msg%d: Size desired %d\n",
-	       msgid, (int)op->desired_length);
-    printf("msg%d: tag_wild %d\n",msgid,op->tag_wild);
-    if ( all )
-	printf("msg%d: Tag desired %d actual %d\n",
-	       msgid, (int)op->desired_tag, (int)op->actual_tag);
-    else
-	printf("msg%d: Tag desired %d\n",msgid, (int)op->desired_tag);
-    printf("msg%d: system_buffer %d\n",msgid,op->system_buffer);
-    printf("msg%d: Buffer 0x%lx\n",msgid,(long)op->buffer);
+
+    show_msg_op("start",1);
+
+    show_msg_op("op_type",type);
+    show_msg_op("status",op->status);
+
+    show_msg_op("desired_local_rank",op->desired_local_rank);
+    show_msg_op("desired_global_rank",op->desired_global_rank);
+    show_msg_op("desired_length",op->desired_length);
+    show_msg_op("desired_tag",op->desired_tag);
+    if ( all ) {
+	show_msg_op("actual_local_rank",op->actual_local_rank);
+	show_msg_op("actual_global_rank",op->actual_global_rank);
+	show_msg_op("actual_length",op->actual_length);
+	show_msg_op("actual_tag",op->actual_tag);
+    }
+
+    show_msg_op("tag_wild",op->tag_wild);
+    show_msg_op("system_buffer",op->system_buffer);
+
+    printf("Buffer 0x%lx\n",(long)op->buffer);

      i = 0;
      do {
  	if ( op->extra_text[i][0] )
-	    printf("msg%d: '%s'\n",msgid,op->extra_text[i]);
+	    printf("'%s'\n",op->extra_text[i]);
  	else
  	    i = 10;
      } while ( i++ < 5 );
+
+    show_msg_op("done",1);
  }

  void load_ops (mqs_process *target_process,int type)
=======================================
--- /trunk/src/padb	Tue Dec 22 07:10:41 2009
+++ /trunk/src/padb	Tue Dec 22 12:03:45 2009
@@ -6353,13 +6353,14 @@
      my %stats;

      # Communicator data.
-    my %cd;
+    my %communicator_descriptor;
+    my %message_descriptor;

      my %global;

      $global{exit} = 'unknown';

-    my @cd;
+    my @communicator_list;
      my $bytes_to_read;
      my $str_name;
      my $str_value = $EMPTY_STRING;
@@ -6393,7 +6394,7 @@
                          target_key_pair( $vp, 'minfo_msg', $str_name );
                      }
                  } else {
-                    $cd{$str_name} = $str_value;
+                    $communicator_descriptor{$str_name} = $str_value;
                  }
                  $bytes_to_read = undef;
                  $str_value     = "";
@@ -6455,13 +6456,40 @@
                      $str_name      = $name;
                      $str_global    = 0;
                  } elsif ( $key eq 'rt' ) {
-                    push @{ $cd{rt} }, $value;
+                    push @{ $communicator_descriptor{rt} }, $value;
                  } else {
-                    $cd{$key} = $value;
-                    $cd{mid} = $cid;
+                    $communicator_descriptor{$key} = $value;
+                    $communicator_descriptor{mid} = $cid;
                  }
              } else {
-                target_key_pair( $vp, 'UNPARSEABLE MINFO', $r );
+                target_error( $vp, "UNPARSEABLE MINFO: $r" );
+            }
+        } elsif ( $cmd eq 'Msg:' ) {
+            $stats{msg}++;
+            if (
+                $r =~ m{\A
+                        Msg:
+                        [ ]
+                        (\w+):
+                        (-?\d+)
+                        \z
+                        }x
+              )
+            {
+                my $key   = $1;
+                my $value = $2;
+
+                if ( $key eq 'start' ) {
+                    undef %message_descriptor;
+                } elsif ( $key eq 'done' ) {
+                    push @{ $communicator_descriptor{messages} },
+                      dclone( \%message_descriptor );
+                    undef %message_descriptor;
+                } else {
+                    $message_descriptor{$key} = $value;
+                }
+            } else {
+                target_error( $vp, "UNPARSEABLE MINFO: $r" );
              }
          } elsif ( $cmd eq 'zzz:' ) {
              $stats{zzz}++;
@@ -6487,14 +6515,14 @@
                      $str_global    = 1;
                  }
              } else {
-                target_key_pair( $vp, 'UNPARSEABLE MINFO', $r );
+                target_error( $vp, "UNPARSEABLE MINFO: $r" );
              }
          } elsif ( $cmd eq 'done' ) {
-            push @cd, dclone( \%cd );
-            undef %cd;
+            push @communicator_list, dclone( \%communicator_descriptor );
+            undef %communicator_descriptor;
          } else {
              $stats{raw}++;
-            push @{ $cd{raw} }, $r;
+            push @{ $message_descriptor{raw} }, $r;
          }
      }

@@ -6535,7 +6563,7 @@
          }
      }

-    return minfo_to_array( \@cd );
+    return minfo_to_array( \@communicator_list );

  }

@@ -6545,7 +6573,6 @@
      my @mq;
      foreach my $comm ( @{$cd} ) {

-        #print Dumper $comm;
          push @mq, "comm$comm->{mid}: name: '$comm->{name}'";
          if ( defined $comm->{rank} ) {
              push @mq, "comm$comm->{mid}: rank: '$comm->{rank}'";
@@ -6558,8 +6585,43 @@
              push @mq, "comm$comm->{mid}: Rank: local $i global  
$comm->{rt}[$i]";
          }

-        foreach my $l ( @{ $comm->{raw} } ) {
-            push @mq, $l;
+        my $mid = 0;
+
+        foreach my $m ( @{ $comm->{messages} } ) {
+            my @op_desc = qw(pending_send pending_receive  
unexpected_message);
+            my @status_desc = qw(pending matched complete);
+            my $op = "Operation $m->{op_type} ($op_desc[$m->{op_type}])";
+            $op .= " status $m->{status} ($status_desc[$m->{status}])";
+            push @mq, "msg$mid: $op";
+            push @mq,
+"msg$mid: Rank local $m->{desired_local_rank} global  
$m->{desired_global_rank}";
+            if ( defined $m->{actual_global_rank} ) {
+                push @mq,
+"msg$mid: Actual local $m->{actual_local_rank} global  
$m->{actual_global_rank}";
+            }
+
+            if ( defined $m->{actual_length} ) {
+                push @mq,
+"msg$mid: Size desired $m->{desired_length} actual $m->{actual_length}";
+            } else {
+                push @mq, "msg$mid: Size desired $m->{desired_length}";
+            }
+            push @mq, "msg$mid: tag_wild $m->{tag_wild}";
+
+            if ( defined $m->{actual_tag} ) {
+                push @mq,
+"msg$mid: Tag desired $m->{desired_tag} actual $m->{actual_tag}";
+            } else {
+                push @mq, "msg$mid: Tag desired $m->{desired_tag}";
+            }
+
+            push @mq, "msg$mid: system_buffer $m->{system_buffer}";
+
+            foreach my $l ( @{ $m->{raw} } ) {
+                push @mq, "msg$mid: $l";
+            }
+
+            $mid++;
          }
      }
      return @mq;




More information about the padb-devel mailing list