From fdd60091df5a8e1ec57b5c5797d8721d32c4c4da Mon Sep 17 00:00:00 2001 From: NAUD Maxence <maxence.naud@cea.fr> Date: Fri, 23 Feb 2024 10:49:29 +0000 Subject: [PATCH] Add debug print --- unit_tests/operator/Test_DivImpl.cpp | 8 +++++--- unit_tests/operator/Test_MulImpl.cpp | 6 ++++-- unit_tests/operator/Test_PowImpl.cpp | 6 ++++-- unit_tests/operator/Test_SubImpl.cpp | 8 +++++--- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/unit_tests/operator/Test_DivImpl.cpp b/unit_tests/operator/Test_DivImpl.cpp index 62130b62..a0ed261f 100644 --- a/unit_tests/operator/Test_DivImpl.cpp +++ b/unit_tests/operator/Test_DivImpl.cpp @@ -25,7 +25,7 @@ namespace Aidge { TEST_CASE("[cpu/operator] Div", "[Div][CPU]") { - constexpr std::uint16_t NBTRIALS = 1000; + constexpr std::uint16_t NBTRIALS = 10; // Create a random number generator std::random_device rd; std::mt19937 gen(rd()); @@ -117,7 +117,7 @@ TEST_CASE("[cpu/operator] Div", "[Div][CPU]") { // with broadcasting } - std::cout << "multiplications over time spent: " << (number_of_operation / duration.count())<< std::endl; + std::cout << "number of elements over time spent: " << (number_of_operation / duration.count())<< std::endl; std::cout << "total time: " << duration.count() << "μs" << std::endl; } @@ -212,6 +212,8 @@ TEST_CASE("[cpu/operator] Div", "[Div][CPU]") { const std::size_t nb_elements = std::accumulate(dimsOut.cbegin(), dimsOut.cend(), std::size_t(1), std::multiplies<std::size_t>()); number_of_operation += nb_elements; } + std::cout << "number of elements over time spent: " << (number_of_operation / duration.count())<< std::endl; + std::cout << "total time: " << duration.count() << "μs" << std::endl; } SECTION("+1-D Tensor / 1-D Tensor") { std::size_t number_of_operation = 0; @@ -306,7 +308,7 @@ TEST_CASE("[cpu/operator] Div", "[Div][CPU]") { number_of_operation += nb_elements; } - std::cout << "multiplications over time spent: " << (number_of_operation / duration.count())<< std::endl; + std::cout << "number of elements over time spent: " << (number_of_operation / duration.count())<< std::endl; std::cout << "total time: " << duration.count() << "μs" << std::endl; } } diff --git a/unit_tests/operator/Test_MulImpl.cpp b/unit_tests/operator/Test_MulImpl.cpp index 759a8673..5b5a0576 100644 --- a/unit_tests/operator/Test_MulImpl.cpp +++ b/unit_tests/operator/Test_MulImpl.cpp @@ -117,7 +117,7 @@ TEST_CASE("[cpu/operator] Mul", "[Mul][CPU]") { // with broadcasting } - std::cout << "multiplications over time spent: " << (number_of_operation / duration.count())<< std::endl; + std::cout << "number of elements over time spent: " << (number_of_operation / duration.count())<< std::endl; std::cout << "total time: " << duration.count() << "μs" << std::endl; } @@ -212,6 +212,8 @@ TEST_CASE("[cpu/operator] Mul", "[Mul][CPU]") { const std::size_t nb_elements = std::accumulate(dimsOut.cbegin(), dimsOut.cend(), std::size_t(1), std::multiplies<std::size_t>()); number_of_operation += nb_elements; } + std::cout << "number of elements over time spent: " << (number_of_operation / duration.count())<< std::endl; + std::cout << "total time: " << duration.count() << "μs" << std::endl; } SECTION("+1-D Tensor / 1-D Tensor") { std::size_t number_of_operation = 0; @@ -306,7 +308,7 @@ TEST_CASE("[cpu/operator] Mul", "[Mul][CPU]") { number_of_operation += nb_elements; } - std::cout << "multiplications over time spent: " << (number_of_operation / duration.count())<< std::endl; + std::cout << "number of elements over time spent: " << (number_of_operation / duration.count())<< std::endl; std::cout << "total time: " << duration.count() << "μs" << std::endl; } } diff --git a/unit_tests/operator/Test_PowImpl.cpp b/unit_tests/operator/Test_PowImpl.cpp index eed59fe6..01f97602 100644 --- a/unit_tests/operator/Test_PowImpl.cpp +++ b/unit_tests/operator/Test_PowImpl.cpp @@ -118,7 +118,7 @@ TEST_CASE("[cpu/operator] Pow", "[Pow][CPU]") { // with broadcasting } - std::cout << "multiplications over time spent: " << (number_of_operation / duration.count())<< std::endl; + std::cout << "number of elements over time spent: " << (number_of_operation / duration.count())<< std::endl; std::cout << "total time: " << duration.count() << "μs" << std::endl; } @@ -213,6 +213,8 @@ TEST_CASE("[cpu/operator] Pow", "[Pow][CPU]") { const std::size_t nb_elements = std::accumulate(dimsOut.cbegin(), dimsOut.cend(), std::size_t(1), std::multiplies<std::size_t>()); number_of_operation += nb_elements; } + std::cout << "number of elements over time spent: " << (number_of_operation / duration.count())<< std::endl; + std::cout << "total time: " << duration.count() << "μs" << std::endl; } SECTION("+1-D Tensor / 1-D Tensor") { std::size_t number_of_operation = 0; @@ -307,7 +309,7 @@ TEST_CASE("[cpu/operator] Pow", "[Pow][CPU]") { number_of_operation += nb_elements; } - std::cout << "multiplications over time spent: " << (number_of_operation / duration.count())<< std::endl; + std::cout << "number of elements over time spent: " << (number_of_operation / duration.count())<< std::endl; std::cout << "total time: " << duration.count() << "μs" << std::endl; } } diff --git a/unit_tests/operator/Test_SubImpl.cpp b/unit_tests/operator/Test_SubImpl.cpp index 4b891e98..f9ba894f 100644 --- a/unit_tests/operator/Test_SubImpl.cpp +++ b/unit_tests/operator/Test_SubImpl.cpp @@ -25,7 +25,7 @@ namespace Aidge { TEST_CASE("[cpu/operator] Sub", "[Sub][CPU]") { - constexpr std::uint16_t NBTRIALS = 1000; + constexpr std::uint16_t NBTRIALS = 10; // Create a random number generator std::random_device rd; std::mt19937 gen(rd()); @@ -117,7 +117,7 @@ TEST_CASE("[cpu/operator] Sub", "[Sub][CPU]") { // with broadcasting } - std::cout << "multiplications over time spent: " << (number_of_operation / duration.count())<< std::endl; + std::cout << "number of elements over time spent: " << (number_of_operation / duration.count())<< std::endl; std::cout << "total time: " << duration.count() << "μs" << std::endl; } @@ -212,6 +212,8 @@ TEST_CASE("[cpu/operator] Sub", "[Sub][CPU]") { const std::size_t nb_elements = std::accumulate(dimsOut.cbegin(), dimsOut.cend(), std::size_t(1), std::multiplies<std::size_t>()); number_of_operation += nb_elements; } + std::cout << "number of elements over time spent: " << (number_of_operation / duration.count())<< std::endl; + std::cout << "total time: " << duration.count() << "μs" << std::endl; } SECTION("+1-D Tensor / 1-D Tensor") { std::size_t number_of_operation = 0; @@ -306,7 +308,7 @@ TEST_CASE("[cpu/operator] Sub", "[Sub][CPU]") { number_of_operation += nb_elements; } - std::cout << "multiplications over time spent: " << (number_of_operation / duration.count())<< std::endl; + std::cout << "number of elements over time spent: " << (number_of_operation / duration.count())<< std::endl; std::cout << "total time: " << duration.count() << "μs" << std::endl; } } -- GitLab