An Early Evaluation of the Scalability of Graph Algorithms on the - - PowerPoint PPT Presentation

an early evaluation of the scalability of graph
SMART_READER_LITE
LIVE PREVIEW

An Early Evaluation of the Scalability of Graph Algorithms on the - - PowerPoint PPT Presentation

An Early Evaluation of the Scalability of Graph Algorithms on the Intel MIC Architecture Erik Saule 1 and urek 1 , 2 Umit V. C ataly { esaule,umit } @bmi.osu.edu 1 Department of Biomedical Informatics 2 Department of Electrical and


slide-1
SLIDE 1

An Early Evaluation of the Scalability of Graph Algorithms on the Intel MIC Architecture

Erik Saule1 and ¨ Umit V. C ¸ataly¨ urek1,2

{esaule,umit}@bmi.osu.edu

1Department of Biomedical Informatics 2Department of Electrical and Computer Engineering

The Ohio State University

MTAAP 2012

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC :: 1 / 22

slide-2
SLIDE 2

The Intel MIC Architecture

Features

High Performance Computing with generic x86 cores. High core count. Large SIMD. Highly hyper-threaded.

The Knight Ferry prototype

32 cores (1 reserved for system purposes in our experiments).

The Knight Corner

50+ cores.

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Introduction:: 2 / 22

slide-3
SLIDE 3

Graph Algorithms and Irregular Kernels

Many Applications where GPUs are holding back

Basically all applications based on indirection and pointer chasing: Sparse linear algebra (solvers, factorisation), Graph problem (Shortest Path, Travelling Salesman, Network Analysis), Text search (inexact pattern matching, indexing)

Graph Coloring

Given a graph, assign colors (integers) for each vertex so that two adjacent vertices have different colors.

Breadth First Search traversal

Given a graph and a particular vertex, build a list of all the vertices from the closest ones to the farthest ones.

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Introduction:: 3 / 22

slide-4
SLIDE 4

Graph Algorithms and Irregular Kernels

Many Applications where GPUs are holding back

Basically all applications based on indirection and pointer chasing: Sparse linear algebra (solvers, factorisation), Graph problem (Shortest Path, Travelling Salesman, Network Analysis), Text search (inexact pattern matching, indexing)

Graph Coloring

Given a graph, assign colors (integers) for each vertex so that two adjacent vertices have different colors.

Breadth First Search traversal

Given a graph and a particular vertex, build a list of all the vertices from the closest ones to the farthest ones.

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Introduction:: 3 / 22

slide-5
SLIDE 5

Programming Models

OpenMP

Pragma directives that allow parallel processing. Support for sections, locks, ...

Cilk Plus

Asynchronous function call powered by workstealing. Allows nested

  • parallelism. Focus is on programmability by looking like sequential

execution.

Intel TBB

Collection of tools for parallel processing. Object oriented programing

  • paradigm. Versatile programming model supporting recursive

decomposition, filter based parallel processing...

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Introduction:: 4 / 22

slide-6
SLIDE 6

Outline

1

Introduction

2

Coloring Algorithm Experimental Results

3

Loaded Computation Algorithm Experimental Results

4

Breadth First Search Algorithms Experimental Results

5

Conclusions

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Introduction:: 5 / 22

slide-7
SLIDE 7

Speculative Coloring

Each processor independently color some vertices. Conflicts might occur. They are detected in parallel; and some vertices are uncolored. The process repeats itself. Algorithm 1: TentativeColoring

Data: G = (V , E), Visit ⊂ V , color[1 : |V |] maxcolor ← 1 localMC ← 1 for each v ∈ Visit in parallel do for each w ∈ adj(v) do localFC[color[w]] ← v color[v] ← min{i > 0 : localFC[i] = v} if color[v] > localMC then localMC ← color[v] maxcolor ← Reduce(max) localMC return maxcolor

Algorithm 2: DetectConflict

Data: G = (V , E), Visit ⊂ V , color[1 : |V |] Conflict ← ∅ for each v ∈ Visit in parallel do for each w ∈ adj(v) do if color[v] = color[w] then if v < w then atomic Conflict ← Conflict ∪{v} return Conflict

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Coloring::Algorithm 6 / 22

slide-8
SLIDE 8

Variants

OpenMP

Implementation based on the parallel for construct. Three scheduling policies: static, dynamic, guided. Memory is allocated and indexed by threadIDs.

Cilk Plus

recursive decomposition of the iterations of the loop. Executed with

  • workstealing. Allocating memory per thread is done by using Holders to

allocate memory dynamically. Otherwise hack workerIDs and allocate memory first.

Intel TBB

tbb::parallel for can use multiple types of partitioner: simple recursively divides the range up to a given size. auto uses workstealing event to decide when to stop. affinity tries to maximize cache reuse based on the index ordering.

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Coloring::Algorithm 7 / 22

slide-9
SLIDE 9

Experiments

10 20 30 40 50 60 70 80 20 40 60 80 100 120 140 speedup number of threads OpenMP-dynamic OpenMP-static OpenMP-guided

(a) OpenMP

10 20 30 40 50 60 70 80 20 40 60 80 100 120 140 speedup number of threads CilkPlus CilkPlus-holder

(b) Cilk Plus

10 20 30 40 50 60 70 80 20 40 60 80 100 120 140 speedup number of threads TBB-simple TBB-auto TBB-affinity

(c) TBB

20 40 60 80 100 120 140 160 20 40 60 80 100 120 140 speedup number of threads OpenMP TBB CilkPlus

(d) Randomly Ordered Graph

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Coloring::Experimental Results 8 / 22

slide-10
SLIDE 10

Outline

1

Introduction

2

Coloring Algorithm Experimental Results

3

Loaded Computation Algorithm Experimental Results

4

Breadth First Search Algorithms Experimental Results

5

Conclusions

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Loaded Computation:: 9 / 22

slide-11
SLIDE 11

Loaded Computation

Algorithm 3: IrregularComputation

Data: G = (V , E), Visit ⊂ V , state[1 : |V |] for each v ∈ V in parallel do for i = 0; i < iter; i++ do sum ← state[v] for each w ∈ adj(v) do sum ← sum + state[w] state[v] ←

sum |adj(v)+1|

Variants are the same that in speculative coloring. Allows to change the computation intensivity by tuning the number of iterations.

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Loaded Computation::Algorithm 10 / 22

slide-12
SLIDE 12

Experiments

10 20 30 40 50 60 70 20 40 60 80 100 120 140 speedup number of threads 1 iteration 3 iterations 5 iterations 10 iterations

(e) Using OpenMP

10 20 30 40 50 60 70 20 40 60 80 100 120 140 speedup number of threads 1 iteration 3 iterations 5 iterations 10 iterations

(f) Using Cilk

10 20 30 40 50 60 70 20 40 60 80 100 120 140 speedup number of threads 1 iteration 3 iterations 5 iterations 10 iterations

(g) Using TBB

10 20 30 40 50 60 70 20 40 60 80 100 120 140 speedup number of threads OpenMP TBB CilkPlus

(h) 10 iterations

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Loaded Computation::Experimental Results 11 / 22

slide-13
SLIDE 13

Outline

1

Introduction

2

Coloring Algorithm Experimental Results

3

Loaded Computation Algorithm Experimental Results

4

Breadth First Search Algorithms Experimental Results

5

Conclusions

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Breadth First Search:: 12 / 22

slide-14
SLIDE 14

Parallel Layered Breadth First Search

Algorithm 4: ParLayeredBFS

Data: G = (V , E), source ∈ V for v ∈ V in parallel do bfs[v] ← −1 bfs[source] ← 0 cur.add(source) level ← 1 while ! cur.empty() do for v ∈ cur in parallel do for each w ∈ adj(v) in parallel do if bfs[w] = −1 then bfs[w] ← level uniquely next.add(w) SWAP (cur, next) level ← level + 1 return bfs

Sources of parallelism

parallel vertex traversal parallel edge traversal (inefficient)

Synchronizations

At the end of each level Management of next

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Breadth First Search::Algorithms 13 / 22

slide-15
SLIDE 15

Existing Implementations

Snap [BM08]: a queue based implementation with OpenMP

Keeps a local queue per thread in its TLS. Merge the queues at the end of the level in O(n). Locks the vertices to change their state (visited or not) to avoid a race condition which inserts in next the same vertex multiple times.

Leiserson and Schardl[LS10]: a bag based implementation with Cilk

Observed first that the race condition on next is harmless. A vertex can be added twice to the list. It increases the runtime but the algorithm stays correct. And it is unlikely to happen multiple times. The method is designed to be used with a workstealing scheduler and represents next as a Bag of vertices. It is a data structure that supports split and merge operations in O(log n).

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Breadth First Search::Algorithms 14 / 22

slide-16
SLIDE 16

Existing Implementations

Snap [BM08]: a queue based implementation with OpenMP

Keeps a local queue per thread in its TLS. Merge the queues at the end of the level in O(n). Locks the vertices to change their state (visited or not) to avoid a race condition which inserts in next the same vertex multiple times.

Leiserson and Schardl[LS10]: a bag based implementation with Cilk

Observed first that the race condition on next is harmless. A vertex can be added twice to the list. It increases the runtime but the algorithm stays correct. And it is unlikely to happen multiple times. The method is designed to be used with a workstealing scheduler and represents next as a Bag of vertices. It is a data structure that supports split and merge operations in O(log n).

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Breadth First Search::Algorithms 14 / 22

