Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accelerate the build process of autoware.universe (mostly behavior_planning packages) #4821

Closed
3 tasks done
soblin opened this issue Aug 30, 2023 · 0 comments
Closed
3 tasks done

Comments

@soblin
Copy link
Contributor

soblin commented Aug 30, 2023

Checklist

  • I've read the contribution guidelines.
  • I've searched other issues and no duplicate issues were found.
  • I've agreed with the maintainers that I can plan this task.

Description

Previously I found out that some packages are maybe consuming about 1/3 of its build time just for preprocessing due to huge header files.

You can check how to measure the compile time of a single header file on the above thread. This table is the example:

file time
tier4_autoware_utils/tier4_autoware_utils.hpp 9.5
motion_utils/motion_utils.hpp 9.7
route_handler/route_handler.hpp 14.0
lanelet2_extension/utility/query.hpp 4.0

To solve this issue a applied several refactorings that aims to

  1. avoid include of tier4_autoware_utils.hpp and motion_utils.hpp
  2. remove unnecessary includes in tier4_autoware_utils.hpp and motion_utils.hpp
  3. export template functions in motion_utils.hpp as extern template
  4. include lanelet2_core/lanelet2_routing/lanelet2_extension/Forward.hpp as much as possible

on this branch(https://github.com/soblin/autoware.universe/tree/build-fast/individual/behavior_velocity_planner_common) and measured how much the build time /maximum momory usage decreases.

I compiled all the files in behavior_velocity_planner_speed_bump_module in parallel and measured the process with time -v command.

Without the refactoring,

        Command being timed: "./all.sh"
        User time (seconds): 83.14
        System time (seconds): 8.26
        Percent of CPU this job got: 308%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:29.65
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 2260592
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 581
        Minor (reclaiming a frame) page faults: 2463525
        Voluntary context switches: 11377
        Involuntary context switches: 970
        Swaps: 0
        File system inputs: 121160
        File system outputs: 375512
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0

After the refactorings,

        Command being timed: "./all.sh"
        User time (seconds): 46.03
        System time (seconds): 5.06
        Percent of CPU this job got: 348%
        Elapsed (wall clock) time (h:mm:ss or m:ss): 0:14.66
        Average shared text size (kbytes): 0
        Average unshared data size (kbytes): 0
        Average stack size (kbytes): 0
        Average total size (kbytes): 0
        Maximum resident set size (kbytes): 1351576
        Average resident set size (kbytes): 0
        Major (requiring I/O) page faults: 621
        Minor (reclaiming a frame) page faults: 1449186
        Voluntary context switches: 31465
        Involuntary context switches: 625
        Swaps: 0
        File system inputs: 163024
        File system outputs: 178976
        Socket messages sent: 0
        Socket messages received: 0
        Signals delivered: 0
        Page size (bytes): 4096
        Exit status: 0

You can see the build time / maximum memory usage is reduced by about 50%.

Purpose

x

Possible approaches

This task is ready once

are approved. Then I will ship each PR in several steps:

  • Phase1:
    • remove tier4_autoware_utils.hpp from common/
    • remove motion_utils.hpp from common/
    • remove tier4_autoware_utils.hpp from vehicle/
  • Phase2:
    • remove tier4_autoware_utils.hpp from evaluator/ and simulator/
    • remove tier4_autoware_utils.hpp from system/
    • remove tier4_autoware_utils.hpp from localization/
    • remove tier4_autoware_utils.hpp from perception/
    • remove tier4_autoware_utils.hpp and motion_utils from planning/
    • remove tier4_autoware_utils.hpp from control/
  • Phase3:
    • only include forward declaration of lanelet packages in sensing
    • only include forward declaration of lanelet packages in perception
    • only include forward declaration of lanelet packages in control
    • only include forward declaration of lanelet packages in planning
  • Phase4:
    • refactor tier4_autoware_utils
    • refactor motion_utils
    • refactor behavior_velocity_planner_common

Definition of done

x

@soblin soblin closed this as completed Sep 21, 2023
@xmfcx xmfcx removed this from Autoware Labs Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant