-
Notifications
You must be signed in to change notification settings - Fork 124
Add a uniform coarsening algorithm #2016
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
Open
pratikvn
wants to merge
14
commits into
develop
Choose a base branch
from
unif-coarsening
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
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8ab0cf5
add UniformCoarsening core and config
pratikvn 7149aa3
add core tests
pratikvn cb84155
add reference kernels and tests
pratikvn 469be1c
add common kernels, tests and mpi tests
pratikvn 778466c
enforce_connectedness by default
pratikvn 2d3c195
review updates, rename to aggregation
pratikvn 61a4e1a
remove dep on spgemm
pratikvn 706272f
update example, deprec functions
pratikvn 2ddadbb
add off-diag aggregation test
pratikvn ad24367
fix injection imap bug, update example
pratikvn b6e7019
review updates
pratikvn 552bb14
add TODOs on unification with PGM
pratikvn 97226d1
review updates
pratikvn cef6b44
cloneable fixes
pratikvn 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 hidden or 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 hidden or 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,63 @@ | ||
| // SPDX-FileCopyrightText: 2017 - 2026 The Ginkgo authors | ||
| // | ||
| // SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| #include "core/multigrid/uniform_coarsening_kernels.hpp" | ||
|
|
||
| #include <ginkgo/core/base/math.hpp> | ||
|
|
||
| #include "common/unified/base/kernel_launch.hpp" | ||
| #include "common/unified/base/kernel_launch_reduction.hpp" | ||
| #include "core/components/prefix_sum_kernels.hpp" | ||
|
|
||
|
|
||
| namespace gko { | ||
| namespace kernels { | ||
| namespace GKO_DEVICE_NAMESPACE { | ||
| namespace uniform_coarsening { | ||
|
|
||
|
|
||
| template <typename ValueType, typename IndexType> | ||
| void fill_restrict_op(std::shared_ptr<const DefaultExecutor> exec, | ||
| const array<IndexType>* coarse_rows, | ||
| matrix::Csr<ValueType, IndexType>* restrict_op) | ||
| { | ||
| run_kernel( | ||
| exec, | ||
| [] GKO_KERNEL(auto tidx, const auto coarse_data, | ||
| auto restrict_col_idxs) { | ||
| if (coarse_data[tidx] >= 0) { | ||
| restrict_col_idxs[coarse_data[tidx]] = tidx; | ||
| } | ||
| }, | ||
| coarse_rows->get_size(), coarse_rows->get_const_data(), | ||
| restrict_op->get_col_idxs()); | ||
| } | ||
|
|
||
| GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE( | ||
| GKO_DECLARE_UNIFORM_COARSENING_FILL_RESTRICT_OP); | ||
|
|
||
|
|
||
| template <typename IndexType> | ||
| void fill_incremental_indices(std::shared_ptr<const DefaultExecutor> exec, | ||
| size_type coarse_skip, | ||
| array<IndexType>* coarse_rows) | ||
| { | ||
| const size_type num_elems = coarse_rows->get_size(); | ||
| const size_type num_iters = gko::ceildiv(num_elems, coarse_skip); | ||
| run_kernel( | ||
| exec, | ||
| [] GKO_KERNEL(auto tidx, auto coarse_skip, auto coarse_data) { | ||
| coarse_data[tidx * coarse_skip] = tidx; | ||
| }, | ||
| num_iters, coarse_skip, coarse_rows->get_data()); | ||
| } | ||
|
|
||
| GKO_INSTANTIATE_FOR_EACH_INDEX_TYPE( | ||
| GKO_DECLARE_UNIFORM_COARSENING_FILL_INCREMENTAL_INDICES); | ||
|
|
||
|
|
||
| } // namespace uniform_coarsening | ||
| } // namespace GKO_DEVICE_NAMESPACE | ||
| } // namespace kernels | ||
| } // namespace gko |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -72,6 +72,7 @@ enum class LinOpFactoryType : int { | |
| Multigrid, | ||
| Pgm, | ||
| Rs, | ||
| UniformCoarsening, | ||
| Schwarz | ||
| }; | ||
|
|
||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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.
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.
Uh oh!
There was an error while loading. Please reload this page.