Allreduce#
- event CCL_API allreduce (const void *send_buf, void *recv_buf, size_t count, datatype dtype, reduction rtype, const communicator &comm, const stream &stream, const allreduce_attr &attr=default_allreduce_attr, const vector_class< event > &deps={})
Allreduce is a collective communication operation that performs the global reduction operation on values from all ranks of communicator and distributes the result back to all ranks.
- Parameters
send_buf – the buffer with
count
elements ofdtype
that stores local data to be reducedrecv_buf – [out] the buffer to store reduced result, must have the same dimension as
send_buf
count – the number of elements of type
dtype
insend_buf
andrecv_buf
dtype – the datatype of elements in
send_buf
andrecv_buf`
rtype – the type of the reduction operation to be applied
comm – the communicator for which the operation will be performed
stream – abstraction over a device queue constructed via ccl::create_stream
attr – optional attributes to customize operation
deps – an optional vector of the events that the operation should depend on
- Returns
ccl::event an object to track the progress of the operation
- event CCL_API allreduce (const void *send_buf, void *recv_buf, size_t count, datatype dtype, reduction rtype, const communicator &comm, const allreduce_attr &attr=default_allreduce_attr, const vector_class< event > &deps={})
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- template<class BufferType, class = typename std::enable_if<is_native_type_supported<BufferType>(), event>::type> event CCL_API allreduce (const BufferType *send_buf, BufferType *recv_buf, size_t count, reduction rtype, const communicator &comm, const stream &stream, const allreduce_attr &attr=default_allreduce_attr, const vector_class< event > &deps={})
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Type-safe version.
- template<class BufferType, class = typename std::enable_if<is_native_type_supported<BufferType>(), event>::type> event CCL_API allreduce (const BufferType *send_buf, BufferType *recv_buf, size_t count, reduction rtype, const communicator &comm, const allreduce_attr &attr=default_allreduce_attr, const vector_class< event > &deps={})
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Type-safe version.
- template<class BufferObjectType, class = typename std::enable_if<is_class_supported<BufferObjectType>(), event>::type> event CCL_API allreduce (const BufferObjectType &send_buf, BufferObjectType &recv_buf, size_t count, reduction rtype, const communicator &comm, const stream &stream, const allreduce_attr &attr=default_allreduce_attr, const vector_class< event > &deps={})
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Type-safe version.
- template<class BufferObjectType, class = typename std::enable_if<is_class_supported<BufferObjectType>(), event>::type> event CCL_API allreduce (const BufferObjectType &send_buf, BufferObjectType &recv_buf, size_t count, reduction rtype, const communicator &comm, const allreduce_attr &attr=default_allreduce_attr, const vector_class< event > &deps={})
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Type-safe version.