-
Notifications
You must be signed in to change notification settings - Fork 93
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
42ac678
add file config example with the configs
yhmtsai 5de2254
update build.sh to c++17 in example
yhmtsai 3051acb
add test and update documentation
yhmtsai 8fb6a5a
add missing example link
yhmtsai 9f0469c
use milliseconds directly and update documentation
yhmtsai 05742fe
fix windows execution test by using std::filesystem
yhmtsai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
project(file-config-solver) | ||
|
||
# We only need to find Ginkgo/nlohmann_json if we build this example stand-alone | ||
if (NOT GINKGO_BUILD_EXAMPLES) | ||
find_package(Ginkgo 1.9.0 REQUIRED) | ||
find_package(nlohmann_json 3.9.1 REQUIRED) | ||
endif() | ||
|
||
add_executable(file-config-solver file-config-solver.cpp) | ||
target_link_libraries(file-config-solver Ginkgo::ginkgo nlohmann_json::nlohmann_json) | ||
|
||
# Copy the data files to the execution directory | ||
configure_file(data/A.mtx data/A.mtx COPYONLY) | ||
# Copy the config files to the execution directory | ||
file(GLOB config_list RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" config/*.json) | ||
foreach(config IN LISTS config_list) | ||
configure_file("${config}" "${config}" COPYONLY) | ||
endforeach() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
# set up script | ||
if [ $# -ne 1 ]; then | ||
echo -e "Usage: $0 GINKGO_BUILD_DIRECTORY" | ||
exit 1 | ||
fi | ||
BUILD_DIR=$1 | ||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" &>/dev/null && pwd ) | ||
|
||
source ${THIS_DIR}/../build-setup.sh | ||
|
||
# build | ||
${CXX} -std=c++17 -o ${THIS_DIR}/file-config-solver ${THIS_DIR}/file-config-solver.cpp \ | ||
-I${THIS_DIR}/../../include -I${BUILD_DIR}/include \ | ||
-L${THIS_DIR} ${LINK_FLAGS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"type": "solver::Cg", | ||
"preconditioner": { | ||
"type": "preconditioner::Jacobi", | ||
"max_block_size": 8 | ||
}, | ||
"criteria": [ | ||
{ | ||
"type": "Iteration", | ||
"max_iters": 20 | ||
}, | ||
{ | ||
"type": "ResidualNorm", | ||
"reduction_factor": 1e-7 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"type": "solver::Cg", | ||
"criteria": [ | ||
{ | ||
"type": "Iteration", | ||
"max_iters": 20 | ||
}, | ||
{ | ||
"type": "ResidualNorm", | ||
"reduction_factor": 1e-7 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"type": "solver::Ir", | ||
"solver": { | ||
"type": "solver::Cg", | ||
"criteria": [ | ||
{ | ||
"type": "ResidualNorm", | ||
"reduction_factor": 1e-2 | ||
} | ||
] | ||
}, | ||
"criteria": [ | ||
{ | ||
"type": "Iteration", | ||
"max_iters": 10000 | ||
}, | ||
{ | ||
"type": "ResidualNorm", | ||
"reduction_factor": 1e-12 | ||
} | ||
] | ||
} |
84 changes: 84 additions & 0 deletions
84
examples/file-config-solver/config/mixed-pgm-multigrid-cg.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{ | ||
"type": "solver::Cg", | ||
"preconditioner": { | ||
"type": "solver::Multigrid", | ||
"max_levels": 10, | ||
"min_coarse_rows": 2, | ||
"pre_smoother": [ | ||
{ | ||
"type": "solver::Ir", | ||
"relaxation_factor": 0.9, | ||
"solver": { | ||
"type": "preconditioner::Jacobi", | ||
"max_block_size": 1 | ||
}, | ||
"criteria": [ | ||
{ | ||
"type": "Iteration", | ||
"max_iters": 1 | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "solver::Ir", | ||
"value_type": "float32", | ||
"relaxation_factor": 0.9, | ||
"solver": { | ||
"type": "preconditioner::Jacobi", | ||
"max_block_size": 1 | ||
}, | ||
"criteria": [ | ||
{ | ||
"type": "Iteration", | ||
"max_iters": 1 | ||
} | ||
] | ||
} | ||
], | ||
"post_uses_pre": true, | ||
"mg_level": [ | ||
{ | ||
"type": "multigrid::Pgm", | ||
"deterministic": true | ||
}, | ||
{ | ||
"type": "multigrid::Pgm", | ||
"value_type": "float32", | ||
"deterministic": true | ||
} | ||
], | ||
"coarsest_solver": { | ||
"type": "solver::Ir", | ||
"value_type": "float32", | ||
"relaxation_factor": 0.9, | ||
"solver": { | ||
"type": "preconditioner::Jacobi", | ||
"max_block_size": 1 | ||
}, | ||
"criteria": [ | ||
{ | ||
"type": "Iteration", | ||
"max_iters": 4 | ||
} | ||
] | ||
}, | ||
"default_initial_guess": "zero", | ||
"criteria": [ | ||
{ | ||
"type": "Iteration", | ||
"max_iters": 1 | ||
} | ||
] | ||
}, | ||
"criteria": [ | ||
{ | ||
"type": "Iteration", | ||
"max_iters": 100 | ||
}, | ||
{ | ||
"type": "ResidualNorm", | ||
"reduction_factor": 1e-8, | ||
"baseline": "absolute" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"type": "solver::Gmres", | ||
"preconditioner": { | ||
"type": "preconditioner::Ilu", | ||
"l_solver_type": "solver::LowerTrs", | ||
"reverse_apply": false, | ||
"factorization": { | ||
"type": "factorization::ParIlu" | ||
} | ||
}, | ||
"criteria": [ | ||
{ | ||
"type": "Iteration", | ||
"max_iters": 1000 | ||
}, | ||
{ | ||
"type": "ResidualNorm", | ||
"reduction_factor": 1e-7 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"type": "solver::Cg", | ||
"preconditioner": { | ||
"type": "solver::Multigrid", | ||
"min_coarse_rows": 2, | ||
"mg_level": [ | ||
{ | ||
"type": "multigrid::Pgm", | ||
"deterministic": true | ||
} | ||
], | ||
"criteria": [ | ||
{ | ||
"type": "Iteration", | ||
"max_iters": 1 | ||
} | ||
] | ||
}, | ||
"criteria": [ | ||
{ | ||
"type": "Iteration", | ||
"max_iters": 100 | ||
}, | ||
{ | ||
"type": "ResidualNorm", | ||
"reduction_factor": 1e-8, | ||
"baseline": "absolute" | ||
} | ||
] | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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