ShyLu/FROSch: improve run-time error in case of missing packages
Created by: mayrmt
@trilinos/shylu @searhein
Expectations
Provide a more meaningful error message in case that a certain (optional) Trilinos package has been chosen as subdomain solver, but is not included into the build configuration.
Current Behavior
I'm attempting to use MueLu as coarse solver for FROSch's GDSW preconditioner. This requires the cmake option -D ShyLU_DDFROSch_ENABLE_MueLu:BOOL=ON
. However, without this option the subdomain solver is not recognized and the error message is just FROSCH_ASSERT(false,"SolverType unknown...");
.
Taking MueLu as an example as implemented here:
#ifdef HAVE_SHYLU_DDFROSCH_MUELU
} else if (!ParameterList_->get("SolverType","Amesos").compare("MueLu")) {
// ... calling MueLu setup here ...
}
#endif
else {
FROSCH_ASSERT(false,"SolverType unknown...");
}
The check, whether "MueLu"
has been set as "SolverType"
in the parameter list is already guarded by #ifdef HAVE_SHYLU_DDFROSCH_MUELU
, so we can't tell the user that MueLu is required, but not enabled by the build configuration.
Motivation and Context
Telling the user that a package is required, but has not been enabled in the build configuration helps to figure out, why an error occurs and points to possible solutions.
Definition of Done
-
Improve error message such that it contains details about missing packages.
Possible Solution
We could move the #ifdef HAVE_SHYLU_DDFROSCH_MUELU
inside the parameter check. This detects that MueLu has been asked for, but is not enabled. We can throw an error then that contains much more details. Maybe something along the lines of:
} else if (!ParameterList_->get("SolverType","Amesos").compare("MueLu")) {
#ifdef HAVE_SHYLU_DDFROSCH_MUELU
// ... calling MueLu setup here ...
#else
FROSCH_ASSERT(false, "SolverType is chosen as MueLu, but MueLu is not enabled to work with FROSch. Modify your build configuration to enable MueLu inside ShyLU_DDFROSch!
#endif
}
else {
FROSCH_ASSERT(false,"SolverType unknown...");
}
Steps to Reproduce
- Disable MueLu inside FROSch by setting
-D ShyLU_DDFROSch_ENABLE_MueLu:BOOL=OFF
in the configure script - Set the coarse solver's
"SolverType"
to"MueLu"
- Run any test based on
ShyLU_DDFROSch_thyra_xpetra_laplace.exe
.
Additional Information
I described the issue for MueLu here, but a similar strategy could be applied to all other package dependencies, namely Amesos, Amesos2, and Belos.