0% found this document useful (0 votes)
9 views

Fast_parallel_sort_sub-rows_qs

The paper presents a fast parallel sorting algorithm that utilizes subsets and the quick sort method, demonstrating improved efficiency over traditional parallel quick sort algorithms. It employs a Master/Slave model to divide large data sets into smaller subsets for parallel processing, aiming for faster sorting times. The authors suggest that their algorithm could outperform existing methods in many scenarios and propose future experimental evaluations for further validation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Fast_parallel_sort_sub-rows_qs

The paper presents a fast parallel sorting algorithm that utilizes subsets and the quick sort method, demonstrating improved efficiency over traditional parallel quick sort algorithms. It employs a Master/Slave model to divide large data sets into smaller subsets for parallel processing, aiming for faster sorting times. The authors suggest that their algorithm could outperform existing methods in many scenarios and propose future experimental evaluations for further validation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/273454202

Fast Parallel Sorting Algorithm using Subsets and Quick sort

Article · February 2015

CITATIONS READS

0 375

1 author:

Atanaska Bosakova-Ardenska
University Of Food Technology - Plovdiv
60 PUBLICATIONS 74 CITATIONS

SEE PROFILE

All content following this page was uploaded by Atanaska Bosakova-Ardenska on 13 March 2015.

The user has requested enhancement of the downloaded file.


BALKAN JOURNAL OF ELECTRICAL & COMPUTER ENGINEERING, 2015, Vol.3, No.1 27

Fast Parallel Sorting Algorithm Using Subsets


and Quick Sort
A. Bosakova-Ardenska, N. Vasilev, L. Kostadinova-Georgieva

Abstract— This paper presents fast parallel sorting


algorithm which uses division in subsets and quick sort
algorithm. The proposed algorithm is evaluated by analytic
way and results shows that it will be faster than algorithm in
[3] when time for division in subsets of all set is bigger than
time for sending/receiving of partial subsets.

Index Terms — parallel sorting algorithm, quick sort,


subsets

I. INTRODUCTION
Fig.1 Process allocation

N EARLY 25% of the time during which the computer


works he sorts data [1]. The sorting is operation which
is a part of many algorithms. There are many sorting
algorithms- for common or special cases. In the group of
common (universal) sorting algorithms are: bubble sort,
selection sort, insertion sort, merge sort, quick sort and etc.
In group of private sorting algorithms are lexicographical
sort, bucket sort and other. One of most popular methods
for acceleration when it is necessary to sort big data arrays
is using multiprocessors system. In this case is necessary
to think about parallel architecture and memory
distribution to choose appropriate parallel algorithm.

II. PARALLEL SORTING WITH QUICK SORT


On figure 1 is shown processes allocation for “classic”
parallel quick sort algorithm [2]. For this algorithm number
of parallel processes depends of given row. In other words
for rows with same number of elements but different
character (number of inversions) the number of parallel Fig.2 Principle scheme of algorithm
processes will be different.
In [3] is presented parallel sorting algorithm which is III. FAST PARALLEL SORTING ALGORITHM
faster than “classic” parallel quick sort. In this algorithm The main idea is to divide the given big set of numbers
number of parallel processes doesn’t depend of rows in small subsets. And then parallel sort these subsets with
character. On figure 2 is shown principle scheme of this fastest known universal sorting algorithm- quick sort. In
algorithm. other words is used the technique “divide and conquer”. In
this paper will be discussed one modification of parallel
Atanaska Dimitrova Bosakova-Ardenska works in University of Food
Technologies, Plovdiv in Bulgaria. She is associated professor in algorithm presented in [3] which will “parallelize” division
department of “Computer Systems and Technologies”(a_bosakova@uft- in subsets (sub-rows).
plovdiv.bg). Let we use MPMD (Multiple Program Multiple Data)
Naiden Borisov Vasilev was head of department of “Computer Systems model in version “Master/Slave” [4]. The “Master”
and Technologies” in Technical University Sofia, branch in Plovdiv, process will execute the next steps as follow:
Bulgaria. (e-mail: [email protected]).
1) Open selected by user file with numbers for sorting;
Lena Filipova Kostadinova-Georgieva is head of department of 2) Read numbers in one array;
“Computer Systems and Technologies” in University of Food 3) Calculate count of elements in initial subsets
Technologies, Plovdiv, Bulgaria (e-mail: [email protected]).

Copyright © BAJECE ISSN: 2147-284X February 2015 Vol:3 No:1 http://www.bajece.com


BALKAN JOURNAL OF ELECTRICAL & COMPUTER ENGINEERING, 2015, Vol.3, No.1 28

considering number of parallel processes (n). Every


process must receive nearly equal piece of data;
4) Send to other processes initial subsets (from 1 to n-1).
The first subset will stand in master process;
5) Divide initial subset in n partial subsets. The steps are:
- calculate bounds for subsets. The number of
bounds is equal to n+1. The first bound is 0 and last is max
(the maximal value for given numbers). The other bounds
are calculated by formula:

Bi = i*]max/np[, i=1,2 to n-1 (1)

where with Bi is noted i-th bound. The expression “]


max/np [“ indicates that the np divides max as integer;
- allocate memory for partial subsets;
- divide numbers in partial subsets and store in
other array count of elements for every partial subset;
- send to other processes count of elements for
their partial subset;
- send to other processes their partial subset;
- receiving from other processes first count of
elements for own partial subset and second – partial subset;
6) Sort own subset (which is built from n partial subsets)
with quick sort algorithm;
7) Receive from slave processes their sorted subsets;
8) Save sorted row in file.
Every “Slave” process will execute the next steps as
follow:
1) Receive initial subset;
2) Divide initial subset in n partial subsets. The steps are:
- calculate bounds for subsets. The number of
bounds is equal to n+1. The first bound is 0 and last is max
(the maximal value for given numbers). The other bounds
are calculated by formula (1).
- allocate memory for partial subsets;
- divide numbers in partial subsets and store in
other array count of elements for every partial subset;
Fig. 3 Consolidated flow chart of parallel algorithm
- send to other processes count of elements for
their partial subset; TABLE 1
- send to other processes their partial subset; PARALLEL STEP 1 (INITIAL SUBSETS) FOR 4 PROCESSORS
- receiving from other processes first count of Process 1 Process 3 Process 4
Process 2
elements for own partial subset and second – partial subset;
3) Sort own subset (which is build from n partial subsets) 90, 12, 55, 80, 3 76, 92, 45, 33, 20 13, 48, 55, 60, 100 1, 10, 29, 77, 81
with quick sort algorithm;
4) Send to master process sorted subset.
After division of initial subset in partial subsets every
On Figure 3 is shown consolidated flow chart of parallel process will have 4 partial subsets as shown in Table 2
algorithm. (parallel step 2).
Let show one example for sorting with our fast parallel
TABLE 2
sorting algorithm. The initial conditions are: PARALLEL STEP 2 (PARTIAL SUBSETS) FOR 4 PROCESSORS
- given row has 20 integers; Process
- number of parallel processes is 4 (n=4); Process 1 Process 3 Process 4
Process 2
- range of numbers is: 1 to 100. Subset
In this case bounds will be 5 and they will have the
1 (1-25) 12, 3 20 13 1, 10
values: 1, 25, 50, 75 and 100. The given row is: 90, 12, 55,
80, 3, 76, 92, 45, 33, 20, 13, 48, 55, 60, 100, 1, 10, 29, 77, 2 (25-50) 45, 33 29
and 81. In table 1 are shown initial subsets (parallel step
3 (50-75) 55 48, 55, 60
1).
4 (75-100) 90, 80 76, 92 100 77, 81

Copyright © BAJECE ISSN: 2147-284X February 2015 Vol:3 No:1 http://www.bajece.com


BALKAN JOURNAL OF ELECTRICAL & COMPUTER ENGINEERING, 2015, Vol.3, No.1 29

After sending/receiving of partial subsets every process V. CONCLUSION


will have own subset as shown in Table 3 (parallel step 3). In this paper was presented fast parallel sorting algorithm
which modify algorithm in [3]. The proposed algorithm
TABLE 3
PARALLEL STEP 3 (SUBSETS FOR SORTING) FOR 4 PROCESSORS “parallelizes” division in subsets (sub-rows) and use
MPMD (Master/Slave) model. The algorithm is
Process 1 Process 3 Process 4
Process 2 appropriate for performance on supercomputers and
12, 3, 20, 13, 1, 10 45, 33, 29 55, 48, 55, 60 90, 80, 76, probably will be faster than “classic” parallel quick sort
92, 100, 77, 81 and algorithm with division in subsets [3] in many cases.
In future will be interesting to evaluate experimentally
The next step is sorting and after this every process will proposed algorithm and compare them with other known
have sorted subset (parallel step 4) which is shown in Table parallel sorting algorithms.
4.
REFERENCES
TABLE 4 [1] Knuth D., The art of computer programming, V3. Sorting and
PARALLEL STEP 3 (SORTED SUBSETS) FOR 4 PROCESSORS Searching, Addison Wesley Publishing Company, 1973.
Process 1 Process 3 Process 4 [2] Wilkinson B. and Allen M., Sorting Algorithms, Parallel
Process 2 Programming: Techniques and Applications Using Networked
Workstations and Parallel Computers, Prentice-Hall, 1999.
1, 3, 10, 12, 29, 33, 45 48, 55, 55, 60 76, 77, 80, 81
[3] Bosakova-Ardenska A., N. Vasilev, I. Fillipov, Fast parallel sorting
13, 20 , 90, 92, 100
based on quick sort, TechSys 2013, Journal of the Technical
University Sofia, branch Plovdiv, “Fundamental Sciences and
It is obviously that sequential writing of subsets of Applications”, Vol. 19, 2013, ISSN 1310-8271, pp 35-40.
[4] Joseph JaJa, An Introduction to Parallel Algorithms, Addison-
process 1 to process 4 will give all sorted row (set). Wesley publishing company, 1992.

IV. EVALUATION OF ALGORITHM


BIOGRAPHIES
Time for sorting with algorithm presented in [3] depends
of n and is noted with t1.
ATANASKA D. BOSAKOVA-ARDENSKA was
born in 1980. She received the M.Sc. degree of
t1 = tds1 + tc1 + ts1 + tc1 = tds1 + 2tc1 + ts1 (2) Computer Systems and Technologies at Technical
University of Sofia, Plovdiv branch 2004. She
receives Ph.D. in 2009 with thesis “Parallel
In formula 2 tds1 is time for division in subsets, tc1 is information processing in image processing
time for sending/receiving of subsets and ts1 is time for systems”. From 2010 she is assistant in department
of Computer Systems and Technologies in
sorting of one subset with quick sort algorithm. Time for University of Food Technologies. From 2014 she is
sorting with our fast parallel sorting algorithm is presented associated professor by “Synthesis and Analysis of Algorithms” in
with formula 3. department of Computer Systems and Technologies in University of Food
Technologies in Plovdiv, Bulgaria. She is member of USB (Union of
Scientist in Bulgaria). Her research interests include: parallel algorithms,
t2 = tcis2 + tdps2 + tcps2 + ts2 + tcs2 (3) sorting algorithms, image processing, MPI (Message Passing Interface),
C++ programming.
Contacts: [email protected], [email protected]
In formula 3 tcis2 is time for sending/receiving of initial
subsets, tdps2 is time for division in partial subsets, tcps2
is time for sending/receiving of partial subsets, ts2 is time NAIDEN B. VASILEV is associate professor in
for sorting of subset with quick sort algorithm and tcs2 is department of “Computer Systems and
time for sending/receiving of subsets. Technologies” at Technical University of Plovdiv.
He is receives Ph.D. in 1976. His research interests
To be our algorithm faster than algorithm in [3] it is include: parallel algorithms, discrete mathematics
necessary to satisfied inequality: and music.
Contacts: [email protected]
t2 < t1 (4)

Because initial partial subset is n times smaller than all


set we can think that tdps2 is n times smaller than tds1. The LENA Ph. KOSTADINOVA-GEORGIEVA
receives M.Sc. degree of Automation in technical
time for sorting subsets ts1 and ts2 are equal because the University Sofia 1975. She receives Ph.D. in 2003
subsets are the same. Let us assume that tcis2 is equal to with thesis “Automation of grading and sorting of
tc1 - this means that subsets are almost equal by number. certain fruit and vegetables”. From 2005 she is
associated professor by “Automation, computing
In this case inequality 4 will be: and control systems”. She is head of department of
n “Computer Systems and Technologies” in
t ds1  t cps 2 (5) University of Food technologies, Plovdiv, Bulgaria. Her research interests
n 1 include: application of cybernetic methods (management, pattern
recognition, diagnosis, machine vision) for objective analysis and
where n is number of subsets (parallel processes). classification of foods.
Contacts: [email protected]

Copyright © BAJECE ISSN: 2147-284X February 2015 Vol:3 No:1 http://www.bajece.com

View publication stats

You might also like