Skip to content
Snippets Groups Projects
Commit fdd60091 authored by Maxence Naud's avatar Maxence Naud
Browse files

Add debug print

parent f94b095a
No related branches found
No related tags found
2 merge requests!50version 0.2.0,!30add broadcasting for Arithmetic operators
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
namespace Aidge { namespace Aidge {
TEST_CASE("[cpu/operator] Div", "[Div][CPU]") { TEST_CASE("[cpu/operator] Div", "[Div][CPU]") {
constexpr std::uint16_t NBTRIALS = 1000; constexpr std::uint16_t NBTRIALS = 10;
// Create a random number generator // Create a random number generator
std::random_device rd; std::random_device rd;
std::mt19937 gen(rd()); std::mt19937 gen(rd());
...@@ -117,7 +117,7 @@ TEST_CASE("[cpu/operator] Div", "[Div][CPU]") { ...@@ -117,7 +117,7 @@ TEST_CASE("[cpu/operator] Div", "[Div][CPU]") {
// with broadcasting // 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; std::cout << "total time: " << duration.count() << "μs" << std::endl;
} }
...@@ -212,6 +212,8 @@ TEST_CASE("[cpu/operator] Div", "[Div][CPU]") { ...@@ -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>()); 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; 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") { SECTION("+1-D Tensor / 1-D Tensor") {
std::size_t number_of_operation = 0; std::size_t number_of_operation = 0;
...@@ -306,7 +308,7 @@ TEST_CASE("[cpu/operator] Div", "[Div][CPU]") { ...@@ -306,7 +308,7 @@ TEST_CASE("[cpu/operator] Div", "[Div][CPU]") {
number_of_operation += nb_elements; 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; std::cout << "total time: " << duration.count() << "μs" << std::endl;
} }
} }
......
...@@ -117,7 +117,7 @@ TEST_CASE("[cpu/operator] Mul", "[Mul][CPU]") { ...@@ -117,7 +117,7 @@ TEST_CASE("[cpu/operator] Mul", "[Mul][CPU]") {
// with broadcasting // 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; std::cout << "total time: " << duration.count() << "μs" << std::endl;
} }
...@@ -212,6 +212,8 @@ TEST_CASE("[cpu/operator] Mul", "[Mul][CPU]") { ...@@ -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>()); 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; 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") { SECTION("+1-D Tensor / 1-D Tensor") {
std::size_t number_of_operation = 0; std::size_t number_of_operation = 0;
...@@ -306,7 +308,7 @@ TEST_CASE("[cpu/operator] Mul", "[Mul][CPU]") { ...@@ -306,7 +308,7 @@ TEST_CASE("[cpu/operator] Mul", "[Mul][CPU]") {
number_of_operation += nb_elements; 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; std::cout << "total time: " << duration.count() << "μs" << std::endl;
} }
} }
......
...@@ -118,7 +118,7 @@ TEST_CASE("[cpu/operator] Pow", "[Pow][CPU]") { ...@@ -118,7 +118,7 @@ TEST_CASE("[cpu/operator] Pow", "[Pow][CPU]") {
// with broadcasting // 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; std::cout << "total time: " << duration.count() << "μs" << std::endl;
} }
...@@ -213,6 +213,8 @@ TEST_CASE("[cpu/operator] Pow", "[Pow][CPU]") { ...@@ -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>()); 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; 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") { SECTION("+1-D Tensor / 1-D Tensor") {
std::size_t number_of_operation = 0; std::size_t number_of_operation = 0;
...@@ -307,7 +309,7 @@ TEST_CASE("[cpu/operator] Pow", "[Pow][CPU]") { ...@@ -307,7 +309,7 @@ TEST_CASE("[cpu/operator] Pow", "[Pow][CPU]") {
number_of_operation += nb_elements; 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; std::cout << "total time: " << duration.count() << "μs" << std::endl;
} }
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
namespace Aidge { namespace Aidge {
TEST_CASE("[cpu/operator] Sub", "[Sub][CPU]") { TEST_CASE("[cpu/operator] Sub", "[Sub][CPU]") {
constexpr std::uint16_t NBTRIALS = 1000; constexpr std::uint16_t NBTRIALS = 10;
// Create a random number generator // Create a random number generator
std::random_device rd; std::random_device rd;
std::mt19937 gen(rd()); std::mt19937 gen(rd());
...@@ -117,7 +117,7 @@ TEST_CASE("[cpu/operator] Sub", "[Sub][CPU]") { ...@@ -117,7 +117,7 @@ TEST_CASE("[cpu/operator] Sub", "[Sub][CPU]") {
// with broadcasting // 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; std::cout << "total time: " << duration.count() << "μs" << std::endl;
} }
...@@ -212,6 +212,8 @@ TEST_CASE("[cpu/operator] Sub", "[Sub][CPU]") { ...@@ -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>()); 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; 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") { SECTION("+1-D Tensor / 1-D Tensor") {
std::size_t number_of_operation = 0; std::size_t number_of_operation = 0;
...@@ -306,7 +308,7 @@ TEST_CASE("[cpu/operator] Sub", "[Sub][CPU]") { ...@@ -306,7 +308,7 @@ TEST_CASE("[cpu/operator] Sub", "[Sub][CPU]") {
number_of_operation += nb_elements; 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; std::cout << "total time: " << duration.count() << "μs" << std::endl;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment