-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcpuGroupby.h
74 lines (59 loc) · 1.76 KB
/
cpuGroupby.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
//
// cpuGroupby.h
// RAPIDS
//
// Created by Aaron on 11/27/18.
// Copyright © 2018 Aaron Nightingale. All rights reserved.
//
#ifndef cpuGroupby_h
#define cpuGroupby_h
#include <iostream>
enum reductionType {rmin, rmax, rmean, rcount, rsum};
class cpuGroupby {
public:
// Custom Structures
//Variables
int num_ops;
int* output_keys;
int* output_values;
reductionType* ops;
// ARBITRARY VERSION
int* key_columns;
int* value_columns;
int num_key_columns;
int num_value_columns;
int num_key_rows;
int num_value_rows; //always the same as above...
// Aaron's custom data types
int numGroups;
int* tempCol; //Used for temporary storage of groupPtrs
int* groupPtr; //array of indicies of start of each group
// Functions
void fillRand(int distinctKeys, int distinctVals);
void libsort(); //use std::sort
void groupby();
void getNumGroups();
void doReductionOps();
// Reduction Functions
// To do: add sum function
void rMax(int valIdx);
void rMean(int valIdx);
void rCount(int valIdx);
void rMin(int valIdx);
void rSum(int valIdx);
void printResults();
void allocResultArray();
// ARBITRARY FUNCTIONS
void printData();
bool nextKeyBigger(int cRow);
void swapAtRow(int cRow);
void getGroupPtr();
void writeOutputKeys();
void printGPUResults(int* GPU_output_keys, int* GPU_output_values);
//Constructor / destructor functions
cpuGroupby(int numKeys, int numValues, int numRows);
~cpuGroupby(); // To do - make sure arrays are freed
// GPU Validation
bool validGPUResult(int* GPUKeys, int* GPUValues, int GPUOutputRows, bool isSorted=true);
};
#endif /* cpuGroupby_hpp */