Docsity

LogGP Analysis of Parallel Sorting Algorithms, Exercises of Algorithms and Programming

Toggle sidebar
bg1
LogGP Analysis of Parallel Sorting
Algorithms
Greg Tracy, University of Wisconsin, Madison
Abstract
The need for solutions to large, complex computations has grown considerably. As a
result, so has the need for models that can accurately predict the performance of parallel
systems without constructing the algorithms themselves. Parallel software developers
have a need for analyzing design changes in a quick and efficient manner. The LogGP
model was developed to help answer this problem. In this paper, I apply the LogGP
model to the analysis of parallel sorting algorithms. This paper outlines equations used
to model the performance of parallel sorting and compares the results to models built
using the LogP model as well as comparisons with actual measurements made on the
target hardware.
1 Introduction
This paper investigates the use of the parallel computation model, LogGP [AISS95] in
the analysis of parallel sorting algorithms in a network of workstations (NOW). Although
parallel sorting algorithms are fairly well developed, an accurate model provides some
insight into performance characteristics of the sort as well a quick and efficient means for
testing improvements to the algorithm. The work done in this research is the foundation
for models of more advanced parallel applications. The problems researched in parallel
sorting apply to lots of other parallel applications. The duality of computation and
communication is a common attribute for lots of interesting distributed applications.
In previous work [DCMS96], the LogP [CKPS93] model was applied to a set of sorting
algorithms running on the Thinking Machines CM-5. Those models were accurate to
within 12% of the measured results on the CM-5 and provided compeling evidence that
the LogP model provided the necessary accuracy for parallel sorts. This research
investigates and produces results which indicate that the use of the LogGP model will
result in more accurate models for parallel sorting algorithms due to the size of messages
which are transmitted between nodes. The LogP model assumes “small”, fixed sized
messages being passed between nodes, and therefore does not account for the true
behavior of the NOW sorting algorithm.
This paper will outline the LogGP model created to measure the expected performance of
sorting in a NOW environment. I will present results for a wide range of node
configurations and compare the results of the LogGP model to a LogP model of the same
problem. I will also present data for a series of model variations in an attempt to more
accurately model the current NOW-Sort implementation. This is followed up with an
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download LogGP Analysis of Parallel Sorting Algorithms and more Exercises Algorithms and Programming in PDF only on Docsity!

LogGP Analysis of Parallel Sorting

Algorithms

Greg Tracy, University of Wisconsin, Madison

Abstract

The need for solutions to large, complex computations has grown considerably. As a result, so has the need for models that can accurately predict the performance of parallel systems without constructing the algorithms themselves. Parallel software developers have a need for analyzing design changes in a quick and efficient manner. The LogGP model was developed to help answer this problem. In this paper, I apply the LogGP model to the analysis of parallel sorting algorithms. This paper outlines equations used to model the performance of parallel sorting and compares the results to models built using the LogP model as well as comparisons with actual measurements made on the target hardware.

1 Introduction

This paper investigates the use of the parallel computation model, LogGP [AISS95] in the analysis of parallel sorting algorithms in a network of workstations (NOW). Although parallel sorting algorithms are fairly well developed, an accurate model provides some insight into performance characteristics of the sort as well a quick and efficient means for testing improvements to the algorithm. The work done in this research is the foundation for models of more advanced parallel applications. The problems researched in parallel sorting apply to lots of other parallel applications. The duality of computation and communication is a common attribute for lots of interesting distributed applications.

In previous work [DCMS96], the LogP [CKPS93] model was applied to a set of sorting algorithms running on the Thinking Machines CM-5. Those models were accurate to within 12% of the measured results on the CM-5 and provided compeling evidence that the LogP model provided the necessary accuracy for parallel sorts. This research investigates and produces results which indicate that the use of the LogGP model will result in more accurate models for parallel sorting algorithms due to the size of messages which are transmitted between nodes. The LogP model assumes “small”, fixed sized messages being passed between nodes, and therefore does not account for the true behavior of the NOW sorting algorithm.

This paper will outline the LogGP model created to measure the expected performance of sorting in a NOW environment. I will present results for a wide range of node configurations and compare the results of the LogGP model to a LogP model of the same problem. I will also present data for a series of model variations in an attempt to more accurately model the current NOW-Sort implementation. This is followed up with an

Figure 1: Cost Breakdown of a Parallel Sort (8 nodes, 4 disks, 1000 kilokeys)

launch read dist ribut e sort writ e

57 %

analysis of possible improvements to the algorithm and a comparison to the lower bound of the I/O subsystem. The goals of this model will be to accurately estimate the running time of a set of sorting algorithms outlined in the NOW literature. It will allow performance estimation with variable node counts, link bandwidth, and link latency.

2 NOW-Sort

The NOW-Sort Project [AACHP97] at UC-Berkeley used a set of parallel sorting algorithms to break a performance benchmarking record. They held the premise that networks of commodity workstations could provide the same performance as that of the large, parallel processors with shared memory architectures. The sorting problem was used as a vehicle to prove that these networks could provide a cost effective solution to large parallel problems.

Unlike a single, parallel machine, however, the nodes of a cluster must communicate via the network. The LogGP model captures this communication aspect through the measurement of network characteristics and applying them to the distribution phase of the sorting algorithm.

The baseline algorithm for parallel sorting is as follows:

  1. Read – Each node will read all keys and corresponding records from local disk into memory.
  2. Distribute – Each node will then send all keys and data to the respective node responsible for sorting and storing the data.
  3. Sort – Each node will sort all of the keys and data it has received.
  4. Write – Each node will write its keys and data to local disk.

This research focuses on applying the LogGP model to the second step of this algorithm - distribution. Together with measurements made on the department's NOW cluster, a complete analysis is made of the sorting performance on a range of node configurations.

To better understand the importance of the distribution phase, a sample measurement was taken from a sort run on the department's NOW cluster. The configuration consists of eight nodes each with four disks and a total of 1000K records are sorted. Figure 1 shows the distribution of time spent by a single node. The performance of the sort is bounded by the performance of the distribution phase (57%) as well as the I/O subsystem. The distribution algorithm of the NOW-Sort coalesces data before sending to another

Tdist (k) = 2(k-1)G + 2L + 2o (3) Data Distribution Time

0

1

2

3

4

5

6

4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Number of Nodes

Time (seconds)

(^) LogGP Model LogP Model

Figure 2: Comparison of the distribution times using LogP and LogGP models when sorting 1000K records.

Figure 2 shows the advantage of grouping small messages into one large one. This extension of the LogP model allows the nodes to take advantage of the higher bandwidth attained when sending large packets on the network. It will be shown that this new LogGP model approaches the actual performance measured on the NOW-Sort cluster. Using the LogP model with "small" messages produces results which are off by a factor of four.

5 Variations of Distribution Model

In practice, the NOW-Sort distribution algorithm performs the distribution phase by reading all local keys off of disk and distributing data in successive transmissions to its peers. This behavior was captured in the model with a few modifications.

5.1 Read All, Send All

If multiple, large messages are to be sent one after another, this distribution time can be modeled with the following equation:

Tdist (k) = 2p(k-1)G + (p-1)g + pL + 2o (4)

This expands on (3). The transmission times for p messages are summed and we add in the gap period, g , between each message. Up until now we have separated the two overhead values between sender and receiver, but they are treated as being equal and are combined into one term in equation (4). The node can overlap the transmission overhead of the successive messages with the latency, L , of the previous message. That is why

there are still only 2 overhead cycles in the equation. Depending on the amount of data being sorted by each node, the distribution phase could include any number of transmissions of size k.

5.2 Delayed Transmission

In an attempt to refine this model further, two other factors were taken into consideration. First, the messages are not sent successively. In fact, in an attempt to avoid flooding the network and receiver queues at the nodes, the distribution is executed in a more orderly fashion. The following pseudo-code fragment outlines the algorithm:

for( i=p+1; i < P-1; i = (i+1)% P ) { send_data(i); barrier(); }

If all cluster nodes were ordered from 0 to P , where p identifies the current node; the for loop begins with the node immediately following our own in the list and loops through P- 1 of the nodes in the cluster. This forces each receiver to have only one unique sender. For each node, we transmit the portion of data it is responsible for sorting and writing but originated on p's disk. Implicit in the send_data ()^11 call is a network read if data has arrived. Although it isn't explicitly shown in the above algorithm, reads are occurring. After each call to send_data (), each node blocks on a barrier which is a global synchronization point. When a node reaches the barrier it sends P-1 messages to the rest of the nodes and then waits for P-1 acknowledgements before proceeding. This synchronization step prevents slower nodes from getting overwhelmed with message processing. Time constraints prevented me from adding the barrier delays into the model.

The second modification to (4) is the consideration that not all messages are of the same length. Specifically, the last message will be of variable length depending on how many records will be sorted and how many nodes are in the configuration. (4) can be expressed more accurately by:

Tdist (k) = [å(ki -1)G] + (p-1)g + pL + 2o (5)

And removing the g factor due to the barrier call (limiting the rate at which packets are sent) produces the following model:

Tdist (k) = 2p(k-1)G + 2(k (^) rem)G + 2L + 2o (6)

(^1) The NOW-Sort code was written in Split-C [CDGKLEY93] which is built on top of Active Messages [ECGS92]. Active Messages is a lightweight version of remote procedure calls which passes a handler with each send call which instructs the receiving node to execute some piece of code.

Data Distribution Time

0

1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Number of Nodes

Time (seconds)

Separated Transmission Successive Transmission NOW Measurements

Figure 3: Comparison of the distribution times using a sample of LogGP models along with the actual distribution time measured on the NOW-Sort implementation.

Figure 4 presents the same results with the overlap model added. It is clear that there is a lot to be gained by overlapping the read and distribution phases of the sort. The NOW- Sort team has not yet implemented this version of the algorithm so I am not able to validate the results at this time. Intuitively, however, this is a promising direction to take the algorithm.

Data Distribution Time

0

1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Number of Nodes

Time (seconds)

Separated Transmission Successive Transmission Overlapped Transmission NOW Measurements

Figure 4: Comparison of the three LogGP models including the overlap model and the measured NOW-Sort data

6.1 Total Sort Times

Equations (3) and (4) are the foundation for my sorting models. When T (^) dist is inserted into our overall timing model, we come up with the following equation for each node p :

Tsort = Tread (N/P) + Tdist (N/P) + Tsort (N/P) + Twrite(N/P) (9)

All other timing measurements: Tread, Tsort, and Twrite were obtained from the NOW-Sort cluster and stay constant no matter which model is used for the T (^) dist phase. The overall performance of the sort is presented in Figure 5. In addition to the variations on the distribution model (including the LogP distribution model), the lower bound of the I/O subsystem is shown to provide a gauge as to how much improvement can be expected. The lower bound is based on the measurements produced by the current NOW-Sort implementation. This is not to say that the I/O performance cannot be improved in and of itself.

parallel sorting has been heavily researched and a lot of the problems associated with network and I/O bottlenecks in a parallel sorting environment have been analyzed and perhaps even solved. This application proved to be a good chance to put the LogGP model to use, but a bigger contribution can be made by applying this model to more advanced parallel applications. Applications which require more complex and highly developed communication patterns.

References

[AISS95] Alexandrov, A., M. Ionescu, K. E. Schauser, and C. Scheiman, “LogGP: Incorporating Long Messages into the LogP Model”, Proc. 7 th^ Ann. ACM Symp. On Parallel Algorithms and Architectures , Santa Barbara, CA, July 1995. [AACHP97] Arpaci-Dusseau, A. C., R. H. Arpaci-Dusseau, D. E. Culler, J. M. Hellerstein, D. A. Patterson, “High-Performance Sorting on Networks of Workstations”, SIGMOD , Tucson, Arizona. May, 1997. [CDGKLEY93] Culler, D., A. Dusseau, S. Goldstein, A. Krishnamurthy, S. Lumetta, T. von Eicken, K. Yelick. "Parallel Programmng in Split-C". Supercomputing '93 , 1993. [CKPS93] Culler, D., R. Karp, D. Patterson, A. Sahay, K. E. Schauser, E. Santos, R. Subramonian, and T. Von Eiken, “LogP: Towards a Realistic Model of Parallel Computation”, Proc. 4 th ACM SIGPLAN Symp. On Principles and Practice of Parallel Programming (PpoPP ’93) , San Diego, CA, May 1993. [DCSM96] Dusseau, A., D. E. Culler, K. E. Schauser, and R. P. Martin, “Fast Parallel Sorting Under LogP: Experience with the CM-5”, IEEE Transactions on Parallel and Distributed Systems , Volume 7, No. 8, 1996. [ECGS92] Eicken, T. von, D. E. Culler, S. C. Goldstein, K. E. Schauser, "Active messages: A Mechanism for Integrated Communication and Computation", Proceedings of the 19 th Annual Symposium on Computer Architecture , May 1992. [FAV97] Frank, M. I., A. Agrawal, and M. K. Vernon, “LoPC: Modeling Contention in Parallel Algorithms”, Proc. 6 th^ ACM SIGPLAN Symp. On Principles and Practice of Parallel Programming (PpoPP ’97) , Las Vegas, NV, June 1997. [SV99] Sundaram-Stukel, D., M. K. Vernon, “Predictive Analysis of a Wavefront Application Using LogGP”, Proc. 7 th^ ACM SIGPLAN Symp. On Principles and Practice of Parallel Programming (PpoPP ’99) , Atlanta, GA, May 1999.