SkePU(integratedwithStarPU)  0.8.1
 All Classes Namespaces Files Functions Enumerations Friends Macros Groups Pages
task.h
Go to the documentation of this file.
1 
5 #ifndef TASK_H
6 #define TASK_H
7 
8 #include "src/environment.h"
9 #include <vector>
10 
11 namespace skepu
12 {
13 
14 
31 class Task
32 {
33  public:
34  // return tag id
35  virtual void run_async() = 0;
36 
37  // default implementation given, if not overridden
38  virtual void wait_for_completion(unsigned int tagId)
39  {
40  starpu_tag_wait(tagId);
41  }
42 
43  // default implementation for those Tasks that dont return a value.
44  virtual void *get_result()
45  {
46  return 0;
47  }
48 
49 };
50 
51 
52 // Macros as they can yield better performance than functions, if not inlined.
53 
54 #define getIsFormCall() Environment<int>::getInstance()->m_isFarmCall
55 
56 #define setIsFormCall(arg) Environment<int>::getInstance()->m_isFarmCall = arg
57 
58 #define getUseTagId() Environment<int>::getInstance()->m_useTagIds
59 
60 #define setUseTagId(arg) Environment<int>::getInstance()->m_useTagIds = arg
61 
62 #define setFarmNoWait(arg) Environment<int>::getInstance()->m_useTagIds = arg
63 
64 // to reset TagIds, for each new farm invocation or if you want to reset it after some time.
65 #define resetTagIds() Environment<int>::getInstance()->m_tagIds.clear()
66 
67 // to return TagIds vector
68 #define getTagIds() Environment<int>::getInstance()->m_tagIds
69 
70 }
71 
72 #endif
73 
A class representing a Task for the farm skeleton.
Definition: task.h:31
Contains a class declaration for Environment class.