libfaster API Documentation  Development Version
Super fast distributted computing
worker.h
1 #ifndef LIBFASTER_WORKER_H
2 #define LIBFASTER_WORKER_H
3 
4 #include <vector>
5 #include <string>
6 
7 #include "workerFddBase.h"
8 #include "fastTask.h"
9 
10 namespace faster{
11 
12  class worker;
13  class fastContext;
14  class fastComm;
15 
16 
17  // Worker class
18  // Responsible for receiving and executing tasks and createing workerFDDs .
19  class worker{
20  friend class fastContext;
21  // TODO Fix this!!! not every function should be private !
22  private:
23  unsigned long int id;
24  std::vector< workerFddBase * > fddList;
25  fastComm * comm;
26  char tag;
27  bool finished;
28  char * buffer;
29  void ** funcTable;
30  std::vector< std::tuple<void*, size_t, int> > * globalTable;
31 
32  worker(fastComm * c, void ** ft, std::vector< std::tuple<void*, size_t, int> > & globalTable);
33  ~worker();
34 
35  void run();
36 
37  // Worker functions
38  void createFDD (unsigned long int id, fddType type, size_t size);
39  template <typename K>
40  void _createIFDD (unsigned long int id, fddType type, size_t size);
41  void createIFDD (unsigned long int id, fddType kType, fddType tType, size_t size);
42  void createFDDGroup(unsigned long int id, fddType kType, std::vector<unsigned long int> & members);
43 
44  void discardFDD(unsigned long int id);
45 
46  // 1D Data
47  void setFDDData(unsigned long int id, void * data, size_t size);
48  void setFDDIData(unsigned long int id, void * kays, void * data, size_t size);
49  // 2D Data
50  void setFDDData(unsigned long int id, void * data, size_t * lineSizes, size_t size);
51  void setFDDIData(unsigned long int id, void * kays, void * data, size_t * lineSizes, size_t size);
52 
53  //void getFDDData(unsigned long int id, void *& data, size_t &size);
54 
55  void setFDDOwnership(unsigned long int id, size_t low, size_t up);
56 
57  void readFDDFile(unsigned long int id, std::string &filename, size_t size, size_t offset);
58  void writeFDDFile(unsigned long int id, std::string &path, std::string &sufix);
59 
60  void updateGlobals(fastTask &task);
61  void solve(fastTask & task);
62 
63  void collect(unsigned long int id);
64 
65  void calibrate();
66  };
67 }
68 #endif
Framework context class.
Definition: fastContext.h:66
libfaster main namespace
Definition: _workerFdd.h:11
unsigned int fddType
Dataset type.
Definition: definitions.h:16