Docsity

Understanding Algorithm-Architecture Interplay: A Course by William Gropp - Prof. William , Exams of Computer Science

Toggle sidebar
bg1
Architecture, Algorithms, and
Programming Models
William Gropp
2
Goals of this course
• Algorithms don’t perform the way many
expect
!Learn why - difference between idealized and real
architecture
• Learn techniques to restructure algorithms and
data structures to better
!Some could be performed by compilers but aren’t
!More interesting are changes to the data structures
• Learn ways to create algorithms that are more
suited to modern hardware
• Learn how programming models help or hinder
the expression of efficient algorithms and what
changes are on the horizon
3
Logistics
• Classes Wednesday and Friday 2-3:15, SC 1131
!Except when I’m on travel
• Sept 3,5,10; 24
• Oct 8
• Nov 19,21
• Office hours: TBD, but stop in any time my door is open
• Format: Lectures; Presentations of papers by Students,
and open discussion
!Discussion of Papers
• You should be reading papers in the area
• Sign up and present a paper
• Evaluation: Homework + Presentation + Project (more
on this later)
4
What Will You Learn?
• Computer architecture relevant to understanding
performance
!Or, why(maybe) your codes do not perform as you expect
• Interaction of architecture with algorithms
!Some performance loss is due to the complexity of the
system
• The algorithm does not need to change, but does need some
help to be efficiently realized
!Some performance loss is due to the mismatch between
the hardware and the algorithm
• The algorithm must be revised or replaced
pf3
pf4
pf5
pf8

Partial preview of the text

Download Understanding Algorithm-Architecture Interplay: A Course by William Gropp - Prof. William and more Exams Computer Science in PDF only on Docsity!

Architecture, Algorithms, and

Programming Models

William Gropp

Goals of this course

• Algorithms don’t perform the way many

expect

! Learn why - difference between idealized and real

architecture

• Learn techniques to restructure algorithms and

data structures to better

! Some could be performed by compilers but aren’t

! More interesting are changes to the data structures

• Learn ways to create algorithms that are more

suited to modern hardware

• Learn how programming models help or hinder

the expression of efficient algorithms and what

changes are on the horizon

Logistics

  • Classes Wednesday and Friday 2-3:15, SC 1131

! Except when I’m on travel

  • Sept 3,5,10; 24
  • Oct 8
  • Nov 19,
  • Office hours: TBD, but stop in any time my door is open
  • Format: Lectures; Presentations of papers by Students,

and open discussion

! Discussion of Papers

  • You should be reading papers in the area
  • Sign up and present a paper
  • Evaluation: Homework + Presentation + Project (more

on this later)

What Will You Learn?

  • Computer architecture relevant to understanding

performance

! Or, why(maybe) your codes do not perform as you expect

  • Interaction of architecture with algorithms

! Some performance loss is due to the complexity of the

system

  • The algorithm does not need to change, but does need some

help to be efficiently realized

! Some performance loss is due to the mismatch between

the hardware and the algorithm

  • The algorithm must be revised or replaced

What Will You Learn (con’t)

• Strategies for developing both kinds of

algorithmic enhancements

• And most important, how to think about

performance

• Once you understand the interplay between

algorithms and architecture, we’ll ask how do

programming languages influence/affect/guide

the algorithms that are developed, evaluated,

and used.

! The programming language may add additional

constraints to what is considered possible

! What languages, tools, and language extensions are

available to aid in algorithm and program

development

Parallel Computing

• Some issues will be relevant to

parallel computing

• Most of the initial discussion will be

single thread performance or

single node performance

! Parallel computing architectures will

be covered as needed

! For reasons that will become clear,

much of the programming language

discussion will involve parallel

computing

Project

  • A term project is required for this course. Students will

select an algorithm and analyze it with respect to one or

more architectures and programming models. Students

will make a proposal for a project, due October 17th.

The final project report is due December 10th.

! How does the algorithm fit the selected architecture(s)?

! What is an appropriate performance model?

! How well do the selected programming models support the

implementation of the algorithm with performance?

Some Examples of Projects

• For one of the following algorithms, analyze

how well the natural implementation in several

programming models works on one or more

architectures:

! Dense matrix-matrix multiply

! Sparse matrix-vector multiply

! Sparse matrix-matrix multiply

! Stencil computations

! Distributed hash

! Map Reduce

Algorithms

  • These papers consider some aspects of algorithms that

must perform well on real hardware, as opposed to

idealized hardware.

! The Landscape of Parallel Computing Research: A View

