• Sonuç bulunamadı

Active pixel merging on hypercube multicomputers

N/A
N/A
Protected

Academic year: 2021

Share "Active pixel merging on hypercube multicomputers"

Copied!
8
0
0

Yükleniyor.... (view fulltext now)

Tam metin

(1)

M u l t i c o m p u t e r s *

Tahsin M. Kurd, Cevdet Aykanat, and Biilent ()zg/i~ Dept. of Computer Engineering and Information Sci.

Bilkent University, 06533 Ankara, TURKEY

A b s t r a c t . This paper presents algorithms developed for pixel merging phase of object-space parallel polygon rendering on hypercube-connected multicomputers. These algorithms reduce volume of communication in pixel merging phase by only exchanging local foremost pixels. In order to avoid message fragmentation, local foremost pixels should be stored in consecutive memory locations. An algorithm, called modified seanline z-buffer, is proposed to store local foremost pixels efficiently. This algo- rithm also avoids the initialization of scanline z-buffer for each scanline on the screen. Good processor utilization is achieved by subdividing the image-space among the processors in pixel merging phase. Efficient algo- rithms for load balancing in the pixel merging phase are also proposed and presented. Experimental results obtained on a 16-processor Intel's iPSC/2 hypercube multicomputer are presented.

1 I n t r o d u c t i o n

There are two approaches for parallel polygon rendering in multicomputers; image-space parallelism [1, 2, 3] and object-space parallelism [4, 5, 6]. In object- space parallel rendering, input polygons are partitioned among the processors. Each processor, then, runs a sequential rendering algorithm for its local polygons. Each generated pixel is locally z-buffered to eliminate local hidden pixels. After local z-buffering, pixels generated in each processor should be globally merged, because more t h a n one processor m a y produce a pixel for the same screen coor- dinate. T h e global z-buffering operations during the pixel merging phase can be considered as an overhead to the sequential rendering. Furthermore, each global z-buffering operation necessitates interprocessor communication. Efficient imple- mentation of the pixel merging phase is thus a crucial factor for the performance of object-space parallel rendering. In its simplest form, pixel merging phase can be performed by exchanging pixel information for all pixel locations between pro- cessors. We will call this scheme

full z-buffer merging.

This scheme m a y introduce large communication overhead in pixel merging phase because pixel information for inactive pixel locations are also exchanged. This overhead can be reduced * This work is partially supported by Intel Supercomputer Systems Division grant no. SSD100791-2 and The Scientific and Technical Research Council of Turkey (T/~IBiTAK) grant no. E E E A G - 5 .

(2)

by exchanging only local foremost pixels in each processor. This scheme is re- ferred to here as active pizel merging. The approaches in [5, 6] use architectures whose processors are interconnected in a tree structure for pixel merging phase. Both approaches result in low processor utilization in pixel merging phase due to tree topology. The processors in the lower levels of the tree (e.g., processors at the leaves) may have substantially less work than those in the upper levels of the tree. Another approach presented in [4] utilizes network broadcast capa- bility for pixel merging phase. Each processor, starting from the first processor and continuing in increasing processor id, broadcasts "active" pixels to a global frame buffer. The other processors capture the broadcast pixels and delete their local pixels which are hidden by the broadcast pixels. In this way, the number of pixels broadcast by the next processor is expected to decrease. Their approach will introduce a large communication overhead due to broadcast operation on medium-to-coarse grain distributed-memory architectures. In addition, their ap- proach suffers from low processor utilization because a processor remains idle until the end of pixel merging phase after broadcasting its pixels.

This paper investigates the object-space parallelism on hypercube-connected distributed-memory multicomputers. In our approach, the hypercube intercon- nection topology and message passing characteristics of hypercube multicom- puter are exploited. Algorithms proposed in this work achieve good processor utilization by implicitly subdividing image-space among the processors in pixel merging phase. The volume of communication is decreased by only exchanging local foremost pixels for active pixel locations as in [4]. However, storing only local foremost pixels for efficient pixel merging introduces some overhead to conventional scanline z-buffer algorithm. An algorithm, called modified scanline z-buffer, is proposed to reduce this overhead. The proposed algorithm also avoids initialization of scanline z-buffer for each scanline in local z-buffering. Load bal- ancing issue in pixel merging phase is discussed. Algorithms for achieving better load balance are proposed and discussed.

2

Modified Scanline Z-buffer A l g o r i t h m

In order to prevent message fragmentation in active pixel merging, the local fore- most pixels should be stored in consecutive memory locations. In this section, a modified scanline z-buffer algorithm is presented. This algorithm utilizes a mod- ified scanline scheme to store foremost pixels in consecutive memory locations efficiently. In addition, this algorithm avoids initialization of scanline z-buffer for each scanline by sorting polygon spans at each scanline in increasing minimum x-intersections.

When polygons are projected to the screen (of resolution N x N ) , some of the scanlines intersect the edges of the projected polygons. Each pair of such intersections is called a span. In the first step of the algorithm, the spans are generated and put into the scanlinc span lists. The scanline span lists involve a linked list for each scanline which contains the respective polygon spans. Each span is represented by a record, which contains the intersection pair (minimum x-intersection x~i~ and maximum x-intersection x ~ , x ) and necessary informa- tion for z-buffering and shading. Scanline span lists are constructed by inserting

(3)

the spans of the projected polygons to the a p p r o p r i a t e scanline lists in sorted (increasing) order according to their x,~i~ values. This sorting allows to perform local z-buffering without initializing the scanline array for each scanline on the screen.

In the second step, spans in the scanline lists are processed, in scanline order (y order), for local z-buffering and shading. T w o local arrays are used to store only local foremost pixels. First array is called

Winning Pizel

Array ( W P A ) used to store the foremost (winning) pixels. Each entry in this array contains location information, z value, and shading information about the respective lo- cal foremost pixel. Since z-buffering is done in scanline order, the pixels in the W P A are in scanline order and pixels in a scanline are stored in consecutive locations. Hence, for location information, only x value of the pixel generated for location

(x,y)

needs to be stored in W P A . Second array, called

Modified

Scanline

Array ( M S A ) of size N, is a modified scanline z-buffer. M S A [ x ] gives

the index in W P A of pixel generated at location x. Initially, each entry of the M S A is set to zero. Moreover, a "range" value is associated with each scanline. T h e "range" value of the current scanline is set to one plus the index of the last pixel, which is generated by the previous scanline, in W P A . T h e "range" value for the first scanline is set to i. Since spans are sorted in increasing Xmin values, if a location x in M S A has a value less than the "range" value of current scanline, it means that location x is generated by a span belonging to previous scanlines. For such locations, the generated pixels are directly stored into W P A without any comparison. Otherwise, the generated pixel is compared with the pixel pointed by the index value. This indexing scheme and sorting of spans in scanline span list avoid re-initialization of MSA at each scanline. However, due to comparison made with "range" value, an extra comparison is introduced for each pixel generated. These extra comparison operations are reduced as follows. T h e sorted order of spans in the scanline span lists assures t h a t when a span s in scanline y is rasterized, it will not generate a pixel location x which is less t h a n x~i~ of previous spans. The current span s is divided into two segments

such t h a t one of the segments cover the pixels generated by previous spans in the current scanline and other segment covers the pixels generated by spans of previous scanline. Distance comparisons are m a d e for the pixels in the first seg- ment. The pixels generated for the second segment are stored into W P A without any distance comparisons.

3

P i x e l Merging on H y p e r c u b e M u l t i c o m p u t e r

This section presents two active pixel merging algorithms developed for a d- dimensional hypercube multicomputer with P = 2 4 processors. In these algo- rithms, each processor initially owns local foremost pixels belonging to the whole screen of size N x N . Then, a global z-buffering operation is performed on local

foremost pixels so t h a t each processor gathers global foremost pixels belonging to a horizontal screen subregion of size N x N / P .

(4)

3.1 Pairwise Exchange Scheme

This scheme exploits the

recursive-halving

idea widely used in hypercube-specific global operations. This operation requires d concurrent divide-and-exchange stages. Within each stage i (for i = 0, 1, 2, ..., d - 1), each processor divides hor- izontally its current active region of size N x n into two equal sized subregions (each of size N x

n/2),

referred here as top and b o t t o m subregions, where n = N during the initial halving stage. Meanwhile, each processor divides its current lo- cal foremost pixels into two subsets as belonging to these two subregions, which are referred here as top and b o t t o m pixel subsets. Then, processor pairs which are neighbors over channel i exchange their top and b o t t o m pixel subsets. After the exchange, processors concurrently perform z-buffering operations between retained and received pixel subsets to finish the stage.

3.2 All-to-All Personalized C o m m u n i c a t i o n Scheme

T h e pairwise exchange scheme can also be considered as a

store-and-forward

scheme. At each stage, the received pixels are stored into the local m e m o r y of the processor. These pixels are c o m p a r e d and merged with the pixels retained. After this merge operation, some of the pixels are sent at the next exchange stage, i.e., they are forwarded towards the destination processor t h r o u g h other processors at each concurrent communication step. Note t h a t during these store-compare-and- forward stages, pixels m a y be copied from m e m o r y of one processor to m e m o r y of the other processors more t h a n once. This m e m o r y - t o - m e m o r y copy operations can be reduced by sending the pixels directly to their destination processors.

In i P S C / 2 hypercube multicomputer, communication between processors is done by Direct Connect Modules (DCMs). Communication between two non- neighboring processors is almost as fast as neighbor communications if all the links between two processors are not currently used by other messages. The communication hardware uses the e-cube routing algorithm [7]. Using DCMs, we can exchange messages between non-neighbor processors by the algorithm presented in [8]. This algorithm totally avoids message congestion by ensuring t h a t at each exchange stage, the pixel d a t a is directed to destination processors following disjoint paths.

In all-to-all personalized communication scheme, the screen is implicitly di- vided into P horizontal subregions. Each subregion is implicitly assigned to a processor. Then, each processor sends the pixels belonging to the subregion of processor "k" directly to processor "k". After P - I exchange steps, each proces- sot z-buffers the local pixels with the received pixels. Each processor holds a local z-buffer of size

N x N/P.

Local pixels are scattered onto the z-buffer without any distance comparisons. Then, each received pixel's z value is c o m p a r e d with the z value in the pixel location in the z-buffer. After all pixels are processed, z-buffer contains the pixels in the final picture.

4 L o a d B a l a n c i n g i n P i x e l M e r g i n g S t e p

In this section, t w o heuristics that i m p l e m e n t adaptive subdivision of screen a m o n g processors to achieve g o o d load balance in pixel m e r g i n g are presented.

(5)

4.1 R e c u r s i v e A d a p t i v e S u b d i v i s i o n

This scheme recursively divides the screen into two subregions such t h a t n u m b e r of pixels in one subregion is almost equal to the n u m b e r of pixels in the other subregion. This scheme is well suited to the recursive structure of the hypercube. Each processor counts the n u m b e r of local foremost pixels at each scanline and stores t h e m in an array. Each entry of the array stores the sum of local fore- most pixels at the corresponding scanline. An element-by-element global prefix sum operation is performed on this array to obtain the distribution of foremost pixels in all processors. Then, using this array, each processor divides the screen into two horizontal bands of consecutive scanlines so t h a t each region contains equal n u m b e r of active pixel locations. Along with the division of the screen, the hypercube is also divided into two equal subcubes of dimension d - 1. Top subregion is assigned to one subcube while b o t t o m subregion is assigned to other subcube. Subcubes perform subdivision of the local subregions concurrently and independently. Since screen is divided into horizontal bands, the global array obtained by global sum operation is used for further divisions of the screen.

4.2 Heuristic Bin Packing

In the recursive adaptive subdivision scheme, the subdivision of the screen is done on scanline basis, i.e., scanlines are not divided. For this reason, it is difficult to achieve exactly equal load in each subregion. In addition, when a division point is found and screen is divided into two subregions, each subregion is subdivided independent of the other one. As a result, at each recursive subdivision, the load imbalance between the subregions m a y p r o p a g a t e and increase. Therefore, at the end of recursive subdivision, some processors m a y still have substantially more work load t h a n others. A b e t t e r distribution of work load a m o n g the processors can be achieved by using a different partitioning scheme, called heuristic bin packing. In this scheme, the goal is to minimize the difference between the loads of the m a x i m u m loaded processor and m i n i m u m loaded processor. In order to realize this goal, a scanline is assigned to a processor with m i n i m u m work load. In addition, scanlines are assigned in decreasing n u m b e r of pixels they have, i.e., scanlines t h a t have large number of pixels are assigned at the beginning. In this way, large variations in the processor loads due to new assignments are minimized towards the end.

5 E x p e r i m e n t a l R e s u l t s

T h e algorithms proposed in this work were implemented in C language on a 16- node Intel i P S C / 2 hypercube multicomputer. Algorithms were tested for scenes composed of 1, 2, 4, and 8 tea pots for screens of size 400x400 and 640x640. The characteristics of the scenes are given in Table 1. T h e abbreviations in the figures and tables are AAPC: all-to-all personalized communication, PAIR: pairwise exchange, RS: recursive adaptive subdivision, HBP: heuristic bin packing, ZBUF- EXC: full z-buffer merging. All timing results in the tables are in milliseconds.

Table 2 illustrates the performance comparison of PAIR-RS scheme with full z-buffer merging. T h e timings for some scene instances for Z B U F - E X C scheme

(6)

T a b l e 1. Scene characteristics in terms of total number of pixels generated ( T P G ) , number of polygons, and total number of winning pixels in the final picture ( T P F ) for different screen sizes.

Scene Num. Of Polygons i P O T 3751 2 P O T 7502 4 POT_I 15004 4 POT_2 15004 8 POT_I 30008 8 POT_2 30008 N=400 N=640 T P G T P F T P G T P F 59091 43247 137043 110515 66802 37084 151881 94840 71578 26328 146468 66727 81735 35629 171480 90692 154187 52258 324464 133617 99589 36043 201829 91729

T a b l e 2. Relative execution times of full z-buffer merging and PAIR-RS for N=400.

P Scene 1 P O T 2 P O T 16 !4 P O T _ I i4 P O T _ 2 8 P O T _ I 8 P O T _ 2 !i P O T 12 p O T 8 4 P O T _ I ~ POT_2 POT_I PAIR-RS ZBUF-EXC

Span List Local Pixel Span List Local Pixel Creation z-buffer Merging Creation z-buffer Merging

322 434 348 316 578 2015 481 471 341 470 585 1940 1038 520 323 1015 647 1930 1124 579 408 1099 702 1958 2142 1079 684 2104 1128 2043 2087 701 451 2029 805 1958 630 815 468 612 952 1941 947 886 475 920 989 1882 2037 989 419 1968 1093 1798 2268 1109 545 2186 1191 1881 4219 2030 861 * * *

c o u l d n o t b e o b t a i n e d due t o insufficient local m e m o r y . T h o s e cases a r e i n d i c a t e d b y a "*" in t h i s t a b l e . As seen in T a b l e 2, P A I R - R S gives m u c h b e t t e r r e s u l t s t h a n Z B U F - E X C in pixel m e r g i n g phase. Since pixel i n f o r m a t i o n for i n a c t i v e pixel l o c a t i o n s a r e also e x c h a n g e d , t h e v o l u m e of c o m m u n i c a t i o n in Z B U F - E X C is l a r g e r t h a n t h a t of P A I R - R S . As is also seen f r o m t h e t a b l e , t h e P A I R - R S p e r f o r m s b e t t e r t h a n Z B U F - E X C also in local z-buffer p h a s e since it a v o i d s i n i t i a l i z a t i o n of z-buffer.

T o t a l v o l u m e of c o n c u r r e n t c o m m u n i c a t i o n (in b y t e s ) for v a r i o u s pixel m e r g - ing schemes a r e i l l u s t r a t e d in F i g . 1. T h e t o t a l v o l u m e of c o n c u r r e n t c o m m u n i - c a t i o n is c a l c u l a t e d as t h e s u m of t h e m a x i m u m v o l u m e of c o m m u n i c a t i o n a t each c o m m u n i c a t i o n step. As seen f r o m t h e figure, A A P C s c h e m e r e s u l t s in less v o l u m e of c o m m u n i c a t i o n t h a n P A I R s c h e m e as e x p e c t e d . N o t e t h a t t h e v o l u m e of c o m m u n i c a t i o n in a c t i v e pixel m e r g i n g is p r o p o r t i o n a l to t h e n u m b e r of ac- tive pixel l o c a t i o n s in each p r o c e s s o r . As t h e n u m b e r of p r o c e s s o r s increases, t h e n u m b e r of a c t i v e pixel l o c a t i o n s p e r p r o c e s s o r is e x p e c t e d t o d e c r e a s e . Hence, it is e x p e c t e d t h a t v o l u m e of c o m m u n i c a t i o n d e c r e a s e s as t h e n u m b e r of p r o c e s s o r s i n c r e a s e s as is also seen in Fig. l ( a ) . T h e i n c r e a s e in v o l u m e of c o m m u n i c a t i o n

(7)

