- the CPU resource,
- the timer resource.
+ FIXME[donassolo]: fix doc
The implementation of these resources depends on the platform
models you choose. You can select your model by calling
#surf_host_model_init_current_default() (which will give you a
resource::CpuModel* cpu_model_vm_;
resource::CpuModel* cpu_model_pm_;
resource::DiskModel* disk_model_;
+ simgrid::surf::HostModel* host_model_;
protected:
explicit NetZoneImpl(NetZoneImpl* father, const std::string& name, resource::NetworkModel* network_model);
resource::CpuModel* get_cpu_pm_model() const { return cpu_model_pm_; }
/** @brief Retrieves the disk model associated to this NetZone */
resource::DiskModel* get_disk_model() const { return disk_model_; }
+ /** @brief Retrieves the host model associated to this NetZone */
+ // FIXME[donassolo]: why HostModel isn't in resource namespace?
+ simgrid::surf::HostModel* get_host_model() const { return host_model_; }
const s4u::NetZone* get_iface() const { return &piface_; }
s4u::NetZone* get_iface() { return &piface_; }
#include "simgrid/forward.h"
-/** @ingroup SURF_models
- * @brief The host model
- *
- * Note that when you create an API on top of SURF, the host model should be the only one you use
- * because depending on the platform model, the network model and the CPU model may not exist.
- */
-XBT_PUBLIC_DATA simgrid::surf::HostModel* surf_host_model;
-
-
/*** SURF Globals **************************/
/** @ingroup SURF_simulation
#include "src/kernel/activity/ExecImpl.hpp"
#include "simgrid/Exception.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
#include "simgrid/modelchecker.h"
#include "simgrid/s4u/Exec.hpp"
#include "src/mc/mc_replay.hpp"
surf_action_->set_user_bound(bound_);
}
} else {
- surf_action_ = surf_host_model->execute_parallel(hosts_, flops_amounts_.data(), bytes_amounts_.data(), -1);
+ // FIXME[donassolo]: verify if all hosts belongs to the same netZone?
+ auto host_model = hosts_.front()->get_netpoint()->get_englobing_zone()->get_host_model();
+ surf_action_ = host_model->execute_parallel(hosts_, flops_amounts_.data(), bytes_amounts_.data(), -1);
}
surf_action_->set_activity(this);
}
#include "simgrid/s4u/Engine.hpp"
#include "simgrid/s4u/Host.hpp"
#include "src/kernel/resource/DiskImpl.hpp"
+#include "src/surf/HostImpl.hpp"
#include "src/surf/cpu_interface.hpp"
#include "src/surf/network_interface.hpp"
#include "src/surf/xml/platf_private.hpp"
models_by_type[simgrid::kernel::resource::Model::Type::CPU_PM][0]);
disk_model_ = static_cast<simgrid::kernel::resource::DiskModel*>(
models_by_type[simgrid::kernel::resource::Model::Type::DISK][0]);
+ // FIXME[donassolo]: we probably need some validation of the coherence among
+ // the different models in each netZone
+ host_model_ = static_cast<simgrid::surf::HostModel*>(models_by_type[simgrid::kernel::resource::Model::Type::HOST][0]);
XBT_DEBUG("NetZone '%s' created with the id '%u'", get_cname(), netpoint_->id());
}
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "simdag_private.hpp"
+#include "simgrid/kernel/routing/NetPoint.hpp"
#include "src/surf/HostImpl.hpp"
#include "src/surf/surf_interface.hpp"
#include <algorithm>
XBT_VERB("Executing task '%s'", task->name);
/* Beware! The scheduling data are now used by the surf action directly! no copy was done */
+ // FIXME[donassolo]: verify if all hosts belongs to the same netZone?
+ auto host_model = (*task->allocation).front()->get_netpoint()->get_englobing_zone()->get_host_model();
task->surf_action =
- surf_host_model->execute_parallel(*task->allocation, task->flops_amount, task->bytes_amount, task->rate);
+ host_model->execute_parallel(*task->allocation, task->flops_amount, task->bytes_amount, task->rate);
task->surf_action->set_data(task);
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(res_host, ker_resource, "Host resources agregate CPU, networking and I/O features");
-simgrid::surf::HostModel *surf_host_model = nullptr;
-
/*************
* Callbacks *t
*************/
}
}
-XBT_PUBLIC_DATA simgrid::surf::HostModel* surf_host_model;
-
#endif /* SURF_HOST_INTERFACE_HPP */
void surf_host_model_init_current_default()
{
- surf_host_model = new simgrid::surf::HostCLM03Model();
+ /* 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::surf::HostCLM03Model();
simgrid::config::set_default<bool>("network/crosstraffic", true);
surf_cpu_model_init_Cas01();
surf_network_model_init_LegrandVelho();
{
XBT_CINFO(xbt_cfg, "Switching to the L07 model to handle parallel tasks.");
- surf_host_model = new simgrid::surf::HostL07Model();
- all_existing_models.push_back(surf_host_model);
- models_by_type[simgrid::kernel::resource::Model::Type::HOST].push_back(surf_host_model);
+ auto host_model = new simgrid::surf::HostL07Model();
+ all_existing_models.push_back(host_model);
+ models_by_type[simgrid::kernel::resource::Model::Type::HOST].push_back(host_model);
}
namespace simgrid {