Added benchmark for kernel launch
This commit is contained in:
@@ -9,19 +9,30 @@ int main()
|
|||||||
{
|
{
|
||||||
ad::array x(10, ad::FLOAT_TYPE), y(10, ad::FLOAT_TYPE), z(10, ad::FLOAT_TYPE);
|
ad::array x(10, ad::FLOAT_TYPE), y(10, ad::FLOAT_TYPE), z(10, ad::FLOAT_TYPE);
|
||||||
ad::tools::timer t;
|
ad::tools::timer t;
|
||||||
std::cout << "-------------------------" << std::endl;
|
// std::cout << "-------------------------" << std::endl;
|
||||||
std::cout << "Expression tree creation:" << std::endl;
|
// std::cout << "Expression tree creation:" << std::endl;
|
||||||
#define BENCH(CREATE, STR) \
|
//#define BENCH(CREATE, STR) \
|
||||||
{\
|
// {\
|
||||||
std::vector<int> flusher(10000000, 1);\
|
// ad::array_expression tmp1(CREATE);\
|
||||||
t.start();\
|
// t.start();\
|
||||||
ad::array_expression tmp(CREATE);\
|
// for(unsigned int i = 0 ; i < 1000 ; ++i)\
|
||||||
std::cout << STR << ": " << t.get() << std::endl;\
|
// ad::array_expression tmp2(CREATE);\
|
||||||
}
|
// std::cout << STR << ": " << t.get()/1000 << std::endl;\
|
||||||
|
// }
|
||||||
|
|
||||||
BENCH(x + y, "2 terms");
|
// BENCH(x + y, "2 terms");
|
||||||
BENCH(x + y + x, "3 terms");
|
// BENCH(x + y + x, "3 terms");
|
||||||
BENCH(x + y + x + y, "4 terms");
|
// BENCH(x + y + x + y, "4 terms");
|
||||||
BENCH(x + y + x + y + x, "5 terms");
|
// BENCH(x + y + x + y + x, "5 terms");
|
||||||
|
//#undef BENCH
|
||||||
std::cout << "-------------------------" << std::endl;
|
std::cout << "-------------------------" << std::endl;
|
||||||
|
x = y + z;
|
||||||
|
ad::cl::synchronize(x.context());
|
||||||
|
t.start();\
|
||||||
|
for(unsigned int i = 0 ; i < 100 ; ++i){
|
||||||
|
x = y + z;
|
||||||
|
ad::cl::synchronize(x.context());
|
||||||
|
}
|
||||||
|
std::cout << "Kernel launch overhead: " << t.get()/100 << std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user