Skip to content

Conversation

@RyanMoulday
Copy link

No description provided.

@RyanMoulday RyanMoulday changed the title Mg two level transfer copy to host MGTwoLevelTransferCopyToHost Oct 1, 2025
* An abstract base class for transfer operators between two multigrid levels.
* The implementation of
* restriction and prolongation between levels is delegated to derived classes,
* which implement prolongate_and_add_internal() and restrict_and_add_internal()
Copy link
Owner

Choose a reason for hiding this comment

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

update comment

Copy link
Owner

Choose a reason for hiding this comment

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

please update this

@RyanMoulday RyanMoulday force-pushed the MGTwoLevelTransferCopyToHost branch from 80576a3 to c696016 Compare October 6, 2025 00:06
MemorySpace::Default>>,
"This class is currently only implemented for vectors of "
"type LinearAlgebra::distributed::Vector.");
/**
Copy link
Owner

Choose a reason for hiding this comment

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

empty line

* Default constructor.
*/
MGTwoLevelTransferBase();
MGTwoLevelTransferBase()
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
MGTwoLevelTransferBase()
MGTwoLevelTransferBase() = default;

MemorySpace::Host>> ||
std::is_same_v<
VectorType,
LinearAlgebra::distributed::Vector<typename VectorType::value_type,
Copy link
Owner

Choose a reason for hiding this comment

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

only support host


/**
* A class which provides extra functionality used by several MGTwoLevelTransfer
* schemes.
Copy link
Owner

Choose a reason for hiding this comment

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

base class for nonnested and mgtransfertwolevel

*/
using Number = typename VectorType::value_type;

using VectorTypeHost = LinearAlgebra::distributed::Vector<Number>;
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
using VectorTypeHost = LinearAlgebra::distributed::Vector<Number>;
using VectorTypeHost = LinearAlgebra::distributed::Vector<Number,MemorySpace::Host>;

VectorTypeHost dst_host;
VectorTypeHost src_host;

copy_to_host(dst_host, dst);
Copy link
Owner

Choose a reason for hiding this comment

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

not necessary

VectorTypeHost dst_host;
VectorTypeHost src_host;

dst_host.reinit(dst.get_partitioner());
Copy link
Owner

Choose a reason for hiding this comment

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

copy should be necessary

interpolate(VectorType &dst, const VectorType &src) const override
{
VectorTypeHost dst_host;
VectorTypeHost src_host;
Copy link
Owner

Choose a reason for hiding this comment

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

make these class members

src.get_partitioner()->locally_owned_range());
rw_vector.import_elements(src, VectorOperation::insert);

dst.reinit(src.get_partitioner());
Copy link
Owner

Choose a reason for hiding this comment

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

if size is ==0:

return {t->dof_handler_fine, t->mg_level_fine};
}

if (const auto t = dynamic_cast<const MGTwoLevelTransferCopyToHost<
Copy link
Owner

Choose a reason for hiding this comment

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

might need constexpr if memoryspace==::default

@RyanMoulday RyanMoulday force-pushed the MGTwoLevelTransferCopyToHost branch from c696016 to 438684e Compare October 6, 2025 06:53
Copy link
Owner

@tjhei tjhei left a comment

Choose a reason for hiding this comment

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

Looks good. Feel free to open the PR to deal.II.

* An abstract base class for transfer operators between two multigrid levels.
* The implementation of
* restriction and prolongation between levels is delegated to derived classes,
* which implement prolongate_and_add_internal() and restrict_and_add_internal()
Copy link
Owner

Choose a reason for hiding this comment

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

please update this

/**
* Default constructor.
*/
MGTwoLevelTransferCore();
Copy link
Owner

Choose a reason for hiding this comment

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

either do = default; or update the comment to just say "constructor" if you need it to do something. :-)

/**
* Vectors used for the host transfer.
*/

Copy link
Owner

Choose a reason for hiding this comment

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

remove empty line

// &,
// const LinearAlgebra::distributed::Vector<S2, MemorySpace::Host> &,
// const bool) const;
// MGLevelGlobalTransfer<LinearAlgebra::distributed::Vector<S1,
Copy link
Owner

Choose a reason for hiding this comment

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

why are these here? you can delete these lines, I think.

@RyanMoulday RyanMoulday force-pushed the MGTwoLevelTransferCopyToHost branch 6 times, most recently from 1a5aff7 to c62d29c Compare October 8, 2025 01:30
…rmits transfer on device vectors via use of an internal MGTwoLevelTransfer class defined on the host.
@RyanMoulday RyanMoulday force-pushed the MGTwoLevelTransferCopyToHost branch from c62d29c to d2efed8 Compare October 8, 2025 23:26
@tjhei tjhei closed this Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants