Call the Dot kernel and print out results
This commit is contained in:
parent
0ef9b6691b
commit
04ca357159
17
main.cpp
17
main.cpp
@ -133,7 +133,7 @@ void run()
|
|||||||
stream->write_arrays(a, b, c);
|
stream->write_arrays(a, b, c);
|
||||||
|
|
||||||
// List of times
|
// List of times
|
||||||
std::vector<std::vector<double>> timings(4);
|
std::vector<std::vector<double>> timings(5);
|
||||||
|
|
||||||
// Declare timers
|
// Declare timers
|
||||||
std::chrono::high_resolution_clock::time_point t1, t2;
|
std::chrono::high_resolution_clock::time_point t1, t2;
|
||||||
@ -165,6 +165,12 @@ void run()
|
|||||||
t2 = std::chrono::high_resolution_clock::now();
|
t2 = std::chrono::high_resolution_clock::now();
|
||||||
timings[3].push_back(std::chrono::duration_cast<std::chrono::duration<double> >(t2 - t1).count());
|
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
|
// Check solutions
|
||||||
@ -181,15 +187,16 @@ void run()
|
|||||||
|
|
||||||
std::cout << std::fixed;
|
std::cout << std::fixed;
|
||||||
|
|
||||||
std::string labels[4] = {"Copy", "Mul", "Add", "Triad"};
|
std::string labels[5] = {"Copy", "Mul", "Add", "Triad", "Dot"};
|
||||||
size_t sizes[4] = {
|
size_t sizes[5] = {
|
||||||
2 * sizeof(T) * ARRAY_SIZE,
|
2 * sizeof(T) * ARRAY_SIZE,
|
||||||
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
|
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
|
// Get min/max; ignore the first result
|
||||||
auto minmax = std::minmax_element(timings[i].begin()+1, timings[i].end());
|
auto minmax = std::minmax_element(timings[i].begin()+1, timings[i].end());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user