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

Reduce memory required to compile pybind11 interface #371

Merged
merged 3 commits into from
Jan 28, 2022

Conversation

scpeters
Copy link
Member

🦟 Bug fix

We observed some instances of ign-math6 CI jobs failing due to running out of memory during compilation of the pybind11 interfaces. This is a prototype for how to reduce memory usage.

Build Status https://build.osrfoundation.org/job/ign-math6-debbuilder/1334/

Summary

Currently all pybind11 template interfaces are compiled in the same translation unit in _ignition_math_pybind11.cc. It is hypothesized that this contributes to the substantial memory consumption. This pull request provides a prototype of how to reduce that memory consumption by moving the template instantiations from _ignition_math_pybind11.cc to a separate translation unit Vector2.cc. Thanks to @sloretz for suggesting the approach.

I also made a minor change in 62b65e0 that reduces the number of header files indirectly included by _ignition_math_pybind11.cc. This may not be impactful but is easy to do.

We can repeat this approach for the remaining files in a follow-up pull request if it is approved.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

Reduce the number of headers included in the
_ignition_math_pybind11.cc translation unit.

Signed-off-by: Steve Peters <[email protected]>
This isolates the template code into its own
translation unit.

Signed-off-by: Steve Peters <[email protected]>
@scpeters scpeters requested a review from ahcorde January 27, 2022 20:18
@github-actions github-actions bot added Gazebo 1️1️ Dependency of Gazebo classic version 11 🏢 edifice Ignition Edifice 🏯 fortress Ignition Fortress 🏰 citadel Ignition Citadel labels Jan 27, 2022
@codecov
Copy link

codecov bot commented Jan 27, 2022

Codecov Report

Merging #371 (213d924) into ign-math6 (286a5d4) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           ign-math6     #371   +/-   ##
==========================================
  Coverage      99.65%   99.65%           
==========================================
  Files             67       67           
  Lines           6380     6380           
==========================================
  Hits            6358     6358           
  Misses            22       22           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 286a5d4...213d924. Read the comment docs.

@scpeters scpeters merged commit 3d0b05c into gazebosim:ign-math6 Jan 28, 2022
@scpeters scpeters deleted the pybind_memory branch January 28, 2022 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel 🏢 edifice Ignition Edifice 🏯 fortress Ignition Fortress Gazebo 1️1️ Dependency of Gazebo classic version 11
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants