WRENCH  1.11
Cyberinfrastructure Simulation Workbench
Overview Installation Getting Started WRENCH 101 WRENCH 102
ComputeAction.h
1 
10 #ifndef WRENCH_COMPUTEACTION_H
11 #define WRENCH_COMPUTEACTION_H
12 
13 #include <string>
14 
15 #include "wrench/action/Action.h"
16 
17 namespace wrench {
18 
19  class ComputeThread;
20  class ParallelModel;
21 
25  class ComputeAction : public Action {
26 
27  public:
28  double getFlops() const;
29  unsigned long getMinNumCores() const override;
30  unsigned long getMaxNumCores() const override;
31  double getMinRAMFootprint() const override;
32  std::shared_ptr<ParallelModel> getParallelModel() const;
33 
34  protected:
35  friend class CompoundJob;
36 
37  ComputeAction(std::string name,
38  std::shared_ptr<CompoundJob> job,
39  double flops,
40  double ram,
41  unsigned long min_core,
42  unsigned long max_core,
43  std::shared_ptr<ParallelModel> parallel_model);
44 
45  void execute(std::shared_ptr<ActionExecutor> action_executor) override;
46  void terminate(std::shared_ptr<ActionExecutor> action_executor) override;
47 
48  private:
49  double flops;
50  unsigned long min_num_cores;
51  unsigned long max_num_cores;
52  double ram;
53  std::shared_ptr<ParallelModel> parallel_model;
54 
55  void simulateComputationAsSleep(std::shared_ptr<ActionExecutor> action_executor, std::vector<double> &work_per_thread);
56  void simulateComputationWithComputeThreads(std::shared_ptr<ActionExecutor> action_executor, std::vector<double> &work_per_thread);
57 
58  std::vector<std::shared_ptr<ComputeThread>> compute_threads;
59 
60 
61  };
62 }
63 
64 
65 #endif //WRENCH_COMPUTEACTION_H
wrench::ComputeAction::getMinNumCores
unsigned long getMinNumCores() const override
Returns the action's minimum number of required cores.
Definition: ComputeAction.cpp:64
wrench::ComputeAction::getMaxNumCores
unsigned long getMaxNumCores() const override
Returns the action's maximum number of required cores.
Definition: ComputeAction.cpp:72
wrench
Definition: Action.cpp:28
wrench::ComputeAction::terminate
void terminate(std::shared_ptr< ActionExecutor > action_executor) override
Method called when the task terminates.
Definition: ComputeAction.cpp:115
wrench::ComputeAction::getMinRAMFootprint
double getMinRAMFootprint() const override
Returns the action's minimum required memory footprint.
Definition: ComputeAction.cpp:80
wrench::ComputeAction
A class that implements a compute action.
Definition: ComputeAction.h:25
wrench::ComputeAction::getFlops
double getFlops() const
Returns the action's flops.
Definition: ComputeAction.cpp:56
wrench::ComputeAction::ComputeAction
ComputeAction(std::string name, std::shared_ptr< CompoundJob > job, double flops, double ram, unsigned long min_core, unsigned long max_core, std::shared_ptr< ParallelModel > parallel_model)
Constructor.
Definition: ComputeAction.cpp:35
wrench::ComputeAction::getParallelModel
std::shared_ptr< ParallelModel > getParallelModel() const
Returns the action's parallel model.
Definition: ComputeAction.cpp:88
wrench::ComputeAction::execute
void execute(std::shared_ptr< ActionExecutor > action_executor) override
Method to execute the task.
Definition: ComputeAction.cpp:96
wrench::Action
An abstract class that implements the concept of an action.
Definition: Action.h:28
wrench::CompoundJob
A compound job.
Definition: CompoundJob.h:47