-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
64 lines (46 loc) · 1.5 KB
/
main.cpp
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
#include <iostream>
#include <iterator>
#include <string>
#include <boost/compute/command_queue.hpp>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/sort.hpp>
#include "iterator/SortIterator.h"
#include "io/Print.h"
#include "utils/cmd_options/CommandLineOptions.h"
#include "datatypes/ClMatrixCOO.h"
#include "io/MatrixMarket.h"
#include "matrix_operations/Transpose.h"
namespace compute = boost::compute;
int main(int argc, const char* argv[])
{
std::string vendor;
std::string matrix_file;
if(!computecl::ParseCommandLine(argc, argv, vendor, matrix_file))
{
return 0;
}
std::vector<compute::device> devices = compute::system::devices();
compute::device gpu;
int index = 0;
for (compute::device d : devices)
{
///std::cout << "checking " << d.vendor() << std::endl;
if (d.vendor() == vendor)
{
gpu = d;
std::cout << "device[" << index << "]: "
<< d.name() << " "
<< d.vendor() << std::endl;
}
index++;
}
compute::context context(gpu);
compute::command_queue queue(context, gpu);
computecl::ClHostMatrixCOO<float> matrix;
computecl::readMatrixMarket(matrix, matrix_file);
computecl::writeMatrixMarket(matrix, "test.mtx");
computecl::ClDeviceMatrixCOO<float> cl_matrix(queue);
computecl::readMatrixMarket(cl_matrix, matrix_file, queue);
computecl::writeMatrixMarket(cl_matrix, "test2.mtx", queue);
return 0;
}