-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQ.h
62 lines (49 loc) · 1.28 KB
/
Q.h
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
#ifndef AUGLAG_L1_GPU_Q_H_
#define AUGLAG_L1_GPU_Q_H_
#include "cl.hpp"
#include "R2.h"
namespace auglag1gpu {
class Q {
friend void hostCopy(Q &a, Q&b);
friend void devCopy(cl::CommandQueue &queue, Q &a, Q &b, cl_int *err);
friend void copy(cl::CommandQueue &queue, Q &a, Q &b, cl_int *err);
public:
enum Triangle {odd = 0, even = 1};
Q(cl::Context &context, int m1, int m2, int mdf, double h);
Q(const Q &a);
~Q();
Q& operator=(const Q &a);
Q hostCopy();
Q devCopy(cl::CommandQueue &queue, cl_int *err);
Q copy(cl::CommandQueue &queue, cl_int *err);
int pull(cl::CommandQueue &queue);
int push(cl::CommandQueue &queue);
cl::Buffer getHandle();
R2 operator()(int i, int j, Triangle comp) const;
R2& operator()(int i, int j, Triangle comp);
double div(int i, int j) const;
int getM1() const;
int getM2() const;
int getMdf() const;
double getH() const;
private:
struct Data {
cl::Context context;
int refCounter;
R2 *hostPtr;
cl::Buffer devicePtr;
int m1;
int m2;
int mdf;
double h;
};
Data *data;
};
void hostCopy(Q &a, Q &b);
void devCopy(cl::CommandQueue &queue, Q &a, Q &b, cl_int *err);
void copy(cl::CommandQueue &queue, Q &a, Q &b, cl_int *err);
double dot(const Q& x1, const Q &x2);
double dot(const Q& x);
double norm2(const Q& x);
}
#endif