Call the Dot kernel and print out results

This commit is contained in:
Tom Deakin 2016-10-14 14:40:28 +01:00
parent 0ef9b6691b
commit 04ca357159

View File

@ -133,7 +133,7 @@ void run()
stream->write_arrays(a, b, c);
// List of times
std::vector<std::vector<double>> timings(4);
std::vector<std::vector<double>> timings(5);
// Declare timers
std::chrono::high_resolution_clock::time_point t1, t2;
@ -165,6 +165,12 @@ void run()
t2 = std::chrono::high_resolution_clock::now();
timings[3].push_back(std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count());
// Execute Dot
t1 = std::chrono::high_resolution_clock::now();
stream->dot();
t2 = std::chrono::high_resolution_clock::now();
timings[4].push_back(std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count());
}
// Check solutions
@ -181,15 +187,16 @@ void run()
std::cout << std::fixed;
std::string labels[4] = {"Copy", "Mul", "Add", "Triad"};
size_t sizes[4] = {
std::string labels[5] = {"Copy", "Mul", "Add", "Triad", "Dot"};
size_t sizes[5] = {
2 * sizeof(T) * ARRAY_SIZE,
2 * sizeof(T) * ARRAY_SIZE,
3 * sizeof(T) * ARRAY_SIZE,
3 * sizeof(T) * ARRAY_SIZE
3 * sizeof(T) * ARRAY_SIZE,
2 * sizeof(T) * ARRAY_SIZE
};
for (int i = 0; i < 4; i++)
for (int i = 0; i < 5; i++)
{
// Get min/max; ignore the first result
auto minmax = std::minmax_element(timings[i].begin()+1, timings[i].end());