程序代写代做代考 concurrency GPU algorithm COMP8551 Heterogenous computing

COMP8551 Heterogenous computing

COMP 8551
Advanced Games
Programming
Techniques

Heterogenous computing

Borna Noureddin, Ph.D.
British Columbia Institute of Technology

Overview
•Motivation
•Parallel software
•Data-parallel
• Task-parallel
•Heterogenous computing

2

©
B

or
na

N
ou

re
dd

in
C

O
M

P
85

51

Motivation
• Programming computers composed of a
combination of CPUs, GPUs, and other
processors
• Write single program that can run on wide range
of systems
• Cell phones
• Laptops
• Nodes in massive supercomputers

• High portability by exposing hardware
3

©
B

or
na

N
ou

re
dd

in
C

O
M

P
85

51

Motivation
• Raw performance used to drive innovation
• Focus now performance delivered per watt expended
• Many cores at lower frequencies more power-efficient
• Will continue to squeeze more transistors onto single die
• But now will compete on power efficiency instead of raw
performance
• Microprocessors built from multiple low-power cores

4

©
B

or
na

N
ou

re
dd

in
C

O
M

P
85

51

!

!
!

!
!
!

!

!
!

!
!

!
!
!

!
!

!
!

!
!

!

!
!

!
!

!
!

!
!

!
!

!
!

!
!

!
!

!
!

! !

! ! !

!

! =
! =
! !

! ! ! !

!

! ! =
! =
! !

! ! ! ! !

Concurrency/parallel software
• Parallelism = concurrency enabled by hardware
• Challenge for programmers:
• find concurrency in problem

• can be as simple as executing independent stream of operations for
each pixel in image

• can be incredibly complicated with multiple streams of operations
that share information and must tightly orchestrate their execution

• express concurrency in software
• streams of operations that will execute concurrently must be defined
• data they operate on associated with them
• dependencies between them managed so that correct answer is
produced when they run concurrently

• run resulting program so that concurrency delivers desired
performance

5

©
B

or
na

N
ou

re
dd

in
C

O
M

P
85

51

Parallel programming
• This is the crux of the parallel programming problem

• Key to parallel programming: high-level abstraction or
model to make parallel programming problem more
manageable

• Task parallelism
• E.g., problems organized around updates over points on grid

• Data parallelism
• E.g., problems expressed as traversals over graphs 6

©
B

or
na

N
ou

re
dd

in
C

O
M

P
85

51

Data-parallel programming
• Programmers think of their problems in terms of
collections of data elements that can be updated
concurrently
• Parallelism expressed by concurrently applying the same
stream of instructions (a task) to each data element
• Parallelism is in data

7

©
B

or
na

N
ou

re
dd

in
C

O
M

P
85

51

Task-parallel programming
• Directly define and manipulate concurrent tasks

• Problems decomposed into tasks that can run
concurrently, which are then mapped onto processing
elements (PEs) of a parallel computer for execution

• Easiest when tasks completely independent, but is also
used with tasks that share data

• Tasks vary widely in computational demands, so
distributing them so that they all finish at about the
same time can be difficult: load balancing

8

©
B

or
na

N
ou

re
dd

in
C

O
M

P
85

51

Task-parallel programming

9

©
B

or
na

N
ou

re
dd

in
C

O
M

P
85

51

Heterogenous computing
• General-purpose processor:
• wide range of functional units to respond to any computational
demand

• Processors specialized to a specific function:
• fewer wasted transistors
• include only those functional units required by their special
function

1
0

©
B

or
na

N
ou

re
dd

in
C

O
M

P
85

51

Heterogenous computing
• Regardless of programming model, next step =
map program onto real hardware

• Here, heterogeneous computers present unique
problems

• Computational elements in system may:
• have different instruction sets
• have different memory architectures
• run at different speeds 1

1

©
B

or
na

N
ou

re
dd

in
C

O
M

P
85

51

Heterogenous computing
• Traditionally:
• think of software as set of modules implementing distinct
portions of problem

• modules explicitly tied to components in heterogeneous platform
• E.g., graphics software runs on GPU, other software runs on CPU
• General-purpose GPU (GPGPU) programming broke this model
• Algorithms outside of graphics were modified to fit onto GPU

• Hardware heterogeneity complicated
• Programmers depend on high-level abstractions that
hide complexity of hardware
• Heterogeneous programming language exposes
heterogeneity and is counter to the trend toward
increasing abstraction

1
2

©
B

or
na

N
ou

re
dd

in
C

O
M

P
85

51

Heterogenous computing
Application for heterogeneous platform must:
1. Discover components that make up heterogeneous

system
2. Probe characteristics of components so software can

adapt to specific features of different hardware
elements

3. Create blocks of instructions (kernels) that will run on
platform

4. Set up manipulate memory objects involved in
computation

5. Execute kernels in correct order and on correct
components of system

6. Collect final results

1
3

©
B

or
na

N
ou

re
dd

in
C

O
M

P
85

51

Review

•Motivation
•Parallel software
•Data-parallel
• Task-parallel
•Heterogenous computing

1
4

©
B

or
na

N

ou
re

dd
in

C
O

M
P

85
51

1
5

©
B

or
na

N

ou
re

dd
in

C
O

M
P

85
51

E N D