from Berkeley, particularly Section 3. (Tech report EECS-

! Cache-Oblivious Algorithms (Algorithms for Memory

Hierarchies, LNCS 2625, pages 193-212, Springer Verlag)

! An analysis of sparse matrix-vector multiply is presented

in this paper: Achieving high sustained performance in an

unstructured mesh CFD application (SC1999)

Programming Models

  • Many programming models have been proposed to

address various goals. These papers look at some of the

issues in programming for high performance while

retaining productivity.

! A comparative study of the NAS MG benchmark across

parallel languages and architectures SC 2000

! Programmability of the HPCS Languages: A Case Study

with a Quantum Chemistry Kernel

! Automated Transformation for Performance-Critical

Kernels ACM SIGPLAN LCSD'07, Yi and Whaley

Example

• Lets look at a simple example

• Matrix-matrix multiply

! Classic example, often used in discussion of

compiler optimizations

! Core of the “HPLinpack” benchmark

! Simple to express: In Fortran,

do i=1, n

do j=1,n

c(i,j) = 0

do k=1,n

c(i,j) = c(i,j) + a(i,k) * b(k,j)

Performance Estimate

• How fast should this run?

! Standard complexity analysis in numerical analysis

counts floating point operations

! Our matrix-matrix multiply algorithm has 2n^3

floating point operations

  • 3 nested loops, each with n iterations
  • 1 multiply, 1 add in each inner iteration

! For n=100, 2x10^6 operations, or about 1 msec on a

2GHz processor :)

! For n=1000, 2x10^9 operations, or about 1 sec

The Reality

• N=

! 1818 MF (1.1ms)

• N=

! 335 MF (6s)

• What this tells us:

! Obvious expression of algorithms are

not transformed into leading

performance.

• Try it yourself! Code on web site

Questions and Comments

• Why does the algorithm run slowly

at large sizes?

• Why doesn’t the compiler do a

better job?

• What about other algorithms such

as Strassen’s algorithm?

Another Example: Scalability

• Two algorithms

run in parallel

• Perfect speedup is

# of processors

• Algorithm 1 is

(nearly) perfect

• Algorithm 2 is

fading

• Which is best?

Scalability and Time

  • Algorithm 1 has very

poor uniprocessor

performance

  • Algorithm 2 has very

good uniprocessor

performance

  • Not a (too) contrived

case - such examples

have appeared in papers

and proposals

Real and Idealized

Computer Architectures

  • Any algorithm assumes an idealized architecture

! Common choice:

  • Floating point work costs time
  • Data movement is free

! Real systems:

  • Floating point is free (fully overlapped with other operations)
  • Data movement costs time…a lot of time
  • Classical complexity analysis for numerical algorithms is

no longer correct (more precisely, no longer relevant )

! Known since at least BLAS2 and BLAS

CPU

register register register

Cache Memory

Main Memory

Simplified Computer

Architecture

  • Main memory contains

the program data

  • Cache memory contains

a copy of the main

memory data

! Cache is faster but

consumes more space

and power

! Cache items accessed by

their address in main

memory

  • Registers contain

working data only

! Modern CPUs perform

most or all operations

only on data in register

Simplified Performance Models

  • The processor runs in discrete steps, controlled by a

clock

! Typical clock rates exceed 2 GHz

  • Few operations complete in a single clock period
  • One way to describe the operations is with two

parameters:

! Latency: the time it takes to complete a single operation

(number of clock ticks or cycles)

! Bandwidth: the steady-state rate at which operations can

be completed

  • Example: Memory access

! A read of a single word from main memory may take 450+

cycles (IBM POWER6)

! Bandwidth to main memory is GB/s (>4 on POWER6)

CPU and Memory Performance

Aug- 76 Aug- 80 Aug- 84 Aug- 88 Aug- 92 Aug- 96 Aug- 00

Date of Introduction

Clock Rate (ns)

Supercomputer (Cray, NEC) RISC (HP, MIPS) CISC (Intel) Memory

DRAM

Performance

Floating

point

relevant

Floating

point

irrelevant

More Recent Results

(or meet Y2K, or correctness first )

Jan- 00 Sep- 13 May- 27 Jan- 41 Oct- 54 Jun- 68 Feb- 82 Oct- 95 Jul- 09 Date of Introduction

Clock Rate (ns)

Supercomputer (Cray, NEC) RISC (HP, MIPS) CISC (Intel) Memory 30

Trends in Computer

Architecture I

• Latency to memory will continue to

grow relative to CPU speed

! Latency hiding techniques require

finding increasing amounts of

independent work: Little’s law implies

• Number of concurrent memory

references = Latency * rate

• For 1 reference per cycle, this is already

100 – 1000 concurrent references

Trends in Computer

Architecture II

• Clock speeds will continue to

increase

! The rate of clock rate increase has

increased recently!

! Light travels 3 cm (in a vacuum) in

one cycle of a 10 GHz clock

• CPU chips won’t be causally connected

within a single clock cycle, i.e., a signal

will not cross the chip in a single clock

cycle

• Processors will be parallel!

Trends in Computer

Architecture III

  • Power dissipation problems will force more changes

! Current trends imply chips with energy densities greater than a

nuclear reactor

! Already a problem: The current issue of consumer reports looks at

the likelihood of getting a serious burn from

your laptop!

! Will force

new ways

to get

performance,

such as

extensive

parallelism