slide-17
SLIDE 17

A blocked queue based implementation

Goals

Scheduling overhead in O(1): no bags. End of level overhead in O(1): no merge.

Blocked Queues

The threads: fill up concurrently a single queue. reserve a part with an atomic operation. fill up the block with a sentinel value at the end of the level.

Variants

Implemented in OpenMP and TBB. With or without locks on next.

1 2 4 6 8 9

b1 e1

5 3 7

e2 eq b2

−1−1−1 −1−1−1−1 1 2 4 6 8 9

b1 e1

5 3 7

e2 eq b2 ¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Breadth First Search::Algorithms 15 / 22

slide-18
SLIDE 18

A performance model

Observation

The parallelism of the algorithm depends on the shape of the graph. If the graph is a chain, there is no parallelism. Moreover, every single vertex can not be scheduled independently.

Assumptions

There is a synchronization at the end of each level. There are xl vertices in level l. t threads are used. Computations are performed by blocks of b

  • vertices. Processing each vertex takes the same time. No other scheduling
  • verhead.

Model

The computation time of level l is then: c(l) = xl if xl < b and c(l) = xl

tb

  • ∗ b otherwise.

Maximum speedup:

L

l=1 xl

L

l=1 c(l). ¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Breadth First Search::Algorithms 16 / 22

slide-19
SLIDE 19

Impact of the synchronizations

5 10 15 20 25 30 35 40 20 40 60 80 100 120 140 speedup number of threads Model OpenMP-Block-relaxed OpenMP-Block

(i) pwtk

5 10 15 20 25 30 35 40 20 40 60 80 100 120 140 speedup number of threads Model OpenMP-Block-relaxed OpenMP-Block

(j) inline 1

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Breadth First Search::Experimental Results 17 / 22

slide-20
SLIDE 20

Comparisons

2 4 6 8 10 5 10 15 20 25 speedup number of threads Model OpenMP-Block-relaxed TBB-Block-relaxed OpenMP-TLS CilkPlus-Bag-relaxed

(k) All graphs on CPU

5 10 15 20 25 30 35 40 20 40 60 80 100 120 140 speedup number of threads Model OpenMP-Block-relaxed TBB-Block-relaxed CilkPlus-Bag-relaxed

(l) All graphs on Intel MIC

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Breadth First Search::Experimental Results 18 / 22

slide-21
SLIDE 21

Outline

1

Introduction

2

Coloring Algorithm Experimental Results

3

Loaded Computation Algorithm Experimental Results

4

Breadth First Search Algorithms Experimental Results

5

Conclusions

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Conclusions:: 19 / 22

slide-22
SLIDE 22

Conclusions

Hyperthreading

In all experiment the behavior of the algorithm changed when hyperthreading is used. Coloring speeds up with different slopes up to 4 threads per core. Loaded computation peeked at 2 threads per core. None of the BFS kernel improved with more than 1 thread per core.

Simple scheduling policies

Simple dynamic scheduling policies appear to be the best since they keep scheduling overhead low allowing to pump as much data as possible. Difference disappear quickly when the amount of computation increases.

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Conclusions:: 20 / 22

slide-23
SLIDE 23

Perspective

Knight Corner

All the experiments were run on prototype KNF cards. Looking forward to perform analysis on production KNC cards.

Comparison with GPUs

Will the Intel MIC architecture allow to perform graph analysis kernels faster than GPUs? Performing fair comparisons.

Programming models

We used simple parallelism. But the cores are independent; Pipelined computing should be efficient. Integration in Dataflow middleware such as DataCutter.

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Conclusions:: 21 / 22

slide-24
SLIDE 24

Thank you

Support

Intel for allowing us to use Knight Ferry prototypes. OSC for providing computation infrastructure.

More information

contact : umit@bmi.osu.edu visit: http://bmi.osu.edu/hpc/ or http://bmi.osu.edu/~umit

Research at HPC lab is funded by

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Conclusions:: 22 / 22

slide-25
SLIDE 25

David A. Bader and Kamesh Madduri. Snap, small-world network analysis and partitioning: An open-source parallel graph framework for the exploration of large-scale networks. In International Symposium on Parallel and Distributed Processing (IPDPS), pages 1–12, 2008. Charles L. Leiserson and Tao B. Schardl. A work-efficient parallel breadth-first search algorithm (or how to cope with the nondeterminism of reducers). In Symposium on Parallel Architectures and Algorithms (SPAA), pages 303–314, 2010.

¨ Umit V. C ¸ataly¨ urek Ohio State University, Biomedical Informatics HPC Lab http://bmi.osu.edu/hpc Graph Algorithms on Intel MIC Conclusions:: 22 / 22