Skip to content

Commit

Permalink
#672: docs: write doxygen for scatter
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Jun 16, 2020
1 parent d4f5b85 commit ade553e
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/vt/collective/scatter/scatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,68 @@

namespace vt { namespace collective { namespace scatter {

/**
* \struct Scatter
*
* \brief Scatter data across all nodes from a single origin
*
* Performs an asynchronous scatter over all the nodes in the
* communicator/runtime. Recursively bisect the data as we move down the
* spanning tree.
*/
struct Scatter : virtual collective::tree::Tree {
using FuncSizeType = std::function<std::size_t(NodeType)>;
using FuncDataType = std::function<void(NodeType, void*)>;

/**
* \internal \brief Construct a scatter manager
*/
Scatter();

/**
* \brief Scatter data to all nodes
*
* \param[in] total_size total size of data to scatter
* \param[in] max_proc_size max data to be scattered to any node
* \param[in] size_fn callback to get size for each node
* \param[in] data_fn callback to get data for each node
*/
template <typename MessageT, ActiveTypedFnType<MessageT>* f>
void scatter(
std::size_t const& total_size, std::size_t const& max_proc_size,
FuncSizeType size_fn, FuncDataType data_fn
);

protected:
/**
* \internal \brief Receive scattered data down the spanning tree
*
* \param[in] msg the scatter message
*/
void scatterIn(ScatterMsg* msg);

private:
/**
* \internal \brief Helper function to scatter data
*
* \param[in] node the current code
* \param[in] ptr pointer to raw data
* \param[in] elm_size bytes per element of raw data
* \param[in] size_fn callback to get size for each node
* \param[in] data_fn callback to get data for each node
*
* \return incremented point after scatter is complete
*/
char* applyScatterRecur(
NodeType node, char* ptr, std::size_t elm_size, FuncSizeType size_fn,
FuncDataType data_fn
);

/**
* \internal \brief Active function to receive scattered data
*
* \param[in] msg the scatter message
*/
static void scatterHandler(ScatterMsg* msg);
};

Expand Down

0 comments on commit ade553e

Please sign in to comment.