D e b u ggi ng para l l e l code i s somewhat more complex than debugging sequential code . We
Digital Technical journal No. 4 Februmy I 'J87
debug o u r para ! J e l code u s i n g the fol l ow i ng methodo logy. The functional ity of our para l lel code does not depend on the nu mber of slave processes or on which specific process performs a particular task. Therefore , the whole code can be executed by the same process. For example, CAYE N NE ru ns w i t h o n l y one process i f the nu mber of s lave p rocesses is spe c i fied to be zero . This a llows most algo r i t h m i c mod i fica tions made in the code to be debugged with the VMS debugging faci li t i es provided for sequen tial code.
After the first debuggi ng phase, a code section cou ld sti l l have errors when run with multiple p rocesses . Our rou t i nes a l low two fo rms of debugging, requested e ither through a flag i n t h e a rgu m e n t l i st o f t h e l o g i c a l fu n c t i o n MASTEILPROCESS or through a command- l i n e
option . The first form o f debugging permits the ass ignment of a different term i nal to each pro cess and the setting of a debugg i ng session for each process on i ts assigned term i nal . The sec ond form of debugging is i ntended to be used with a workstation. A different workstation win dow is assigned to each process, and a debugg i ng session is set up for each process i n its ass igned wi ndow. The number of processes that can be debugged concu rrently is l i m i ted to e ither the number of termi nals ava ilable or the number of workstation windows that can be opened.
Exa mple
The fol l owi n g exa m p l e , s hown i n F i gure 2 , i ll ustrates some of the functiona l i ty of our set of rout ines. We want to compute the sum SUM of all i ntegers from 1 to N' S. We assume that a mas ter process with the h e l p of N slave processes does the task. Each slave process is a ssigned a unique number PROCESS_NUM BER between 1 and N by the logical function MASTEILPROCESS. The section of shared memory consists of an array P A R T I A L _ S U M o f s i z e N. T h e s l a v e p r o cesses w o r k i n p a ra l l e l . E a c h sl ave process adds S conse c u t i ve i n tege rs a nd stores i ts re s u l t i n t h e s h a r e d m e m o r y l o c a t i o n PARTlAL_SUM (PROCES5_NUMBER) .
After the slave processes have completed their task, the master process adds their partial sums, stored in the shared array PARTIALSUM , to pro duce the final resu l t SUM . The code correspond ing to this procedure fo llows. ( Re member that master a n d slave process run t h e exact same executable fi le.)
1 2 3
A Parallel Implemen tation of the Circu it Simulator SPICE o n the VAX 8800 System P R O G R A M p a r a l l e l E ND L O G I C A L m a s t e r - p r o c e s s I N T E G E R p r o c e s s _ n u m b e r I N T E G E R n u m b e r _ o f _ s l a v e s , d e f a u l t _ n u m b e r _ o f _ s l a v e s I N T E G E R d e b u g _ f l a g P A R A M E T E R ( d e f a u l t _ n u m b e r _ o f _ s l a v e s = S , d e b u g _ f l a g = O ) C O M M O N / s h a r e d / n u m b e r _ o f _ s l a v e s C O M M O N / l o c a l / p r o c e s s _ n u m b e r I F ( m a s t e r _ p r o c e s s ( p r o c e s s _ n u m b e r , n u m b e r _ o f _ s l a ve s , d e f a u 1 t _ n u m b e r _ o f _ s 1 a v e s , 1 i n p u t 1 , 1 o u t p u t 1 , d e b u 9 -f 1 a g ) ) T H E N C A L L m a s t e r _ c o d e E L S E C A L L s l a v e _ c o d e E N D I F S U B R O U T I N E m a s t e r _ c o d e E N D I N T E G E R n u m b e r _ o f _ s l a v e s , ma x i m u m _ n u m b e r _ o f _ s l a v e s , i P A R A M E T E R ( ma x i m u m _ n u m b e r _ o f _ s l a v e s = 1 0 ) I N T E G E R p a r t i a l _ s u m ( ma x i m u m _ n u m b e r _ o f _ s l a v e s ) , s u m C O M M O N / s h a r e d / n u m b e r _ o f _ s l a v e s , p a r t i a l _ s u m C A L L f o r k s u m = 0 DO i = 1 , n u m b e r _ o f _ s l a v e s s u m = s u m + p a r t i a l _ s u m ( i ) E N DD O S U B R O U T I N E s l a v e _ c o d e E N D 1 24 I N T E G E R p r o c e s s _ n u m b e r , n u m b e r _ o f _ s l a v e s , s t a r t , s , i I N T E G E R p a r t i a L s u m ( 1 ) P A R A M E T E R ( s = 2 0 0 ) C O M M O N / l o c a l / p r o c e s s _ n u m b e r C O M M O N / s h a r e d / n u m b e r _ o f _ s l a v e s , p a r t i a l _ s u m p a r t i a l _ s um ( p r o c e s s _ n u m b e r ) = 0 s t a r t = < p r o c e s s _ n u m b e r - 1 ) * s DO i = s t a r t + 1 , s t a r t + s p a r t i a l _ s u m ( p r o c e s s _ n u m b e r ) p a r t i a l _ s u m ( p r o c e s s _ n u m b e r ) + i E N D D O C A L L j o i n _ e x i t
Figure 2 PROGRAM Parallel
Digital Technical Journal
In the next section we describe how we cre ated para l le l processi ng in severa l phases of the ci rcu i t s i m u lator SPICE to produce the program CAYENN E.