Skip to content

Fix mpi4py include path in CO_SIM_IO_BUILD_PYTHON_MPI4PY_INTERFACE - #383

Merged
loumalouomega merged 1 commit into
masterfrom
fix-mpi4py
Oct 26, 2026
Merged

loumalouomega merged 1 commit into
masterfrom
fix-mpi4py

Conversation

@loumalouomega

Copy link
Copy Markdown
Member

Description

CO_SIM_IO_BUILD_PYTHON_MPI4PY_INTERFACE never added the mpi4py include directory. mpi4py_interface.cpp includes <mpi4py/mpi4py.h>, so the build only worked if the caller passed -isystem <site-packages>/mpi4py/include through CMAKE_CXX_FLAGS. The CI job currently does that as a workaround.

Changes

  • When the option is enabled, query the Python interpreter for mpi4py.get_include(). It uses Python_EXECUTABLE and falls back to PYTHON_EXECUTABLE, because pybind11 may set either.
  • Add the result to PyCoSimIOMPI_mpi4pyInterface as a SYSTEM include directory.
  • Stop configuration with a clear error if mpi4py can't be imported or its include directory doesn't exist.

Testing

  • Configured with -DCO_SIM_IO_BUILD_PYTHON=ON -DCO_SIM_IO_BUILD_MPI=ON -DCO_SIM_IO_BUILD_PYTHON_MPI4PY_INTERFACE=ON and no CMAKE_CXX_FLAGS.
  • Built PyCoSimIOMPI_mpi4pyInterface successfully.

@loumalouomega
loumalouomega merged commit 589b41b into master Oct 26, 2026
24 of 27 checks passed
@loumalouomega
loumalouomega deleted the fix-mpi4py branch October 26, 2026 10:28
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

Successfully merging this pull request may close these issues.

2 participants