is parallel programming hard, and if so, why?€¦ · 19/1/2009  · 2008 sw starting salaries:...

59
© 2002 IBM Corporation 2009 linux.conf.au Kernel Miniconf January 19, 2009 Copyright © 2009 IBM Is Parallel Programming Hard, And If So, Why? Paul E. McKenney IBM Distinguished Engineer & CTO Linux Linux Technology Center

Upload: others

Post on 17-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

© 2002 IBM Corporation

2009 linux.conf.au Kernel Miniconf

January 19, 2009 Copyright © 2009 IBM

Is Parallel Programming Hard, And If So, Why?

Paul E. McKenneyIBM Distinguished Engineer & CTO LinuxLinux Technology Center

Page 2: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 2

Credits

Joint work with Manish Gupta, Maged Michael,Phil Howard, Joshua Triplett, and Jonathan Walpole

Page 3: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 3

Overview

Why Parallel Programming?Parallel Programming GoalsParallel Programming TasksPerformance of Synchronization OperationsDo “Tasks” Relate to Real-World Software?Conclusions

Page 4: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 4

Why Parallel Programming?

Page 5: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 5

Why Parallel Programming? (Party Line)

Page 6: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 6

Why Parallel Programming? (Reality)

Parallelism is one performance-optimization technique of many

Hashing, search trees, parsers, cordic algorithms, ...

But the kernel is special In-kernel performance and scalability losses cannot

be made up by user-level code Therefore, if any user application is to be fast and

scalable, the portion of the kernel used by that application must be fast and scalable

System libraries and utilities can also be specialAs can database kernels, web servers, ...

More on this later!

Page 7: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 7

Parallel Programming Goals

Page 8: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 8

Parallel Programming Goals

Performance

Productivity Generality

Page 9: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 9

Parallel Programming Goals: Why Performance?

(Performance often expressed as scalability or normalized as in performance per watt)

If you don't care about performance, why are you bothering with parallelism???

Just run single threaded and be happy!!!

But what about: All the multi-core systems out there? Efficient use of resources? Everyone saying parallel programming is crucial?

Parallel Programming: one optimization of manyCPU: one potential bottleneck of many

Page 10: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 10

Parallel Programming Goals: Why Productivity?

1948 CSIRAC (oldest intact computer) 2,000 vacuum tubes, 768 20-bit words of memory $10M AU construction price 1955 technical salaries: $3-5K/year Makes business sense to dedicate 10-person team to increasing

performance by 10%

2008 z80 (popular 8-bit microprocessor) 8,500 transistors, 64K 8-bit works of memory $1.36 per CPU in quantity 1,000 (7 OOM decrease) 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment to

gain 10% performance!• Or 10% more performance must be blazingly important• Or you are doing this as a hobby... In which case, do what you want!

Page 11: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 11

Parallel Programming Goals: Why Generality?

The more general the solution, the more users to spread the cost over.

HW

FW

OS Kernel

System Utilities & Libraries

Middleware (e.g., DBMS)

Application

Per

form

ance G

enerality

Productivity

Page 12: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 12

Performance, Scalability, and Generality

MPI

C/C++ LockingPlus Threads

Java

Productivity

Per

form

ance

and

Sca

labi

lity

OpenMP

Map / Reduce

SQL LAMP

Ruby onRails

Pick any two!!!

“Nirvana”

To

o b

ad it

do

esn

't e

xist

!!!

Page 13: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 13

Why Are Environments Specialized?

C/C++ Locking Plus Threads General purpose (and the only one useful for Linux kernel work)

Java General purpose

MPI Theoretically general purpose, but used primarily for HPC

OpenMP Parallel loops, primarily HPC (parallelize single control flow)

SQL Relational database (not good for tree/graph-structured data)

Map/Reduce “Shardable” applications with no cross-shard dependencies

LAMP Relational database with web presence

Ruby on Rails Relational database with web presence without legacy database

Page 14: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 14

Why Are Environments Specialized?

User 1User 2

User 3 User 4

HW/Abs

Page 15: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 15

Parallel Programming Tasks

Page 16: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 16

Parallel Programming Tasks

Parallel Programming Only Partly Technical Human element is extremely important What can a human being easily construct and read?

• Similar to stylized English used in emergency situations• Clarity, concision, and unambiguity trump style and grace

In a perfect world, use human-factors studies But few very narrow parallel human-factors studies And programmers vary by orders of magnitude < 3-4 OOM benefit is invisible to affordable study

Therefore, look at tasks that must be performed for parallel programs that need not be for sequential programs

Page 17: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 17

Parallel Programming Tasks

WorkPartitioning

InteractingWith Hardware

ParallelAccess Control

ResourcePartitioning

& Replication

Data-parallel approach: first partition resources, then partition work, and onlythen worry about parallel access control. Lather, rinse, and repeat.

Page 18: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 18

Parallel Programming Tasks (Close-Up View)

ParallelAccess Control

Impl

icit

vs.

Exp

licit S

ynch

ron

ization

Mech

anism

s

Page 19: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 19

Parallel Programming Tasks (Even Closer View)

Synchronization Mechanisms

To name but a few...

Locking

MessagePassing

ReferenceCounting

DataOwnership

HazardPointers

NBS

Transactions

TM

RCU

Page 20: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 20

Parallel Programming Tasks: RCU

For read-mostly data structures, RCU provides the benefits of the data-parallel model

But without the need to actually partition or replicate the RCU-protected data structures

Readers access data without needing to exclude each others or updates

• Extremely lightweight read-side primitives

And RCU provides additional read-side performance and scalability benefits

With a few limitations and restrictions....

Page 21: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 21

RCU for Read-Mostly Data Structures

WorkPartitioning

InteractingWith Hardware

ParallelAccess Control

RCU data-parallel approach: first partition resources, then partition work, andonly then worry about parallel access control, and only for updates.

ResourcePartitioning

& Replication

RCU

Almost...

Page 22: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 22

RCU Usage in the Linux Kernel

Page 23: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 23

Update-Mostly, Need Consistent Data(RCU is Really Unlikely to be the Right Tool For The Job)

Read-Write, Need Consistent Data(RCU Might Be OK...)

Read-Mostly, Need Consistent Data(RCU Works OK)

RCU Area of Applicability

Read-Mostly, Stale &Inconsistent Data OK(RCU Works Great!!!)

Page 24: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 24

Performance of Synchronization Mechanisms

Page 25: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 25

Performance of Synchronization Mechanisms

Operation RatioClock period 0.6 1Best-case CAS 37.9 63.2Best-case lock 65.6 109.3Single cache miss 139.5 232.5CAS cache miss 306.0 510.0

Cost (ns)

4-CPU 1.8GHz AMD Opteron 844 system

Typical synchronization mechanisms do this a lot

Heavily optimized reader-writer lock might get here for readers (but too bad

about those poor writers...)

Need to be here!(Partitioning/RCU)

Page 26: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 26

System Hardware Structure

CPU CPU CPU CPU

$ $ $ $

Interconnect

CPU CPU CPU CPU

$ $ $ $

Interconnect

CPU CPU CPU CPU

$ $ $ $

Interconnect

CPU CPU CPU CPU

$ $ $ $

Interconnect

Interconnect MemoryMemory

SO

L R

T @

5G

Hz

Electrons move at 0.03C to 0.3C in transistors and, so lots of waiting. 3D to the rescue?

3 ce

ntim

eter

s

Page 27: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 27

CPU Hardware Structure

CPU CPU CPU CPU

$ $ $ $

Interconnect

StoreBuffer

StoreBuffer

StoreBuffer

StoreBuffer

Page 28: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 28

Why Aren't All Instructions Created Equal?

t = CAS(&c, 0, 1);

a = 1;

b = 2;

c = 3;

Store Buffer

a=1

a=1,b=2

a=1,b=2,c=3

a = 1;

b = 2;

Store Buffer

a=1

a=1,b=2

a=1,b=2

Wait for cache line containing “c”!!!

Cannot possibly know “t” till then!!!

There are many tricks the HW guys play – otherwise the latencies would be much worse.

Page 29: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 29

Visual Demonstration of Instruction Overhead

The Bogroll Demonstration

Page 30: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 30

Exercise: Dining Philosophers ProblemEach philosopher requires two forks to eat.Need to avoid starvation.

Page 31: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 31

Exercise: Dining Philosophers Solution #1

1

52

3 4Locking hierarchy.Pick up low-numbered fork first,preventing deadlock. Is this a good solution???

Page 32: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 32

Exercise: Dining Philosophers Solution #2

15

2

3

4Locking hierarchy.Pick up low-numbered fork first,preventing deadlock.

If all want to eat, at least two will be able to do so.

Page 33: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 33

Exercise: Dining Philosophers Solution #3

Zero contention.All 5 can eat concurrently.Excellent disease control.

Page 34: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 34

Exercise: Dining Philosophers Solutions

Objections to solution #2 and #3: “You can't just change the rules like that!!!”

• No rule against moving or adding forks!!! “Dining Philosophers Problem valuable lock-hierarchy

teaching tool – #3 just destroyed it!!!”• Lock hierarchy is indeed very valuable and widely used, so the

restriction “there can only be five forks positioned as shown” does indeed have its place, even if it didn't appear in this instance of the Dining Philosophers Problem.

• But the lesson of transforming the problem into perfectly partitionable form is also very valuable, and given the wide availability of cheap multiprocessors, most desperately needed.

“But what if each fork cost a million dollars?”• Then we make the philosophers eat with their fingers... ☺

Page 35: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 35

But What To Do...

What do you do for a problem that is inherently fine-grained (so that synchronization primitives such as locking, TM, NBS, &c are inefficient) and update-heavy (so that RCU is not helpful)?

Page 36: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 36

But What To Do...

What do you do for a problem that is inherently fine-grained (so that synchronization primitives such as locking, TM, NBS, &c are inefficient) and update-heavy (so that RCU is not helpful)?

Why not just write an optimized sequential program? Or you can always invent something new!!!

Page 37: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 37

Do “Tasks” Relate to Real-World Software?

Page 38: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 38

Parallel Programming Tasks

WorkPartitioning

InteractingWith Hardware

ParallelAccess Control

Data-parallel approach: first partition resources, then partition work, and onlythen worry about parallel access control. Lather, rinse, and repeat.

ResourcePartitioning

& Replication

Page 39: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 39

Do “Tasks” Relate to Real-World Software?

Three Real-World Production Environments: “Locking plus threads” (L+T)

• Linux kernel, Pthreads, Windows Threads, ...• Often augmented: TM, RCU, ...

Message Passing Interface (MPI)• Environment of choice for high-end scientific computing

Structured Query Language (SQL)• Decades-old RDBMS workhorse

All three have excellent performance Look primarily at productivity

Page 40: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 40

Do “Tasks” Relate to Real-World Software?

L+T MPI SQLWork Partitioning m m A

Error Processing A A AGlobal Processing m m AThread Load Balancing M M AWork Item Load Balancing m m AAffinity to Resources m m AControl of Utilization m M A

Page 41: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 41

Do “Tasks” Relate to Real-World Software?

Parallel Access Control L+T MPI SQLImplicit vs. Explicit I e IMessage Passing m m ALocking m ATransactions mReference Counting m AShared Variables m AOwnership m A A

Page 42: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 42

Do “Tasks” Relate to Real-World Software?

Resource Partitioning L+T MPI SQLOver Systems m HOver NUMA Nodes m m AOver CPUs/Dies/Cores A A AOver Critical Sections m AOver Synchronization Primitives m HOver Storage Devices m m hOver Pages and Cache Lines m m A

Page 43: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 43

Conclusions

Page 44: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 44

Summary and Problem Statement

SQL Offers Impressive Example of Pervasive Parallel Automation With High Performance

Unfortunately, quite specialized L+T and MPI are General With High Performance

Too bad about that low productivity!!! So: use SQL Where it Makes Sense, Else L+T or MPI

MPI scales higher than does L+T, but harder to convert Parallel Research and Development:

High productivity and high performance (specialized apps)• Remember what the spreadsheet did for the PC!!!

Generality and high performance (infrastructure)• For the experts developing the above apps

Generality and high productivity• But only if some advantage over sequential environment!!!

Page 45: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 45

Problem Statement #1: Parallel Pitfall

Page 46: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 46

Problem Statement #1

WorkPartitioning

InteractingWith Hardware

ParallelAccess Control

Start with preconceivedalgorithmic work breakdown

ResourcePartitioning

& Replication

Page 47: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 47

Problem Statement #1

WorkPartitioning

InteractingWith Hardware

ParallelAccess Control

Start with preconceivedalgorithmic work breakdown

ResourcePartitioning

& Replication

Choosesynchronization mechanism

Page 48: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 48

Problem Statement #1

WorkPartitioning

InteractingWith Hardware

ParallelAccess Control

Start with preconceivedalgorithmic work breakdown

ResourcePartitioning

& Replication

Choosesynchronization mechanism

No attention to partitioning and replication:Poor scalability and performance!!!

Page 49: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 49

Problem Statement #2: Take Over The World!!!

Narf!!!

Page 50: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 50

Problem Statement #2

Performance

Productivity Generality

Job #1 to “Take Over the World”

But now a choice: Performance? or Productivity?

Page 51: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 51

Problem Statement #2

Performance

Productivity Generality

Job #1 to “Take Over the World”

Also need to“Be the Best”

After all, publishing performance improvements is much easier than publishing productivity results!

Page 52: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 52

Problem Statement #2

Performance

Productivity Generality

Job #1 to “Take Over the World”

Also need to“Be the Best”

Which meanspoor productivity...

Page 53: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 53

Problem Statement #2

Performance

Productivity Generality

Job #1 to “Take Over the World”

Also need to“Be the Best”

And then these people have the gall to complainthat parallel programming is hard!!!

Which meanspoor productivity...

Page 54: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 54

If You Really Want to Take Over the World...

Page 55: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 55

If You Really Want to Take Over the World...

Remember what the spreadsheet and word processordid for the personal computer.

Page 56: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 56

If You Really Want to Take Over the World...

Remember what the spreadsheet and word processordid for the personal computer.

Then focus on solving a specific problem really well.

Sometimes, generality can be a shot in the foot!!!

Page 57: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 57

Is Parallel Programming Hard, And If So, Why?

Parallel Programming is as Hard or as Easy as We Make It.

It is that hard (or that easy) because we make it that way!!!

Page 58: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 58

Legal Statement

This work represents the view of the author and does not necessarily represent the view of IBM.

IBM and IBM (logo) are trademarks or registered trademarks of International Business Machines Corporation in the United States and/or other countries.

Linux is a registered trademark of Linus Torvalds.

Other company, product, and service names may be trademarks or service marks of others.

This material is based upon work supported by the National Science Foundation under Grant No. CNS-0719851.

Page 59: Is Parallel Programming Hard, And If So, Why?€¦ · 19/1/2009  · 2008 SW starting salaries: $50-95K/year US (1 OOM increase) Need 1M CPUs to break even on a one-person-year investment

IBM Linux Technology Center

“Is Parallel Programming Hard?” 2009 linux.conf.au kernel Miniconf © 2009 IBM Corporation 59

Questions?