surf_cpu_model_pm = new CpuPlopModel();
- simgrid::surf::on_postparse.connect(cpu_add_traces);
+ simgrid::kernel::resource::on_postparse.connect(cpu_add_traces);
xbt_dynar_push(model_list, &surf_cpu_model_pm);
}
~~~
void Host::setProperty(const char*key, const char *value){
simgrid::simix::kernelImmediate([&] {
- simgrid::surf::HostImpl* surf_host = this->extension<simgrid::surf::HostImpl>();
- surf_host->setProperty(key,value);
+ simgrid::kernel::resource::HostImpl* host =
+ this->extension<simgrid::kernel::resource::HostImpl>();
+ host->setProperty(key,value);
});
}
~~~
@code{cpp}
xbt_dict_t Host::properties() {
return simgrid::simix::kernelImmediate([&] {
- simgrid::surf::HostImpl* surf_host =
- this->extension<simgrid::surf::HostImpl>();
- return surf_host->getProperties();
+ simgrid::kernel::resource::HostImpl* host =
+ this->extension<simgrid::kernel::resource::HostImpl>();
+ return host->getProperties();
});
}
@endcode
class Model;
class Resource;
class CpuModel;
+class HostImpl;
+class HostModel;
class NetworkModel;
class NetworkModelIntf;
class LinkImpl;
class Profile;
} // namespace profile
} // namespace kernel
-namespace surf {
- class HostImpl;
- class HostModel;
-}
namespace mc {
class CommunicationDeterminismChecker;
}
/** @brief Retrieves the disk model associated to this NetZone */
const std::shared_ptr<resource::DiskModel>& get_disk_model() const { return disk_model_; }
/** @brief Retrieves the host model associated to this NetZone */
- const std::shared_ptr<surf::HostModel>& get_host_model() const { return host_model_; }
+ const std::shared_ptr<resource::HostModel>& get_host_model() const { return host_model_; }
const s4u::NetZone* get_iface() const { return &piface_; }
s4u::NetZone* get_iface() { return &piface_; }
void set_cpu_vm_model(std::shared_ptr<resource::CpuModel> cpu_model);
void set_cpu_pm_model(std::shared_ptr<resource::CpuModel> cpu_model);
void set_disk_model(std::shared_ptr<resource::DiskModel> disk_model);
- void set_host_model(std::shared_ptr<surf::HostModel> host_model);
+ void set_host_model(std::shared_ptr<resource::HostModel> host_model);
/** @brief get the route between two nodes in the full platform
*
std::shared_ptr<resource::CpuModel> cpu_model_vm_;
std::shared_ptr<resource::CpuModel> cpu_model_pm_;
std::shared_ptr<resource::DiskModel> disk_model_;
- std::shared_ptr<surf::HostModel> host_model_;
+ std::shared_ptr<resource::HostModel> host_model_;
/** @brief Perform sealing procedure for derived classes, if necessary */
virtual void do_seal()
{ /* obviously nothing to do by default */
protected:
#ifndef DOXYGEN
- friend surf::HostImpl;
friend Host;
friend Link;
friend Disk;
friend kernel::routing::NetPoint;
friend kernel::routing::NetZoneImpl;
+ friend kernel::resource::HostImpl;
friend kernel::resource::LinkImpl;
void host_register(const std::string& name, Host* host);
void host_unregister(const std::string& name);
friend kernel::resource::VMModel; // Use the pimpl_cpu to compute the VM sharing
friend kernel::resource::VirtualMachineImpl; // creates the the pimpl_cpu
friend kernel::routing::NetZoneImpl;
- friend surf::HostImpl; // call destructor from private implementation
+ friend kernel::resource::HostImpl; // call destructor from private implementation
// The private implementation, that never changes
- surf::HostImpl* const pimpl_;
+ kernel::resource::HostImpl* const pimpl_;
kernel::resource::CpuImpl* pimpl_cpu_ = nullptr;
kernel::routing::NetPoint* pimpl_netpoint_ = nullptr;
public:
- explicit Host(surf::HostImpl* pimpl) : pimpl_(pimpl) {}
+ explicit Host(kernel::resource::HostImpl* pimpl) : pimpl_(pimpl) {}
protected:
virtual ~Host(); // Call destroy() instead of manually deleting it.
/** Block the calling actor on an execution located on the called host (with explicit priority) */
void execute(double flops, double priority) const;
- surf::HostImpl* get_impl() const { return pimpl_; }
+ kernel::resource::HostImpl* get_impl() const { return pimpl_; }
};
} // namespace s4u
} // namespace simgrid
static ActorImpl* self();
double get_kill_time() const;
void set_kill_time(double kill_time);
- boost::intrusive::list_member_hook<> host_actor_list_hook; /* simgrid::surf::HostImpl::actor_list_ */
+ boost::intrusive::list_member_hook<> host_actor_list_hook; /* resource::HostImpl::actor_list_ */
boost::intrusive::list_member_hook<> kernel_destroy_list_hook; /* EngineImpl actors_to_destroy */
boost::intrusive::list_member_hook<> smx_synchro_hook; /* {mutex,cond,sem}->sleeping */
* Resource *
************/
-class XBT_PUBLIC VirtualMachineImpl : public surf::HostImpl, public xbt::Extendable<VirtualMachineImpl> {
+class XBT_PUBLIC VirtualMachineImpl : public HostImpl, public xbt::Extendable<VirtualMachineImpl> {
#ifndef DOXYGEN
friend s4u::VirtualMachine;
#endif
* @brief SURF VM model interface class
* @details A model is an object which handle the interactions between its Resources and its Actions
*/
-class XBT_PRIVATE VMModel : public surf::HostModel {
+class XBT_PRIVATE VMModel : public HostModel {
public:
explicit VMModel(const std::string& name);
xbt_assert(cpu_model_pm_,
"Impossible to create host: %s. Invalid CPU model: nullptr. Have you set the parent of this NetZone: %s?",
name.c_str(), get_cname());
- auto* res = (new surf::HostImpl(name))->get_iface();
+ auto* res = (new resource::HostImpl(name))->get_iface();
res->set_netpoint((new NetPoint(name, NetPoint::Type::Host))->set_englobing_zone(this));
cpu_model_pm_->create_cpu(res, speed_per_pstate);
disk_model_ = std::move(disk_model);
}
-void NetZoneImpl::set_host_model(std::shared_ptr<surf::HostModel> host_model)
+void NetZoneImpl::set_host_model(std::shared_ptr<resource::HostModel> host_model)
{
xbt_assert(not sealed_, "Impossible to set host model to an already sealed NetZone(%s)", this->get_cname());
host_model_ = std::move(host_model);
*************/
namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
/*********
* Model *
for (auto const& actor : actor_list_)
msg += "\n\t" + std::string(actor.get_name());
- kernel::EngineImpl::get_instance()->display_all_actor_status();
+ EngineImpl::get_instance()->display_all_actor_status();
xbt_die("%s", msg.c_str());
}
for (auto const& arg : actors_at_boot_)
{
for (auto const& arg : actors_at_boot_) {
XBT_DEBUG("Booting Actor %s(%s) right now", arg->name.c_str(), arg->host->get_cname());
- simgrid::kernel::actor::ActorImplPtr actor =
- simgrid::kernel::actor::ActorImpl::create(arg->name, arg->code, nullptr, arg->host, nullptr);
+ actor::ActorImplPtr actor = actor::ActorImpl::create(arg->name, arg->code, nullptr, arg->host, nullptr);
actor->set_properties(arg->properties);
if (arg->on_exit)
*actor->on_exit = *arg->on_exit;
}
/** Kill all actors hosted here */
-void HostImpl::turn_off(const kernel::actor::ActorImpl* issuer)
+void HostImpl::turn_off(const actor::ActorImpl* issuer)
{
for (auto& actor : actor_list_) {
XBT_DEBUG("Killing Actor %s@%s on behalf of %s which turned off that host.", actor.get_cname(),
}
// When a host is turned off, we want to keep only the actors that should restart for when it will boot again.
// Then get rid of the others.
- auto elm = remove_if(begin(actors_at_boot_), end(actors_at_boot_), [](const kernel::actor::ProcessArg* arg) {
+ auto elm = remove_if(begin(actors_at_boot_), end(actors_at_boot_), [](const actor::ProcessArg* arg) {
if (arg->auto_restart)
return false;
delete arg;
for (auto const& disk : disks_)
disk.second->seal();
}
-} // namespace surf
+} // namespace resource
+} // namespace kernel
} // namespace simgrid
#include <vector>
namespace simgrid {
-namespace surf {
-
+namespace kernel {
+namespace resource {
/*********
* Model *
*********/
* @brief SURF Host model interface class
* @details A model is an object which handle the interactions between its Resources and its Actions
*/
-class XBT_PRIVATE HostModel : public kernel::resource::Model {
+class XBT_PRIVATE HostModel : public Model {
public:
using Model::Model;
- virtual kernel::resource::Action* execute_parallel(const std::vector<s4u::Host*>& host_list,
- const double* flops_amount, const double* bytes_amount,
- double rate) = 0;
+ virtual Action* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+ const double* bytes_amount, double rate) = 0;
};
/************
* @details A host represents a machine with an aggregation of a Cpu, a RoutingEdge and Disk(s)
*/
class XBT_PRIVATE HostImpl : public xbt::PropertyHolder {
- using ActorList = boost::intrusive::list<
- kernel::actor::ActorImpl,
- boost::intrusive::member_hook<kernel::actor::ActorImpl, boost::intrusive::list_member_hook<>,
- &kernel::actor::ActorImpl::host_actor_list_hook>>;
+ using ActorList =
+ boost::intrusive::list<actor::ActorImpl,
+ boost::intrusive::member_hook<actor::ActorImpl, boost::intrusive::list_member_hook<>,
+ &actor::ActorImpl::host_actor_list_hook>>;
ActorList actor_list_;
- std::vector<kernel::actor::ProcessArg*> actors_at_boot_;
+ std::vector<actor::ProcessArg*> actors_at_boot_;
s4u::Host piface_;
- std::map<std::string, kernel::resource::DiskImpl*, std::less<>> disks_;
+ std::map<std::string, DiskImpl*, std::less<>> disks_;
xbt::string name_{"noname"};
bool sealed_ = false;
HostImpl(const std::string& name, s4u::Host* piface);
public:
- friend kernel::resource::VirtualMachineImpl;
+ friend VirtualMachineImpl;
explicit HostImpl(const std::string& name);
void destroy(); // Must be called instead of the destructor
const char* get_cname() const { return name_.c_str(); }
void turn_on() const;
- void turn_off(const kernel::actor::ActorImpl* issuer);
+ void turn_off(const actor::ActorImpl* issuer);
std::vector<s4u::ActorPtr> get_all_actors();
size_t get_actor_count() const;
- void add_actor(kernel::actor::ActorImpl* actor) { actor_list_.push_back(*actor); }
- void remove_actor(kernel::actor::ActorImpl* actor) { xbt::intrusive_erase(actor_list_, *actor); }
- void add_actor_at_boot(kernel::actor::ProcessArg* arg) { actors_at_boot_.emplace_back(arg); }
+ void add_actor(actor::ActorImpl* actor) { actor_list_.push_back(*actor); }
+ void remove_actor(actor::ActorImpl* actor) { xbt::intrusive_erase(actor_list_, *actor); }
+ void add_actor_at_boot(actor::ProcessArg* arg) { actors_at_boot_.emplace_back(arg); }
void seal();
function(actor);
}
};
-} // namespace surf
+} // namespace resource
+} // namespace kernel
} // namespace simgrid
-#endif /* SURF_HOST_INTERFACE_HPP */
+#endif /* HOST_INTERFACE_HPP */
************/
/** @ingroup SURF_network_interface
* @brief SURF network link interface class
- * @details A Link represents the link between two [hosts](@ref simgrid::surf::HostImpl)
+ * @details A Link represents the link between two [hosts](@ref simgrid::kernel::resource::HostImpl)
*/
class LinkImpl : public LinkImplIntf {
s4u::Link piface_;
************/
/** @ingroup SURF_interface
* @brief SURF network link interface class
- * @details A Link represents the link between two [hosts](@ref simgrid::surf::HostImpl)
+ * @details A Link represents the link between two [hosts](@ref HostImpl)
*/
class LinkImplIntf : public Resource_T<LinkImplIntf>, public xbt::PropertyHolder {
public:
************/
/** @ingroup SURF_network_interface
* @brief SURF network link interface class
- * @details A Link represents the link between two [hosts](@ref simgrid::surf::HostImpl)
+ * @details A Link represents the link between two [hosts](@ref HostImpl)
*/
class SplitDuplexLinkImpl : public LinkImplIntf {
s4u::SplitDuplexLink piface_;
void surf_host_model_init_current_default()
{
simgrid::config::set_default<bool>("network/crosstraffic", true);
- auto host_model = std::make_shared<simgrid::surf::HostCLM03Model>("Host_CLM03");
+ auto host_model = std::make_shared<simgrid::kernel::resource::HostCLM03Model>("Host_CLM03");
auto* engine = simgrid::kernel::EngineImpl::get_instance();
engine->add_model(host_model);
engine->get_netzone_root()->set_host_model(host_model);
void surf_host_model_init_compound()
{
- auto host_model = std::make_shared<simgrid::surf::HostCLM03Model>("Host_CLM03");
+ auto host_model = std::make_shared<simgrid::kernel::resource::HostCLM03Model>("Host_CLM03");
auto* engine = simgrid::kernel::EngineImpl::get_instance();
engine->add_model(host_model);
engine->get_netzone_root()->set_host_model(host_model);
}
namespace simgrid {
-namespace surf {
-double HostCLM03Model::next_occurring_event(double now)
+namespace kernel {
+namespace resource {
+
+double HostCLM03Model::next_occurring_event(double /*now*/)
{
/* nothing specific to be done here
* surf_solve already calls all the models next_occurring_event properly */
return -1.0;
}
-kernel::resource::Action* HostCLM03Model::execute_parallel(const std::vector<s4u::Host*>& host_list,
- const double* flops_amount, const double* bytes_amount,
- double rate)
+Action* HostCLM03Model::execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+ const double* bytes_amount, double rate)
{
- kernel::resource::Action* action = nullptr;
+ Action* action = nullptr;
auto net_model = host_list[0]->get_netpoint()->get_englobing_zone()->get_network_model();
if ((host_list.size() == 1) && (has_cost(bytes_amount, 0) <= 0) && (has_cost(flops_amount, 0) > 0)) {
action = host_list[0]->get_cpu()->execution_start(flops_amount[0], rate);
return action;
}
-} // namespace surf
+} // namespace resource
+} // namespace kernel
} // namespace simgrid
#include "src/surf/HostImpl.hpp"
-#ifndef SURF_HOST_CLM03_HPP_
-#define SURF_HOST_CLM03_HPP_
+#ifndef HOST_CLM03_HPP_
+#define HOST_CLM03_HPP_
/***********
* Classes *
***********/
namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
class XBT_PRIVATE HostCLM03Model : public HostModel {
public:
using HostModel::HostModel;
double next_occurring_event(double now) override;
void update_actions_state(double now, double delta) override;
- kernel::resource::Action* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
- const double* bytes_amount, double rate) override;
+ Action* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+ const double* bytes_amount, double rate) override;
};
-}
-}
+} // namespace resource
+} // namespace kernel
+} // namespace simgrid
-#endif /* SURF_HOST_CLM03_HPP_ */
+#endif /* HOST_CLM03_HPP_ */
**********/
/** @ingroup SURF_network_interface
* @brief SURF network action interface class
- * @details A NetworkAction represents a communication between two [hosts](@ref simgrid::surf::HostImpl)
+ * @details A NetworkAction represents a communication between two [hosts](@ref HostImpl)
*/
class NetworkAction : public Action {
s4u::Host& src_;
{
XBT_CINFO(xbt_cfg, "Switching to the L07 model to handle parallel tasks.");
- auto host_model = std::make_shared<simgrid::surf::HostL07Model>("Host_Ptask");
+ auto host_model = std::make_shared<simgrid::kernel::resource::HostL07Model>("Host_Ptask");
auto* engine = simgrid::kernel::EngineImpl::get_instance();
engine->add_model(host_model);
engine->get_netzone_root()->set_host_model(host_model);
}
namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
HostL07Model::HostL07Model(const std::string& name) : HostModel(name)
{
- auto* maxmin_system = new simgrid::kernel::lmm::FairBottleneck(true /* selective update */);
+ auto* maxmin_system = new lmm::FairBottleneck(true /* selective update */);
set_maxmin_system(maxmin_system);
auto net_model = std::make_shared<NetworkL07Model>("Network_Ptask", this, maxmin_system);
- auto engine = simgrid::kernel::EngineImpl::get_instance();
+ auto engine = EngineImpl::get_instance();
engine->add_model(net_model);
engine->get_netzone_root()->set_network_model(net_model);
engine->get_netzone_root()->set_cpu_pm_model(cpu_model);
}
-CpuL07Model::CpuL07Model(const std::string& name, HostL07Model* hmodel, kernel::lmm::System* sys)
+CpuL07Model::CpuL07Model(const std::string& name, HostL07Model* hmodel, lmm::System* sys)
: CpuModel(name), hostModel_(hmodel)
{
set_maxmin_system(sys);
set_maxmin_system(nullptr);
}
-NetworkL07Model::NetworkL07Model(const std::string& name, HostL07Model* hmodel, kernel::lmm::System* sys)
+NetworkL07Model::NetworkL07Model(const std::string& name, HostL07Model* hmodel, lmm::System* sys)
: NetworkModel(name), hostModel_(hmodel)
{
set_maxmin_system(sys);
double HostL07Model::next_occurring_event(double now)
{
double min = HostModel::next_occurring_event_full(now);
- for (kernel::resource::Action const& action : *get_started_action_set()) {
+ for (Action const& action : *get_started_action_set()) {
const auto& net_action = static_cast<const L07Action&>(action);
if (net_action.get_latency() > 0 && (min < 0 || net_action.get_latency() < min)) {
min = net_action.get_latency();
if (((action.get_remains() <= 0) && (action.get_variable()->get_penalty() > 0)) ||
((action.get_max_duration() != NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
- action.finish(kernel::resource::Action::State::FINISHED);
+ action.finish(Action::State::FINISHED);
continue;
}
/* Need to check that none of the model has failed */
int i = 0;
- const kernel::lmm::Constraint* cnst = action.get_variable()->get_constraint(i);
+ const lmm::Constraint* cnst = action.get_variable()->get_constraint(i);
while (cnst != nullptr) {
i++;
- const kernel::resource::Resource* constraint_id = cnst->get_id();
+ const Resource* constraint_id = cnst->get_id();
if (not constraint_id->is_on()) {
XBT_DEBUG("Action (%p) Failed!!", &action);
- action.finish(kernel::resource::Action::State::FAILED);
+ action.finish(Action::State::FAILED);
break;
}
cnst = action.get_variable()->get_constraint(i);
}
}
-kernel::resource::CpuAction* HostL07Model::execute_parallel(const std::vector<s4u::Host*>& host_list,
- const double* flops_amount, const double* bytes_amount,
- double rate)
+CpuAction* HostL07Model::execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+ const double* bytes_amount, double rate)
{
return new L07Action(this, host_list, flops_amount, bytes_amount, rate);
}
-L07Action::L07Action(kernel::resource::Model* model, const std::vector<s4u::Host*>& host_list,
- const double* flops_amount, const double* bytes_amount, double rate)
+L07Action::L07Action(Model* model, const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+ const double* bytes_amount, double rate)
: CpuAction(model, 1.0, false), computationAmount_(flops_amount), communicationAmount_(bytes_amount), rate_(rate)
{
size_t link_nb = 0;
continue;
double lat = 0.0;
- std::vector<kernel::resource::LinkImpl*> route;
+ std::vector<LinkImpl*> route;
hostList_[k / host_list.size()]->route_to(hostList_[k % host_list.size()], route, &lat);
latency = std::max(latency, lat);
for (size_t k = 0; k < host_list.size() * host_list.size(); k++) {
if (bytes_amount[k] <= 0.0)
continue;
- std::vector<kernel::resource::LinkImpl*> route;
+ std::vector<LinkImpl*> route;
hostList_[k / host_list.size()]->route_to(hostList_[k % host_list.size()], route, nullptr);
for (auto const& link : route)
}
}
-kernel::resource::Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
+Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
{
std::vector<s4u::Host*> host_list = {src, dst};
const auto* flops_amount = new double[2]();
bytes_amount[1] = size;
- kernel::resource::Action* res = hostModel_->execute_parallel(host_list, flops_amount, bytes_amount, rate);
+ Action* res = hostModel_->execute_parallel(host_list, flops_amount, bytes_amount, rate);
static_cast<L07Action*>(res)->free_arrays_ = true;
return res;
}
-kernel::resource::CpuImpl* CpuL07Model::create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate)
+CpuImpl* CpuL07Model::create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate)
{
return (new CpuL07(host, speed_per_pstate))->set_model(this);
}
-kernel::resource::LinkImpl* NetworkL07Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
+LinkImpl* NetworkL07Model::create_link(const std::string& name, const std::vector<double>& bandwidths)
{
xbt_assert(bandwidths.size() == 1, "Non WIFI link must have only 1 bandwidth.");
auto link = new LinkL07(name, bandwidths[0], get_maxmin_system());
return link;
}
-kernel::resource::LinkImpl* NetworkL07Model::create_wifi_link(const std::string& name,
- const std::vector<double>& bandwidths)
+LinkImpl* NetworkL07Model::create_wifi_link(const std::string& name, const std::vector<double>& bandwidths)
{
THROW_UNIMPLEMENTED;
}
* Resource *
************/
-kernel::resource::CpuAction* CpuL07::execution_start(double size, double user_bound)
+CpuAction* CpuL07::execution_start(double size, double user_bound)
{
std::vector<s4u::Host*> host_list = {get_iface()};
xbt_assert(user_bound <= 0, "User bound not supported by ptask model");
auto* flops_amount = new double[host_list.size()]();
flops_amount[0] = size;
- kernel::resource::CpuAction* res =
+ CpuAction* res =
static_cast<CpuL07Model*>(get_model())->hostModel_->execute_parallel(host_list, flops_amount, nullptr, -1);
static_cast<L07Action*>(res)->free_arrays_ = true;
return res;
}
-kernel::resource::CpuAction* CpuL07::sleep(double duration)
+CpuAction* CpuL07::sleep(double duration)
{
auto* action = static_cast<L07Action*>(execution_start(1.0, -1));
action->set_max_duration(duration);
- action->set_suspend_state(kernel::resource::Action::SuspendStates::SLEEPING);
+ action->set_suspend_state(Action::SuspendStates::SLEEPING);
get_model()->get_maxmin_system()->update_variable_penalty(action->get_variable(), 0.0);
return action;
/** @brief take into account changes of speed (either load or max) */
void CpuL07::on_speed_change()
{
- const kernel::lmm::Element* elem = nullptr;
+ const lmm::Element* elem = nullptr;
get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), speed_.peak * speed_.scale);
while (const auto* var = get_constraint()->get_variable(&elem)) {
- const kernel::resource::Action* action = var->get_id();
+ const Action* action = var->get_id();
get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(), speed_.scale * speed_.peak);
}
CpuImpl::on_speed_change();
}
-LinkL07::LinkL07(const std::string& name, double bandwidth, kernel::lmm::System* system) : LinkImpl(name)
+LinkL07::LinkL07(const std::string& name, double bandwidth, lmm::System* system) : LinkImpl(name)
{
this->set_constraint(system->constraint_new(this, bandwidth));
bandwidth_.peak = bandwidth;
}
-void CpuL07::apply_event(kernel::profile::Event* triggered, double value)
+void CpuL07::apply_event(profile::Event* triggered, double value)
{
XBT_DEBUG("Updating cpu %s (%p) with value %g", get_cname(), this, value);
if (triggered == speed_.event) {
}
}
-void LinkL07::apply_event(kernel::profile::Event* triggered, double value)
+void LinkL07::apply_event(profile::Event* triggered, double value)
{
XBT_DEBUG("Updating link %s (%p) with value=%f", get_cname(), this, value);
if (triggered == bandwidth_.event) {
void LinkL07::set_latency(double value)
{
latency_check(value);
- const kernel::lmm::Element* elem = nullptr;
+ const lmm::Element* elem = nullptr;
latency_.peak = value;
while (const auto* var = get_constraint()->get_variable(&elem)) {
for (size_t j = 0; j < host_count; j++) {
if (communicationAmount_[i * host_count + j] > 0) {
double lat = 0.0;
- std::vector<kernel::resource::LinkImpl*> route;
+ std::vector<LinkImpl*> route;
hostList_.at(i)->route_to(hostList_.at(j), route, &lat);
lat_current = std::max(lat_current, lat * communicationAmount_[i * host_count + j]);
}
}
}
- double lat_bound = kernel::resource::NetworkModel::cfg_tcp_gamma / (2.0 * lat_current);
+ double lat_bound = NetworkModel::cfg_tcp_gamma / (2.0 * lat_current);
XBT_DEBUG("action (%p) : lat_bound = %g", this, lat_bound);
if ((latency_ <= 0.0) && is_running()) {
if (rate_ < 0)
}
}
-} // namespace surf
+} // namespace resource
+} // namespace kernel
} // namespace simgrid
#define HOST_L07_HPP_
namespace simgrid {
-namespace surf {
+namespace kernel {
+namespace resource {
/***********
* Classes *
class XBT_PRIVATE LinkL07;
class XBT_PRIVATE L07Action;
-/*********
- * Tools *
- *********/
/*********
* Model *
double next_occurring_event(double now) override;
void update_actions_state(double now, double delta) override;
- kernel::resource::CpuAction* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
- const double* bytes_amount, double rate) override;
+ CpuAction* execute_parallel(const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+ const double* bytes_amount, double rate) override;
};
-class CpuL07Model : public kernel::resource::CpuModel {
+class CpuL07Model : public CpuModel {
public:
- CpuL07Model(const std::string& name, HostL07Model* hmodel, kernel::lmm::System* sys);
+ CpuL07Model(const std::string& name, HostL07Model* hmodel, lmm::System* sys);
CpuL07Model(const CpuL07Model&) = delete;
CpuL07Model& operator=(const CpuL07Model&) = delete;
~CpuL07Model() override;
* method in surf_presolve */
};
- kernel::resource::CpuImpl* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate) override;
+ CpuImpl* create_cpu(s4u::Host* host, const std::vector<double>& speed_per_pstate) override;
HostL07Model* hostModel_;
};
-class NetworkL07Model : public kernel::resource::NetworkModel {
+class NetworkL07Model : public NetworkModel {
public:
- NetworkL07Model(const std::string& name, HostL07Model* hmodel, kernel::lmm::System* sys);
+ NetworkL07Model(const std::string& name, HostL07Model* hmodel, lmm::System* sys);
NetworkL07Model(const NetworkL07Model&) = delete;
NetworkL07Model& operator=(const NetworkL07Model&) = delete;
~NetworkL07Model() override;
- kernel::resource::LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) final;
- kernel::resource::LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) override;
+ LinkImpl* create_link(const std::string& name, const std::vector<double>& bandwidths) final;
+ LinkImpl* create_wifi_link(const std::string& name, const std::vector<double>& bandwidths) override;
- kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
+ Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
void update_actions_state(double /*now*/, double /*delta*/) override{
/* this action is done by HostL07Model which shares the LMM system with the CPU model
* Overriding to an empty function here allows us to handle the Cpu07Model as a regular
* Resource *
************/
-class CpuL07 : public kernel::resource::CpuImpl {
+class CpuL07 : public CpuImpl {
public:
- using kernel::resource::CpuImpl::CpuImpl;
+ using CpuImpl::CpuImpl;
CpuL07(const CpuL07&) = delete;
CpuL07& operator=(const CpuL07&) = delete;
- void apply_event(kernel::profile::Event* event, double value) override;
- kernel::resource::CpuAction* execution_start(double size, double user_bound) override;
- kernel::resource::CpuAction* execution_start(double, int, double) override
+ void apply_event(profile::Event* event, double value) override;
+ CpuAction* execution_start(double size, double user_bound) override;
+ CpuAction* execution_start(double, int, double) override
{
THROW_UNIMPLEMENTED;
return nullptr;
}
- kernel::resource::CpuAction* sleep(double duration) override;
+ CpuAction* sleep(double duration) override;
protected:
void on_speed_change() override;
};
-class LinkL07 : public kernel::resource::LinkImpl {
+class LinkL07 : public LinkImpl {
public:
- LinkL07(const std::string& name, double bandwidth, kernel::lmm::System* system);
+ LinkL07(const std::string& name, double bandwidth, lmm::System* system);
LinkL07(const LinkL07&) = delete;
LinkL07& operator=(const LinkL07&) = delete;
~LinkL07() override;
- void apply_event(kernel::profile::Event* event, double value) override;
+ void apply_event(profile::Event* event, double value) override;
void set_bandwidth(double value) override;
void set_latency(double value) override;
};
/**********
* Action *
**********/
-class L07Action : public kernel::resource::CpuAction {
+class L07Action : public CpuAction {
std::vector<s4u::Host*> hostList_;
bool free_arrays_ = false; // By default, computationAmount_ and friends are freed by caller. But not for sequential
// exec and regular comms
public:
L07Action() = delete;
- L07Action(kernel::resource::Model* model, const std::vector<s4u::Host*>& host_list, const double* flops_amount,
+ L07Action(Model* model, const std::vector<s4u::Host*>& host_list, const double* flops_amount,
const double* bytes_amount, double rate);
L07Action(const L07Action&) = delete;
L07Action& operator=(const L07Action&) = delete;
void update_latency(double delta, double precision) { double_update(&latency_, delta, precision); }
};
-} // namespace surf
+} // namespace resource
+} // namespace kernel
} // namespace simgrid
#endif /* HOST_L07_HPP_ */