SlideShare a Scribd company logo
1 of 103
Download to read offline
Parallelizing
                           a Real-Time
                       Steering Simulation
                      for Computer Games
                              with
                             OpenMP
                               Bjoern Knafla and Claudia Leopold
                                 University of Kassel (Germany)
Dienstag, 11. September 2007                                      1
Dienstag, 11. September 2007   2
Steering a flock of birds



Dienstag, 11. September 2007                2
Dienstag, 11. September 2007   3
Dienstag, 11. September 2007   3
Dienstag, 11. September 2007   3
Bird




Dienstag, 11. September 2007          3
Bird
                               Boid




Dienstag, 11. September 2007          3
Bird
                                Boid
                               Agent



Dienstag, 11. September 2007           3
Dienstag, 11. September 2007   4
CPU
                               core




Dienstag, 11. September 2007          4
Dienstag, 11. September 2007   4
CPU    CPU    CPU    CPU
                               core   core   core   core

                               CPU    CPU    CPU    CPU
                               core   core   core   core

                               CPU    CPU    CPU    CPU
                               core   core   core   core

                               CPU    CPU    CPU    CPU
                               core   core   core   core




Dienstag, 11. September 2007                               4
Dienstag, 11. September 2007   4
Outline




Dienstag, 11. September 2007             5
Outline
                    1. Steering behaviors




Dienstag, 11. September 2007                5
Outline
                    1. Steering behaviors
                    2. OpenSteerDemo




Dienstag, 11. September 2007                5
Outline
                    1. Steering behaviors
                    2. OpenSteerDemo
                    3. Bad parallelization




Dienstag, 11. September 2007                 5
Outline
                    1. Steering behaviors
                    2. OpenSteerDemo
                    3. Bad parallelization
                    4. Parallelization that works




Dienstag, 11. September 2007                        5
Outline
                    1. Steering behaviors
                    2. OpenSteerDemo
                    3. Bad parallelization
                    4. Parallelization that works
                    5. Performance




Dienstag, 11. September 2007                        5
Outline
                    1. Steering behaviors
                    2. OpenSteerDemo
                    3. Bad parallelization
                    4. Parallelization that works
                    5. Performance
                    6. Summary


Dienstag, 11. September 2007                        5
Steering behaviors



Dienstag, 11. September 2007                        6
Dienstag, 11. September 2007   7
Dienstag, 11. September 2007   7
Dienstag, 11. September 2007   7
Dienstag, 11. September 2007   7
Alignment
Dienstag, 11. September 2007               8
OpenSteerDemo




Dienstag, 11. September 2007                   9
OpenSteerDemo
                               Testbed for the open source library
                               OpenSteer from Craig W. Reynods




Dienstag, 11. September 2007                                         9
OpenSteerDemo
                               Testbed for the open source library
                               OpenSteer from Craig W. Reynods
                               Simulates steering behavior of agents




Dienstag, 11. September 2007                                           9
OpenSteerDemo
                               Testbed for the open source library
                               OpenSteer from Craig W. Reynods
                               Simulates steering behavior of agents
                               Game-like C++ real-time application




Dienstag, 11. September 2007                                           9
OpenSteerDemo
                               Testbed for the open source library
                               OpenSteer from Craig W. Reynods
                               Simulates steering behavior of agents
                               Game-like C++ real-time application
                               OpenGL




Dienstag, 11. September 2007                                           9
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


Dienstag, 11. September 2007                                           9
Main loop




Dienstag, 11. September 2007               10
Main loop


                               Input   Update   Output




Dienstag, 11. September 2007                             10
Main loop


                                                Graph-
                               Input   Update
                                                  ics




Dienstag, 11. September 2007                             11
Input stage


                                                     Graph-
                               Input     Update
                                                       ics


                                       Time step t



Dienstag, 11. September 2007                                  12
Update stage


                                                     Graph-
                               Input     Update
                                                       ics


                                       Time step t



Dienstag, 11. September 2007                                  13
Graphics stage


                                                     Graph-
                               Input     Update
                                                      ics


                                       Time step t



Dienstag, 11. September 2007                                  14
Next main loop cycle


                                                       Graph-
                               Input      Update
                                                         ics


                                       Time step t+1



Dienstag, 11. September 2007                                    15
Update stage


                                                Graph-
                               Input   Update
                                                  ics




Dienstag, 11. September 2007                             16
Agent update
                                        Update
                                         agent

                    read + write       read + write   read + write     write

                       Agent
                                      Neighbors       Random.        Graphics
                       state

                               references




Dienstag, 11. September 2007                                                    17
Time step t
                In state t-1

                    Update     Update   Update         Update
                     agent      agent    agent   ...    agent
                       0          1        2              n



                Sequential
                    agent
                   update
                    order
Dienstag, 11. September 2007                                    18
Time step t
                In state t-1

                    Update     Update   Update           Update
                     agent      agent    agent   ...      agent
                       0          1        2                n



                Sequential                             Neighbors
                    agent
                   update
                    order                              In state t-1
Dienstag, 11. September 2007                                          18
Time step t
                               In state t-1

                   Update       Update        Update         Update
                    agent        agent         agent   ...    agent
                      0            1             2              n



                Sequential
                    agent
                   update
                    order
Dienstag, 11. September 2007                                          19
Time step t
                    In state t            In state t-1

                    Update       Update    Update              Update
                     agent        agent     agent        ...    agent
                       0            1         2                   n



                Sequential
                    agent
                   update
                    order
Dienstag, 11. September 2007                                            20
Time step t
                               In state t              In state t-1

                    Update     Update       Update         Update
                     agent      agent        agent   ...    agent
                       0          1            2              n



                Sequential
                    agent
                   update
                    order
Dienstag, 11. September 2007                                          21
Time step t
                               In state t              In state t-1

                    Update     Update       Update          Update
                     agent      agent        agent   ...     agent
                       0          1            2               n



                Sequential                                 Neighbors
                    agent
                   update
                    order                                  In state ?
Dienstag, 11. September 2007                                            21
Bad parallelization



Dienstag, 11. September 2007                         22
Dienstag, 11. September 2007   23
Questionable reliability
                     and correctness


Dienstag, 11. September 2007                  23
No speedup




Dienstag, 11. September 2007                24
No speedup




Dienstag, 11. September 2007                24
Main
                 parallelization problems


Dienstag, 11. September 2007                25
Dienstag, 11. September 2007   26
Race conditions




Dienstag, 11. September 2007                     26
Race conditions

                                Global variables, deep inheritance
                                hierarchies, strongly interdependent
                                classes




Dienstag, 11. September 2007                                           26
Race conditions

                                Global variables, deep inheritance
                                hierarchies, strongly interdependent
                                classes

                               Non-determinism




Dienstag, 11. September 2007                                           26
Race conditions

                                Global variables, deep inheritance
                                hierarchies, strongly interdependent
                                classes

                               Non-determinism

                                Order of agent updates and random
                                numbers




Dienstag, 11. September 2007                                           26
Race conditions

                                Global variables, deep inheritance
                                hierarchies, strongly interdependent
                                classes

                               Non-determinism

                                Order of agent updates and random
                                numbers

                               Non-thread-safe functions

Dienstag, 11. September 2007                                           26
Parallelization
                                that works


Dienstag, 11. September 2007                     27
Guiding ideas




Dienstag, 11. September 2007                   28
Guiding ideas
                               Update order independent simulation




Dienstag, 11. September 2007                                         28
Guiding ideas
                               Update order independent simulation
                               Agent modification only dependent on its
                               steering vector




Dienstag, 11. September 2007                                             28
Guiding ideas
                               Update order independent simulation
                               Agent modification only dependent on its
                               steering vector
                               Minimize synchronization




Dienstag, 11. September 2007                                             28
Guiding ideas
                               Update order independent simulation
                               Agent modification only dependent on its
                               steering vector
                               Minimize synchronization
                               Finish parallel processing before graphics
                               stage



Dienstag, 11. September 2007                                                28
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


Dienstag, 11. September 2007                                                28
Refactorization



Dienstag, 11. September 2007                     29
Split agent update
                                     Agent update


                                   Sim.      Modify
                                   agent     agent



                                    Agent
                                   update
                                    order
Dienstag, 11. September 2007                          30
Simulate agent stage
                               read + write    Sim.
                                               agent
                   Steering
                    Vector                       read                 read     write


                                               Agent                         Render-
                  Random.                                      Neighbors
                                               state                         Feeder
                      Agent                   Agent public

                      state                              references

                  Agent private


Dienstag, 11. September 2007                                                           31
Simulate agent stage
                               read + write    Sim.
                                               agent
                   Steering
                    Vector                       read
                                                     on st            read
                                                                             on st     write
                                                   c                    c
                                               Agent                                 Render-
                  Random.                                      Neighbors
                                               state                                 Feeder
                      Agent                   Agent public

                      state                              references

                  Agent private


Dienstag, 11. September 2007                                                                   31
Modify agent stage
                               read   Modify
                                      agent
                   Steering
                    Vector            read + write

                                       Agent                       Render-
                  Random.                              Neighbors
                                       state                       Feeder
                      Agent           Agent public

                      state                      references

                  Agent private


Dienstag, 11. September 2007                                                 32
Modify neighbor data
                             structure
                                                     Modify
                                                     neigh-
                                                      bors
                   Steering
                    Vector           read                 write

                                   Agent                          Render-
                  Random.                          Neighbors
                                   state                          Feeder
                      Agent       Agent public

                      state                  references

                  Agent private

Dienstag, 11. September 2007                                                33
Refactor update stage


                               Input   Update   Output




Dienstag, 11. September 2007                             34
Split update stage

                                           Update stage



                                         Sim.       Modify



                               Sub-stages: simulation and modification


Dienstag, 11. September 2007                                            35
Old update stage

               Update agent              Update agent           Update agent

            Sim.               Modify   Sim.    Modify         Sim.    Modify
            agent              agent    agent   agent    ...   agent   agent
              0                  0        1       1              n       n



 Sequential
 processing
     order
Dienstag, 11. September 2007                                                    36
Time step t

                                         Agents in state t-1

           Sim.                Modify      Sim.      Modify          Sim.    Modify
           agent               agent       agent     agent     ...   agent   agent
             0                   0           1         1               n       n



 Sequential
 processing
     order
Dienstag, 11. September 2007                                                          37
Time step t

                    Agent in state t                        Agents in state t-1

            Sim.               Modify    Sim.    Modify         Sim.       Modify
            agent              agent     agent   agent    ...   agent      agent
              0                  0         1       1              n          n



 Sequential
 processing
     order
Dienstag, 11. September 2007                                                        38
New update stage

                   Simulation sub-stage                  Modification sub-stage

        Sim.                   Sim.          Sim.    Modify   Modify          Modify
        agent                  agent   ...   agent   agent    agent     ...   agent
          0                      1             n       0        1               n



 Sequential
 processing
     order
Dienstag, 11. September 2007                                                           39
Time step t

               Agents in public state t-1

        Sim.                   Sim.          Sim.    Modify   Modify         Modify
        agent                  agent   ...   agent   agent    agent    ...   agent
          0                      1             n       0        1              n



 Sequential
 processing
     order
Dienstag, 11. September 2007                                                          40
Time step t

                Agents in public state t-1

         Sim.                  Sim.          Sim.    Modify   Modify         Modify
         agent                 agent   ...   agent   agent    agent    ...   agent
           0                     1             n       0        1              n



 Sequential
 processing
     order
Dienstag, 11. September 2007                                                          41
Time step t

                Agents in public state t-1

         Sim.                  Sim.          Sim.    Modify   Modify         Modify
         agent                 agent   ...   agent   agent    agent    ...   agent
           0                     1             n       0        1              n



 Sequential
 processing
     order
Dienstag, 11. September 2007                                                          42
Time step t

                Agents in public state t-1

         Sim.                  Sim.          Sim.    Modify   Modify         Modify
         agent                 agent   ...   agent   agent    agent    ...   agent
           0                     1             n       0        1              n



 Sequential                                          Each agent is modified
 processing                                          based solely on its own
     order                                           state
Dienstag, 11. September 2007                                                          42
Parallelization



Dienstag, 11. September 2007                     43
Parallel update stage
                               Simulation                                  Modification
                                   S                   S               M   M   M




                               P                                   P
                                                               B                   B
                               a           S           S
                                                                   a   M   M   M


                                                               a                   a
                               r                                   r
                                                               r                   r   Update
                               a   S           S           S
                                                                   a   M   M   M

                                                               r                   r   neigh-
                               l                                   l
                                                               i                   i    bors
                               l       S           S
                                                                   l   M   M   M

                                                               e                   e
                               e                                   e                   Possibly
                                                               r                   r
                               l   S           S           S
                                                                   l   M   M   M       parallel

Dienstag, 11. September 2007                                                                      44
Parallel simulation
                                       sub-stage
                               Simulation                              Modification
                                   S                   S




                               P                                   P
                                                               B            B
                               a           S           S
                                                                   a
                                                               a            a
                               r                                   r
                                                               r            r    Update
                               a   S           S           S
                                                                   a
                                                               r            r    neigh-
                               l                                   l
                                                               i            i     bors
                               l       S           S
                                                                   l
                                                               e            e
                               e                                   e              Possibly
                                                               r            r
                               l   S           S           S
                                                                   l              parallel

Dienstag, 11. September 2007                                                                 45
Parallel modification
                                 sub-stage
                               Simulation           Modification
                                                M   M   M




                               P            P
                                        B                   B
                               a            a   M   M   M


                                        a                   a
                               r            r
                                        r                   r   Update
                               a            a   M   M   M

                                        r                   r   neigh-
                               l            l
                                        i                   i    bors
                               l            l   M   M   M

                                        e                   e
                               e            e                   Possibly
                                        r                   r
                               l            l   M   M   M       parallel

Dienstag, 11. September 2007                                               46
Parallel modification
                                 sub-stage
                               Simulation       Modification


                               P            P
                                        B            B
                               a            a
                                        a            a
                               r            r
                                        r            r    Update
                               a            a
                                        r            r    neigh-
                               l            l
                                        i            i     bors
                               l            l
                                        e            e
                               e            e              Possibly
                                        r            r
                               l            l              parallel

Dienstag, 11. September 2007                                          47
Performance




Dienstag, 11. September 2007                 48
Test-computer
                           Dual-processor dual-
                           core 2 GHz AMD
                           Opteron with 2 GB Ram

                           2x Nvidia 7800 GTX
                           graphics cards in SLI
                           mode

                           Linux OS




Dienstag, 11. September 2007                       49
Max speedups




Dienstag, 11. September 2007                  50
Max speedups
                               Comparison of OpenSteerDemo flock of
                               birds simulation with 4 threads with
                               OpenMP-disabled version




Dienstag, 11. September 2007                                          50
Max speedups
                               Comparison of OpenSteerDemo flock of
                               birds simulation with 4 threads with
                               OpenMP-disabled version


                               Whole application: ! 2.84




Dienstag, 11. September 2007                                          50
Max speedups
                               Comparison of OpenSteerDemo flock of
                               birds simulation with 4 threads with
                               OpenMP-disabled version


                               Whole application: ! 2.84


                               Update stage: !! ! 3.54


Dienstag, 11. September 2007                                          50
Summary



Dienstag, 11. September 2007             51
Dienstag, 11. September 2007   52
Refactored first




Dienstag, 11. September 2007                     52
Refactored first

                               Simplicity!




Dienstag, 11. September 2007                     52
Refactored first

                               Simplicity!

                               High-level design to min. synchronization




Dienstag, 11. September 2007                                               52
Refactored first

                               Simplicity!

                               High-level design to min. synchronization

                               Explicit context




Dienstag, 11. September 2007                                               52
Refactored first

                               Simplicity!

                               High-level design to min. synchronization

                               Explicit context

                               Deferred computation




Dienstag, 11. September 2007                                               52
Refactored first

                               Simplicity!

                               High-level design to min. synchronization

                               Explicit context

                               Deferred computation

                               Identified slices for data-parallel
                               computation

Dienstag, 11. September 2007                                               52
Thank you!



Dienstag, 11. September 2007                53

More Related Content

Viewers also liked

Acs towards a gold standard database
Acs   towards a gold standard  database Acs   towards a gold standard  database
Acs towards a gold standard database Sean Ekins
 
LinkedIn for education: An Implementation Aid
LinkedIn for education: An Implementation AidLinkedIn for education: An Implementation Aid
LinkedIn for education: An Implementation AidRaghunath Ramaswamy
 
Test driven infrastructure development
Test driven infrastructure developmentTest driven infrastructure development
Test driven infrastructure developmentTomas Doran
 
Helsinki book launch jenn lim delivering happiness_45_16.9
Helsinki book launch jenn lim delivering happiness_45_16.9Helsinki book launch jenn lim delivering happiness_45_16.9
Helsinki book launch jenn lim delivering happiness_45_16.9Delivering Happiness
 
Локальная_система_позиционирования
Локальная_система_позиционированияЛокальная_система_позиционирования
Локальная_система_позиционированияOleg Dubinin
 
Impacto de las tics en las practicas educativas pedi00190 tabla1 3
Impacto de las tics en las practicas educativas pedi00190 tabla1 3Impacto de las tics en las practicas educativas pedi00190 tabla1 3
Impacto de las tics en las practicas educativas pedi00190 tabla1 3german8329
 
Network Security Expert and Risk Analyst
Network Security Expert and Risk AnalystNetwork Security Expert and Risk Analyst
Network Security Expert and Risk AnalystAshok K DL
 
CISOs are from Mars, CIOs are from Venus
CISOs are from Mars, CIOs are from VenusCISOs are from Mars, CIOs are from Venus
CISOs are from Mars, CIOs are from VenusBarry Caplin
 
Resume milind patil
Resume milind patilResume milind patil
Resume milind patilMilind Patil
 
Atlassian User Group, AUG Wiesbaden, 25 October 2012
Atlassian User Group, AUG Wiesbaden, 25 October 2012Atlassian User Group, AUG Wiesbaden, 25 October 2012
Atlassian User Group, AUG Wiesbaden, 25 October 2012Sarah Maddox
 

Viewers also liked (14)

Acs towards a gold standard database
Acs   towards a gold standard  database Acs   towards a gold standard  database
Acs towards a gold standard database
 
6th lesson
6th lesson6th lesson
6th lesson
 
LinkedIn for education: An Implementation Aid
LinkedIn for education: An Implementation AidLinkedIn for education: An Implementation Aid
LinkedIn for education: An Implementation Aid
 
Test driven infrastructure development
Test driven infrastructure developmentTest driven infrastructure development
Test driven infrastructure development
 
Helsinki book launch jenn lim delivering happiness_45_16.9
Helsinki book launch jenn lim delivering happiness_45_16.9Helsinki book launch jenn lim delivering happiness_45_16.9
Helsinki book launch jenn lim delivering happiness_45_16.9
 
Локальная_система_позиционирования
Локальная_система_позиционированияЛокальная_система_позиционирования
Локальная_система_позиционирования
 
Big ideas 2015
Big ideas 2015Big ideas 2015
Big ideas 2015
 
MEC / CES - January 6, 2015
MEC / CES - January 6, 2015MEC / CES - January 6, 2015
MEC / CES - January 6, 2015
 
MySQL
MySQLMySQL
MySQL
 
Impacto de las tics en las practicas educativas pedi00190 tabla1 3
Impacto de las tics en las practicas educativas pedi00190 tabla1 3Impacto de las tics en las practicas educativas pedi00190 tabla1 3
Impacto de las tics en las practicas educativas pedi00190 tabla1 3
 
Network Security Expert and Risk Analyst
Network Security Expert and Risk AnalystNetwork Security Expert and Risk Analyst
Network Security Expert and Risk Analyst
 
CISOs are from Mars, CIOs are from Venus
CISOs are from Mars, CIOs are from VenusCISOs are from Mars, CIOs are from Venus
CISOs are from Mars, CIOs are from Venus
 
Resume milind patil
Resume milind patilResume milind patil
Resume milind patil
 
Atlassian User Group, AUG Wiesbaden, 25 October 2012
Atlassian User Group, AUG Wiesbaden, 25 October 2012Atlassian User Group, AUG Wiesbaden, 25 October 2012
Atlassian User Group, AUG Wiesbaden, 25 October 2012
 

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

Rcos presentation
Rcos presentationRcos presentation
Rcos presentationmskmoorthy
 
De vuelta al pasado con SQL y stored procedures
De vuelta al pasado con SQL y stored proceduresDe vuelta al pasado con SQL y stored procedures
De vuelta al pasado con SQL y stored proceduresNorman Clarke
 
Conquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JSConquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JSCaridy Patino
 
Aspect Oriented Programming and Design
Aspect Oriented Programming and DesignAspect Oriented Programming and Design
Aspect Oriented Programming and DesignManikanda kumar
 
Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)benwaine
 
JBoss AS 7 from a user perspective
JBoss AS 7 from a user perspectiveJBoss AS 7 from a user perspective
JBoss AS 7 from a user perspectiveMax Andersen
 
Ruby + Rails
Ruby + RailsRuby + Rails
Ruby + Railsbetabeers
 
TorqueBox - When Java meets Ruby
TorqueBox - When Java meets RubyTorqueBox - When Java meets Ruby
TorqueBox - When Java meets RubyBruno Oliveira
 
Apache MINA: The high-performance protocol construction toolkit.
Apache MINA: The high-performance protocol construction toolkit.Apache MINA: The high-performance protocol construction toolkit.
Apache MINA: The high-performance protocol construction toolkit.osi
 
ZFS and FreeBSD Jails
ZFS and FreeBSD JailsZFS and FreeBSD Jails
ZFS and FreeBSD Jailsapeiron
 
Tackling Big Data with Hadoop
Tackling Big Data with HadoopTackling Big Data with Hadoop
Tackling Big Data with Hadooppoorlytrainedape
 

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

Rcos presentation
Rcos presentationRcos presentation
Rcos presentation
 
De vuelta al pasado con SQL y stored procedures
De vuelta al pasado con SQL y stored proceduresDe vuelta al pasado con SQL y stored procedures
De vuelta al pasado con SQL y stored procedures
 
Caridy patino - node-js
Caridy patino - node-jsCaridy patino - node-js
Caridy patino - node-js
 
Conquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JSConquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JS
 
Aspect Oriented Programming and Design
Aspect Oriented Programming and DesignAspect Oriented Programming and Design
Aspect Oriented Programming and Design
 
Backbone.js
Backbone.jsBackbone.js
Backbone.js
 
Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)
 
JBoss AS 7 from a user perspective
JBoss AS 7 from a user perspectiveJBoss AS 7 from a user perspective
JBoss AS 7 from a user perspective
 
Ruby + Rails
Ruby + RailsRuby + Rails
Ruby + Rails
 
Wp7 gapmeetup
Wp7 gapmeetupWp7 gapmeetup
Wp7 gapmeetup
 
TorqueBox - When Java meets Ruby
TorqueBox - When Java meets RubyTorqueBox - When Java meets Ruby
TorqueBox - When Java meets Ruby
 
Apache MINA: The high-performance protocol construction toolkit.
Apache MINA: The high-performance protocol construction toolkit.Apache MINA: The high-performance protocol construction toolkit.
Apache MINA: The high-performance protocol construction toolkit.
 
ZFS and FreeBSD Jails
ZFS and FreeBSD JailsZFS and FreeBSD Jails
ZFS and FreeBSD Jails
 
Tackling Big Data with Hadoop
Tackling Big Data with HadoopTackling Big Data with Hadoop
Tackling Big Data with Hadoop
 

Recently uploaded

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 

Recently uploaded (20)

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 

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

  • 1. Parallelizing a Real-Time Steering Simulation for Computer Games with OpenMP Bjoern Knafla and Claudia Leopold University of Kassel (Germany) Dienstag, 11. September 2007 1
  • 3. Steering a flock of birds Dienstag, 11. September 2007 2
  • 8. Bird Boid Dienstag, 11. September 2007 3
  • 9. Bird Boid Agent Dienstag, 11. September 2007 3
  • 11. CPU core Dienstag, 11. September 2007 4
  • 13. CPU CPU CPU CPU core core core core CPU CPU CPU CPU core core core core CPU CPU CPU CPU core core core core CPU CPU CPU CPU core core core core Dienstag, 11. September 2007 4
  • 16. Outline 1. Steering behaviors Dienstag, 11. September 2007 5
  • 17. Outline 1. Steering behaviors 2. OpenSteerDemo Dienstag, 11. September 2007 5
  • 18. Outline 1. Steering behaviors 2. OpenSteerDemo 3. Bad parallelization Dienstag, 11. September 2007 5
  • 19. Outline 1. Steering behaviors 2. OpenSteerDemo 3. Bad parallelization 4. Parallelization that works Dienstag, 11. September 2007 5
  • 20. Outline 1. Steering behaviors 2. OpenSteerDemo 3. Bad parallelization 4. Parallelization that works 5. Performance Dienstag, 11. September 2007 5
  • 21. Outline 1. Steering behaviors 2. OpenSteerDemo 3. Bad parallelization 4. Parallelization that works 5. Performance 6. Summary Dienstag, 11. September 2007 5
  • 29. OpenSteerDemo Testbed for the open source library OpenSteer from Craig W. Reynods Dienstag, 11. September 2007 9
  • 30. OpenSteerDemo Testbed for the open source library OpenSteer from Craig W. Reynods Simulates steering behavior of agents Dienstag, 11. September 2007 9
  • 31. OpenSteerDemo Testbed for the open source library OpenSteer from Craig W. Reynods Simulates steering behavior of agents Game-like C++ real-time application Dienstag, 11. September 2007 9
  • 32. OpenSteerDemo Testbed for the open source library OpenSteer from Craig W. Reynods Simulates steering behavior of agents Game-like C++ real-time application OpenGL Dienstag, 11. September 2007 9
  • 33. 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 Dienstag, 11. September 2007 9
  • 34. Main loop Dienstag, 11. September 2007 10
  • 35. Main loop Input Update Output Dienstag, 11. September 2007 10
  • 36. Main loop Graph- Input Update ics Dienstag, 11. September 2007 11
  • 37. Input stage Graph- Input Update ics Time step t Dienstag, 11. September 2007 12
  • 38. Update stage Graph- Input Update ics Time step t Dienstag, 11. September 2007 13
  • 39. Graphics stage Graph- Input Update ics Time step t Dienstag, 11. September 2007 14
  • 40. Next main loop cycle Graph- Input Update ics Time step t+1 Dienstag, 11. September 2007 15
  • 41. Update stage Graph- Input Update ics Dienstag, 11. September 2007 16
  • 42. Agent update Update agent read + write read + write read + write write Agent Neighbors Random. Graphics state references Dienstag, 11. September 2007 17
  • 43. Time step t In state t-1 Update Update Update Update agent agent agent ... agent 0 1 2 n Sequential agent update order Dienstag, 11. September 2007 18
  • 44. Time step t In state t-1 Update Update Update Update agent agent agent ... agent 0 1 2 n Sequential Neighbors agent update order In state t-1 Dienstag, 11. September 2007 18
  • 45. Time step t In state t-1 Update Update Update Update agent agent agent ... agent 0 1 2 n Sequential agent update order Dienstag, 11. September 2007 19
  • 46. Time step t In state t In state t-1 Update Update Update Update agent agent agent ... agent 0 1 2 n Sequential agent update order Dienstag, 11. September 2007 20
  • 47. Time step t In state t In state t-1 Update Update Update Update agent agent agent ... agent 0 1 2 n Sequential agent update order Dienstag, 11. September 2007 21
  • 48. Time step t In state t In state t-1 Update Update Update Update agent agent agent ... agent 0 1 2 n Sequential Neighbors agent update order In state ? Dienstag, 11. September 2007 21
  • 51. Questionable reliability and correctness Dienstag, 11. September 2007 23
  • 52. No speedup Dienstag, 11. September 2007 24
  • 53. No speedup Dienstag, 11. September 2007 24
  • 54. Main parallelization problems Dienstag, 11. September 2007 25
  • 56. Race conditions Dienstag, 11. September 2007 26
  • 57. Race conditions Global variables, deep inheritance hierarchies, strongly interdependent classes Dienstag, 11. September 2007 26
  • 58. Race conditions Global variables, deep inheritance hierarchies, strongly interdependent classes Non-determinism Dienstag, 11. September 2007 26
  • 59. Race conditions Global variables, deep inheritance hierarchies, strongly interdependent classes Non-determinism Order of agent updates and random numbers Dienstag, 11. September 2007 26
  • 60. Race conditions Global variables, deep inheritance hierarchies, strongly interdependent classes Non-determinism Order of agent updates and random numbers Non-thread-safe functions Dienstag, 11. September 2007 26
  • 61. Parallelization that works Dienstag, 11. September 2007 27
  • 62. Guiding ideas Dienstag, 11. September 2007 28
  • 63. Guiding ideas Update order independent simulation Dienstag, 11. September 2007 28
  • 64. Guiding ideas Update order independent simulation Agent modification only dependent on its steering vector Dienstag, 11. September 2007 28
  • 65. Guiding ideas Update order independent simulation Agent modification only dependent on its steering vector Minimize synchronization Dienstag, 11. September 2007 28
  • 66. Guiding ideas Update order independent simulation Agent modification only dependent on its steering vector Minimize synchronization Finish parallel processing before graphics stage Dienstag, 11. September 2007 28
  • 67. 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 Dienstag, 11. September 2007 28
  • 69. Split agent update Agent update Sim. Modify agent agent Agent update order Dienstag, 11. September 2007 30
  • 70. Simulate agent stage read + write Sim. agent Steering Vector read read write Agent Render- Random. Neighbors state Feeder Agent Agent public state references Agent private Dienstag, 11. September 2007 31
  • 71. Simulate agent stage read + write Sim. agent Steering Vector read on st read on st write c c Agent Render- Random. Neighbors state Feeder Agent Agent public state references Agent private Dienstag, 11. September 2007 31
  • 72. Modify agent stage read Modify agent Steering Vector read + write Agent Render- Random. Neighbors state Feeder Agent Agent public state references Agent private Dienstag, 11. September 2007 32
  • 73. Modify neighbor data structure Modify neigh- bors Steering Vector read write Agent Render- Random. Neighbors state Feeder Agent Agent public state references Agent private Dienstag, 11. September 2007 33
  • 74. Refactor update stage Input Update Output Dienstag, 11. September 2007 34
  • 75. Split update stage Update stage Sim. Modify Sub-stages: simulation and modification Dienstag, 11. September 2007 35
  • 76. Old update stage Update agent Update agent Update agent Sim. Modify Sim. Modify Sim. Modify agent agent agent agent ... agent agent 0 0 1 1 n n Sequential processing order Dienstag, 11. September 2007 36
  • 77. Time step t Agents in state t-1 Sim. Modify Sim. Modify Sim. Modify agent agent agent agent ... agent agent 0 0 1 1 n n Sequential processing order Dienstag, 11. September 2007 37
  • 78. Time step t Agent in state t Agents in state t-1 Sim. Modify Sim. Modify Sim. Modify agent agent agent agent ... agent agent 0 0 1 1 n n Sequential processing order Dienstag, 11. September 2007 38
  • 79. New update stage Simulation sub-stage Modification sub-stage Sim. Sim. Sim. Modify Modify Modify agent agent ... agent agent agent ... agent 0 1 n 0 1 n Sequential processing order Dienstag, 11. September 2007 39
  • 80. Time step t Agents in public state t-1 Sim. Sim. Sim. Modify Modify Modify agent agent ... agent agent agent ... agent 0 1 n 0 1 n Sequential processing order Dienstag, 11. September 2007 40
  • 81. Time step t Agents in public state t-1 Sim. Sim. Sim. Modify Modify Modify agent agent ... agent agent agent ... agent 0 1 n 0 1 n Sequential processing order Dienstag, 11. September 2007 41
  • 82. Time step t Agents in public state t-1 Sim. Sim. Sim. Modify Modify Modify agent agent ... agent agent agent ... agent 0 1 n 0 1 n Sequential processing order Dienstag, 11. September 2007 42
  • 83. Time step t Agents in public state t-1 Sim. Sim. Sim. Modify Modify Modify agent agent ... agent agent agent ... agent 0 1 n 0 1 n Sequential Each agent is modified processing based solely on its own order state Dienstag, 11. September 2007 42
  • 85. Parallel update stage Simulation Modification S S M M M P P B B a S S a M M M a a r r r r Update a S S S a M M M r r neigh- l l i i bors l S S l M M M e e e e Possibly r r l S S S l M M M parallel Dienstag, 11. September 2007 44
  • 86. Parallel simulation sub-stage Simulation Modification S S P P B B a S S a a a r r r r Update a S S S a r r neigh- l l i i bors l S S l e e e e Possibly r r l S S S l parallel Dienstag, 11. September 2007 45
  • 87. Parallel modification sub-stage Simulation Modification M M M P P B B a a M M M a a r r r r Update a a M M M r r neigh- l l i i bors l l M M M e e e e Possibly r r l l M M M parallel Dienstag, 11. September 2007 46
  • 88. Parallel modification sub-stage Simulation Modification P P B B a a a a r r r r Update a a r r neigh- l l i i bors l l e e e e Possibly r r l l parallel Dienstag, 11. September 2007 47
  • 90. Test-computer Dual-processor dual- core 2 GHz AMD Opteron with 2 GB Ram 2x Nvidia 7800 GTX graphics cards in SLI mode Linux OS Dienstag, 11. September 2007 49
  • 91. Max speedups Dienstag, 11. September 2007 50
  • 92. Max speedups Comparison of OpenSteerDemo flock of birds simulation with 4 threads with OpenMP-disabled version Dienstag, 11. September 2007 50
  • 93. Max speedups Comparison of OpenSteerDemo flock of birds simulation with 4 threads with OpenMP-disabled version Whole application: ! 2.84 Dienstag, 11. September 2007 50
  • 94. Max speedups Comparison of OpenSteerDemo flock of birds simulation with 4 threads with OpenMP-disabled version Whole application: ! 2.84 Update stage: !! ! 3.54 Dienstag, 11. September 2007 50
  • 97. Refactored first Dienstag, 11. September 2007 52
  • 98. Refactored first Simplicity! Dienstag, 11. September 2007 52
  • 99. Refactored first Simplicity! High-level design to min. synchronization Dienstag, 11. September 2007 52
  • 100. Refactored first Simplicity! High-level design to min. synchronization Explicit context Dienstag, 11. September 2007 52
  • 101. Refactored first Simplicity! High-level design to min. synchronization Explicit context Deferred computation Dienstag, 11. September 2007 52
  • 102. Refactored first Simplicity! High-level design to min. synchronization Explicit context Deferred computation Identified slices for data-parallel computation Dienstag, 11. September 2007 52
  • 103. Thank you! Dienstag, 11. September 2007 53