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

add file config example with the configs #1662

Merged
merged 6 commits into from
Oct 23, 2024
Merged

add file config example with the configs #1662

merged 6 commits into from
Oct 23, 2024

Conversation

yhmtsai
Copy link
Member

@yhmtsai yhmtsai commented Aug 6, 2024

This PR adds the example to show the solver configuration based on the file.
This PR aims to set up config close to the existing example without any registry usage.
Note. the stopping criterion is different among these configs.

  • cg.json: simple-solver
  • blockjacobi-cg.json: preconditioned-solver
  • ir.json: iterative-refinement
  • parilu.json: ilu-preconditioned-solver (by using factoization parameter directly)
  • pgm-multigrid-cg.json: multigrid-preconditioned-solver (set min_coarse_rows additionally due to this small example matrix)
  • mixed-pgm-multigrid-cg.json: mixed-multigrid-preconditioned-solver (assuming there are always more than one level)

There will be another one example to show the registry usage.

@yhmtsai yhmtsai added the 1:ST:ready-for-review This PR is ready for review label Aug 6, 2024
@yhmtsai yhmtsai requested review from a team August 6, 2024 09:31
@yhmtsai yhmtsai self-assigned this Aug 6, 2024
@ginkgo-bot ginkgo-bot added reg:build This is related to the build system. reg:example This is related to the examples. labels Aug 6, 2024
Copy link
Member

@MarcelKoch MarcelKoch left a comment

Choose a reason for hiding this comment

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

LGTM. I would prefer the json files merged.

examples/file-config-solver/config/blockjacobi-cg.json Outdated Show resolved Hide resolved
examples/file-config-solver/build.sh Outdated Show resolved Hide resolved
examples/file-config-solver/file-config-solver.cpp Outdated Show resolved Hide resolved
@MarcelKoch MarcelKoch added this to the Ginkgo 1.9.0 milestone Aug 26, 2024
Copy link
Member

@thoasm thoasm left a comment

Choose a reason for hiding this comment

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

Right now, I only comment until the discussion is resolved.
I would like all configuration files to be tested and part of the CI.
Other than that, I only have nits.

examples/file-config-solver/doc/tooltip Outdated Show resolved Hide resolved
examples/file-config-solver/file-config-solver.cpp Outdated Show resolved Hide resolved
examples/file-config-solver/file-config-solver.cpp Outdated Show resolved Hide resolved
examples/file-config-solver/file-config-solver.cpp Outdated Show resolved Hide resolved
examples/file-config-solver/file-config-solver.cpp Outdated Show resolved Hide resolved
examples/file-config-solver/file-config-solver.cpp Outdated Show resolved Hide resolved
examples/file-config-solver/config/blockjacobi-cg.json Outdated Show resolved Hide resolved
// mixed-pgm-multigrid-cg.json: mixed-multigrid-preconditioned-solver
// (assuming there are always more than one
// level)
auto config = gko::ext::config::parse_json_file(configfile);
Copy link
Member

Choose a reason for hiding this comment

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

My main concern is that this only tests a single file as part of our automatic tests. It doesn't check the other files, so we couldn't detect if we broke the compatibility.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure whether using examples as kind of integration test is a good idea.
I have add the test to check they can be runnable

@@ -20,6 +20,7 @@ set(EXAMPLES_EXEC_LIST
set(EXAMPLES_LIST
${EXAMPLES_EXEC_LIST}
custom-stopping-criterion
file-config-solver
Copy link
Member

Choose a reason for hiding this comment

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

Does this mean they are not run as part of our CI?
Is there a reason why we don't?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have added test which only checks it can run properly.

Copy link
Member Author

Choose a reason for hiding this comment

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

I do not reuse the existing one because it needs to accept additional parameter

Copy link
Member

@MarcelKoch MarcelKoch left a comment

Choose a reason for hiding this comment

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

I still think that

  1. JSON is not the right format
  2. The files should be combined, and annotated with comments

But I won't hold up the PR.

Copy link
Member

@MarcelKoch MarcelKoch left a comment

Choose a reason for hiding this comment

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

you also need to add the file to doc/examples/examples.hpp.in

@yhmtsai
Copy link
Member Author

yhmtsai commented Sep 10, 2024

I think json does not support the comment in the file.

My thought on this example is to show user can provide any kind of new config and then they can get a new solver without recompilation.
Combining them and accessing by key is somehow in the half-way. When they add a new solver to try, they need to recompile the program for the new key which is conflicted with the file config benefit.

Json is not suitable format

It is another topic. this example does not tend to handle this discussion.

Copy link
Collaborator

@greole greole left a comment

Choose a reason for hiding this comment

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

LGTM.

examples/file-config-solver/file-config-solver.cpp Outdated Show resolved Hide resolved
examples/file-config-solver/file-config-solver.cpp Outdated Show resolved Hide resolved
examples/file-config-solver/doc/intro.dox Outdated Show resolved Hide resolved
examples/file-config-solver/file-config-solver.cpp Outdated Show resolved Hide resolved
examples/file-config-solver/file-config-solver.cpp Outdated Show resolved Hide resolved
@yhmtsai yhmtsai added 1:ST:ready-to-merge This PR is ready to merge. and removed 1:ST:ready-for-review This PR is ready for review labels Oct 18, 2024
@yhmtsai yhmtsai force-pushed the config_example branch 4 times, most recently from bae74ac to 8eb792f Compare October 20, 2024 22:41
yhmtsai and others added 2 commits October 22, 2024 17:36
yhmtsai and others added 3 commits October 22, 2024 17:36
Co-authored-by: Marcel Koch <marcel.koch@kit.edu>
Co-authored-by: Thomas Grützmacher <thomas.gruetzmacher@kit.edu>
Co-authored-by: Marcel Koch <marcel.koch@kit.edu>
Co-authored-by: Gregor Olenik <gregor.olenik@web.de>
@yhmtsai yhmtsai force-pushed the config_example branch 2 times, most recently from ee9aaac to 0d68ea2 Compare October 22, 2024 20:52
@yhmtsai yhmtsai merged commit 272b4ff into develop Oct 23, 2024
8 of 11 checks passed
@yhmtsai yhmtsai deleted the config_example branch October 23, 2024 08:04
Copy link

sonarcloud bot commented Oct 23, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1:ST:ready-to-merge This PR is ready to merge. reg:build This is related to the build system. reg:example This is related to the examples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants