Faster  0.0.4Alpha
Superfastdistributtedcomputing
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  private:
22  unsigned long int id;
23  std::vector< workerFddBase * > fddList;
24  fastComm * comm;
25  char tag;
26  bool finished;
27  char * buffer;
28  void ** funcTable;
29  std::vector< std::pair<void*, size_t> > * globalTable;
30 
31  worker(fastComm * c, void ** ft, std::vector< std::pair<void*, size_t> > & globalTable);
32  ~worker();
33 
34  void run();
35 
36  // Worker functions
37  void createFDD (unsigned long int id, fddType type, size_t size);
38  template <typename K>
39  void _createIFDD (unsigned long int id, fddType type, size_t size);
40  void createIFDD (unsigned long int id, fddType kType, fddType tType, size_t size);
41  void createFDDGroup(unsigned long int id, fddType kType, std::vector<unsigned long int> & members);
42 
43  void discardFDD(unsigned long int id);
44 
45  // 1D Data
46  void setFDDData(unsigned long int id, void * data, size_t size);
47  void setFDDIData(unsigned long int id, void * kays, void * data, size_t size);
48  // 2D Data
49  void setFDDData(unsigned long int id, void * data, size_t * lineSizes, size_t size);
50  void setFDDIData(unsigned long int id, void * kays, void * data, size_t * lineSizes, size_t size);
51 
52  //void getFDDData(unsigned long int id, void *& data, size_t &size);
53 
54  void setFDDOwnership(unsigned long int id, size_t low, size_t up);
55 
56  void readFDDFile(unsigned long int id, std::string &filename, size_t size, size_t offset);
57 
58  void updateGlobals(fastTask &task);
59  void solve(fastTask & task);
60 
61  void collect(unsigned long int id);
62 
63  void calibrate();
64  };
65 }
66 #endif
Definition: fastComm.h:116
Definition: fastContext.h:54
Definition: _workerFdd.h:11
Definition: fastTask.h:11
Definition: worker.h:19