# Optimizations of the Social Force Model ## Table of Contents 1. [Performance Results](#performance-results) 2. [Baseline](#2-baseline) 3. [Optimization 1](#3-optimization-1) 4. [Optimization 2](#4-optimization-2) 5. [Optimization 3](#5-optimization-3) 6. [Optimization 4](#6-optimization-4) 7. [Optimization 5](#7-optimization-5) 8. [Optimization 6](#8-optimization-6) 9. [Optimization 7](#9-optimization-7) 10. [Optimization 8](#10-optimization-8) 11. [Optimization 9](#11-optimization-9) --- ## Performance Results ### x86 **Machine**: ``` Processors: 16 × AMD Ryzen AI 7 350 w/ Radeon 860M Memory: 32 GiB of RAM (30.6 GiB usable) Graphics Processor: AMD Radeon 860M Graphics Manufacturer: LENOVO Product Name: 83HX System Version: IdeaPad Slim 5 14AKP10 ``` **Frequency**: 2 GHz | # | Optimization | W(n) [Flops] | T(n) [Cycles] | Performance [Flops/Cycle] | Author | | --- | ------------ | ---------------- | -------------- | ------------------------- | ------ | | 0 | Baseline | 1'058'400'000.00 | 850'352'900.00 | 1.24 | | | 1 | Inlining | 1'058'400'000.00 | 756'088'260.00 | 1.40 | Elliot | | 2 | | | | | | | 3 | | | | | | | 4 | | | | | | | 5 | | | | | | | 6 | | | | | | | 7 | | | | | | | 8 | | | | | | | 9 | | | | | | ### ARM **Machine**: ``` ``` **Frequency**: ... | # | Optimization | W(n) [Flops] | T(n) [Cycles] | Performance [Flops/Cycle] | Author | | --- | ------------ | ------------ | ------------- | ------------------------- | ------ | | 0 | Baseline | | | | | | 1 | | | | | | | 2 | | | | | | | 3 | | | | | | | 4 | | | | | | | 5 | | | | | | | 6 | | | | | | | 7 | | | | | | | 8 | | | | | | | 9 | | | | | | ## 2. Baseline **Author**: [Name] **Description**: Standard implementation without optimizations. ```cpp // Paste your code here only the relevant part ``` --- ## 3. Optimization 1 **Author**: [Quy Anh] «Elliot» Nguyen **Description**: Manually inlined functions, namely `w`, `acceleration_term_dt`, `pedestrian_repulsion_dt`, `obstacle_repulsion_dt`, `norm`, `dot`, and `find_nearest_obstacle_point`, all into `run_simulation`. Got rid of small number checks after verifying they do not affect results. Removed all references to `Vector2d` and rewrote `Pedestrian` into a struct of doubles. Reduced `sqrt()` calls using mathematical properties. **Relevant Files**: `variant_inlining_1.cpp`, `variant_inlining_2.cpp`, `variant_inlining_3.cpp`, `variant_inlining_4.cpp`, `variant_inlining_5.cpp`, `variant_inlining_6.cpp`, `variant_inlining_7.cpp`, `pedestrian_reduced.hpp` ## 4. Optimization 2 **Author**: [Name] **Description**: [Briefly describe the optimization technique] ```cpp // Paste your code here only the relevant part ``` --- ## 5. Optimization 3 **Author**: [Name] **Description**: [Briefly describe the optimization technique] ```cpp // Paste your code here only the relevant part ``` --- ## 6. Optimization 4 **Author**: [Name] **Description**: [Briefly describe the optimization technique] ```cpp // Paste your code here only the relevant part ``` --- ## 7. Optimization 5 **Author**: [Name] **Description**: [Briefly describe the optimization technique] ```cpp // Paste your code here only the relevant part ``` --- ## 8. Optimization 6 **Author**: [Name] **Description**: [Briefly describe the optimization technique] ```cpp // Paste your code here only the relevant part ``` --- ## 9. Optimization 7 **Author**: [Name] **Description**: [Briefly describe the optimization technique] ```cpp // Paste your code here only the relevant part ``` --- ## 10. Optimization 8 **Author**: [Name] **Description**: [Briefly describe the optimization technique] ```cpp // Paste your code here only the relevant part ``` --- ## 11. Optimization 9 **Author**: [Name] **Description**: [Briefly describe the optimization technique] ```cpp // Paste your code here only the relevant part ``` ---