libfaster API Documentation  Development Version
Super fast distributted computing
workerFdd.h
1 #ifndef LIBFASTER_WORKERFDD_H
2 #define LIBFASTER_WORKERFDD_H
3 
4 #include <list>
5 #include <omp.h>
6 #include <unordered_map>
7 
8 #include "workerFddBase.h"
9 
10 namespace faster {
11  template <class T>
12  class fddStorage;
13 
14  template <class T>
15  class workerFddCore;
16 
17  template <class T>
18  class _workerFdd;
19 
20  template <class K, class T>
21  class workerIFdd;
22 
23 
24  // Interface for dynamic loading that wraps C-style language
25  //template <class T>
26  class workerFdd : public workerFddBase{
27  private:
28  workerFddBase * _fdd;
29 
30  static std::unordered_map<fddType, int> hAssign;
31  static std::unordered_map<fddType, int> khAssign;
32  static void * dLHandler[3][7];
33  static std::unordered_map<char, void *> funcTable[3][7];
34 
35  void * load(const std::string);
36  void loadSym(dFuncName funcName, const std::string symbolName);
37 
38  void loadLib();
39  void loadLibI();
40  void loadSymbols();
41  public:
42  workerFdd(fddType t);
43  workerFdd(fddType kt, fddType t);
44  workerFdd(unsigned long int ident, fddType t);
45  workerFdd(unsigned long int ident, fddType t, size_t size);
46  workerFdd(unsigned long int ident, fddType kt, fddType t);
47  workerFdd(unsigned long int ident, fddType kt, fddType t, size_t size);
48  ~workerFdd();
49 
50  fddType getType();
51  fddType getKeyType();
52 
53  //T & operator[](size_t address);
54  void * getItem(size_t address);
55  void * getKeys();
56  void * getData();
57  size_t getSize();
58  size_t itemSize();
59  size_t baseSize();
60  void setSize(size_t s);
61 
62  void deleteItem(void * item);
63  void shrink();
64 
65  // For known types
66  void setData(void * d , size_t size );
67  void setData(void * d , size_t * lineSizes , size_t size );
68  void setData(void * k , void * d , size_t size );
69  void setData(void * k , void * d , size_t *lineSizes , size_t size );
70 
71  // For anonymous types
72  void setDataRaw(void * data, size_t size) override;
73  void setDataRaw(void * data, size_t *lineSizes, size_t size);
74  void setDataRaw( void *k, void *d, size_t s);
75  void setDataRaw( void *k, void *d, size_t *l, size_t s);
76 
77  size_t * getLineSizes();
78 
79  void insert(void * k, void * in, size_t s);
80  void insertl(void * in);
81 
82  //void insert(T & in);
83  //void insert(T & in, size_t s);
84  //void insert(std::deque<T> & in);
85  //void insert(std::deque< std::pair<T, size_t> > & in);
86 
87  // Apply task functions to FDDs
88  void apply(void * func UNUSED, fddOpType op UNUSED, workerFddBase * dest UNUSED, fastCommBuffer & comm UNUSED){}
89  void preapply(unsigned long int id, void * func, fddOpType op, workerFddBase * dest, fastComm * comm) override;
90 
91  void collect(fastComm * comm) override;
92 
93  void groupByKey(fastComm *comm);
94  void countByKey(fastComm *comm);
95  void exchangeDataByKey(fastComm *comm);
96  std::vector< std::vector<void*> > * getKeyLocations() ;
97  void * getUKeys();
98  void setUKeys(void * uk);
99  void * getKeyMap();
100  void setKeyMap(void * km);
101 
102  void writeToFile(void * path, size_t procId, void * sufix);
103  };
104 
105 }
106 
107 #endif
unsigned int fddOpType
Dataset operation type.
Definition: definitions.h:41
libfaster main namespace
Definition: _workerFdd.h:11
unsigned int fddType
Dataset type.
Definition: definitions.h:16