Browse Prior Art Database

Dynamic Debug of Parallel/Distributed Programs

IP.com Disclosure Number: IPCOM000110780D
Original Publication Date: 1994-Jan-01
Included in the Prior Art Database: 2005-Mar-26
Document File: 4 page(s) / 100K

Publishing Venue

IBM

Related People

Hearn, AR: AUTHOR

Abstract

Proposed is dynamic invocation of a software debugging aid from within a program to solve difficulties encountered when attempting to synchronize error debugging of parallel programs.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 52% of the total text.

Dynamic Debug of Parallel/Distributed Programs

      Proposed is dynamic invocation of a software debugging aid from
within a program to solve difficulties encountered when attempting to
synchronize error debugging of parallel programs.

      A problem exists with the use of Workstations (e.g., RISC
SYSTEM/6000*) in a cluster for parallel processing.  To debug such a
program requires control of all the processes on each processor.
Disclosed is a method of running a debug tool concurrently on all the
processes.  Many of the processes could spawn other processes, and
controlling the execution and analyzing these processes is also a
problem.  The solution is to initiate a debug tool on the process
using one fork of the process itself.  To demonstrate the method, an
example is given using the debug aid Xcdb.  The message-passing tool
used in the example is PVM, but the method could apply to any message
passing tool and any debug aid that is Process ID selective.   To
invoke the debug aid dynamically within the program is achieved by
adding two lines to both the host and node programs.  The first line
calls a routine called 'xcdbg' which 'forks' the process.  The
'child' process dynamically calls xcdbg using the 'parent' Process
ID.  The second line prevents the parent process proceeding by adding
a sleep command.

The source code for xcdbg is as follows:

/********************************************

* Dynamic use of Xcdb for Parallel Programs *

* Written by A R Hearn 14 Oct 92            *

* Last updated:                             *

*                                           *

********************************************/

#include<stdio.h>

     /*--------------------------*/

    /* nm = program name        */

   /*  me = instance           */

  /*   di = display ID        */

 /*    cd = source directory */

/*--------------------------*/

void xcdbg(char *nm, int me, char *di, char *cd)

{

  int lnm, ldi, lcd;

  pid_t pid, fpid;

  char *xc;

  lnm = strlen(nm);

  ldi = strlen(di);

  lcd = strlen(cd);

  xc = (char *)malloc((1di+1cd+2*1nm+43)*sizeof(char));

  pid = getpid();

  fpid = fork();

  if(0==fpid){

  sprintf(xc, "xcdb -display %s -title '%2d %s' -a %6d -s %s %s\0",

  di,me,nm,pid,cd,nm);

  system(xc); exit(0);}

{

      The following simple program shows how to use the routine on a
program requiring debug.  Only the first part of the program is shown
for brevity.

#include<stdio.h>

#include<math.h>

extern double eltime(int);     /* elapsed time */

extern void xcdbg(char *, int, char *, char *); /* added for debug */

main(int argc, char *argvffl")

{

  int i, j = 0, k = 0, stat;

  int me, nprcs = 2, number, loops;

  float *data, div, avt , maxt, mint, delt;

  double *times, *timee;

  int bytes, msgtype, instance;

  char compoffl32";

     /****************/

    /* Enroll ...