-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbenchmark.cpp
More file actions
28 lines (26 loc) · 795 Bytes
/
benchmark.cpp
File metadata and controls
28 lines (26 loc) · 795 Bytes
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
#include "Cmatrix.h"
#include "time.h"
#include <profileapi.h>
using namespace std;
int main() {
LARGE_INTEGER frequency, start, finish;
ofstream fout ("benchmark.txt");
for (int N = 1024; N <= 16384; N *= 2)
{
for (int n = 1; n <= 128; n *= 2)
{
vector<cl_float> a_data(n * N, 1);
vector<cl_float> b_data(n * N, 2);
Matrix a(a_data, n);
a = T(a);
Matrix b(b_data, n);
QueryPerformanceFrequency(&frequency);
QueryPerformanceCounter(&start);
Matrix tmp = a * b;
QueryPerformanceCounter(&finish);
fout << (double)(finish.QuadPart - start.QuadPart) / frequency.QuadPart * 1000 << ", ";
}
fout << '\n';
}
return 0;
}