Added benchmark for expression tree creation
This commit is contained in:
@@ -2,8 +2,8 @@ set(CMAKE_BUILD_TYPE Release)
|
|||||||
|
|
||||||
find_package(CUDA)
|
find_package(CUDA)
|
||||||
|
|
||||||
foreach(PROG blas)
|
foreach(PROG blas overhead)
|
||||||
add_executable(${PROG}-bench ${PROG}.cpp)
|
add_executable(${PROG}-bench ${PROG}.cpp)
|
||||||
target_link_libraries(${PROG}-bench atidlas ${OPENCL_LIBRARIES})
|
target_link_libraries(${PROG}-bench atidlas ${OPENCL_LIBRARIES})
|
||||||
set_target_properties(${PROG}-bench PROPERTIES COMPILE_FLAGS "-Wall -Wextra")
|
set_target_properties(${PROG}-bench PROPERTIES COMPILE_FLAGS "-Wall -Wextra")
|
||||||
|
|
||||||
|
27
bench/overhead.cpp
Normal file
27
bench/overhead.cpp
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#include "atidlas/array.h"
|
||||||
|
#include "atidlas/tools/timer.hpp"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace ad = atidlas;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
ad::array x(10, ad::FLOAT_TYPE), y(10, ad::FLOAT_TYPE), z(10, ad::FLOAT_TYPE);
|
||||||
|
ad::tools::timer t;
|
||||||
|
std::cout << "-------------------------" << std::endl;
|
||||||
|
std::cout << "Expression tree creation:" << std::endl;
|
||||||
|
#define BENCH(CREATE, STR) \
|
||||||
|
{\
|
||||||
|
std::vector<int> flusher(10000000, 1);\
|
||||||
|
t.start();\
|
||||||
|
ad::array_expression tmp(CREATE);\
|
||||||
|
std::cout << STR << ": " << t.get() << std::endl;\
|
||||||
|
}
|
||||||
|
|
||||||
|
BENCH(x + y, "2 terms");
|
||||||
|
BENCH(x + y + x, "3 terms");
|
||||||
|
BENCH(x + y + x + y, "4 terms");
|
||||||
|
BENCH(x + y + x + y + x, "5 terms");
|
||||||
|
std::cout << "-------------------------" << std::endl;
|
||||||
|
}
|
Reference in New Issue
Block a user