m 200K = o~ 150K lOOK Fig. 1. C3 OAAPC-HBF I I -,-=~F J AAPC-RS _ IC*~--*D PA[R-RS . . . . . . i . . .

i iiiiii

-'-4 2 4 1 6 Number of P r ~ e s s o r s

(~)

Volume of communication for

O - O P,~IR-RS, A=640X640 : I ~ l AAPC-RS, A=640X640 ' AAPC-HBP. A=640x64 ', 400K A A PAIR*FtS. A=400x400 : ~ -- ~ AAPC-RS, A:400x4O0 ~ : .... i i -b,. 1

1 POT " 2 POT 4 POT 1 4 POT_2 8 POT_I POT 2 Scene

(b)

(a) 2 POT scene on different processors, A = 400 x 400. (b) A = 400 x 400 and A = 640 x 640 for different scenes on 16 processors.

in PAIR-RS scheme on 4 processors is due to store-and-forward overheads. It is also experimentally observed t h a t better load balance in pixel merging indirectly affects the volume of communication as well. As illustrated in Fig. l(b), HBP scheme results in less volume of communication than RS scheme.

Performance comparison of load balancing heuristics are illustrated in Fig. 2. The load imbalance is the ratio of the difference of the work loads of maximum and minimum loaded processors to average work load. The work load of a pro- cessor was taken to be the number of pixel merging operations it performs in the pixel merging phase. As seen from the figure, HBP achieves much better load balance than RS as expected. Load balance improves with increasing screen reso- lution due to better accuracy in dividing the screen. As is also seen from Fig. 2(a), H B P scales better than RS for larger number of processors. A speedup of 11.47 was obtained using 16 processors with A A P C - H B P scheme for 2 P O T scene and A = 640 x 640.

6 C o n c l u s i o n s

In this work, efficient algorithms were proposed for active pixel merging on hy- percube muRicomputers. These algorithms reduce the volume of communication by exchanging only active pixel locations in pixel merging phase. The message fragmentation in active pixel merging is avoided by storing local foremost pixels to consecutive memory locations in local z-buffering phase. An algorithm, called modified scanline z-buffer, is proposed to store the local foremost pixels into con- secutive memory locations efficiently. This algorithm also avoids initialization of scanline z-buffer for each scanline on the screen. It is experimentally observed that active pixel merging with modified scanline z-buffer algorithm performs better than full z-buffer merging. It is also experimentally observed that all-to- all personalized communication scheme achieves less communication overhead than pairwise exchange scheme due to less store-and-forward overheads in active

(8)

.... ll ii!

H~BP X = 4 o o ~ ; i d b

il

ii

:

.... I :

~ R s . A=~Oox~o0

i

- - o ~ l R S , A = 6 4 0 X 6 4 0 . . . R ~ , . ~ = 4 0 0 x 4 0 0 O --4E~ H B P . A=4GOx400 H B P . A = 6 4 0 X 6 4 0 0 . 3 0 o . 3 0 . . . ~- . . . ;- . . . o,2o ~ 0 . 2 0 - ~ ', ,, ,

o.

i

i

!

0 , 0 0 0 010po T 2 P O T 4 P O T 1 4 P O T _ 2 8 P O T 1 g P O T _ 2

Number o! Processors Scene

(a)

(b)

Fig. 2. Comparison of RS with HBP. (a) Different number of processors for 2 POT scene, A = 400 x 400. (b) Different screen resolutions and different scenes on 16 pro- cessors.

pixel merging. Two load balancing heuristics were proposed to distribute load evenly in pixel merging. The heuristic bin packing achieves better load balance and scales better than recursive adaptive subdivision in active pixel merging. Therefore, it is recommended that all-to-all personalized communication with heuristic bin packing scheme should be utilized for active pixel merging on hy- percube multicomputers.

R e f e r e n c e s

1. J.C. Highfield and H.E. Bez, 'Hidden surface elimination on parallel processors', Computer Graphics Forum, 11(5) 293-307 (1992).

2. D. Ellsworth, 'A multieomputer polygon rendering algorithm for interactive ap- plications', in Proe. of 1993 Parallel Rendering Symposium~ San Jose, 43-48 (Oct. 1993).

3. S. Whitman, Multiprocessor Methods for Computer Graphics Rendering, Jones and Bartlett Publishers, Boston (1992).

4. M. Cox and P. Hanrahan, 'Pixel merging for object-parallel rendering: A dis- tributed snooping algorithm', in Proc. of 1993 Parallel Rendering Symposium, San Jose, 49-56 (Oct. 1993).

5. R. Seopigno, A. Paoluzzi, S. Guerrini, and G. Rumolo, 'Parallel depth-merge: A paradigm for hidden surface removal', Comput. ~4 Graphics, 17(5), 583-592 (1993). 6. J. Li and S. Miguet, 'Z-buffer on a transputer-based machine', in Proc. of the Sixth Distributed Memory Computing Conf., IEEE Computer Society Press, 315- 322 (April 1991).

7. S.F. Nugent, 'The iPSC/2 direct-connect communications technology': in Proc. Third Conf. H.y.percube Concurrent Comput. and Appl., 51-60 (Jan. 1988). 8. B. Abah, F. Ozgfiner, and A. Bataineh, 'Balanced parallel sort on hypereube

multiprocessors', IEEE Trans. on Parallel and Distributed Systems, 4(5), 572- 581 (1993).

Şekil

Fig. 2.  Comparison  of RS  with  HBP.  (a)  Different  number  of processors  for  2  POT  scene,  A  =  400  x  400

Referanslar

Benzer Belgeler

The plaintext message will be encrypted first using the Hill-Cipher algorithm with the key matrix generated by the Quantum Shift register, then the cipher-text will be

Örneğin neden şiirin çok satma­ dığından yakınılır (her) dönemde Attila Ilhan’ın şiirleri üst üste bas­ kılar yapar ve hatta güzel yetmiş ya­ şında

The conclusion of this study showed that 8-week weight control program intervention improved the obese Psychotic Recovery Patients’BMI, percentage of body fat, waist and

Toplumsal katılım düzeyinin belirlenmesi için Yetiyitimi Değerlendirme Çizelgesi-II (World Health Organization Disability Assessment Schedule 2.0,

3 Figures are taken from Arms Control Association: Treaties, Current Strategic Nuclear Forces of the Former Soviet Union, October 2001, available on line at: www.armscontrol.org. 4

While firms that depend on export market for revenue are impacted negatively by parity risk, domestic market oriented firms’ export decline significantly, due to an increase in

Ancak, “Yüzünü görmek değil, daha ismini bile tanımazdan evvel ben zevcemi aldattım” (6) diyen Şadan Bey, Sabiha Hanım’ı, önce hizmetçileri Servinaz ve

MGB considers a a direct mechanism where the message set of each player coincides with the set of all possible characteristics a player may have and the outcome function assigns