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

RPE::evaluate_and_process(): pack only if needed #15163

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

peterrum
Copy link
Member

@peterrum peterrum commented May 1, 2023

follow up to #15156

Copy link
Member

@bangerth bangerth left a comment

Choose a reason for hiding this comment

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

I am not in favor of this patch. We already have Utilities::MPI::isend()/recv(). If the overhead of packing is too large for these, then we should write a fast path for these functions rather than duplicate the functionality into other functions.

Comment on lines 332 to 345
template <typename T>
std::enable_if_t<Utilities::MPI::is_mpi_type<T> == true, void>
pack_and_isend(T * data,
const unsigned int size,
const unsigned int rank,
const unsigned int tag,
const MPI_Comm comm,
std::vector<std::vector<char>> &buffers,
std::vector<MPI_Request> & requests)
{
requests.emplace_back(MPI_Request());

buffers.emplace_back(
Utilities::pack(std::vector<T>(data, data + size), false));
Copy link
Member

Choose a reason for hiding this comment

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

You have this the wrong way around: This is the function with Utilities::MPI::is_mpi_type<T> == true for which you specifically don't have to pack, whereas for the function above where you don't pack you actually do have to pack.

@peterrum peterrum force-pushed the evaluate_and_process_refactor_no_copy branch 3 times, most recently from 8993018 to 70f9e5b Compare May 4, 2023 09:03
@peterrum peterrum mentioned this pull request May 4, 2023
13 tasks
@tamiko tamiko marked this pull request as draft July 4, 2023 18:31
@peterrum peterrum force-pushed the evaluate_and_process_refactor_no_copy branch from 70f9e5b to 0e74f25 Compare January 9, 2024 09:48
@bangerth
Copy link
Member

@peterrum How do we proceed with this PR?

Shift around

More ArrayView

Specialize code for tensors

Allow to specify components

Also for evaluate_and_process()

Update

Reduce number of sweeps
@peterrum peterrum force-pushed the evaluate_and_process_refactor_no_copy branch from f642dd1 to bc18550 Compare May 13, 2024 19:44
@peterrum peterrum marked this pull request as ready for review May 16, 2024 20:36
@kronbichler
Copy link
Member

I tried the new code with the additional restructuring and I am very happy about the performance gain we can get (together with #16896, #16895, I see an improvement of around a factor of 2 in the non-nested multigrid algorithm on a server processor). I will look into the code once you think it is complete enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants