diff --git a/gloo/CMakeLists.txt b/gloo/CMakeLists.txt index 02124e904..9716011c7 100644 --- a/gloo/CMakeLists.txt +++ b/gloo/CMakeLists.txt @@ -43,6 +43,7 @@ list(APPEND GLOO_HDRS "${CMAKE_CURRENT_SOURCE_DIR}/broadcast_one_to_all.h" "${CMAKE_CURRENT_SOURCE_DIR}/context.h" "${CMAKE_CURRENT_SOURCE_DIR}/gather.h" + "${CMAKE_CURRENT_SOURCE_DIR}/gatherv.h" "${CMAKE_CURRENT_SOURCE_DIR}/math.h" "${CMAKE_CURRENT_SOURCE_DIR}/pairwise_exchange.h" "${CMAKE_CURRENT_SOURCE_DIR}/reduce.h" diff --git a/gloo/transport/tcp/unbound_buffer.cc b/gloo/transport/tcp/unbound_buffer.cc index fc8fb559b..fc12ed554 100644 --- a/gloo/transport/tcp/unbound_buffer.cc +++ b/gloo/transport/tcp/unbound_buffer.cc @@ -203,6 +203,12 @@ void UnboundBuffer::throwIfException() { std::rethrow_exception(ex_); } } +bool UnboundBuffer::testRecv() { + return recvCompletions_ != 0; +} +bool UnboundBuffer::testSend() { + return sendCompletions_ != 0; +} } // namespace tcp } // namespace transport diff --git a/gloo/transport/tcp/unbound_buffer.h b/gloo/transport/tcp/unbound_buffer.h index e4ad92c63..53d31fc6c 100644 --- a/gloo/transport/tcp/unbound_buffer.h +++ b/gloo/transport/tcp/unbound_buffer.h @@ -61,6 +61,9 @@ class UnboundBuffer : public ::gloo::transport::UnboundBuffer { void handleRecvCompletion(int rank); void handleSendCompletion(int rank); + bool testRecv() override; + bool testSend() override; + protected: std::shared_ptr context_; diff --git a/gloo/transport/unbound_buffer.cc b/gloo/transport/unbound_buffer.cc index cdd9aa0ad..727d5fe0e 100644 --- a/gloo/transport/unbound_buffer.cc +++ b/gloo/transport/unbound_buffer.cc @@ -6,6 +6,7 @@ * LICENSE file in the root directory of this source tree. */ +#include #include "gloo/transport/unbound_buffer.h" namespace gloo { @@ -13,6 +14,12 @@ namespace transport { // Have to provide implementation for pure virtual destructor. UnboundBuffer::~UnboundBuffer() {} +bool UnboundBuffer::testRecv() { + abort(); +} +bool UnboundBuffer::testSend() { + abort(); +} } // namespace transport } // namespace gloo diff --git a/gloo/transport/unbound_buffer.h b/gloo/transport/unbound_buffer.h index b21b5b3a0..5f9f3143e 100644 --- a/gloo/transport/unbound_buffer.h +++ b/gloo/transport/unbound_buffer.h @@ -117,6 +117,14 @@ class UnboundBuffer { uint64_t slot, size_t offset = 0, size_t nbytes = kUnspecifiedByteCount) = 0; + + // Tests if a reception is possibly complete. Only valid if called after + // `recv` and before `waitRecv` + virtual bool testRecv(); + + // Tests if a sending is possibly complete. Only valid if called after + // `send` and before `waitSend` + virtual bool testSend(); }; } // namespace transport