11 #ifndef WRENCH_WORKUNITMULTICOREEXECUTOR_H
12 #define WRENCH_WORKUNITMULTICOREEXECUTOR_H
15 #include "wrench/services/Service.h"
17 #include "wrench/services/compute/workunit_executor/Workunit.h"
27 class WorkerThreadWork;
31 class SimulationTimestampTaskFailure;
40 class WorkunitExecutor :
public Service {
46 unsigned long num_cores,
47 double ram_utilization,
48 std::string callback_mailbox,
49 std::shared_ptr<Workunit> workunit,
50 std::shared_ptr<StorageService> scratch_space,
51 std::shared_ptr<StandardJob> job,
52 double thread_startup_overhead,
53 bool simulate_computation_as_sleep);
55 void kill(
bool job_termination);
57 unsigned long getNumCores();
58 std::shared_ptr<StandardJob> getJob();
59 double getMemoryUtilization();
60 std::set<WorkflowFile*> getFilesStoredInScratch();
63 std::shared_ptr<Workunit> workunit;
67 bool failure_timestamp_should_be_generated =
false;
68 bool task_completion_timestamp_should_be_generated =
false;
69 bool terminated_due_job_being_forcefully_terminated =
false;
70 bool task_start_timestamp_has_been_inserted =
false;
71 bool task_failure_time_stamp_has_already_been_generated =
false;
73 SimulationTimestampTaskFailure *foo;
75 void cleanup(
bool has_returned_from_main,
int return_value)
override;
77 void performWork(Workunit *work);
79 void runMulticoreComputationForTask(WorkflowTask *task,
bool simulate_computation_as_sleep);
81 bool isUseOfScratchSpaceOK();
82 bool areFileLocationsOK(WorkflowFile **offending_file);
84 std::string callback_mailbox;
85 unsigned long num_cores;
86 double ram_utilization;
87 double thread_startup_overhead;
88 bool simulate_computation_as_sleep;
90 std::shared_ptr<StorageService> scratch_space;
92 std::set<WorkflowFile* > files_stored_in_scratch;
93 std::vector<std::shared_ptr<ComputeThread>> compute_threads;
96 std::shared_ptr<StandardJob> job;
107 #endif //WRENCH_WORKUNITEXECUTOR_H