libfaster API Documentation
Development Version
Super fast distributted computing
fexample-int-file.cpp
1
#include <iostream>
2
#include "libfaster.h"
3
4
#define NUMITEMS 100*1000
5
6
using namespace
std
;
7
using namespace
faster
;
8
9
int
map1(
int
& a){
10
return
a / 2;
11
}
12
13
14
int
reduce1(
int
&a,
int
&b){
15
return
a + b;
16
}
17
18
19
int
main(
int
argc,
char
** argv){
20
// Init Faster Framework
21
cout <<
"Init FastLib"
<<
'\n'
;
22
fastContext
fc(argc,argv);
23
fc.
registerFunction
((
void
*) &map1);
24
fc.
registerFunction
((
void
*) &reduce1);
25
26
fc.
startWorkers
();
27
if
(!fc.
isDriver
())
28
return
0;
29
30
cout <<
"Import Data"
<<
'\n'
;
31
fdd<int>
data(fc,
"../res/testM.txt"
);
32
33
cout <<
"Process Data"
<<
'\n'
;
34
int
result = data.map<
int
>(&map1)->reduce(&reduce1);
35
36
cout <<
"DONE!"
<<
'\n'
;
37
std::cout << result <<
"\n"
;
38
39
return
0;
40
}
faster::fastContext::startWorkers
void startWorkers()
Start worker machines computation.
Definition:
fastContext.cpp:58
std
STL namespace.
faster::fastContext::registerFunction
void registerFunction(void *funcP)
Register a user custom function in the context.
Definition:
fastContext.cpp:48
faster::fastContext::isDriver
bool isDriver()
Checks for the driver process.
Definition:
fastContext.cpp:76
faster::fastContext
Framework context class.
Definition:
fastContext.h:66
faster::fdd
Fast Distributted Dataset(FDD) is like a cluster distributted Array. This class is the user side impl...
Definition:
fastContext.h:24
faster
libfaster main namespace
Definition:
_workerFdd.h:11
faster.git
src
examples
fexample-int-file.cpp
Generated on Tue Nov 22 2016 19:01:07 for libfaster API Documentation by
1.8.12