1 /* Copyright (c) 2013-2019. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
9 #include "src/surf/HostImpl.hpp"
21 class XBT_PRIVATE HostL07Model;
22 class XBT_PRIVATE CpuL07Model;
23 class XBT_PRIVATE NetworkL07Model;
25 class XBT_PRIVATE CpuL07;
26 class XBT_PRIVATE LinkL07;
28 class XBT_PRIVATE L07Action;
36 class HostL07Model : public HostModel {
39 ~HostL07Model() override;
41 double next_occuring_event(double now) override;
42 void update_actions_state(double now, double delta) override;
43 kernel::resource::Action* execute_parallel(size_t host_nb, sg_host_t* host_list, double* flops_amount,
44 double* bytes_amount, double rate) override;
47 class CpuL07Model : public CpuModel {
49 CpuL07Model(HostL07Model* hmodel, kernel::lmm::System* sys);
52 Cpu* create_cpu(simgrid::s4u::Host* host, std::vector<double>* speed_per_pstate, int core) override;
53 HostL07Model *hostModel_;
56 class NetworkL07Model : public kernel::resource::NetworkModel {
58 NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys);
60 kernel::resource::LinkImpl* create_link(const std::string& name, double bandwidth, double latency,
61 s4u::Link::SharingPolicy policy) override;
63 kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
65 HostL07Model *hostModel_;
72 class CpuL07 : public Cpu {
74 CpuL07(CpuL07Model* model, simgrid::s4u::Host* host, std::vector<double>* speed_per_pstate, int core);
76 bool is_used() override;
77 void apply_event(tmgr_trace_event_t event, double value) override;
78 kernel::resource::Action* execution_start(double size) override;
79 simgrid::kernel::resource::Action* execution_start(double size, int requested_cores) override
84 kernel::resource::Action* sleep(double duration) override;
87 void on_speed_change() override;
90 class LinkL07 : public kernel::resource::LinkImpl {
92 LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency,
93 s4u::Link::SharingPolicy policy);
95 bool is_used() override;
96 void apply_event(tmgr_trace_event_t event, double value) override;
97 void set_bandwidth(double value) override;
98 void set_latency(double value) override;
104 class L07Action : public CpuAction {
105 friend Action *CpuL07::execution_start(double size);
106 friend Action *CpuL07::sleep(double duration);
107 friend Action* HostL07Model::execute_parallel(size_t host_nb, sg_host_t* host_list, double* flops_amount,
108 double* bytes_amount, double rate);
109 friend Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate);
112 L07Action(kernel::resource::Model* model, size_t host_nb, sg_host_t* host_list, double* flops_amount,
113 double* bytes_amount, double rate);
118 std::vector<s4u::Host*> hostList_;
119 double* computationAmount_; /* pointer to the data that lives in s4u action -- do not free unless if free_arrays */
120 double* communicationAmount_; /* pointer to the data that lives in s4u action -- do not free unless if free_arrays */
125 bool free_arrays_ = false; // By default, computationAmount_ and friends are freed by caller. But not for sequential
126 // exec and regular comms
132 #endif /* HOST_L07_HPP_ */