1 /* Copyright (c) 2013-2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
13 #include "host_interface.hpp"
25 class XBT_PRIVATE HostL07Model;
26 class XBT_PRIVATE CpuL07Model;
27 class XBT_PRIVATE NetworkL07Model;
29 class XBT_PRIVATE CpuL07;
30 class XBT_PRIVATE LinkL07;
32 class XBT_PRIVATE L07Action;
40 class HostL07Model : public HostModel {
45 double next_occuring_event(double now) override;
46 void updateActionsState(double now, double delta) override;
47 Action *executeParallelTask(int host_nb, sg_host_t *host_list,
48 double *flops_amount, double *bytes_amount,
49 double rate) override;
52 class CpuL07Model : public CpuModel {
54 CpuL07Model(HostL07Model *hmodel,lmm_system_t sys);
57 Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeakList,
58 int pstate, double speedScale,
59 tmgr_trace_t speedTrace, int core,
61 tmgr_trace_t state_trace) override;
62 HostL07Model *p_hostModel;
65 class NetworkL07Model : public NetworkModel {
67 NetworkL07Model(HostL07Model *hmodel, lmm_system_t sys);
69 Link* createLink(const char *name,
71 tmgr_trace_t bw_trace,
73 tmgr_trace_t lat_trace,
75 tmgr_trace_t state_trace,
76 e_surf_link_sharing_policy_t policy,
77 xbt_dict_t properties) override;
79 Action *communicate(NetCard *src, NetCard *dst, double size, double rate) override;
80 bool next_occuring_event_isIdempotent() override {return true;}
82 HostL07Model *p_hostModel;
89 class CpuL07 : public Cpu {
91 CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeakList, int pstate,
92 double power_scale, tmgr_trace_t power_trace,
93 int core, int initiallyOn, tmgr_trace_t state_trace);
95 bool isUsed() override;
96 void apply_event(tmgr_trace_iterator_t event, double value) override;
97 Action *execution_start(double size) override;
98 Action *sleep(double duration) override;
100 void onSpeedChange() override;
103 class LinkL07 : public Link {
105 LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props,
107 tmgr_trace_t bw_trace,
109 tmgr_trace_t lat_trace,
111 tmgr_trace_t state_trace,
112 e_surf_link_sharing_policy_t policy);
114 bool isUsed() override;
115 void apply_event(tmgr_trace_iterator_t event, double value) override;
116 void updateBandwidth(double value) override;
117 void updateLatency(double value) override;
123 class L07Action : public CpuAction {
124 friend Action *CpuL07::execution_start(double size);
125 friend Action *CpuL07::sleep(double duration);
126 friend Action *HostL07Model::executeParallelTask(int host_nb,
128 double *flops_amount,
129 double *bytes_amount,
132 L07Action(Model *model, int host_nb,
134 double *flops_amount,
135 double *bytes_amount,
141 int unref() override;
143 std::vector<NetCard*> * p_netcardList = new std::vector<NetCard*>();
144 double *p_computationAmount;
145 double *p_communicationAmount;
153 #endif /* HOST_L07_HPP_ */