-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathL3OptimizerHelper.h
78 lines (61 loc) · 1.73 KB
/
L3OptimizerHelper.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Created on: Feb 10, 2014
* Author: Mirko Myllykoski (mirko.myllykoski@gmail.com)
*/
#ifndef PSCRCL_L3_OPTIMIZER_HELPER
#define PSCRCL_L3_OPTIMIZER_HELPER
#include "optimizer/AbstractOptimizerHelper.h"
#include "L3DeviceContext.h"
#include "CopyPointer.h"
namespace pscrCL {
class L3OptimizerHelper : public AbstractOptimizerHelper {
public:
L3OptimizerHelper(
cl::Context &context,
cl::Device &device,
int n3,
int l3Ldf1,
int l3Ldf2,
int l3MatLdf,
int count1,
int count2,
PscrCLMode mode);
virtual ~L3OptimizerHelper() {};
// Tells the helper to allocate all necessary resources. Should be called
// before the first prepare/evaluate.
virtual void initialize();
// Tells tehe helper to recover from invalid Commanqueue situation
virtual void recover();
// Tells helper to prepare for run with the given OptValues.
virtual bool prepare(const OptValues& values);
// Runs the the solver using the OptValues given earlier through prepare()
// member function.
virtual void run();
// Tells the helper to finalize the OpenCL command queue. Blocking.
virtual void finalize();
// Tells helper to release the unnecessary resources. Should be called only
// when all desired evaluations have been carried out.
virtual void release();
private:
cl::Context context;
cl::Device device;
int n3;
int l3Ldf1;
int l3Ldf2;
int l3MatLdf;
int count1;
int count2;
PscrCLMode mode;
CopyPointer<CommandQueue> queue;
CopyPointer<OptValues> optValues;
CopyPointer<L3DeviceContext> deviceContext;
cl::Buffer devCoefMatrix;
cl::Buffer devLambda1;
cl::Buffer devLambda2;
cl::Buffer devF;
cl::Buffer devTmp;
bool initialized;
bool prepared;
};
}
#endif