diff --git a/docs/Doxyfile b/docs/Doxyfile index 870788edd..6e2703b9f 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -44,7 +44,7 @@ PROJECT_NUMBER = 0.0.1 # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = "An MPI wrapper which makes using MPI feel like real C++" +PROJECT_BRIEF = "(Near) zero-overhead C++ MPI bindings." # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 @@ -1187,7 +1187,7 @@ HTML_HEADER = docs/custom_doxygen/header.html # that doxygen normally uses. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_FOOTER = docs/custom_doxygen/footer.html +# HTML_FOOTER = docs/custom_doxygen/footer.html # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style # sheet that is used by each HTML page. It can be used to fine-tune the look of @@ -1225,7 +1225,9 @@ HTML_EXTRA_STYLESHEET = extern/doxygen-awesome-css/doxygen-awesome.css \ # files will be copied as-is; there are no commands or markers available. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_EXTRA_FILES = extern/doxygen-awesome-css/doxygen-awesome-darkmode-toggle.js +HTML_EXTRA_FILES = extern/doxygen-awesome-css/doxygen-awesome-darkmode-toggle.js \ + extern/doxygen-awesome-css/doxygen-awesome-fragment-copy-button.js \ + extern/doxygen-awesome-css/doxygen-awesome-paragraph-link.js # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to @@ -1238,6 +1240,8 @@ HTML_EXTRA_FILES = extern/doxygen-awesome-css/doxygen-awesome-darkmode-tog HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE = LIGHT + # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors # in the HTML output. For a value of 0 the output will use gray-scales only. A # value of 255 will produce the most vivid colors. diff --git a/docs/custom_doxygen/footer.html b/docs/custom_doxygen/footer.html deleted file mode 100644 index 292753c24..000000000 --- a/docs/custom_doxygen/footer.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - diff --git a/docs/custom_doxygen/header.html b/docs/custom_doxygen/header.html index cd6634fb2..01fcfa991 100644 --- a/docs/custom_doxygen/header.html +++ b/docs/custom_doxygen/header.html @@ -1,6 +1,6 @@ - + - + @@ -8,6 +8,9 @@ $projectname: $title $title + + + @@ -16,12 +19,27 @@ + + + $treeview $search $mathjax +$darkmode $extrastylesheet - + + + + + + @@ -36,12 +54,12 @@
- + - + - diff --git a/extern/doxygen-awesome-css b/extern/doxygen-awesome-css index 4cd62308d..df88fe4fd 160000 --- a/extern/doxygen-awesome-css +++ b/extern/doxygen-awesome-css @@ -1 +1 @@ -Subproject commit 4cd62308d825fe0396d2f66ffbab45d0e247724c +Subproject commit df88fe4fdd97714fadfd3ef17de0b4401f804052 diff --git a/include/kamping/result.hpp b/include/kamping/result.hpp index 03efde2b8..d663a62e6 100644 --- a/include/kamping/result.hpp +++ b/include/kamping/result.hpp @@ -429,6 +429,7 @@ class NonBlockingResult { auto extract() { if constexpr (owns_request) { auto result = extract_result(); // we try to extract the result first, so that we get a nice error message + // TODO: return a named struct return std::pair(_request.extract(), std::move(result)); } else { return extract_result(); @@ -436,13 +437,16 @@ class NonBlockingResult { } /// @brief Waits for the underlying \ref Request to complete by calling \ref Request::wait() and upon completion - /// returns an \c std::pair containing an \ref MPIResult and the status if \ref kamping::status_out() is passend. + /// returns: /// - /// If the result is empty (see \ref MPIResult::is_empty), only the status is returned. + /// If \p status is an out-parameter: + /// - If the result is not empty (see \ref MPIResult::is_empty), an \c std::pair containing an \ref MPIResult and + /// the status. + /// - If the result is empty, only the status is returned. /// - /// If \c kamping::status(ignore<>) is passed as a parameter or the status - /// parameter is omited, only the result is returned (or nothing if the - /// result is empty). + /// If \p is \c kamping::status(ignore<>), or not an out-paramter: + /// - If the result is not empty (see \ref MPIResult::is_empty), only the result is returned. + /// - If the result is empty, nothing is returned. /// /// This method is only available if this result owns the underlying request. If this is not the case, the user must /// manually wait on the request that they own and manually obtain the result via \ref extract(). @@ -473,13 +477,15 @@ class NonBlockingResult { } } - /// @brief Tests the underlying \ref Request for completion by calling \ref Request::test() and returns an \c - /// std::optional containing the underlying \ref MPIResult on success. If \ref kamping::status_out() is passed as a - /// parameter, also returns the status. If the associated operation has not completed yet, returns \c std::nullopt. + /// @brief Tests the underlying \ref Request for completion by calling \ref + /// Request::test() and returns a value convertible to \c bool indicating if the request is complete. /// - /// The return value depends on the encapsulated result and the status parameter: See \ref wait() for details. + /// The type of the return value depends on the encapsulated result and the \p status parameter and follows the same + /// semantics as \ref wait(), but its return value is wrapped in an \c std::optional. + /// The optional only contains a value if the request is complete, i.e. \c test() succeeded. /// - /// If both the result is empty and no status is requested, returns \c true if the underlying request is complete. + /// If both the result is empty and no status returned, returns a \c bool indicating completion instead of an \c + /// std::optional. /// /// This method is only available if this result owns the underlying request. If this is not the case, the user must /// manually test the request that they own and manually obtain the result via \ref extract(). diff --git a/tests/nonblocking_result_test.cpp b/tests/nonblocking_result_test.cpp index d5ca6c14f..367e0281b 100644 --- a/tests/nonblocking_result_test.cpp +++ b/tests/nonblocking_result_test.cpp @@ -21,9 +21,9 @@ using namespace kamping; -static bool test_succeed = false; -static size_t num_wait_calls = 0; -int const TOUCHED_BY_MOCK_TAG = 42; +static bool let_mpi_test_succeed = false; +static size_t num_wait_calls = 0; +int const TOUCHED_BY_MOCK_TAG = 42; KAMPING_MAKE_HAS_MEMBER(wait) KAMPING_MAKE_HAS_MEMBER(test) @@ -42,18 +42,18 @@ int MPI_Test(MPI_Request*, int* flag, MPI_Status* status) { if (status != MPI_STATUS_IGNORE) { status->MPI_TAG = TOUCHED_BY_MOCK_TAG; } - *flag = test_succeed; + *flag = let_mpi_test_succeed; return MPI_SUCCESS; } class NonBlockingResultTest : public ::testing::Test { void SetUp() override { - test_succeed = false; - num_wait_calls = 0; + let_mpi_test_succeed = false; + num_wait_calls = 0; } void TearDown() override { - test_succeed = false; - num_wait_calls = 0; + let_mpi_test_succeed = false; + num_wait_calls = 0; } }; @@ -176,12 +176,12 @@ TEST_F(NonBlockingResultTest, owning_request_and_result_test_works) { recv_buf_obj.underlying().push_back(42); recv_buf_obj.underlying().push_back(43); recv_buf_obj.underlying().push_back(44); - auto request_obj = request(); - auto result = kamping::make_nonblocking_result(std::move(recv_buf_obj), std::move(request_obj)); - test_succeed = false; + auto request_obj = request(); + auto result = kamping::make_nonblocking_result(std::move(recv_buf_obj), std::move(request_obj)); + let_mpi_test_succeed = false; EXPECT_FALSE(result.test().has_value()); - test_succeed = true; - auto data = result.test(); + let_mpi_test_succeed = true; + auto data = result.test(); EXPECT_TRUE(data.has_value()); auto expected_data = std::vector{42, 43, 44}; EXPECT_EQ(data.value().extract_recv_buffer(), expected_data); @@ -192,12 +192,12 @@ TEST_F(NonBlockingResultTest, owning_request_and_result_test_works_status_out) { recv_buf_obj.underlying().push_back(42); recv_buf_obj.underlying().push_back(43); recv_buf_obj.underlying().push_back(44); - auto request_obj = request(); - auto result = kamping::make_nonblocking_result(std::move(recv_buf_obj), std::move(request_obj)); - test_succeed = false; + auto request_obj = request(); + auto result = kamping::make_nonblocking_result(std::move(recv_buf_obj), std::move(request_obj)); + let_mpi_test_succeed = false; EXPECT_FALSE(result.test(status_out()).has_value()); - test_succeed = true; - auto data = result.test(status_out()); + let_mpi_test_succeed = true; + auto data = result.test(status_out()); EXPECT_TRUE(data.has_value()); auto expected_data = std::vector{42, 43, 44}; EXPECT_EQ(data.value().first.extract_recv_buffer(), expected_data); @@ -209,13 +209,13 @@ TEST_F(NonBlockingResultTest, owning_request_and_result_test_works_status_in) { recv_buf_obj.underlying().push_back(42); recv_buf_obj.underlying().push_back(43); recv_buf_obj.underlying().push_back(44); - auto request_obj = request(); - auto result = kamping::make_nonblocking_result(std::move(recv_buf_obj), std::move(request_obj)); - test_succeed = false; + auto request_obj = request(); + auto result = kamping::make_nonblocking_result(std::move(recv_buf_obj), std::move(request_obj)); + let_mpi_test_succeed = false; Status status; EXPECT_FALSE(result.test(status_out(status)).has_value()); - test_succeed = true; - auto data = result.test(status_out(status)); + let_mpi_test_succeed = true; + auto data = result.test(status_out(status)); EXPECT_TRUE(data.has_value()); auto expected_data = std::vector{42, 43, 44}; EXPECT_EQ(data.value().extract_recv_buffer(), expected_data); @@ -256,15 +256,6 @@ TEST_F(NonBlockingResultTest, owning_request_and_result_extract_works) { TEST_F(NonBlockingResultTest, owning_request_and_empty_result_types_match) { auto request_obj = request(); auto result = kamping::make_nonblocking_result(std::move(request_obj)); - // EXPECT_TRUE(has_member_test_v); - // EXPECT_TRUE(has_member_test_v); - // { - // using test_return_type = decltype(result.test()); - // EXPECT_TRUE((std::is_same_v)); - // EXPECT_TRUE(has_member_wait_v); - // } - // using wait_return_type = decltype(result.wait()); - // EXPECT_TRUE((std::is_same_v)); EXPECT_TRUE(has_member_test_v); EXPECT_TRUE(has_member_wait_v); @@ -304,14 +295,45 @@ TEST_F(NonBlockingResultTest, owning_request_and_empty_result_types_match) { } TEST_F(NonBlockingResultTest, owning_request_and_empty_result_test_works) { - auto request_obj = request(); - auto result = kamping::make_nonblocking_result(std::move(request_obj)); - test_succeed = false; + auto request_obj = request(); + auto result = kamping::make_nonblocking_result(std::move(request_obj)); + let_mpi_test_succeed = false; EXPECT_FALSE(result.test()); - test_succeed = true; + let_mpi_test_succeed = true; EXPECT_TRUE(result.test()); } +TEST_F(NonBlockingResultTest, owning_request_and_empty_result_test_works_status_out) { + auto request_obj = request(); + auto result = kamping::make_nonblocking_result(std::move(request_obj)); + let_mpi_test_succeed = false; + EXPECT_FALSE(result.test(status_out())); + let_mpi_test_succeed = true; + std::optional status = result.test(status_out()); + EXPECT_TRUE(status.has_value()); + EXPECT_EQ(status.value().tag(), TOUCHED_BY_MOCK_TAG); +} + +TEST_F(NonBlockingResultTest, owning_request_and_empty_result_test_works_status_in) { + auto request_obj = request(); + auto result = kamping::make_nonblocking_result(std::move(request_obj)); + let_mpi_test_succeed = false; + Status status; + EXPECT_FALSE(result.test(status_out(status))); + let_mpi_test_succeed = true; + EXPECT_TRUE(result.test(status_out(status))); + EXPECT_EQ(status.tag(), TOUCHED_BY_MOCK_TAG); +} + +TEST_F(NonBlockingResultTest, owning_request_and_empty_result_wait_works) { + auto request_obj = request(); + auto result = kamping::make_nonblocking_result(std::move(request_obj)); + EXPECT_EQ(num_wait_calls, 0); + static_assert(std::is_same_v); + result.wait(); + EXPECT_EQ(num_wait_calls, 1); +} + TEST_F(NonBlockingResultTest, owning_request_and_empty_result_test_works_status_out) { auto request_obj = request(); auto result = kamping::make_nonblocking_result(std::move(request_obj));
+
$projectname $projectnumber
$projectbrief
@@ -49,7 +67,7 @@ -
+
$projectbrief