-/* Copyright (c) 2007-2022. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <simgrid/kernel/routing/NetZoneImpl.hpp>
#include <simgrid/s4u/Engine.hpp>
+#include <xbt/asserts.hpp>
#include <xbt/config.hpp>
#include "simgrid/config.h"
/**************************************/
/*** Resource Creation & Destruction **/
/**************************************/
-void surf_host_model_init_ptask_L07()
-{
- XBT_CINFO(xbt_cfg, "Switching to the L07 model to handle parallel tasks.");
- xbt_assert(cfg_ptask_solver != "maxmin", "Invalid configuration. Cannot use maxmin solver with parallel tasks.");
-
- auto* system = simgrid::kernel::lmm::System::build(cfg_ptask_solver, true /* selective update */);
- auto host_model = std::make_shared<simgrid::kernel::resource::HostL07Model>("Host_Ptask", system);
- auto* engine = simgrid::kernel::EngineImpl::get_instance();
- engine->add_model(host_model);
- engine->get_netzone_root()->set_host_model(host_model);
-}
+SIMGRID_REGISTER_HOST_MODEL(
+ ptask_L07, "Host model somehow similar to Cas01+CM02+S19 but allowing parallel tasks", []() {
+ XBT_CINFO(xbt_cfg, "Switching to the L07 model to handle parallel tasks.");
+ xbt_assert(cfg_ptask_solver != "maxmin", "Invalid configuration. Cannot use maxmin solver with parallel tasks.");
+
+ xbt_assert(simgrid::config::is_default("network/model") && simgrid::config::is_default("cpu/model"),
+ "Changing the network or CPU model is not allowed when using the ptasks host model.");
+
+ auto* system = simgrid::kernel::lmm::System::build(cfg_ptask_solver.get(), true /* selective update */);
+ auto host_model = std::make_shared<simgrid::kernel::resource::HostL07Model>("Host_Ptask", system);
+ auto* engine = simgrid::kernel::EngineImpl::get_instance();
+ engine->add_model(host_model);
+ engine->get_netzone_root()->set_host_model(host_model);
+ });
namespace simgrid::kernel::resource {
auto cpu_model = std::make_shared<CpuL07Model>("Cpu_Ptask", this, sys);
engine->add_model(cpu_model);
engine->get_netzone_root()->set_cpu_pm_model(cpu_model);
+
+ simgrid_disk_models().by_name("S19").init();
}
CpuL07Model::CpuL07Model(const std::string& name, HostL07Model* hmodel, lmm::System* sys)
++it; // increment iterator here since the following calls to action.finish() may invalidate it
if (action.get_latency() > 0) {
if (action.get_latency() > delta) {
- action.update_latency(delta, sg_surf_precision);
+ action.update_latency(delta, sg_precision_timing);
} else {
action.set_latency(0.0);
}
update_bound();
}
-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, bool /* streamed */)
{
std::vector<s4u::Host*> host_list = {src, dst};
const auto* flops_amount = new double[2]();