5 #define NUMITEMS 10*1000 11 vector<int> map1(vector<int> & input){
12 vector<int> output(input.size());
15 for (
size_t i = 0; i < input.size(); ++i ){
16 output[i] = input[i] / 2;
24 vector<int> reduce1(vector<int> & a, vector<int> & b){
25 size_t oSize = max(a.size(), b.size());
26 vector<int> out(oSize);
28 for (
size_t i = 0; i < oSize; ++i ){
45 int main(
int argc,
char ** argv){
47 cout <<
"Init FastLib" <<
'\n';
57 cout <<
"Generate Data" <<
'\n';
58 vector<int> rawdata[NUMITEMS];
61 for (
size_t i = 0; i < NUMITEMS; ++i ){
64 size_t dataSize = (rand() % 10) + 1;
66 rawdata[i].assign(dataSize, 2);
69 cout <<
"Import Data" <<
'\n';
72 cout <<
"Process Data" <<
'\n';
73 vector<int> result = data.map<vector<int>>(&map1)->reduce(&reduce1);
75 cout <<
"DONE!" <<
'\n';
77 for (
size_t i = 0; i < result.size(); ++i){
78 cout << result[i] <<
' ';
void startWorkers()
Start worker machines computation.
void registerFunction(void *funcP)
Register a user custom function in the context.
bool isDriver()
Checks for the driver process.
Fast Distributted Dataset(FDD) is like a cluster distributted Array. This class is the user side impl...