enum class Type {
HOST, /**< Host models: see surf_host_model_description for more details */
NETWORK, /**< Network models: see surf_network_model_description for more details */
- CPU, /**< CPU models: see surf_cpu_model_description for more details */
+ CPU_PM, /**< CPU model for physical machines: see surf_cpu_model_description for more details */
+ CPU_VM, /**< CPU model for virtual machines: see surf_cpu_model_description for more details */
DISK, /**< Disk models: see surf_disk_model_description for more details */
VM /**< VM model */
};
std::map<std::pair<NetPoint*, NetPoint*>, BypassRoute*> bypass_routes_; // src x dst -> route
routing::NetPoint* netpoint_ = nullptr; // Our representative in the father NetZone
resource::NetworkModel* network_model_;
+ resource::CpuModel* cpu_model_vm_;
protected:
explicit NetZoneImpl(NetZoneImpl* father, const std::string& name, resource::NetworkModel* network_model);
RoutingMode hierarchy_ = RoutingMode::unset;
resource::NetworkModel* get_network_model() const { return network_model_; }
+ resource::CpuModel* get_cpu_vm_model() const { return cpu_model_vm_; }
const s4u::NetZone* get_iface() const { return &piface_; }
s4u::NetZone* get_iface() { return &piface_; }
unsigned int get_table_size() const { return vertices_.size(); }
*/
XBT_PUBLIC_DATA simgrid::kernel::resource::CpuModel* surf_cpu_model_pm;
-/** @ingroup SURF_models
- * @brief The CPU model object for the virtual machine layer
- */
-XBT_PUBLIC_DATA simgrid::kernel::resource::CpuModel* surf_cpu_model_vm;
-
/** @ingroup SURF_models
* @brief The host model
*
"Refusing to create a second NetZone called '%s'.", get_cname());
netpoint_ = new NetPoint(name_, NetPoint::Type::NetZone, father_);
+ if (models_by_type[simgrid::kernel::resource::Model::Type::CPU_VM].size() > 0) {
+ cpu_model_vm_ = static_cast<simgrid::kernel::resource::CpuModel*>(
+ models_by_type[simgrid::kernel::resource::Model::Type::CPU_VM][0]);
+ }
XBT_DEBUG("NetZone '%s' created with the id '%u'", get_cname(), netpoint_->id());
}
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(res_vm, ker_resource, "Virtual Machines, containing actors and mobile accross hosts");
-simgrid::vm::VMModel* surf_vm_model = nullptr;
-
void surf_vm_model_init_HL13()
{
- if (surf_cpu_model_vm != nullptr)
- surf_vm_model = new simgrid::vm::VMModel();
+ /* FIXME[donassolo]: this smells bad, but works
+ * (the constructor saves its pointer in all_existing_models and models_by_type :O).
+ * We need a manager for these models */
+ new simgrid::vm::VMModel();
}
namespace simgrid {
double solved_value = ws_vm->get_impl()->get_action()->get_variable()->get_value();
XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->get_cname(), ws_vm->get_pm()->get_cname());
- xbt_assert(cpu->get_model() == surf_cpu_model_vm);
kernel::lmm::System* vcpu_system = cpu->get_model()->get_maxmin_system();
vcpu_system->update_constraint_bound(cpu->get_constraint(), virt_overhead * solved_value);
}
- /* 2. Ready. Get the next occurring event */
- return surf_cpu_model_vm->next_occurring_event(now);
+ /* actual next occurring event is determined by VM CPU model at surf_solve */
+ return -1.0;
}
/************
}
}
-XBT_PUBLIC_DATA simgrid::vm::VMModel* surf_vm_model;
-
#endif /* VM_INTERFACE_HPP_ */
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "simgrid/Exception.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
#include "simgrid/s4u/Actor.hpp"
#include "simgrid/vm.h"
#include "src/include/surf/surf.hpp"
for (int i = 0; i < physical_host->get_pstate_count(); i++)
speeds.push_back(physical_host->get_pstate_speed(i));
- surf_cpu_model_vm->create_cpu(this, speeds)->set_core_count(core_amount)->seal();
+ // FIXME[donassolo]: shoud this be done at the Impl class???
+ physical_host->get_netpoint()->get_englobing_zone()->get_cpu_vm_model()->create_cpu(this, speeds)->set_core_count(core_amount)->seal();
if (physical_host->get_pstate() != 0)
set_pstate(physical_host->get_pstate());
void surf_cpu_model_init_Cas01()
{
xbt_assert(surf_cpu_model_pm == nullptr, "CPU model already initialized. This should not happen.");
- xbt_assert(surf_cpu_model_vm == nullptr, "CPU model already initialized. This should not happen.");
if (cpu_optim_opt == "TI") {
simgrid::kernel::resource::CpuTiModel::create_pm_vm_models();
algo = simgrid::kernel::resource::Model::UpdateAlgo::FULL;
surf_cpu_model_pm = new simgrid::kernel::resource::CpuCas01Model(algo);
- surf_cpu_model_vm = new simgrid::kernel::resource::CpuCas01Model(algo);
+ models_by_type[simgrid::kernel::resource::Model::Type::CPU_PM].push_back(surf_cpu_model_pm);
+ auto cpu_model_vm = new simgrid::kernel::resource::CpuCas01Model(algo);
+ models_by_type[simgrid::kernel::resource::Model::Type::CPU_VM].push_back(cpu_model_vm);
}
namespace simgrid {
CpuCas01Model::CpuCas01Model(Model::UpdateAlgo algo) : CpuModel(algo)
{
all_existing_models.push_back(this);
- models_by_type[simgrid::kernel::resource::Model::Type::CPU].push_back(this);
bool select = config::get_value<bool>("cpu/maxmin-selective-update");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(res_cpu, ker_resource, "CPU resource, fueling execution activites");
simgrid::kernel::resource::CpuModel* surf_cpu_model_pm;
-simgrid::kernel::resource::CpuModel* surf_cpu_model_vm;
namespace simgrid {
namespace kernel {
{
speed_.scale = 1;
speed_.peak = speed_per_pstate_.front();
+ // FIXME[donassolo]: don't set here.. everytime I take half an hour to discover where it comes
host->pimpl_cpu = this;
}
void CpuTiModel::create_pm_vm_models()
{
xbt_assert(surf_cpu_model_pm == nullptr, "CPU model already initialized. This should not happen.");
- xbt_assert(surf_cpu_model_vm == nullptr, "CPU model already initialized. This should not happen.");
surf_cpu_model_pm = new CpuTiModel();
- surf_cpu_model_vm = new CpuTiModel();
+ models_by_type[simgrid::kernel::resource::Model::Type::CPU_PM].push_back(surf_cpu_model_pm);
+ auto cpu_model_vm = new CpuTiModel();
+ models_by_type[simgrid::kernel::resource::Model::Type::CPU_VM].push_back(cpu_model_vm);
}
CpuTiModel::CpuTiModel() : CpuModel(Model::UpdateAlgo::FULL)
{
all_existing_models.push_back(this);
- models_by_type[simgrid::kernel::resource::Model::Type::CPU].push_back(this);
}
CpuTiModel::~CpuTiModel()
surf_host_model_description[host_id].model_init_preparse();
XBT_DEBUG("Call vm_model_init");
+ // FIXME[donassolo]: maybe remove it, find a way to create the object and leave the
+ // dependency with surf_cpu_model_vm explicity
surf_vm_model_init_HL13();
XBT_DEBUG("Call disk_model_init");
// following the order it was done in HostCLM03Model->next_occurring_event
XBT_DEBUG("Looking for next event in CPU models");
- surf_update_next_event(models_by_type[simgrid::kernel::resource::Model::Type::CPU], time_delta);
+ surf_update_next_event(models_by_type[simgrid::kernel::resource::Model::Type::CPU_PM], time_delta);
XBT_DEBUG("Looking for next event in network models");
surf_update_next_event(models_by_type[simgrid::kernel::resource::Model::Type::NETWORK], time_delta);
XBT_DEBUG("Looking for next event in disk models");
XBT_DEBUG("Looking for next event in virtual models");
surf_update_next_event(models_by_type[simgrid::kernel::resource::Model::Type::VM], time_delta);
+ surf_update_next_event(models_by_type[simgrid::kernel::resource::Model::Type::CPU_VM], time_delta);
XBT_DEBUG("Min for resources (remember that NS3 don't update that value): %f", time_delta);