dolfinx
dolfinx copied to clipboard
[BUG]: FindParMETIS.cmake has flawed behaviour
Summarize the issue
When building with cmake, the search path for parmetis includes PARMETIS_ROOT/lib, but if PARMETIS_ROOT is not set, then it will search in /lib. For some installations, (as I have found), there may be a copy of libparmetis.so in /lib.
e.g. when I build with spack on this specific machine, it links against both the parmetis in spack, and the one in /lib, causing MPI issues.
How to reproduce the bug
Build dolfinx using spack on a machine with parmetis installed in /lib.
Minimal Example (Python)
N/A
Output (Python)
N/A
Version
main branch
DOLFINx git commit
No response
Installation
No response
Additional information
No response
I am not sure how to clean up the cmake file to prevent this from happening, currently has:
HINTS ${PARMETIS_ROOT}/lib $ENV{PARMETIS_ROOT}/lib ${PETSC_INCLUDE_DIRS}
but if PARMETIS_ROOT is not set, (or in ENV) then will revert to /lib
I've cleaned up the CMake. One of the issues is that we were often using undefined variables, e.g. using PARMETIS_ROOT even when it's not set. This is now fixed, and CI will now fail if we use undefined variables in CMake.