parallelizing a real-time steering simulation for computer games with openmp by bjoern knafla and...

103
Parallelizing a Real-Time Steering Sim ulation f or Computer Games with OpenMP Bjoern Knafla and Claudia Leopold University of Kassel (Germany) 1 Dienstag, 11. September 2007

Upload: bjoern-knafla

Post on 09-May-2015

979 views

Category:

Technology


1 download

DESCRIPTION

Slides from my presentation of a paper with the same title at ParCo 2007 - http://www.fz-juelich.de/nic-series/volume38/knafla.pdf . Future computer games need parallel programming to meet their ever growing hunger for per- formance. We report on our experiences in parallelizing the game-like C++ application Open- SteerDemo with OpenMP. To enable deterministic data-parallel processing of real-time agent steering behaviour, we had to change the high-level design, and refactor interfaces for explicit shared resource access. Our experience is summarized in a set of guidelines to help parallelizing legacy game code.

TRANSCRIPT

Page 1: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Parallelizinga Real-Time

Steering Simulation for Computer Games

withOpenMP

Bjoern Knafla and Claudia LeopoldUniversity of Kassel (Germany)

1Dienstag, 11. September 2007

Page 2: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

2Dienstag, 11. September 2007

Page 3: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Steering a flock of birds

2Dienstag, 11. September 2007

Page 4: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

3Dienstag, 11. September 2007

Page 5: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

3Dienstag, 11. September 2007

Page 6: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

3Dienstag, 11. September 2007

Page 7: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Bird

3Dienstag, 11. September 2007

Page 8: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

BirdBoid

3Dienstag, 11. September 2007

Page 9: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

BirdBoid

Agent

3Dienstag, 11. September 2007

Page 10: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

4Dienstag, 11. September 2007

Page 11: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

CPU

core

4Dienstag, 11. September 2007

Page 12: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

4Dienstag, 11. September 2007

Page 13: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

CPU

core

CPU

core

CPU

core

CPU

core

CPU

core

CPU

core

CPU

core

CPU

core

CPU

core

CPU

core

CPU

core

CPU

core

CPU

core

CPU

core

CPU

core

CPU

core

4Dienstag, 11. September 2007

Page 14: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

4Dienstag, 11. September 2007

Page 15: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Outline

5Dienstag, 11. September 2007

Page 16: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Outline

1. Steering behaviors

5Dienstag, 11. September 2007

Page 17: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Outline

1. Steering behaviors

2. OpenSteerDemo

5Dienstag, 11. September 2007

Page 18: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Outline

1. Steering behaviors

2. OpenSteerDemo

3. Bad parallelization

5Dienstag, 11. September 2007

Page 19: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Outline

1. Steering behaviors

2. OpenSteerDemo

3. Bad parallelization

4. Parallelization that works

5Dienstag, 11. September 2007

Page 20: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Outline

1. Steering behaviors

2. OpenSteerDemo

3. Bad parallelization

4. Parallelization that works

5. Performance

5Dienstag, 11. September 2007

Page 21: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Outline

1. Steering behaviors

2. OpenSteerDemo

3. Bad parallelization

4. Parallelization that works

5. Performance

6. Summary

5Dienstag, 11. September 2007

Page 22: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Steering behaviors

6Dienstag, 11. September 2007

Page 23: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

7Dienstag, 11. September 2007

Page 24: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

7Dienstag, 11. September 2007

Page 25: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

7Dienstag, 11. September 2007

Page 26: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

7Dienstag, 11. September 2007

Page 27: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Alignment8Dienstag, 11. September 2007

Page 28: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

OpenSteerDemo

9Dienstag, 11. September 2007

Page 29: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

OpenSteerDemo

Testbed for the open source library OpenSteer from Craig W. Reynods

9Dienstag, 11. September 2007

Page 30: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

OpenSteerDemo

Testbed for the open source library OpenSteer from Craig W. Reynods

Simulates steering behavior of agents

9Dienstag, 11. September 2007

Page 31: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

OpenSteerDemo

Testbed for the open source library OpenSteer from Craig W. Reynods

