![Page 1: 64-149 Praktikum Parallele Programmierung Fabian Besner](https://reader031.vdokument.com/reader031/viewer/2022020203/588094861a28ab8f108be1cd/html5/thumbnails/1.jpg)
SwarmFlocking64-149 Praktikum Parallele Programmierung
Fabian Besner, Dominik Lohmann, Jakob Rieck
{2besner,2lohmann,2rieck}@informatik.uni-hamburg.de
github.com/dominiklohmann/PAPO14-SwarmFlocking
![Page 2: 64-149 Praktikum Parallele Programmierung Fabian Besner](https://reader031.vdokument.com/reader031/viewer/2022020203/588094861a28ab8f108be1cd/html5/thumbnails/2.jpg)
Flocking Behavior
Seperation Alignment Cohesion
![Page 3: 64-149 Praktikum Parallele Programmierung Fabian Besner](https://reader031.vdokument.com/reader031/viewer/2022020203/588094861a28ab8f108be1cd/html5/thumbnails/3.jpg)
Parallelization
• Cut the world into vertical areas and distribute the swarm into partial swarms
• Each partial swarm is aware of its possibly relevant neighbors
• Neighbors communicate their local updates after each step
• Root also calculates the predator movement and therefore needs to have everything
![Page 4: 64-149 Praktikum Parallele Programmierung Fabian Besner](https://reader031.vdokument.com/reader031/viewer/2022020203/588094861a28ab8f108be1cd/html5/thumbnails/4.jpg)
Optimizationposition velocityx y z _ x y z _Boid 32 Bytex y z x y zMPI_BOID 24 Byte (25% less)x y zMPI_BOID_THIN 12 Byte (62,5% less)
• SSE(2) instructions for 75% better performance in Vector.h
• Custom Datatype for MPI to reduce communication overhead
• Algorithm optimizations to only view boids in a neighbored PartialSwarm so boid density actually influences the performance
![Page 5: 64-149 Praktikum Parallele Programmierung Fabian Besner](https://reader031.vdokument.com/reader031/viewer/2022020203/588094861a28ab8f108be1cd/html5/thumbnails/5.jpg)
Command Line Interface % ./bin/simulation --help Options: -h [ --help ] Print this help message -b [ --boid-count ] arg Number of boids to simulate -p [ --predator-count ] arg Number of predators to simulate -s [ --steps ] arg Number of steps to simulate -o [ --output ] arg Specify an output file
% ./bin/visualisation --help Options: -h [ --help ] Print this help message -i [ --input ] arg input file source --fps arg Set a custom number of frames to be displayed each second (defaults to 30) -s [ --single-stepping ] Control execution of the visualisation by pressing 'space' --stdin use stdin as source (overwrites --input) -b [ --boid-count ] arg Number of boids per frame -p [ --predator-count ] arg Number of predators per frame
![Page 6: 64-149 Praktikum Parallele Programmierung Fabian Besner](https://reader031.vdokument.com/reader031/viewer/2022020203/588094861a28ab8f108be1cd/html5/thumbnails/6.jpg)
Performance Reportmpirun -np 16 time simulation -s 100 -b x -p 0 -o /dev/null
1
100
10.000
0 75000 150000 225000 300000
local cluster
![Page 7: 64-149 Praktikum Parallele Programmierung Fabian Besner](https://reader031.vdokument.com/reader031/viewer/2022020203/588094861a28ab8f108be1cd/html5/thumbnails/7.jpg)
Performance Reportmpirun -np x time simulation -s 100 -b 65536 -p 0 -o /dev/null
0
250
500
750
1.000
0 75 150 225 300
![Page 8: 64-149 Praktikum Parallele Programmierung Fabian Besner](https://reader031.vdokument.com/reader031/viewer/2022020203/588094861a28ab8f108be1cd/html5/thumbnails/8.jpg)
Implementation Problems
• Outdated versions of g++, libstdc++, boost and most notably MPI on cluster coupled with local development and testing
• Trial and error development with OpenGL
• Indeterministic results (due to optimizations) make testing a lot harder
![Page 9: 64-149 Praktikum Parallele Programmierung Fabian Besner](https://reader031.vdokument.com/reader031/viewer/2022020203/588094861a28ab8f108be1cd/html5/thumbnails/9.jpg)
Demo