Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pentschev committed Jan 15, 2025
1 parent 3dd168d commit a772d87
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
26 changes: 17 additions & 9 deletions cpp/include/ucxx/typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,28 @@ enum Tag : ucp_tag_t {};
*/
enum TagMask : ucp_tag_t {};

struct TagRecvInfo {
Tag senderTag; ///< Sender tag
size_t length; ///< The size of the received data

TagRecvInfo() = delete;
explicit TagRecvInfo(const ucp_tag_recv_info_t&);
};

/**
* @brief A full UCP tag mask.
*
* A convenience constant providing a full UCP tag mask (all bits set).
*/
static constexpr TagMask TagMaskFull{std::numeric_limits<std::underlying_type_t<TagMask>>::max()};

/**
* @brief Information about probed tag message.
*
* Contains information returned when probing by a tag message received by the worker but
* not yet consumed.
*/
class TagRecvInfo {
public:
Tag senderTag; ///< Sender tag
size_t length; ///< The size of the received data

TagRecvInfo() = delete;
explicit TagRecvInfo(const ucp_tag_recv_info_t&);
};

/**
* @brief A UCP configuration map.
*
Expand Down Expand Up @@ -132,7 +139,8 @@ typedef std::function<std::shared_ptr<Buffer>(size_t)> AmAllocatorType;
* @brief Active Message receiver callback.
*
* Type for a custom Active Message receiver callback, executed by the remote worker upon
* Active Message request completion.
* Active Message request completion. The first parameter is the request that completed,
* the second is the handle of the UCX endpoint of the sender.
*/
typedef std::function<void(std::shared_ptr<Request>, ucp_ep_h)> AmReceiverCallbackType;

Expand Down
15 changes: 11 additions & 4 deletions cpp/include/ucxx/worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -685,19 +685,26 @@ class Worker : public Component {
*
* Checks the worker for any uncaught tag messages. An uncaught tag message is any
* tag message that has been fully or partially received by the worker, but not matched
* by a corresponding `ucp_tag_recv_*` call.
* by a corresponding `ucp_tag_recv_*` call. Additionally, returns information about the
* tag message.
*
* @code{.cpp}
* // `worker` is `std::shared_ptr<ucxx::Worker>`
* assert(!worker->tagProbe(0));
* auto probe = worker->tagProbe(0);
* assert(!probe.first)
*
* // `ep` is a remote `std::shared_ptr<ucxx::Endpoint` to the local `worker`
* ep->tagSend(buffer, length, 0);
*
* assert(worker->tagProbe(0));
* probe = worker->tagProbe(0);
* assert(probe.first);
* assert(probe.second.tag == 0);
* assert(probe.second.length == length);
* @endcode
*
* @returns `true` if any uncaught messages were received, `false` otherwise.
* @returns pair where first elements is `true` if any uncaught messages were received,
* `false` otherwise, and second element contain the information from the tag
* receive.
*/
[[nodiscard]] std::pair<bool, TagRecvInfo> tagProbe(const Tag tag,
const TagMask tagMask = TagMaskFull);
Expand Down

0 comments on commit a772d87

Please sign in to comment.