Simulates steering behavior of agents

Game-like C++ real-time application

9Dienstag, 11. September 2007

Page 32: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

OpenSteerDemo

Testbed for the open source library OpenSteer from Craig W. Reynods

Simulates steering behavior of agents

Game-like C++ real-time application

OpenGL

9Dienstag, 11. September 2007

Page 33: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

OpenSteerDemo

Testbed for the open source library OpenSteer from Craig W. Reynods

Simulates steering behavior of agents

Game-like C++ real-time application

OpenGL

http://opensteer.sourceforge.net

9Dienstag, 11. September 2007

Page 34: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Main loop

10Dienstag, 11. September 2007

Page 35: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Main loop

Input Update Output

10Dienstag, 11. September 2007

Page 36: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Input Update Graph-

ics

Main loop

11Dienstag, 11. September 2007

Page 37: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Input stage

Time step t

Input Update Graph-

ics

12Dienstag, 11. September 2007

Page 38: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Update stage

Time step t

Input Update Graph-

ics

13Dienstag, 11. September 2007

Page 39: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Graphics stage

Time step t

Input Update Graph-

ics

14Dienstag, 11. September 2007

Page 40: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Next main loop cycle

Time step t+1

Input Update Graph-

ics

15Dienstag, 11. September 2007

Page 41: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Update stage

Input Update Graph-

ics

16Dienstag, 11. September 2007

Page 42: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Agent update

Update

agent

Neighbors Random.Agent

state

read + write read + write read + write

references

Graphics

write

17Dienstag, 11. September 2007

Page 43: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Time step t

Sequentialagent

updateorder

Update

agent

0

Update

agent

1

Update

agent

2

Update

agent

n

...

In state t-1

18Dienstag, 11. September 2007

Page 44: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Time step t

Sequentialagent

updateorder

Neighbors

In state t-1

Update

agent

0

Update

agent

1

Update

agent

2

Update

agent

n

...

In state t-1

18Dienstag, 11. September 2007

Page 45: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Time step t

Sequentialagent

updateorder

Update

agent

0

Update

agent

1

Update

agent

2

Update

agent

n

...

In state t-1

19Dienstag, 11. September 2007

Page 46: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Time step t

Sequentialagent

updateorder

Update

agent

0

Update

agent

1

Update

agent

2

Update

agent

n

...

In state t-1In state t

20Dienstag, 11. September 2007

Page 47: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Time step t

Sequentialagent

updateorder

Update

agent

0

Update

agent

1

Update

agent

2

Update

agent

n

...

In state t-1In state t

21Dienstag, 11. September 2007

Page 48: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Time step t

Sequentialagent

updateorder

Neighbors

In state ?

Update

agent

0

Update

agent

1

Update

agent

2

Update

agent

n

...

In state t-1In state t

21Dienstag, 11. September 2007

Page 49: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Bad parallelization

22Dienstag, 11. September 2007

Page 50: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

23Dienstag, 11. September 2007

Page 51: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Questionable reliabilityand correctness

23Dienstag, 11. September 2007

Page 52: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

No speedup

24Dienstag, 11. September 2007

Page 53: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

No speedup

24Dienstag, 11. September 2007

Page 54: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Mainparallelization problems

25Dienstag, 11. September 2007

Page 55: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

26Dienstag, 11. September 2007

Page 56: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Race conditions

26Dienstag, 11. September 2007

Page 57: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Race conditions

Global variables, deep inheritance hierarchies, strongly interdependent classes

26Dienstag, 11. September 2007

Page 58: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Race conditions

Global variables, deep inheritance hierarchies, strongly interdependent classes

Non-determinism

26Dienstag, 11. September 2007

Page 59: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Race conditions

Global variables, deep inheritance hierarchies, strongly interdependent classes

Non-determinism

Order of agent updates and random numbers

26Dienstag, 11. September 2007

Page 60: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Race conditions

Global variables, deep inheritance hierarchies, strongly interdependent classes

Non-determinism

Order of agent updates and random numbers

Non-thread-safe functions

26Dienstag, 11. September 2007

Page 61: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Parallelizationthat works

27Dienstag, 11. September 2007

Page 62: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Guiding ideas

28Dienstag, 11. September 2007

Page 63: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Guiding ideas

Update order independent simulation

28Dienstag, 11. September 2007

Page 64: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Guiding ideas

Update order independent simulation

Agent modification only dependent on its steering vector

28Dienstag, 11. September 2007

Page 65: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Guiding ideas

Update order independent simulation

Agent modification only dependent on its steering vector

Minimize synchronization

28Dienstag, 11. September 2007

Page 66: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Guiding ideas

Update order independent simulation

Agent modification only dependent on its steering vector

Minimize synchronization

Finish parallel processing before graphics stage

28Dienstag, 11. September 2007

Page 67: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Guiding ideas

Update order independent simulation

Agent modification only dependent on its steering vector

Minimize synchronization

Finish parallel processing before graphics stage

Interfaces for explicit context

28Dienstag, 11. September 2007

Page 68: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Refactorization

29Dienstag, 11. September 2007

Page 69: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Split agent update

Agentupdateorder

Sim.

agent

Modify

agent

Agent update

30Dienstag, 11. September 2007

Page 70: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Simulate agent stage

Agent public

Agent private

Sim.

agent

Random.

Agent

state

Agent

stateNeighbors

Render-

Feeder

references

readread

read + write

write

Steering

Vector

31Dienstag, 11. September 2007

Page 71: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Simulate agent stage

Agent public

Agent private

Sim.

agent

Random.

Agent

state

Agent

stateNeighbors

Render-

Feeder

references

readread

read + write

write

Steering

Vectorconst

const

31Dienstag, 11. September 2007

Page 72: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Modify agent stage

Agent public

Agent private

Modify

agent

Random.

Agent

state

Agent

stateNeighbors

Render-

Feeder

references

read + write

read

Steering

Vector

32Dienstag, 11. September 2007

Page 73: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Modify neighbor data structure

Agent public

Agent private

Modify

neigh-

bors

Random.

Agent

state

Agent

stateNeighbors

Render-

Feeder

references

write

Steering

Vector read

33Dienstag, 11. September 2007

Page 74: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Input Update Output

Refactor update stage

34Dienstag, 11. September 2007

Page 75: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Split update stage

Sub-stages: simulation and modification

Sim. Modify

Update stage

35Dienstag, 11. September 2007

Page 76: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Old update stage

Sequentialprocessing

order

Sim.

agent

0

Modify

agent

0

Sim.

agent

1

Modify

agent

1

Sim.

agent

n

Modify

agent

n

...

Update agent Update agent Update agent

36Dienstag, 11. September 2007

Page 77: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Time step t

Sequentialprocessing

order

Sim.

agent

0

Modify

agent

0

Sim.

agent

1

Modify

agent

1

Sim.

agent

n

Modify

agent

n

...

Agents in state t-1

37Dienstag, 11. September 2007

Page 78: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Time step t

Sequentialprocessing

order

Sim.

agent

0

Modify

agent

0

Sim.

agent

1

Modify

agent

1

Sim.

agent

n

Modify

agent

n

...

Agent in state t Agents in state t-1

38Dienstag, 11. September 2007

Page 79: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

New update stage

Sequentialprocessing

order

Sim.

agent

0

Sim.

agent

1

...

Sim.

agent

n

Modify

agent

0

Modify

agent

1

...

Modify

agent

n

Simulation sub-stage Modification sub-stage

39Dienstag, 11. September 2007

Page 80: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Time step t

Sequentialprocessing

order

Sim.

agent

0

Sim.

agent

1

...

Sim.

agent

n

Modify

agent

0

Modify

agent

1

...

Modify

agent

n

Agents in public state t-1

40Dienstag, 11. September 2007

Page 81: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Time step t

Sequentialprocessing

order

Sim.

agent

0

Sim.

agent

1

...

Sim.

agent

n

Modify

agent

0

Modify

agent

1

...

Modify

agent

n

Agents in public state t-1

41Dienstag, 11. September 2007

Page 82: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Time step t

Sequentialprocessing

order

Sim.

agent

0

Sim.

agent

1

...

Sim.

agent

n

Modify

agent

0

Modify

agent

1

...

Modify

agent

n

Agents in public state t-1

42Dienstag, 11. September 2007

Page 83: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Time step t

Each agent is modifiedbased solely on its ownstate

Sequentialprocessing

order

Sim.

agent

0

Sim.

agent

1

...

Sim.

agent

n

Modify

agent

0

Modify

agent

1

...

Modify

agent

n

Agents in public state t-1

42Dienstag, 11. September 2007

Page 84: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Parallelization

43Dienstag, 11. September 2007

Page 85: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Parallel update stage

S M

B

a

r

r

i

e

r

P

a

r

a

l

l

e

l

Simulation

B

a

r

r

i

e

r

P

a

r

a

l

l

e

l

Modification

Update

neigh-

bors

Possibly

parallelS S

S S

S S S

S S

SS

M M

M M M

M M M

M M M

M M M

44Dienstag, 11. September 2007

Page 86: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Parallel simulationsub-stage

S

B

a

r

r

i

e

r

P

a

r

a

l

l

e

l

Simulation

B

a

r

r

i

e

r

P

a

r

a

l

l

e

l

Modification

Update

neigh-

bors

Possibly

parallelS S

S S

S S S

S S

SS

45Dienstag, 11. September 2007

Page 87: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Parallel modificationsub-stage

M

B

a

r

r

i

e

r

P

a

r

a

l

l

e

l

Simulation

B

a

r

r

i

e

r

P

a

r

a

l

l

e

l

Modification

Update

neigh-

bors

Possibly

parallelM M

M M M

M M M

M M M

M M M

46Dienstag, 11. September 2007

Page 88: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Parallel modificationsub-stage

B

a

r

r

i

e

r

P

a

r

a

l

l

e

l

Simulation

B

a

r

r

i

e

r

P

a

r

a

l

l

e

l

Modification

Update

neigh-

bors

Possibly

parallel

47Dienstag, 11. September 2007

Page 89: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Performance

48Dienstag, 11. September 2007

Page 90: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Dual-processor dual-core 2 GHz AMD Opteron with 2 GB Ram

2x Nvidia 7800 GTX graphics cards in SLI mode

Linux OS

Test-computer

49Dienstag, 11. September 2007

Page 91: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Max speedups

50Dienstag, 11. September 2007

Page 92: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Comparison of OpenSteerDemo flock of birds simulation with 4 threads with OpenMP-disabled version

Max speedups

50Dienstag, 11. September 2007

Page 93: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Comparison of OpenSteerDemo flock of birds simulation with 4 threads with OpenMP-disabled version

Whole application: !2.84

Max speedups

50Dienstag, 11. September 2007

Page 94: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Comparison of OpenSteerDemo flock of birds simulation with 4 threads with OpenMP-disabled version

Whole application: !2.84

Update stage: !! ! 3.54

Max speedups

50Dienstag, 11. September 2007

Page 95: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Summary

51Dienstag, 11. September 2007

Page 96: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

52Dienstag, 11. September 2007

Page 97: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Refactored first

52Dienstag, 11. September 2007

Page 98: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Refactored first

Simplicity!

52Dienstag, 11. September 2007

Page 99: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Refactored first

Simplicity!

High-level design to min. synchronization

52Dienstag, 11. September 2007

Page 100: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Refactored first

Simplicity!

High-level design to min. synchronization

Explicit context

52Dienstag, 11. September 2007

Page 101: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Refactored first

Simplicity!

High-level design to min. synchronization

Explicit context

Deferred computation

52Dienstag, 11. September 2007

Page 102: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Refactored first

Simplicity!

High-level design to min. synchronization

Explicit context

Deferred computation

Identified slices for data-parallel computation

52Dienstag, 11. September 2007

Page 103: Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP by Bjoern Knafla and Claudia Leopold (now Fohry)

Thank you!

53Dienstag, 11. September 2007