Skip to content

Commit

Permalink
#728: backport: do not modify reduce interface
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Dec 22, 2020
1 parent a42ae00 commit 866a3aa
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 126 deletions.
120 changes: 6 additions & 114 deletions src/vt/collective/reduce/reduce.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ struct Reduce : virtual collective::tree::Tree {
typename OpT,
typename MsgT
>
PendingSendType reduce(
SequentialIDType reduce(
NodeType const& root, MsgT* msg, Callback<MsgT> cb,
detail::ReduceStamp id = detail::ReduceStamp{},
ReduceNumType const& num_contrib = 1
TagType const& tag = no_tag, SequentialIDType const& seq = no_seq_id,
ReduceNumType const& num_contrib = 1,
VirtualProxyType const& proxy = no_vrt_proxy,
ObjGroupProxyType objgroup = no_obj_group
)
{
return reduce<
Expand All @@ -114,101 +116,9 @@ struct Reduce : virtual collective::tree::Tree {
OpT,
collective::reduce::operators::ReduceCallback<MsgT>
>
>(root, msg, cb, id, num_contrib);
>(root, msg, cb, tag, seq, num_contrib, proxy, objgroup);
}

/**
* \brief Reduce a message up the tree
*
* \param[in] root the root node where the final handler provides the result
* \param[in] msg the message to reduce on this node
* \param[in] cb the callback to trigger on the root node
* \param[in] id the reduction stamp (optional), provided if out-of-order
* \param[in] num_contrib number of expected contributions from this node
*
* \return the next reduction stamp
*/
template <
typename OpT,
typename MsgT,
ActiveTypedFnType<MsgT> *f
>
detail::ReduceStamp reduceImmediate(
NodeType const& root, MsgT* msg, Callback<MsgT> cb,
detail::ReduceStamp id = detail::ReduceStamp{},
ReduceNumType const& num_contrib = 1
);
template <
typename OpT,
typename MsgT
>
detail::ReduceStamp reduceImmediate(
NodeType const& root, MsgT* msg, Callback<MsgT> cb,
detail::ReduceStamp id = detail::ReduceStamp{},
ReduceNumType const& num_contrib = 1
)
{
return reduceImmediate<
OpT,
MsgT,
&MsgT::template msgHandler<
MsgT,
OpT,
collective::reduce::operators::ReduceCallback<MsgT>
>
>(root, msg, cb, id, num_contrib);
}

/**
* \brief Reduce a message up the tree with a target function on the root node
*
* \param[in] root the root node where the final handler provides the result
* \param[in] msg the message to reduce on this node
* \param[in] id the reduction stamp (optional), provided if out-of-order
* \param[in] num_contrib number of expected contributions from this node
*
* \return the next reduction stamp
*/
template <
typename OpT,
typename FunctorT,
typename MsgT,
ActiveTypedFnType<MsgT> *f
>
PendingSendType reduce(
NodeType const& root, MsgT* msg,
detail::ReduceStamp id = detail::ReduceStamp{},
ReduceNumType const& num_contrib = 1
);
template <
typename OpT,
typename FunctorT,
typename MsgT
>
PendingSendType reduce(
NodeType const& root, MsgT* msg,
detail::ReduceStamp id = detail::ReduceStamp{},
ReduceNumType const& num_contrib = 1
)
{
return reduce<
OpT,
FunctorT,
MsgT,
&MsgT::template msgHandler<MsgT, OpT, FunctorT>
>(root, msg, id, num_contrib);
}

/**
* \brief Reduce a message up the tree with a target function on the root node
*
* \param[in] root the root node where the final handler provides the result
* \param[in] msg the message to reduce on this node
* \param[in] id the reduction stamp (optional), provided if out-of-order
* \param[in] num_contrib number of expected contributions from this node
*
* \return the next reduction stamp
*/
template <
typename OpT,
typename FunctorT,
Expand All @@ -220,24 +130,6 @@ struct Reduce : virtual collective::tree::Tree {
SequentialIDType const& seq = no_seq_id, ReduceNumType const& num_contrib = 1,
VirtualProxyType const& proxy = no_vrt_proxy
);
template <
typename OpT,
typename FunctorT,
typename MsgT
>
detail::ReduceStamp reduceImmediate(
NodeType const& root, MsgT* msg,
detail::ReduceStamp id = detail::ReduceStamp{},
ReduceNumType const& num_contrib = 1
)
{
return reduceImmediate<
OpT,
FunctorT,
MsgT,
&MsgT::template msgHandler<MsgT, OpT, FunctorT>
>(root, msg, id, num_contrib);
}

template <typename MessageT>
void reduceAddMsg(
Expand Down
17 changes: 11 additions & 6 deletions src/vt/objgroup/proxy/proxy_objgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ struct Proxy {
typename MsgPtrT,
typename MsgT = typename util::MsgPtrType<MsgPtrT>::MsgType
>
PendingSendType reduce(
MsgPtrT msg, Callback<MsgT> cb, ReduceStamp stamp = ReduceStamp{}
EpochType reduce(
MsgPtrT msg, Callback<MsgT> cb, EpochType epoch = no_epoch,
TagType tag = no_tag
) const
{
return reduce<
Expand All @@ -112,7 +113,7 @@ struct Proxy {
&MsgT::template msgHandler<
MsgT, OpT, collective::reduce::operators::ReduceCallback<MsgT>
>
>(msg, cb, stamp);
>(msg, cb, epoch, tag);
}

template <
Expand All @@ -122,22 +123,26 @@ struct Proxy {
typename MsgT = typename util::MsgPtrType<MsgPtrT>::MsgType,
ActiveTypedFnType<MsgT> *f
>
PendingSendType reduce(MsgPtrT msg, ReduceStamp stamp = ReduceStamp{}) const;
EpochType reduce(
MsgPtrT msg, EpochType epoch = no_epoch, TagType tag = no_tag
) const;
template <
typename OpT = collective::None,
typename FunctorT,
typename MsgPtrT,
typename MsgT = typename util::MsgPtrType<MsgPtrT>::MsgType
>
PendingSendType reduce(MsgPtrT msg, ReduceStamp stamp = ReduceStamp{}) const
EpochType reduce(
MsgPtrT msg, EpochType epoch = no_epoch, TagType tag = no_tag
) const
{
return reduce<
OpT,
FunctorT,
MsgPtrT,
MsgT,
&MsgT::template msgHandler<MsgT, OpT, FunctorT>
>(msg, stamp);
>(msg, epoch, tag);
}

template <
Expand Down
19 changes: 13 additions & 6 deletions src/vt/vrt/collection/reducable/reducable.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ struct Reducable : BaseProxyT {
typename OpT = collective::None,
typename MsgT
>
messaging::PendingSend reduce(
MsgT *const msg, Callback<MsgT> cb, ReduceStamp stamp = ReduceStamp{}
EpochType reduce(
MsgT *const msg, Callback<MsgT> cb, EpochType const& epoch = no_epoch,
TagType const& tag = no_tag
) const
{
return reduce<
Expand All @@ -90,7 +91,7 @@ struct Reducable : BaseProxyT {
&MsgT::template msgHandler<
MsgT, OpT, collective::reduce::operators::ReduceCallback<MsgT>
>
>(msg, cb, stamp);
>(msg, cb, epoch, tag);
}

template <
Expand All @@ -99,20 +100,26 @@ struct Reducable : BaseProxyT {
typename MsgT,
ActiveTypedFnType<MsgT> *f
>
messaging::PendingSend reduce(MsgT *const msg, ReduceStamp stamp = ReduceStamp{}) const;
EpochType reduce(
MsgT *const msg, EpochType const& epoch = no_epoch,
TagType const& tag = no_tag
) const;
template <
typename OpT,
typename FunctorT,
typename MsgT
>
messaging::PendingSend reduce(MsgT *const msg, ReduceStamp stamp = ReduceStamp{}) const
EpochType reduce(
MsgT *const msg, EpochType const& epoch = no_epoch,
TagType const& tag = no_tag
) const
{
return reduce<
OpT,
FunctorT,
MsgT,
&MsgT::template msgHandler<MsgT, OpT, FunctorT>
>(msg, stamp);
>(msg, epoch, tag);
}

template <typename MsgT, ActiveTypedFnType<MsgT> *f>
Expand Down

0 comments on commit 866a3aa

Please sign in to comment.