Reduce memory required to compile pybind11 interface #371
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🦟 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.
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 unitVector2.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
codecheck
passed (See contributing)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.