-
Notifications
You must be signed in to change notification settings - Fork 90
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
Fix issues with distributed preconditioners, add to benchmarks #1660
Open
pratikvn
wants to merge
3
commits into
develop
Choose a base branch
from
fix-distmg-perf
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,11 @@ DEFINE_string(preconditioners, "none", | |
"A comma-separated list of preconditioners to use. " | ||
"Supported values are: none, jacobi, paric, parict, parilu, " | ||
"parilut, ic, ilu, paric-isai, parict-isai, parilu-isai, " | ||
"parilut-isai, ic-isai, ilu-isai, overhead"); | ||
"parilut-isai, ic-isai, ilu-isai, overhead" | ||
#ifdef GINKGO_BUILD_MPI | ||
", schwarz-jacobi, schwarz-ilu, schwarz-ic, schwarz-lu, dist-mg" | ||
#endif | ||
""); | ||
|
||
DEFINE_uint32(parilu_iterations, 5, | ||
"The number of iterations for ParIC(T)/ParILU(T)"); | ||
|
@@ -292,12 +296,139 @@ const std::map<std::string, std::function<std::unique_ptr<gko::LinOpFactory>( | |
.with_sparsity_power(FLAGS_isai_power) | ||
.on(exec); | ||
}}, | ||
{"overhead", [](std::shared_ptr<const gko::Executor> exec) { | ||
{"overhead", | ||
[](std::shared_ptr<const gko::Executor> exec) { | ||
return gko::Overhead<etype>::build() | ||
.with_criteria(gko::stop::ResidualNorm<etype>::build() | ||
.with_reduction_factor(rc_etype{})) | ||
.on(exec); | ||
}}}; | ||
}} | ||
#ifdef GINKGO_BUILD_MPI | ||
, | ||
{"schwarz-jacobi", | ||
[](std::shared_ptr<const gko::Executor> exec) { | ||
return gko::experimental::distributed::preconditioner::Schwarz< | ||
etype>::build() | ||
.with_local_solver( | ||
gko::preconditioner::Jacobi<etype>::build() | ||
.with_max_block_size(FLAGS_jacobi_max_block_size) | ||
.with_storage_optimization( | ||
parse_storage_optimization(FLAGS_jacobi_storage)) | ||
.with_accuracy( | ||
static_cast<rc_etype>(FLAGS_jacobi_accuracy)) | ||
.with_skip_sorting(true) | ||
.on(exec)) | ||
.on(exec); | ||
}}, | ||
{"schwarz-general-isai", | ||
[](std::shared_ptr<const gko::Executor> exec) { | ||
return gko::experimental::distributed::preconditioner::Schwarz< | ||
etype, itype>::build() | ||
.with_local_solver( | ||
gko::preconditioner::GeneralIsai<etype, itype>::build() | ||
.with_sparsity_power(FLAGS_isai_power) | ||
.on(exec)) | ||
.on(exec); | ||
}}, | ||
{"schwarz-spd-isai", | ||
[](std::shared_ptr<const gko::Executor> exec) { | ||
return gko::experimental::distributed::preconditioner::Schwarz< | ||
etype, itype>::build() | ||
.with_local_solver( | ||
gko::preconditioner::SpdIsai<etype, itype>::build() | ||
.with_sparsity_power(FLAGS_isai_power) | ||
.on(exec)) | ||
.on(exec); | ||
}}, | ||
{"schwarz-ilu", | ||
[](std::shared_ptr<const gko::Executor> exec) { | ||
auto fact = | ||
gko::share(gko::factorization::Ilu<etype, itype>::build() | ||
.with_skip_sorting(FLAGS_skip_sorting) | ||
.on(exec)); | ||
return gko::experimental::distributed::preconditioner::Schwarz< | ||
etype, itype>::build() | ||
.with_local_solver(gko::preconditioner::Ilu< | ||
gko::solver::LowerTrs<etype, itype>, | ||
gko::solver::UpperTrs<etype, itype>, | ||
false, itype>::build() | ||
.with_factorization(fact) | ||
.on(exec)) | ||
.on(exec); | ||
}}, | ||
{"schwarz-ic", | ||
[](std::shared_ptr<const gko::Executor> exec) { | ||
auto fact = | ||
gko::share(gko::factorization::Ic<etype, itype>::build() | ||
.with_skip_sorting(FLAGS_skip_sorting) | ||
.on(exec)); | ||
return gko::experimental::distributed::preconditioner::Schwarz< | ||
etype, itype>::build() | ||
.with_local_solver( | ||
gko::preconditioner::Ic< | ||
gko::solver::LowerTrs<etype, itype>, itype>::build() | ||
.with_factorization(fact) | ||
.on(exec)) | ||
.on(exec); | ||
}}, | ||
{"schwarz-lu", | ||
[](std::shared_ptr<const gko::Executor> exec) { | ||
auto fact = gko::share( | ||
gko::experimental::factorization::Lu<etype, itype>::build().on( | ||
exec)); | ||
return gko::experimental::distributed::preconditioner::Schwarz< | ||
etype, itype>::build() | ||
.with_local_solver( | ||
gko::experimental::solver::Direct<etype, itype>::build() | ||
.with_factorization(fact) | ||
.on(exec)) | ||
.on(exec); | ||
}}, | ||
{"dist-mg", | ||
[](std::shared_ptr<const gko::Executor> exec) { | ||
using ir = gko::solver::Ir<etype>; | ||
using schwarz = | ||
gko::experimental::distributed::preconditioner::Schwarz<etype, | ||
itype>; | ||
using bj = gko::preconditioner::Jacobi<etype, itype>; | ||
auto iter_stop = gko::share(gko::stop::Iteration::build() | ||
.with_max_iters(FLAGS_mg_max_iters) | ||
.on(exec)); | ||
auto tol_stop = | ||
gko::share(gko::stop::ResidualNorm<etype>::build() | ||
.with_baseline(gko::stop::mode::absolute) | ||
.with_reduction_factor(FLAGS_mg_tolerance) | ||
.on(exec)); | ||
auto coarsest_solver_gen = gko::share( | ||
ir::build() | ||
.with_solver(schwarz::build().with_local_solver( | ||
bj::build().with_max_block_size(1u).with_skip_sorting( | ||
true))) | ||
.with_relaxation_factor(static_cast<etype>(0.9)) | ||
.with_criteria( | ||
gko::stop::Iteration::build().with_max_iters(4u)) | ||
.on(exec)); | ||
auto pre_smoother = gko::share( | ||
ir::build() | ||
.with_solver(schwarz::build().with_local_solver( | ||
bj::build().with_max_block_size(1u).with_skip_sorting( | ||
true))) | ||
.with_relaxation_factor(static_cast<etype>(0.9)) | ||
.with_criteria( | ||
gko::stop::Iteration::build().with_max_iters(1u)) | ||
.on(exec)); | ||
return gko::solver::Multigrid::build() | ||
.with_mg_level(gko::multigrid::Pgm<etype, itype>::build() | ||
.with_deterministic(FLAGS_mg_deterministic)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these flag are not available yet |
||
.with_criteria(iter_stop, tol_stop) | ||
.with_pre_smoother(pre_smoother) | ||
.with_post_uses_pre(true) | ||
.with_max_levels(FLAGS_mg_num_levels) | ||
.with_coarsest_solver(coarsest_solver_gen) | ||
.on(exec); | ||
}} | ||
#endif | ||
}; | ||
|
||
|
||
#endif // GKO_BENCHMARK_UTILS_PRECONDITIONERS_HPP_ |
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 |
---|---|---|
|
@@ -740,6 +740,11 @@ void Multigrid::generate() | |
GKO_ASSERT_EQ(level > 0, true); | ||
auto last_mg_level = mg_level_list_.back(); | ||
|
||
using ws = workspace_traits<Multigrid>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unused? |
||
this->setup_workspace(); | ||
this->create_state(); | ||
cache_.state->generate(this->get_system_matrix().get(), this, 1); | ||
|
||
// generate coarsest solver | ||
run<gko::multigrid::EnableMultigridLevel, float, double, | ||
std::complex<float>, std::complex<double>>( | ||
|
@@ -908,8 +913,6 @@ void Multigrid::apply_dense_impl(const VectorType* b, VectorType* x, | |
initial_guess_mode guess) const | ||
{ | ||
using ws = workspace_traits<Multigrid>; | ||
this->setup_workspace(); | ||
this->create_state(); | ||
if (cache_.state->nrhs != b->get_size()[1]) { | ||
cache_.state->generate(this->get_system_matrix().get(), this, | ||
b->get_size()[1]); | ||
|
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
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.