WorkunitExecutor.h
1 
11 #ifndef WRENCH_WORKUNITMULTICOREEXECUTOR_H
12 #define WRENCH_WORKUNITMULTICOREEXECUTOR_H
13 
14 
15 #include "wrench/services/Service.h"
16 #include <set>
17 
18 namespace wrench {
19 
20  class Simulation;
21  class StorageService;
22  class WorkflowFile;
23  class WorkflowTask;
24  class StorageService;
25  class StandardJob;
26  class WorkerThreadWork;
27  class Workunit;
28  class ComputeThread;
29  class WorkflowJob;
30 
31  /***********************/
33  /***********************/
34 
38  class WorkunitExecutor : public Service {
39 
40  public:
41 
44  std::string hostname,
45  unsigned long num_cores,
46  double ram_utilization,
47  std::string callback_mailbox,
49  StorageService *scratch_space,
50  StandardJob* job,
51  double thread_startup_overhead,
52  bool simulate_computation_as_sleep);
53 
54  void kill();
55 
56  unsigned long getNumCores();
58  double getMemoryUtilization();
59  std::set<WorkflowFile*> getFilesStoredInScratch();
60 
63 
64  private:
65 
66  int main();
67 
68  void performWork(Workunit *work);
69 
70  void runMulticoreComputation(double flops, double parallel_efficiency, bool simulate_computation_as_sleep);
71 
72  std::string callback_mailbox;
73  unsigned long num_cores;
74  double ram_utilization;
75  double thread_startup_overhead;
76  bool simulate_computation_as_sleep;
77 
78  StorageService* scratch_space;
79 
80  std::set<WorkflowFile* > files_stored_in_scratch;
81  std::vector<std::shared_ptr<ComputeThread>> compute_threads;
82 
83  // a reference to the job it is a part of (currently required for creating the /tmp directory in scratch space)
84  StandardJob* job;
85 
86  };
87 
88  /***********************/
90  /***********************/
91 
92 };
93 
94 
95 #endif //WRENCH_WORKUNITEXECUTOR_H
A service that can be added to the simulation and that can be used by a WMS when executing a workflow...
Definition: Service.h:26
WorkunitExecutor(Simulation *simulation, std::string hostname, unsigned long num_cores, double ram_utilization, std::string callback_mailbox, Workunit *workunit, StorageService *scratch_space, StandardJob *job, double thread_startup_overhead, bool simulate_computation_as_sleep)
Constructor.
Definition: WorkunitExecutor.cpp:50
std::set< WorkflowFile * > getFilesStoredInScratch()
Retrieve the list of files stored in scratch space storage.
Definition: WorkunitExecutor.cpp:486
A class to describe a unit of work that&#39;s a sub-component of a StandardJob.
Definition: Workunit.h:34
std::string hostname
The name of the host on which the daemon is running.
Definition: S4U_Daemon.h:47
unsigned long getNumCores()
Returns the number of cores the service has been allocated.
Definition: WorkunitExecutor.cpp:470
Workunit * workunit
The Workunit this WorkunitExecutor is supposed to perform.
Definition: WorkunitExecutor.h:62
A standard (i.e., non-pilot) workflow job that can be submitted to a ComputeService by a WMS (via a J...
Definition: StandardJob.h:38
A class that provides basic simulation methods.
Definition: Simulation.h:34
StandardJob * getJob()
Retrieve the job the WorkunitExecutor is working for.
Definition: WorkunitExecutor.cpp:494
double getMemoryUtilization()
Returns the RAM the service has been allocated.
Definition: WorkunitExecutor.cpp:478
Simulation * simulation
a pointer to the simulation object
Definition: S4U_Daemon.h:84
void kill()
Kill the worker thread.
Definition: WorkunitExecutor.cpp:86
The storage service base class.
Definition: StorageService.h:35
An service that performs a WorkUnit.
Definition: WorkunitExecutor.h:38
Definition: TerminalOutput.cpp:15