-
Notifications
You must be signed in to change notification settings - Fork 91
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
enable Half in mpi #1759
base: develop
Are you sure you want to change the base?
enable Half in mpi #1759
Conversation
Error: The following files need to be formatted:
You can find a formatting patch under Artifacts here or run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm mainly concerned about using device buffers for the custom operations, and maybe moving the operations into a private header.
|
||
|
||
template <typename ValueType> | ||
inline void sum(void* input, void* output, int* len, MPI_Datatype* datatype) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these functions work with device buffers? Or is it maybe necessary to copy the device buffers first to the host and then do the operation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the same concern.
However, I think mpi will not use device memory to handle the reduction operation. Even in frontier, they have additional unit to handle not use gpu to sum cross nodes.
mpi::op_manager sum_op_; | ||
mpi::op_manager norm_sum_op_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the vector needs to store these. We can either just create them when needed, and delete them directly afterward. There should not be a large overhead associated to that. Or we use globals (probably in the form of returning a static variable). I would not mind using that, since we only need to have one operation per value type anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried the static variable already but it did not work out.
We call MPI_finalize to finish, but the static variable will be destroyed when the process leave main scope, which is after MPI_finalize and MPI complains that.
GKO_REGISTER_MPI_TYPE(std::complex<float>, MPI_C_FLOAT_COMPLEX); | ||
GKO_REGISTER_MPI_TYPE(std::complex<double>, MPI_C_DOUBLE_COMPLEX); | ||
|
||
|
||
namespace detail { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the operation isn't stored in the vector anymore, we can move all of this into a private header, which I would prefer quite a lot.
|
||
static std::unique_ptr<target_type> create_empty(const source_type* source) | ||
{ | ||
return target_type::create(source->get_executor(), | ||
source->get_communicator()); | ||
} | ||
|
||
// Allow to create_empty of the same type | ||
// For distributed case, next<next<V>> will be V in the candicated list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo:
// For distributed case, next<next<V>> will be V in the candicated list. | |
// For distributed case, next<next<V>> will be V in the candidate list. |
|
||
static std::unique_ptr<target_type> create_empty(const source_type* source) | ||
{ | ||
return target_type::create(source->get_executor(), | ||
source->get_communicator()); | ||
} | ||
|
||
// Allow to create_empty of the same type | ||
// For distributed case, next<next<V>> will be V in the candicated list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean if half is disabled, right? But shouldn't that also lead to issues with Dense
?
This PR enables half precision in distributed environment by adding custom operation.
one-side operation like accumulation and fetch_and_op does not support custom operation.
Note. Newer version of mpi might support half precision natively (also for one-side operation) if the administrator build it with compiler supporting native half precision and enable the option.
TODO: