/** \ingroup SURF_models
* \brief List of initialized models
*/
-XBT_PUBLIC_DATA std::vector<simgrid::kernel::resource::Model*>* all_existing_models;
+XBT_PUBLIC_DATA std::vector<simgrid::kernel::resource::Model*> all_existing_models;
#endif
{
if (surf_cpu_model_vm) {
surf_vm_model = new simgrid::vm::VMModel();
- all_existing_models->push_back(surf_vm_model);
+ all_existing_models.push_back(surf_vm_model);
}
}
total_time += elapsed_time;
/* let's see which tasks are done */
- for (auto const& model : *all_existing_models) {
+ for (auto const& model : all_existing_models) {
simgrid::kernel::resource::Action* action = model->extract_done_action();
while (action != nullptr && action->get_data() != nullptr) {
SD_task_t task = static_cast<SD_task_t>(action->get_data());
/** Wake up all processes waiting for a Surf action to finish */
static void SIMIX_wake_processes()
{
- for (auto const& model : *all_existing_models) {
+ for (auto const& model : all_existing_models) {
simgrid::kernel::resource::Action* action;
XBT_DEBUG("Handling the processes whose action failed (if any)");
algo = simgrid::kernel::resource::Model::UpdateAlgo::FULL;
surf_cpu_model_pm = new simgrid::surf::CpuCas01Model(algo);
- all_existing_models->push_back(surf_cpu_model_pm);
+ all_existing_models.push_back(surf_cpu_model_pm);
surf_cpu_model_vm = new simgrid::surf::CpuCas01Model(algo);
- all_existing_models->push_back(surf_cpu_model_vm);
+ all_existing_models.push_back(surf_cpu_model_vm);
}
namespace simgrid {
CpuTiModel::CpuTiModel() : CpuModel(Model::UpdateAlgo::FULL)
{
- all_existing_models->push_back(this);
+ all_existing_models.push_back(this);
}
CpuTiModel::~CpuTiModel()
namespace surf {
HostCLM03Model::HostCLM03Model()
{
- all_existing_models->push_back(this);
+ all_existing_models.push_back(this);
}
double HostCLM03Model::next_occuring_event(double now)
{
xbt_assert(surf_network_model == nullptr, "Cannot set the network model twice");
surf_network_model = new simgrid::kernel::resource::NetworkCm02Model();
- all_existing_models->push_back(surf_network_model);
+ all_existing_models.push_back(surf_network_model);
simgrid::config::set_default<double>("network/latency-factor", 13.01);
simgrid::config::set_default<double>("network/bandwidth-factor", 0.97);
simgrid::config::set_default<double>("network/weight-S", 0.0);
surf_network_model = new simgrid::kernel::resource::NetworkCm02Model();
- all_existing_models->push_back(surf_network_model);
+ all_existing_models.push_back(surf_network_model);
}
/***************************************************************************/
simgrid::config::set_default<double>("network/weight-S", 20537);
surf_network_model = new simgrid::kernel::resource::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
- all_existing_models->push_back(surf_network_model);
+ all_existing_models.push_back(surf_network_model);
}
simgrid::config::set_default<double>("network/weight-S", 20537);
surf_network_model = new simgrid::kernel::resource::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
- all_existing_models->push_back(surf_network_model);
+ all_existing_models.push_back(surf_network_model);
}
void surf_network_model_init_Vegas()
simgrid::config::set_default<double>("network/weight-S", 20537);
surf_network_model = new simgrid::kernel::resource::NetworkCm02Model(&simgrid::kernel::lmm::make_new_lagrange_system);
- all_existing_models->push_back(surf_network_model);
+ all_existing_models.push_back(surf_network_model);
}
namespace simgrid {
{
xbt_assert(surf_network_model == nullptr);
surf_network_model = new simgrid::kernel::resource::NetworkConstantModel();
- all_existing_models->push_back(surf_network_model);
+ all_existing_models.push_back(surf_network_model);
}
namespace simgrid {
xbt_assert(surf_network_model == nullptr, "Cannot set the network model twice");
surf_network_model = new simgrid::kernel::resource::NetworkIBModel();
- all_existing_models->push_back(surf_network_model);
+ all_existing_models.push_back(surf_network_model);
simgrid::s4u::Link::on_communication_state_change.connect(IB_action_state_changed_callback);
simgrid::s4u::Link::on_communicate.connect(IB_action_init_callback);
simgrid::s4u::Host::on_creation.connect(IB_create_host_callback);
xbt_assert(surf_network_model == nullptr, "Cannot set the network model twice");
surf_network_model = new simgrid::kernel::resource::NetworkNS3Model();
- all_existing_models->push_back(surf_network_model);
+ all_existing_models.push_back(surf_network_model);
}
static simgrid::config::Flag<std::string>
if (surf_network_model)
return;
surf_network_model = new simgrid::kernel::resource::NetworkSmpiModel();
- all_existing_models->push_back(surf_network_model);
+ all_existing_models.push_back(surf_network_model);
simgrid::config::set_default<double>("network/weight-S", 8775);
}
xbt_assert(not surf_network_model, "Cannot switch to ptasks: network model already defined");
surf_host_model = new simgrid::surf::HostL07Model();
- all_existing_models->push_back(surf_host_model);
+ all_existing_models.push_back(surf_host_model);
}
void surf_storage_model_init_default()
{
surf_storage_model = new simgrid::surf::StorageN11Model();
- all_existing_models->push_back(surf_storage_model);
+ all_existing_models.push_back(surf_storage_model);
}
namespace simgrid {
}
XBT_DEBUG ("Set every models in the right state by updating them to 0.");
- for (auto const& model : *all_existing_models)
+ for (auto const& model : all_existing_models)
model->update_actions_state(NOW, 0.0);
}
time_delta = next_event_virt;
}
- for (auto const& model : *all_existing_models) {
+ for (auto const& model : all_existing_models) {
if (model != surf_host_model && model != surf_vm_model && model != surf_network_model &&
model != surf_storage_model) {
double next_event_model = model->next_occuring_event(NOW);
NOW = NOW + time_delta;
// Inform the models of the date change
- for (auto const& model : *all_existing_models)
+ for (auto const& model : all_existing_models)
model->update_actions_state(NOW, time_delta);
simgrid::s4u::on_time_advance(time_delta);
* Utils *
*********/
-std::vector<simgrid::kernel::resource::Model*>* all_existing_models = nullptr; /* to destroy models correctly */
+std::vector<simgrid::kernel::resource::Model*> all_existing_models; /* to destroy models correctly */
simgrid::trace_mgr::future_evt_set *future_evt_set = nullptr;
std::vector<std::string> surf_path;
USER_HOST_LEVEL = simgrid::s4u::Host::extension_create(nullptr);
xbt_init(argc, argv);
- if (not all_existing_models)
- all_existing_models = new std::vector<simgrid::kernel::resource::Model*>();
if (not future_evt_set)
future_evt_set = new simgrid::trace_mgr::future_evt_set();
delete stype;
}
- for (auto const& model : *all_existing_models)
+ for (auto const& model : all_existing_models)
delete model;
- delete all_existing_models;
delete future_evt_set;
future_evt_set = nullptr;
double now = surf_get_clock();
XBT_INFO("Next Event : %g", now);
- for (auto const& model : *all_existing_models) {
+ for (auto const& model : all_existing_models) {
if (model->get_started_action_set()->size() != 0) {
XBT_DEBUG("\t Running that model");
running = 1;