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

Amgx parallel graph match reference and fill_seq_array #528

Merged
merged 26 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9d32f7b
create EnableCFOp, CFOpFactory and implement matrix-dependent functio…
yhmtsai Apr 22, 2020
36cf47c
rename CoarseFine to RestrictProlong
yhmtsai May 13, 2020
ff18f2e
add core test
yhmtsai May 29, 2020
60f68ee
move the test to correct place and format
yhmtsai Jun 3, 2020
ab61015
add csr absolute and store weight explicitly
yhmtsai Jul 6, 2020
9a37dde
replace extract_diagonal
yhmtsai Jul 6, 2020
c856a6e
fix control flow and use fill_array
yhmtsai Jul 8, 2020
0b8b39d
fix amg_pgm_kernel determinstic problem
yhmtsai Aug 12, 2020
1300930
converting to csr if the system matrix is not csr
yhmtsai Aug 25, 2020
bdbf0b7
remove unneeded code, add description of agg_group
yhmtsai Aug 26, 2020
89876a2
use AbsoluteComputable and update documentation
yhmtsai Aug 27, 2020
bb213cf
update focumentation and fix format
yhmtsai Aug 28, 2020
6b6525b
review update
yhmtsai Oct 20, 2020
a249373
add multigrid related interface and move to linop
yhmtsai Jan 20, 2021
e8682c7
add multigrid_level default apply and test
yhmtsai Jan 21, 2021
bb3b66c
Apply suggestions from code review
yhmtsai Jan 25, 2021
ac20215
Rename the multigrid interface, improve doc
yhmtsai Jan 27, 2021
29aca61
WIP: add UseComposition and ApplyAddable interface
yhmtsai Feb 5, 2021
122b349
WIP
yhmtsai Feb 2, 2021
4c3f785
mapping, multigridlevel, usecomp, applyaddable
yhmtsai Feb 17, 2021
629004d
implement fill_seq_array and add test
yhmtsai Mar 4, 2021
85449b8
use csr to represent restrict/prolong
yhmtsai Mar 4, 2021
8b140dd
remove unused func, add documentation
yhmtsai Mar 5, 2021
9d4f8bc
Add fill_array TypedTest and update documentation
yhmtsai Mar 9, 2021
599d740
RestrictProlong -> MgLevel, rstr_prlg -> mg_level
yhmtsai Mar 9, 2021
1fdfd83
split MultigridLevel EnableMultigridLevel
yhmtsai Mar 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
RestrictProlong -> MgLevel, rstr_prlg -> mg_level
  • Loading branch information
yhmtsai committed Mar 11, 2021
commit 599d740c0f14564480c64b7e1ab8479e24c61bf4
10 changes: 5 additions & 5 deletions core/test/multigrid/amgx_pgm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ class AmgxPgmFactory : public ::testing::Test {
typename std::tuple_element<1, decltype(ValueIndexType())>::type;
using Mtx = gko::matrix::Csr<value_type, index_type>;
using Vec = gko::matrix::Dense<value_type>;
using RestrictProlong = gko::multigrid::AmgxPgm<value_type, index_type>;
using MgLevel = gko::multigrid::AmgxPgm<value_type, index_type>;
AmgxPgmFactory()
: exec(gko::ReferenceExecutor::create()),
amgxpgm_factory(RestrictProlong::build()
amgxpgm_factory(MgLevel::build()
.with_max_iterations(2u)
.with_max_unassigned_ratio(0.1)
.with_deterministic(true)
Expand All @@ -69,7 +69,7 @@ class AmgxPgmFactory : public ::testing::Test {
{}

std::shared_ptr<const gko::Executor> exec;
std::unique_ptr<typename RestrictProlong::Factory> amgxpgm_factory;
std::unique_ptr<typename MgLevel::Factory> amgxpgm_factory;
};

TYPED_TEST_CASE(AmgxPgmFactory, gko::test::ValueIndexTypes);
Expand All @@ -83,8 +83,8 @@ TYPED_TEST(AmgxPgmFactory, FactoryKnowsItsExecutor)

TYPED_TEST(AmgxPgmFactory, DefaultSetting)
{
using RestrictProlong = typename TestFixture::RestrictProlong;
auto factory = RestrictProlong::build().on(this->exec);
using MgLevel = typename TestFixture::MgLevel;
auto factory = MgLevel::build().on(this->exec);

ASSERT_EQ(factory->get_parameters().max_iterations, 15u);
ASSERT_EQ(factory->get_parameters().max_unassigned_ratio, 0.05);
Expand Down
2 changes: 1 addition & 1 deletion include/ginkgo/core/multigrid/amgx_pgm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace multigrid {
* @tparam ValueType precision of matrix elements
* @tparam IndexType precision of matrix indexes
*
* @ingroup RestrictProlong
* @ingroup MultigridLevel
* @ingroup Multigrid
* @ingroup LinOp
*/
Expand Down
49 changes: 22 additions & 27 deletions reference/test/multigrid/amgx_pgm_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ class AmgxPgm : public ::testing::Test {
typename std::tuple_element<1, decltype(ValueIndexType())>::type;
using Mtx = gko::matrix::Csr<value_type, index_type>;
using Vec = gko::matrix::Dense<value_type>;
using RestrictProlong = gko::multigrid::AmgxPgm<value_type, index_type>;
using MgLevel = gko::multigrid::AmgxPgm<value_type, index_type>;
using VT = value_type;
using real_type = gko::remove_complex<value_type>;
using WeightMtx = gko::matrix::Csr<real_type, index_type>;
AmgxPgm()
: exec(gko::ReferenceExecutor::create()),
amgxpgm_factory(RestrictProlong::build()
amgxpgm_factory(MgLevel::build()
.with_max_iterations(2u)
.with_max_unassigned_ratio(0.1)
.on(exec)),
Expand Down Expand Up @@ -107,7 +107,7 @@ class AmgxPgm : public ::testing::Test {
agg(exec, 5)
{
this->create_mtx(mtx.get(), weight.get(), &agg, coarse.get());
rstr_prlg = amgxpgm_factory->generate(mtx);
mg_level = amgxpgm_factory->generate(mtx);
mtx_diag = weight->extract_diagonal();
}

Expand Down Expand Up @@ -210,8 +210,8 @@ class AmgxPgm : public ::testing::Test {
std::shared_ptr<Vec> prolong_ans;
std::shared_ptr<Vec> prolong_applyans;
std::shared_ptr<Vec> fine_x;
std::unique_ptr<typename RestrictProlong::Factory> amgxpgm_factory;
std::unique_ptr<RestrictProlong> rstr_prlg;
std::unique_ptr<typename MgLevel::Factory> amgxpgm_factory;
std::unique_ptr<MgLevel> mg_level;
};

TYPED_TEST_SUITE(AmgxPgm, gko::test::ValueIndexTypes);
Expand All @@ -220,13 +220,12 @@ TYPED_TEST_SUITE(AmgxPgm, gko::test::ValueIndexTypes);
TYPED_TEST(AmgxPgm, CanBeCopied)
{
using Mtx = typename TestFixture::Mtx;
using RestrictProlong = typename TestFixture::RestrictProlong;
using MgLevel = typename TestFixture::MgLevel;
auto copy = this->amgxpgm_factory->generate(Mtx::create(this->exec));

copy->copy_from(this->rstr_prlg.get());
auto copy_mtx =
static_cast<RestrictProlong *>(copy.get())->get_system_matrix();
auto copy_agg = static_cast<RestrictProlong *>(copy.get())->get_const_agg();
copy->copy_from(this->mg_level.get());
auto copy_mtx = copy->get_system_matrix();
auto copy_agg = copy->get_const_agg();
auto copy_coarse = copy->get_coarse_op();

this->assert_same_matrices(static_cast<const Mtx *>(copy_mtx.get()),
Expand All @@ -241,13 +240,12 @@ TYPED_TEST(AmgxPgm, CanBeCopied)
TYPED_TEST(AmgxPgm, CanBeMoved)
{
using Mtx = typename TestFixture::Mtx;
using RestrictProlong = typename TestFixture::RestrictProlong;
using MgLevel = typename TestFixture::MgLevel;
auto copy = this->amgxpgm_factory->generate(Mtx::create(this->exec));

copy->copy_from(std::move(this->rstr_prlg));
auto copy_mtx =
static_cast<RestrictProlong *>(copy.get())->get_system_matrix();
auto copy_agg = static_cast<RestrictProlong *>(copy.get())->get_const_agg();
copy->copy_from(std::move(this->mg_level));
auto copy_mtx = copy->get_system_matrix();
auto copy_agg = copy->get_const_agg();
auto copy_coarse = copy->get_coarse_op();

this->assert_same_matrices(static_cast<const Mtx *>(copy_mtx.get()),
Expand All @@ -262,13 +260,11 @@ TYPED_TEST(AmgxPgm, CanBeMoved)
TYPED_TEST(AmgxPgm, CanBeCloned)
{
using Mtx = typename TestFixture::Mtx;
using RestrictProlong = typename TestFixture::RestrictProlong;
auto clone = this->rstr_prlg->clone();
using MgLevel = typename TestFixture::MgLevel;
auto clone = this->mg_level->clone();
auto clone_mtx = clone->get_system_matrix();
auto clone_agg =
static_cast<RestrictProlong *>(clone.get())->get_const_agg();
auto clone_coarse =
dynamic_cast<RestrictProlong *>(clone.get())->get_coarse_op();
auto clone_agg = clone->get_const_agg();
auto clone_coarse = clone->get_coarse_op();

this->assert_same_matrices(static_cast<const Mtx *>(clone_mtx.get()),
this->mtx.get());
Expand All @@ -281,13 +277,12 @@ TYPED_TEST(AmgxPgm, CanBeCloned)

TYPED_TEST(AmgxPgm, CanBeCleared)
{
using RestrictProlong = typename TestFixture::RestrictProlong;
using MgLevel = typename TestFixture::MgLevel;

this->rstr_prlg->clear();
auto mtx = static_cast<RestrictProlong *>(this->rstr_prlg.get())
->get_system_matrix();
auto coarse = this->rstr_prlg->get_coarse_op();
auto agg = static_cast<RestrictProlong *>(this->rstr_prlg.get())->get_agg();
this->mg_level->clear();
auto mtx = this->mg_level->get_system_matrix();
auto coarse = this->mg_level->get_coarse_op();
auto agg = this->mg_level->get_agg();

ASSERT_EQ(mtx, nullptr);
ASSERT_EQ(coarse, nullptr);
Expand Down