Draft: Protect calls to ParMETIS by HAVE_PARMETIS
Summary
ParMETIS can only be used if 1. the parmetis header parmetis.h
is included and 2. the parmetis library is linked. IF this is the case, the compile definition HAVE_PARMETIS
is set. This MR check for this define on all ParMETIS calls.
Merge request reports
Activity
- Resolved by Simon Praetorius
Just for the record: When is
graphRepartition()
orcommGraphRepartition()
actually called?MatrixHierarchy<...>::build(criterion) { if( #if HAVE_PARMETIS /* some_condition */ #else false #endif || criterion.accumulate()==atOnceAccu ) { repartitionAndDistributeMatrix(...); } //... /* another call to repartitionAndDistributeMatrix() protected by several conditions but with nparts = 1 */ }
with
repartitionAndDistributeMatrix()
overloaded forSequentialInformation
(just an error message) and otherInformation
callingcommGraphRepartition()
if#if AMG_REPART_ON_COMM_GRAPH
, otherwisegraphRepartition()
.Thus, the
graphRepartition()
is only called if ParMETIS is available, or a specific accumulation criterion is set. (Default issuccessiveAccu
). Inside ofgraphRepartition()
there is another check for ParMETIS:#if !HAVE_PARMETIS nparts=1; #else if(nparts>1) { ParMETIS_V3_PartKway(...); } #endif
and inside
commGraphRepartition()
the strategy is a bit different, therenparts
is not set to1
, but we have to set another compile flag:#if !HAVE_PARMETIS // ... #else #if PARALLEL_PARTITION ParMETIS_V3_PartKway(...); #endif #endif
Edited by Simon PraetoriusThe call to
ParMETIS_V3_PartKway
is actually already protected. It is just a bit difficult to find out, since there are up to 4-5 levels of nested preprocessor conditions without any comments. The reason why I got linker errors is, because in dune-common the#define HAVE_PARMETIS 1
was set independent of whether it was linked or not. This is now fixed with dune-common!1205 (merged)Sorry for the noise. I will close this MR.