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
Optimize Utilities::MPI::broadcast() #11955
Comments
Hi @bangerth, I would like to work on this starter project. What do you recommend to use in order to detect if the template type Also, when you say that we do not need to call |
I think it makes sense to add the optimization for MPI data types. For everything else, you would likely need to serialize or create a custom MPI data type to get the padding right. In dealii/include/deal.II/base/mpi.templates.h Lines 46 to 174 in 9d8c8e9
|
Thank you @masterleinad, this is exactly what I was looking for. Am I allowed to use concept from C++20? I would like to define a template<typename T>
concept BuiltIn_MPI_DataType = requires(T a) {
{ mpi_type_id(a) };
}; and then provide two versions of template <BuiltIn_MPI_DataType T>
T
broadcast(const MPI_Comm &comm,
const T &object_to_send,
const unsigned int root_process)
{ |
Unfortunately not. We are still at C++14. |
Ah, that would be nice if we could already use C++20 :-) Fortunately, MPI's list of data types is fixed, and you could use something like this to find out whether a type in question is in a specific list (encoded in the form of a A small amount of |
#11940 introduces an MPI broadcast function, which packs up the argument, determines the size, sends around the size, on all processors allocates a sufficiently large buffer, and then in a second
MPI_Bcast
sends the actual data.This could be optimized: If the argument is a built-in type or fixed-size array thereof, we don't need to call
pack()
but can just send the data and the receiving end will know what the buffer size needs to be because it can just stack-allocate the output object.@bergbauer -- FYI.
The text was updated successfully, but these errors were encountered: