Skip to content

Respect CMAKE_DISABLE_FIND_PACKAGE_ZOLTAN in REQUIRE_ZOLTAN check#1014

Open
hakonhagland wants to merge 1 commit intoOPM:masterfrom
hakonhagland:zoltan_cmake
Open

Respect CMAKE_DISABLE_FIND_PACKAGE_ZOLTAN in REQUIRE_ZOLTAN check#1014
hakonhagland wants to merge 1 commit intoOPM:masterfrom
hakonhagland:zoltan_cmake

Conversation

@hakonhagland
Copy link
Copy Markdown
Contributor

Related: #1013 and OPM/opm-simulators#6956.

  • Skip the REQUIRE_ZOLTAN error when CMAKE_DISABLE_FIND_PACKAGE_ZOLTAN is set, since the user has explicitly opted out of Zoltan — the configuration should not fail for a deliberately disabled package

Motivation

When building with an MPI implementation that doesn't have a matching Zoltan package (e.g. MPICH instead of OpenMPI), users need to disable Zoltan via -DCMAKE_DISABLE_FIND_PACKAGE_ZOLTAN=ON. Currently this still fails because REQUIRE_ZOLTAN defaults to ON and fires a SEND_ERROR when ZOLTAN_FOUND is false, requiring the additional flag -DREQUIRE_ZOLTAN=OFF as a workaround. After this change, -DCMAKE_DISABLE_FIND_PACKAGE_ZOLTAN=ON alone is sufficient.

When a user passes -DCMAKE_DISABLE_FIND_PACKAGE_ZOLTAN=ON to
explicitly disable Zoltan, the REQUIRE_ZOLTAN check should not
fire. Previously, passing CMAKE_DISABLE_FIND_PACKAGE_ZOLTAN=ON
would prevent find_package(ZOLTAN) from finding Zoltan, but the
REQUIRE_ZOLTAN check would still fail because ZOLTAN_FOUND is
false and REQUIRE_ZOLTAN defaults to ON.
@hakonhagland
Copy link
Copy Markdown
Contributor Author

jenkins build this please

@hakonhagland hakonhagland added the manual:irrelevant This PR is a minor fix and should not appear in the manual label Mar 20, 2026
@blattms
Copy link
Copy Markdown
Member

blattms commented Mar 20, 2026

Are you then using METIS or no load balancer at all?

We never envisioned using a parallel cpgrid without any loadbalancer. It is not really a production use case and I would try to not add any maintenance effort for doing this.

@hakonhagland
Copy link
Copy Markdown
Contributor Author

hakonhagland commented Mar 20, 2026

Are you then using METIS or no load balancer at all?

@blattms I tested this with the simple partitioner (--partition-method=simple) (no METIS). I ended up building Zoltan from source for my MPICH testing, so I no longer need the no-Zoltan path myself. However, the fixes are still worth having for correctness:

  • Commit 1 changes #if HAVE_MPI to #if HAVE_MPI && HAVE_ZOLTAN where Zoltan types (ZOLTAN_ID_PTR, Zoltan_Struct) are used, the existing guards are simply incorrect since the code won't compile without Zoltan. This is minimal maintenance (adding && HAVE_ZOLTAN to a few existing #if lines, no new code paths).

  • Commit 2 fixes a latent bug: CombinedGridWellGraph is used by vanillaPartitionGridOnRoot (the else fallback in CpGrid.cpp:387), but its constructor was inside #if HAVE_ZOLTAN. If that code path is ever reached without Zoltan, it would dereference a null pointer and SIGSEGV. The fix moves the constructor to #if HAVE_MPI where it belongs.

Someone following the same path (trying MPICH, disabling Zoltan temporarily) would hit these same failures. The fix smooths that path and having the simple partitioner work correctly may be useful for comparison and debugging purposes, even if it's not production quality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:irrelevant This PR is a minor fix and should not appear in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants