This repository was archived by the owner on Dec 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
162 lines (114 loc) · 5.15 KB
/
main.cpp
File metadata and controls
162 lines (114 loc) · 5.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#include <benchmarks.hpp>
#include <iomanip>
#include <iostream>
using namespace sycl;
int
main()
{
device d{ default_selector{} };
context c{ d };
queue q{ c, d };
const size_t max_wg_size =
d.get_info<info::device::max_work_group_size>() >> 1;
std::cout << "running on " << d.get_info<info::device::name>() << "\n"
<< std::endl;
std::cout << "Parallel Similarity Transform for finding max "
"eigen value (with vector)\n"
<< std::endl;
for (uint i = 7; i <= 13; i++) {
const uint dim = 1ul << i;
uint itr_count = 0;
int64_t tm = benchmark_similarity_transform(
q, dim, dim <= max_wg_size ? dim : max_wg_size, &itr_count);
std::cout << std::setw(5) << std::left << dim << "x" << std::setw(5)
<< std::right << dim << "\t\t\t" << std::setw(10) << std::right
<< tm << " ms"
<< "\t\t\t" << std::setw(6) << std::right << itr_count
<< " round(s)" << std::endl;
}
std::cout << "\n[kernel] Sum Across Rows of Matrix (v0)\n" << std::endl;
for (uint i = 7; i <= 13; i++) {
const uint dim = 1ul << i;
int64_t tm = benchmark_sum_across_rows_kernel_v0(
q, dim, dim <= max_wg_size ? dim : max_wg_size);
std::cout << std::setw(5) << std::left << dim << "x" << std::setw(5)
<< std::right << dim << "\t\t\t" << std::setw(10) << std::right
<< (double)tm * 1e-3 << " ms" << std::endl;
}
std::cout << "\n[kernel] Sum Across Rows of Matrix (v1)\n" << std::endl;
for (uint i = 7; i <= 13; i++) {
const uint dim = 1ul << i;
int64_t tm = benchmark_sum_across_rows_kernel_v1(
q, dim, dim <= max_wg_size ? dim : max_wg_size);
std::cout << std::setw(5) << std::left << dim << "x" << std::setw(5)
<< std::right << dim << "\t\t\t" << std::setw(10) << std::right
<< (double)tm * 1e-3 << " ms" << std::endl;
}
std::cout << "\n[kernel] Sum Across Rows of Matrix (v2)\n" << std::endl;
for (uint i = 7; i <= 13; i++) {
const uint dim = 1ul << i;
int64_t tm = benchmark_sum_across_rows_kernel_v2(
q, dim, dim <= max_wg_size ? dim : max_wg_size);
std::cout << std::setw(5) << std::left << dim << "x" << std::setw(5)
<< std::right << dim << "\t\t\t" << std::setw(10) << std::right
<< (double)tm * 1e-3 << " ms" << std::endl;
}
std::cout << "\n[kernel] Max Value in Vector (v0)\n" << std::endl;
for (uint i = 16; i <= 25; i++) {
const uint dim = 1ul << i;
int64_t tm = benchmark_find_vector_max_v0(
q, dim, dim <= max_wg_size ? dim : max_wg_size);
std::cout << std::setw(9) << std::right << dim << "\t\t\t" << std::setw(10)
<< std::right << (double)tm * 1e-3 << " ms" << std::endl;
}
std::cout << "\n[kernel] Max Value in Vector (v1)\n" << std::endl;
for (uint i = 16; i <= 25; i++) {
const uint dim = 1ul << i;
int64_t tm = benchmark_find_vector_max_v1(
q, dim, dim <= max_wg_size ? dim : max_wg_size);
std::cout << std::setw(9) << std::right << dim << "\t\t\t" << std::setw(10)
<< std::right << (double)tm * 1e-3 << " ms" << std::endl;
}
std::cout << "\n[kernel] Max Value in Vector (v2)\n" << std::endl;
for (uint i = 16; i <= 25; i++) {
const uint dim = 1ul << i;
int64_t tm = benchmark_find_vector_max_v2(
q, dim, dim <= max_wg_size ? dim : max_wg_size);
std::cout << std::setw(9) << std::right << dim << "\t\t\t" << std::setw(10)
<< std::right << (double)tm * 1e-3 << " ms" << std::endl;
}
std::cout << "\n[kernel] Eigen Vector Computation (v0)\n" << std::endl;
for (uint i = 16; i <= 25; i++) {
const uint dim = 1ul << i;
int64_t tm = benchmark_compute_eigen_vector_v0(
q, dim, dim <= max_wg_size ? dim : max_wg_size);
std::cout << std::setw(9) << std::right << dim << "\t\t\t" << std::setw(10)
<< std::right << (double)tm * 1e-3 << " ms" << std::endl;
}
std::cout << "\n[kernel] Eigen Vector Computation (v1)\n" << std::endl;
for (uint i = 16; i <= 25; i++) {
const uint dim = 1ul << i;
int64_t tm = benchmark_compute_eigen_vector_v1(
q, dim, dim <= max_wg_size ? dim : max_wg_size);
std::cout << std::setw(9) << std::right << dim << "\t\t\t" << std::setw(10)
<< std::right << (double)tm * 1e-3 << " ms" << std::endl;
}
std::cout << "\n[kernel] Next Matrix Computation\n" << std::endl;
for (uint i = 7; i <= 13; i++) {
const uint dim = 1ul << i;
int64_t tm = benchmark_compute_next_matrix(
q, dim, dim <= max_wg_size ? dim : max_wg_size);
std::cout << std::setw(5) << std::left << dim << "x" << std::setw(5)
<< std::right << dim << "\t\t\t" << std::setw(10) << std::right
<< (double)tm * 1e-3 << " ms" << std::endl;
}
std::cout << "\n[kernel] Stop Criteria Checker\n" << std::endl;
for (uint i = 16; i <= 25; i++) {
const uint dim = 1ul << i;
int64_t tm = benchmark_stop_criteria_tester(
q, dim, dim <= max_wg_size ? dim : max_wg_size);
std::cout << std::setw(9) << std::right << dim << "\t\t\t" << std::setw(10)
<< std::right << (double)tm * 1e-3 << " ms" << std::endl;
}
return 0;
}