Skip to content

CMake: Expose Python LTO Control #980

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

Merged
merged 1 commit into from
May 15, 2021
Merged

Conversation

ax3l
Copy link
Member

@ax3l ax3l commented May 14, 2021

Before, LTO/IPO was default-enabled for the Python bindings. This can sometimes, e.g. on PPC64le with GCC 6.4.0 on Summit, cause problems in complex enough scenarios and fail to link.

We now expose control via the standardized CMake variable CMAKE_INTERPROCEDURAL_OPTIMIZATION. This variable populates the INTERPROCEDURAL_OPTIMIZATION property of targets but only works really reliably with CMake 3.18+. We keep the default logic to use LTO, use the pybind11::lto target for older CMake but let the user deactivate the Python LTO by setting the CMAKE_INTERPROCEDURAL_OPTIMIZATION variable to false.

Related to: pybind/pybind11#3006

Before, LTO/IPO was default-enabled for the Python bindings.
This can sometimes, e.g. on PPC64le with GCC 6.4.0 on Summit, cause
problems in complex enough scenarios and fail to link.

We now expose control via the standardized CMake variable
`CMAKE_INTERPROCEDURAL_OPTIMIZATION`. This variable populates the
`INTERPROCEDURAL_OPTIMIZATION` property of targets but only works
really reliably with CMake 3.18+. We keep the default logic to use
LTO, use the `pybind11::lto` target for older CMake but let the user
deactivate the Python LTO by setting the
`CMAKE_INTERPROCEDURAL_OPTIMIZATION` variable to false.
@ax3l ax3l force-pushed the topic-cmakePyIPOcontrol branch from fe92a53 to 5e99930 Compare May 14, 2021 23:53
@ax3l ax3l merged commit 5d184d9 into openPMD:dev May 15, 2021
@ax3l ax3l deleted the topic-cmakePyIPOcontrol branch May 15, 2021 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant