-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathReductionOperation.h
More file actions
39 lines (28 loc) · 1.49 KB
/
ReductionOperation.h
File metadata and controls
39 lines (28 loc) · 1.49 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
#pragma once
#include "ComputePlatform.h"
enum class ReductionOp
{
Min = 0,
Max = 1,
Sum = 2
};
class ReductionOperation
{
public:
explicit ReductionOperation(ComputePlatform& ThePlatform);
float Reduce(cl::Buffer InputBuffer, int Count, ReductionOp Operator);
PointXYZ ReducePoints(cl::Buffer InputBuffer, int NumberOfPoints, ReductionOp Operator);
float Reduce(cl::CommandQueue Queue, cl::Buffer InputBuffer, int Count, ReductionOp Operator);
PointXYZ ReducePoints(cl::CommandQueue Queue, cl::Buffer InputBuffer, int NumberOfPoints, ReductionOp Operator);
double ReduceDouble(cl::CommandQueue Queue, cl::Buffer InputBuffer, int Count, ReductionOp Operator);
private:
float ReduceCPUKernel(cl::CommandQueue Queue, cl::Buffer InputBuffer, int Count, ReductionOp Operation);
float ReduceGPUKernel(cl::CommandQueue Queue, cl::Buffer InputBuffer, int Count, ReductionOp Operation);
PointXYZ ReducePointsCPUKernel(cl::CommandQueue Queue, cl::Buffer InputBuffer, int NumberOfPoints, ReductionOp Operation);
PointXYZ ReducePointsGPUKernel(cl::CommandQueue Queue, cl::Buffer InputBuffer, int NumberOfPoints, ReductionOp Operation);
double ReduceCPUDoubleKernel(cl::CommandQueue Queue, cl::Buffer InputBuffer, int Count, ReductionOp Operation);
double ReduceGPUDoubleKernel(cl::CommandQueue Queue, cl::Buffer InputBuffer, int Count, ReductionOp Operation);
ComputePlatform& ThePlatform;
cl::Program ReductionProgram;
std::map<cl::Device, cl::Buffer> ResultBuffers;
};