Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ifpack move parameters and options to xml file #400

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

dharinib98
Copy link
Contributor

@dharinib98 dharinib98 commented Feb 19, 2025

Description and Context

Ifpack parameters have been moved to an xml file like other preconditioners. Input parameters related to Ifpack have bene removed from the code. Further steps include moving it to the back end based on Stratimikos.

Related Issues and Merge Requests

Part of #365

@dharinib98 dharinib98 self-assigned this Feb 19, 2025
@dharinib98 dharinib98 changed the title 1361 ifpack move parameters and options to xml file [Draft]1361 ifpack move parameters and options to xml file Feb 19, 2025
@sebproell sebproell marked this pull request as draft February 19, 2025 14:13
@sebproell sebproell changed the title [Draft]1361 ifpack move parameters and options to xml file Ifpack move parameters and options to xml file Feb 19, 2025
@mayrmt mayrmt requested a review from maxfirmbach February 19, 2025 14:37
@mayrmt
Copy link
Member

mayrmt commented Feb 19, 2025

@dharinib98, this branch needs to be rebased to resolve merge conflicts.

Copy link
Member

@mayrmt mayrmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to the input files change the preconditioner for some tests, since the new xml file always use zero overlap and a fill level of 0, while some tests have used different settings. I don't say, that you have to change this. I just want to create awareness for this change.

What are the plans to actually dis-allow the old way of configuring Ifpack preconditioners>

Comment on lines 240 to 245
/*ifpacklist.set("fact: level-of-fill", inparams.get<int>("IFPACKGFILL"));
ifpacklist.set("partitioner: overlap", inparams.get<int>("IFPACKOVERLAP"));
ifpacklist.set("schwarz: combine mode",
inparams.get<std::string>("IFPACKCOMBINE")); // can be "Zero", "Add", "Insert"
ifpacklist.set("schwarz: reordering type", "rcm"); // "rcm" or "metis" or "amd"
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/*ifpacklist.set("fact: level-of-fill", inparams.get<int>("IFPACKGFILL"));
ifpacklist.set("partitioner: overlap", inparams.get<int>("IFPACKOVERLAP"));
ifpacklist.set("schwarz: combine mode",
inparams.get<std::string>("IFPACKCOMBINE")); // can be "Zero", "Add", "Insert"
ifpacklist.set("schwarz: reordering type", "rcm"); // "rcm" or "metis" or "amd"
*/

ifpacklist.set("partitioner: overlap", inparams.get<int>("IFPACKOVERLAP"));
ifpacklist.set("schwarz: combine mode",
inparams.get<std::string>("IFPACKCOMBINE")); // can be "Zero", "Add", "Insert"
ifpacklist.set("schwarz: reordering type", "rcm"); // "rcm" or "metis" or "amd"
*/

std::string xmlfile = inparams.get<std::string>("IFPACK_XML_FILE");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::string xmlfile = inparams.get<std::string>("IFPACK_XML_FILE");
const std::string xmlfile = inparams.get<std::string>("IFPACK_XML_FILE");

... and also at other places throughout this PR.

Comment on lines 64 to 65
IFPACK_XML_FILE xml/ifpack.xml
IFPACKCOMBINE Zero
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
IFPACK_XML_FILE xml/ifpack.xml
IFPACKCOMBINE Zero
IFPACK_XML_FILE xml/ifpack.xml
IFPACKCOMBINE Zero

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yet another reason to use yaml for input files :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is also the case with overlap values, not all files use a value of 0. Based on the number of tests that fail, we can think about a solution by maybe adding another xml file for the higher gfill values

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can have one or two default xml files in the central xml file collection. If individual tests require a specialized preconditioned, then we can put the xml file just next to the input file.

@@ -61,8 +61,7 @@ AZTOL 1.0E-3
AZCONV AZ_r0
AZITER 1000
AZSUB 50
IFPACKGFILL 1
IFPACKOVERLAP 1
IFPACK_XML_FILE xml/ifpack.xml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This places the xml file into the top level directory of all xml files for solvers/preconditioners. There is an existing folder structure. @maxfirmbach, should we sort it into the folder structure? If yes, where? Into a new directory?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dharinib98 @mayrmt We need to figure out a place, not sure where it fits best, in theory we could just create a folder called preconditioner and put all preconditioner related .xml files there with an updated naming scheme. So xml/preconditioner/ifpack.xml would work for me right now.

Copy link
Contributor

@maxfirmbach maxfirmbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one major point I would like to change. Currently AZPREC is called ILU, which I would like to switch to Ifpack to be consistent with all other AZPREC package calls e.g. MueLu and Teko. This will for sure change again soon, but for now we are not limited to ILU by using the .xml file as one could also use ILUT or even just a Jacobi method.

@@ -61,8 +61,7 @@ AZTOL 1.0E-3
AZCONV AZ_r0
AZITER 1000
AZSUB 50
IFPACKGFILL 1
IFPACKOVERLAP 1
IFPACK_XML_FILE xml/ifpack.xml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dharinib98 @mayrmt We need to figure out a place, not sure where it fits best, in theory we could just create a folder called preconditioner and put all preconditioner related .xml files there with an updated naming scheme. So xml/preconditioner/ifpack.xml would work for me right now.

@maxfirmbach maxfirmbach added status: under review Issues undergoing review during a pull request type: enhancement A new feature or enhancement to be implemented team: solvers labels Feb 19, 2025
@maxfirmbach
Copy link
Contributor

The changes to the input files change the preconditioner for some tests, since the new xml file always use zero overlap and a fill level of 0, while some tests have used different settings. I don't say, that you have to change this. I just want to create awareness for this change.

What are the plans to actually dis-allow the old way of configuring Ifpack preconditioners>

@mayrmt We will use the provided .xml file for now and see how many tests fail. From that point on we slowly work towards passing all tests with a minimal set of configs.

@dharinib98 dharinib98 force-pushed the 1361-ifpack-move-parameters-and-options-to-xml-file branch from eab2e0e to 0cdbd4a Compare February 20, 2025 09:48
Comment on lines 65 to 66
Core::Utils::string_parameter(
"IFPACK_XML_FILE", "none", "xml file defining any IFPACK options", &list);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can read files in a better way (so that relative paths are correctly resolved). See e.g. https://github.com/4C-multiphysics/4C/blob/main/src/inpar/4C_inpar_solver.cpp#L104-L108

// get the type of ifpack preconditioner from solver parameter list
std::string prectype = solverlist_.get("Preconditioner Type", "ILU");
const int overlap = ifpacklist_.get("IFPACKOVERLAP", 0);
std::string xmlFileName = ifpacklist_.get<std::string>("IFPACK_XML_FILE");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::string xmlFileName = ifpacklist_.get<std::string>("IFPACK_XML_FILE");
const std::string xmlFileName = ifpacklist_.get<std::string>("IFPACK_XML_FILE");

Comment on lines 60 to 61
auto prectype = ifpack_params.get<std::string>("Preconditioner type");
auto overlap = ifpack_params.get<int>("Overlap");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Const qualifiers?

Suggested change
auto prectype = ifpack_params.get<std::string>("Preconditioner type");
auto overlap = ifpack_params.get<int>("Overlap");
const std::string prectype = ifpack_params.get<std::string>("Preconditioner type");
const int overlap = ifpack_params.get<int>("Overlap");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: under review Issues undergoing review during a pull request team: solvers type: enhancement A new feature or enhancement to be implemented
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants