Dijkstra's Shortest Path Algorithm Serial and Parallel Execution Performance Analysis
Dijkstra's Shortest Path Algorithm Serial and Parallel Execution Performance Analysis
Department for Computing and Informatics, Faculty of Electrical Engineering, University of Sarajevo
Abstract - This article introduces the problem of In this article, firstly you can find a definition of the
parallelization of Dijkstra's algorithm, a well known Dijkstra's algorithm for computing single-source shortest
algorithm for computing single-source shortest path in a path in a graph, and then there is a parallel algorithm
graph. Dijkstra's algorithm can be applied to graphs with a
given to solve the shortest path problem of the single
various number of vertices and edges. Dijkstra's shortest path
algorithm is implemented and presented, and the
source graphs, where one implementation of single
performances of its parallel and serial execution are source shortest path algorithm executed on dual-core and
compared. The algorithm implementation was parallelized i5 processor with OpenMP, and one with OpenCL.
using OpenMP (Open Multi-Processing) and OpenCL (Open Finally we can find through experiments that parallel
Computing Language) standards. Its performances were algorithm used in this article is has better performance
measured on 4 different configurations, based on dual core than the serial one.
and i5 processors. The experimental results prove that the
parallel execution of the algorithm has good performances in
II. DIJKSTRA'S ALGORITHM
terms of speed-up ratio, when compared to its serial
execution. Finally, the results show that, because of Dijkstra's
algorithm in itself is sequential, and difficult to parallelize, Dijkstra's algorithm finds the length of an shortest path
average speed-up ratio achieved by parallelization is only between two vertices in a graph.
10%. This proves to be a huge disadvantage of this algorithm, The algorithm works as follows:
because its use is widespread, and enhancing its performance 1. Choose the source vertex
would have great effects in its many uses. 2. Define a set S of vertices, and initialise it to
emptyset. As the algorithm progresses, the set S
Keywords - Dijkstra algorithm; single source shortest path; will store those vertices to which a shortest path
parallel algorithm; OpenMP, OpenCL
has been found.
3. Label the source vertex with 0, and insert it into
S.
I. INTRODUCTION
4. Consider each vertex not in S connected by an
edge from the newly inserted vertex. Label the
With the development of computer and information
vertex not in S with the label of the newly
technology, the research about graph theory get a wide
inserted vertex + the length of the edge.
range of attention, and a variety of graph structures and
But if the vertex not in S was already labeled, its new
algorithms have been proposed [2].
label will be min(label of newly inserted vertex + length
The shortest path algorithm is always a research hotspot
of edge, old label)
in graph theory and it is the most basic algorithm. For
5. Pick a vertex not in S with the smallest label,
example, shortest path algorithm is used to implement
and add it to S.
traffic engineering in IP networks and to improve
6. Repeat from step 4, until the destination vertex
Intelligent and Transportation Systems. But for that kind
is in S or there are no labeled vertices not in S.
of algorithm it is very difficult to improve its
If the destination is labeled, its label is the distance from
performance.
source to destination. If it is not labeled, there is no path
Currently the algorithms for the serial shortest path
from the source to the destination.[6]
optimization have reached the time limitation. Therefore
the parallel computation is an efficient way to improve
the performance. By putting some constraints on the data
and taking the advantage of the hardware, the
performance of the algorithms can be significantly
improved.
1811
paths between nodes and vid.size() is size of vector with
all nodes in graph
1812
across the available compute hardware. The application
detects the number of GPU and CPU devices and splits
the workload across the devices.
Each of the kernels is written to process one vertex at a
time and it was implemented by workload portioning.
In the case CPU device is selected from the initial menu
when execution starts, the OpenCL implementation will
multithread the implementation across the available
cores.
Configuration 1:
Processor: Intel(R) Core(TM) i5 CPUM460 @ 2.53GHz
2.53GHz
GPU: AMD Radeon HD 6500M/5600/5700 series
Configuration 2: 4.c
Processor: Intel(R) Pentium(R) Dual CPU T2390@
1.86GHz 1.87GHz
GPU: Intel® GMA X3100
Configuration 3:
Processor: Intel Celeron Dual Core CPU T1500 @
1.86GHz 1.86GHz
GPU: Intel GMA X3100
Configuration 4:
Processor: Intel(R) Core(TM)2 Duo CPU T5760 @ 4.d
1.80GHz
GPU: Mobile Intel(R) 965 Express Chipset Family
4.a
1813
5.a VII. CONCLUSION
1814
[5] Kevin Kelley, Tao B. Schardl, „Parallel Single-Source
Shortest Paths“, 2007.
[6]
http://www.cs.bham.ac.uk/~mdr/teaching/modules0
4/java2/DijkstraAlgo.html, last modified on 29th
October 2004.
1815