-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
62 lines (54 loc) · 2.09 KB
/
main.cpp
File metadata and controls
62 lines (54 loc) · 2.09 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
#include <iostream>
#include <vector>
#include "scow.h"
#include "GpuImg.hpp"
#include "GpuKernel.hpp"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
struct Launch
{
string fname;
int dimx, dimy;
Launch(string name, int x, int y) :
fname(name), dimx(x), dimy(y)
{}
};
int main()
{
SCOW_Set_Up();
scow_Steel_Thread *pthread = Make_Steel_Thread(Pick_Device_By_Type(CL_DEVICE_TYPE_GPU));
std::string filename = "C:\\Images\\Shore.pgm";
GpuImg shore(pthread, filename);
//GpuImg shore(pthread, filename, CL_MEM_ALLOC_HOST_PTR);
const int runs = 8;
vector<Launch> launches({
Launch("SimpleCopy.cl", shore.cols, shore.rows),
Launch("ReadRow2.cl", shore.cols / 2, shore.rows),
Launch("ReadRow4.cl", shore.cols / 4, shore.rows),
Launch("ReadRow8.cl", shore.cols / 8, shore.rows),
Launch("ReadRow16.cl", shore.cols / 16, shore.rows),
Launch("ReadCol2.cl", shore.cols, shore.rows / 2),
Launch("ReadCol4.cl", shore.cols, shore.rows / 4),
Launch("ReadCol8.cl", shore.cols, shore.rows / 8),
Launch("ReadCol16.cl", shore.cols, shore.rows / 16),
Launch("ReadRow2x2.cl", shore.cols / 2, shore.rows / 2),
Launch("ReadRow4x4.cl", shore.cols / 4, shore.rows / 4),
Launch("ReadRow8x8.cl", shore.cols / 8, shore.rows / 8),
Launch("ReadRow16x16.cl", shore.cols / 16, shore.rows / 16),
Launch("ReadCol2x2.cl", shore.cols / 2, shore.rows / 2),
Launch("ReadCol4x4.cl", shore.cols / 4, shore.rows / 4),
Launch("ReadCol8x8.cl", shore.cols / 8, shore.rows / 8),
Launch("ReadCol16x16.cl", shore.cols / 16, shore.rows / 16)
});
for (auto it = launches.begin(); it != launches.end(); it++){
cout << it->fname << "\t";
GpuKernel kern(pthread, it->fname);
kern.Bunch(shore, runs, it->dimx, it->dimy);
}
shore.fromGPU();
shore.Show();
pthread->Destroy(pthread);
SCOW_Tear_Down();
}