From 3be0396ca83e510e42adc8e3eb12f4befb2f1fff Mon Sep 17 00:00:00 2001 From: Fred Suter Date: Wed, 9 Nov 2022 17:43:12 -0500 Subject: [PATCH] Completely revise the way to deal with Streamed I/Os Do not implement a new funky HostModel but handle the io_stream call in CLM03. Basic idea (thx alegrand): start from a regular NetworkAction and add some extra constraints if it is an I/O stream. + Pros: easy to implement and inherit of all the complexity of the network part. This would have been too much work and redundancy with a new model. No extra flag, just a new type of I/Os (similar to the Comm::sendto spirit) + Cons: had to cheat a bit to NOT inherit some of the network model (LV08) complexity for the I/O part (bandwidth factor). Still has to find a way to not pay the network latency if the stream starts from a disk. Had to add a little hack to reserve more space in communicate for the extra constraints. This new type of I/O is tested in teshsuite/s4u/io-stream (with the basic CM02 model without crosstraffic to verify if bottlenecks are correctly handled, and then with the default config) --- MANIFEST.in | 2 - src/kernel/activity/CommImpl.cpp | 2 +- src/kernel/resource/NetworkModel.hpp | 2 +- src/surf/host_clm03.cpp | 32 +++- src/surf/host_clm03.hpp | 2 +- src/surf/network_cm02.cpp | 12 +- src/surf/network_cm02.hpp | 7 +- src/surf/network_constant.cpp | 3 +- src/surf/network_constant.hpp | 2 +- src/surf/network_ns3.cpp | 2 +- src/surf/network_ns3.hpp | 2 +- src/surf/ptask_L07.cpp | 2 +- src/surf/ptask_L07.hpp | 4 +- src/surf/sio_S22.cpp | 184 --------------------- src/surf/sio_S22.hpp | 69 -------- src/surf/surf_interface.cpp | 2 - src/surf/surf_interface.hpp | 1 - teshsuite/s4u/io-stream/io-stream.cpp | 17 +- teshsuite/s4u/io-stream/io-stream.tesh | 68 +++++--- teshsuite/surf/surf_usage/surf_usage.cpp | 2 +- teshsuite/surf/surf_usage2/surf_usage2.cpp | 2 +- tools/cmake/DefinePackages.cmake | 2 - 22 files changed, 110 insertions(+), 311 deletions(-) delete mode 100644 src/surf/sio_S22.cpp delete mode 100644 src/surf/sio_S22.hpp diff --git a/MANIFEST.in b/MANIFEST.in index 80df1c2e53..106269a794 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2630,8 +2630,6 @@ include src/surf/ns3/ns3_simulator.hpp include src/surf/ptask_L07.cpp include src/surf/ptask_L07.hpp include src/surf/sg_platf.cpp -include src/surf/sio_S22.cpp -include src/surf/sio_S22.hpp include src/surf/surf_interface.cpp include src/surf/surf_interface.hpp include src/surf/xml/platf.hpp diff --git a/src/kernel/activity/CommImpl.cpp b/src/kernel/activity/CommImpl.cpp index ca40f6ae61..70f560e9d9 100644 --- a/src/kernel/activity/CommImpl.cpp +++ b/src/kernel/activity/CommImpl.cpp @@ -124,7 +124,7 @@ CommImpl* CommImpl::start() * routes and later create the respective surf actions */ auto net_model = from_->get_netpoint()->get_englobing_zone()->get_network_model(); - surf_action_ = net_model->communicate(from_, to_, size_, rate_); + surf_action_ = net_model->communicate(from_, to_, size_, rate_, false); surf_action_->set_activity(this); surf_action_->set_category(get_tracing_category()); set_start_time(surf_action_->get_start_time()); diff --git a/src/kernel/resource/NetworkModel.hpp b/src/kernel/resource/NetworkModel.hpp index 06ada6816d..e507e0f1bb 100644 --- a/src/kernel/resource/NetworkModel.hpp +++ b/src/kernel/resource/NetworkModel.hpp @@ -53,7 +53,7 @@ public: * @param rate Allows to limit the transfer rate. Negative value means unlimited. * @return The action representing the communication */ - virtual Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) = 0; + virtual Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate, bool streamed) = 0; double next_occurring_event_full(double now) override; diff --git a/src/surf/host_clm03.cpp b/src/surf/host_clm03.cpp index 03dd2a9d92..77cb7cbc23 100644 --- a/src/surf/host_clm03.cpp +++ b/src/surf/host_clm03.cpp @@ -56,6 +56,34 @@ static inline double has_cost(const double* array, size_t pos) return -1.0; } +Action* HostCLM03Model::io_stream(s4u::Host* src_host, DiskImpl* src_disk, s4u::Host* dst_host, DiskImpl* dst_disk, + double size) +{ + auto net_model = src_host->get_englobing_zone()->get_network_model(); + auto system = net_model->get_maxmin_system(); + auto* action = net_model->communicate(src_host, dst_host, size, -1, true); + + size_t nb_disks = 0; + if (src_disk != nullptr) + nb_disks++; + if (dst_disk != nullptr) + nb_disks++; + + // We don't want to apply the network model bandwidth factor to the I/O constraints + double bw_factor = net_model->get_bandwidth_factor(); + if (src_disk != nullptr){ + //FIXME: if the stream starts from a disk, we might not want to pay the network latency + system->expand(src_disk->get_constraint(), action->get_variable(), bw_factor); + system->expand(src_disk->get_read_constraint(), action->get_variable(), bw_factor); + } + if (dst_disk != nullptr){ + system->expand(dst_disk->get_constraint(), action->get_variable(), bw_factor); + system->expand(dst_disk->get_write_constraint(), action->get_variable(), bw_factor); + } + + return action; +} + Action* HostCLM03Model::execute_parallel(const std::vector& host_list, const double* flops_amount, const double* bytes_amount, double rate) { @@ -64,7 +92,7 @@ Action* HostCLM03Model::execute_parallel(const std::vector& host_lis 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); } else if ((host_list.size() == 1) && (has_cost(flops_amount, 0) <= 0)) { - action = net_model->communicate(host_list[0], host_list[0], bytes_amount[0], rate); + action = net_model->communicate(host_list[0], host_list[0], bytes_amount[0], rate, false); } else if ((host_list.size() == 2) && (has_cost(flops_amount, 0) <= 0) && (has_cost(flops_amount, 1) <= 0)) { int nb = 0; double value = 0.0; @@ -76,7 +104,7 @@ Action* HostCLM03Model::execute_parallel(const std::vector& host_lis } } if (nb == 1) { - action = net_model->communicate(host_list[0], host_list[1], value, rate); + action = net_model->communicate(host_list[0], host_list[1], value, rate, false); } else if (nb == 0) { xbt_die("Cannot have a communication with no flop to exchange in this model. You should consider using the " "ptask model"); diff --git a/src/surf/host_clm03.hpp b/src/surf/host_clm03.hpp index 9e073b5c3f..90e2de1f47 100644 --- a/src/surf/host_clm03.hpp +++ b/src/surf/host_clm03.hpp @@ -22,7 +22,7 @@ public: Action* execute_thread(const s4u::Host* host, double flops_amount, int thread_count) override; Action* execute_parallel(const std::vector& host_list, const double* flops_amount, const double* bytes_amount, double rate) override; - Action* io_stream(s4u::Host* src_host, DiskImpl* src_disk, s4u::Host* dst_host, DiskImpl* dst_disk, double size) override { return nullptr; } + Action* io_stream(s4u::Host* src_host, DiskImpl* src_disk, s4u::Host* dst_host, DiskImpl* dst_disk, double size) override; }; } // namespace simgrid::kernel::resource diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index a0f4776d03..2bccd2e09a 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -369,10 +369,16 @@ void NetworkCm02Model::comm_action_set_bounds(const s4u::Host* src, const s4u::H } void NetworkCm02Model::comm_action_set_variable(NetworkCm02Action* action, const std::vector& route, - const std::vector& back_route) + const std::vector& back_route, bool streamed) { size_t constraints_per_variable = route.size(); constraints_per_variable += back_route.size(); + if (streamed) { + // setting the number of variable for a communication action involved in a I/O streaming operation + // requires to reserve some extra space for the constraints related to the source disk (global and read + // bandwidth) and destination disk (global and write bandwidth). We thus add 4 constraints. + constraints_per_variable += 4; + } if (action->latency_ > 0) { action->set_variable(get_maxmin_system()->variable_new(action, 0.0, -1.0, constraints_per_variable)); @@ -400,7 +406,7 @@ void NetworkCm02Model::comm_action_set_variable(NetworkCm02Action* action, const } } -Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) +Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate, bool streamed) { double latency = 0.0; std::vector back_route; @@ -426,7 +432,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz comm_action_set_bounds(src, dst, size, action, route, netzones, rate); /* creating the maxmin variable associated to this action */ - comm_action_set_variable(action, route, back_route); + comm_action_set_variable(action, route, back_route, streamed); /* expand maxmin system to consider this communication in bw constraint for each link in route and back_route */ comm_action_expand_constraints(src, dst, action, route, back_route); diff --git a/src/surf/network_cm02.hpp b/src/surf/network_cm02.hpp index 5ba4fa553e..54c01364e9 100644 --- a/src/surf/network_cm02.hpp +++ b/src/surf/network_cm02.hpp @@ -42,7 +42,7 @@ class NetworkCm02Model : public NetworkModel { const std::unordered_set& netzones, double rate) const; /** @brief Create maxmin variable in communication action */ void comm_action_set_variable(NetworkCm02Action* action, const std::vector& route, - const std::vector& back_route); + const std::vector& back_route, bool streamed); public: explicit NetworkCm02Model(const std::string& name); @@ -50,7 +50,7 @@ public: StandardLinkImpl* create_wifi_link(const std::string& name, const std::vector& bandwidths) override; void update_actions_state_lazy(double now, double delta) override; void update_actions_state_full(double now, double delta) override; - 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, bool streamed) override; }; /************ @@ -69,7 +69,8 @@ public: * Action * **********/ class NetworkCm02Action : public NetworkAction { - friend Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate); + friend Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate, + bool streamed); public: using NetworkAction::NetworkAction; diff --git a/src/surf/network_constant.cpp b/src/surf/network_constant.cpp index 957d8c70b2..a5a358838b 100644 --- a/src/surf/network_constant.cpp +++ b/src/surf/network_constant.cpp @@ -71,7 +71,8 @@ void NetworkConstantModel::update_actions_state(double /*now*/, double delta) } } -Action* NetworkConstantModel::communicate(s4u::Host* src, s4u::Host* dst, double size, double /*rate*/) +Action* NetworkConstantModel::communicate(s4u::Host* src, s4u::Host* dst, double size, double /*rate*/, + bool /*streamed*/) { return (new NetworkConstantAction(this, *src, *dst, size)); } diff --git a/src/surf/network_constant.hpp b/src/surf/network_constant.hpp index 229043ac12..82b7791ba7 100644 --- a/src/surf/network_constant.hpp +++ b/src/surf/network_constant.hpp @@ -13,7 +13,7 @@ namespace simgrid::kernel::resource { class NetworkConstantModel : public NetworkModel { public: using NetworkModel::NetworkModel; - 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, bool streamed) override; double next_occurring_event(double now) override; void update_actions_state(double now, double delta) override; diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 222766f624..35b1a0d932 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -368,7 +368,7 @@ StandardLinkImpl* NetworkNS3Model::create_wifi_link(const std::string& name, con return link; } -Action* NetworkNS3Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) +Action* NetworkNS3Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate, bool /*streamed*/) { xbt_assert(rate == -1, "Communication over ns-3 links cannot specify a specific rate. Please use -1 as a value instead of %f.", diff --git a/src/surf/network_ns3.hpp b/src/surf/network_ns3.hpp index a0328a27f4..9e820fc3a2 100644 --- a/src/surf/network_ns3.hpp +++ b/src/surf/network_ns3.hpp @@ -19,7 +19,7 @@ public: ~NetworkNS3Model() override; StandardLinkImpl* create_link(const std::string& name, const std::vector& bandwidth) override; StandardLinkImpl* create_wifi_link(const std::string& name, const std::vector& bandwidth) override; - 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, bool streamed) override; double next_occurring_event(double now) override; bool next_occurring_event_is_idempotent() override { return false; } void update_actions_state(double now, double delta) override; diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index bee5736d00..853007776f 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -230,7 +230,7 @@ L07Action::L07Action(Model* model, const std::vector& host_list, con 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 host_list = {src, dst}; const auto* flops_amount = new double[2](); diff --git a/src/surf/ptask_L07.hpp b/src/surf/ptask_L07.hpp index c48d999117..0fe87583f8 100644 --- a/src/surf/ptask_L07.hpp +++ b/src/surf/ptask_L07.hpp @@ -69,7 +69,7 @@ public: StandardLinkImpl* create_link(const std::string& name, const std::vector& bandwidths) final; StandardLinkImpl* create_wifi_link(const std::string& name, const std::vector& bandwidths) override; - 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, bool streamed) 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 @@ -131,7 +131,7 @@ class L07Action : public CpuAction { friend CpuAction* CpuL07::sleep(double duration); friend CpuAction* HostL07Model::execute_parallel(const std::vector& host_list, const double* flops_amount, const double* bytes_amount, double rate); - friend Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate); + friend Action* NetworkL07Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate, bool streamed); /** * @brief Calculate the CPU bound for the parallel task * diff --git a/src/surf/sio_S22.cpp b/src/surf/sio_S22.cpp deleted file mode 100644 index 1e09262aa6..0000000000 --- a/src/surf/sio_S22.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* Copyright (c) 2022. 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 -#include -#include - -#include "simgrid/config.h" -#include "src/kernel/EngineImpl.hpp" -#include "src/surf/sio_S22.hpp" - -#include - -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_host); -XBT_LOG_EXTERNAL_CATEGORY(xbt_cfg); - -/*********** - * Options * - ***********/ - static simgrid::config::Flag cfg_sio_solver("host/sio_solver", - "Set linear equations solver used by sio model", - "maxmin", - &simgrid::kernel::lmm::System::validate_solver); - -/**************************************/ -/*** Resource Creation & Destruction **/ -/**************************************/ -void surf_host_model_init_sio_S22() -{ - XBT_CINFO(xbt_cfg, "Switching to the S22 model to handle streaming I/Os."); - simgrid::config::set_default("network/crosstraffic", true); - auto host_model = std::make_shared("Host_Sio"); - surf_network_model_init_LegrandVelho(); - surf_cpu_model_init_Cas01(); - surf_disk_model_init_S19(); - - 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 { - -HostS22Model::HostS22Model(const std::string& name) : HostModel(name) -{ - set_maxmin_system(lmm::System::build(cfg_sio_solver.get(), true /* selective update */)); -} - -double HostS22Model::next_occurring_event(double now) -{ - double min = HostModel::next_occurring_event_full(now); - for (Action const& action : *get_started_action_set()) { - const auto& net_action = static_cast(action); - if (net_action.get_latency() > 0 && (min < 0 || net_action.get_latency() < min)) { - min = net_action.get_latency(); - XBT_DEBUG("Updating min with %p (start %f): %f", &net_action, net_action.get_start_time(), min); - } - } - XBT_DEBUG("min value: %f", min); - - return min; -} - -void HostS22Model::update_actions_state(double /*now*/, double delta) -{ - for (auto it = std::begin(*get_started_action_set()); it != std::end(*get_started_action_set());) { - auto& action = static_cast(*it); - ++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); - } else { - action.set_latency(0.0); - } - if ((action.get_latency() <= 0.0) && (action.is_suspended() == 0)) { - action.update_bound(); - get_maxmin_system()->update_variable_penalty(action.get_variable(), 1.0); - action.set_last_update(); - } - } - XBT_DEBUG("Action (%p) : remains (%g) updated by %g.", &action, action.get_remains(), action.get_rate() * delta); - action.update_remains(action.get_rate() * delta); - action.update_max_duration(delta); - - XBT_DEBUG("Action (%p) : remains (%g).", &action, action.get_remains()); - - 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(Action::State::FINISHED); - continue; - } - } -} - -DiskAction* HostS22Model::io_stream(s4u::Host* src_host, DiskImpl* src_disk, s4u::Host* dst_host, DiskImpl* dst_disk, - double size) -{ - return new S22Action(this, src_host, src_disk, dst_host, dst_disk, size); -} - -Action* HostS22Model::execute_thread(const s4u::Host* host, double flops_amount, int thread_count) -{ - /* Create a single action whose cost is thread_count * flops_amount and that requests thread_count cores. */ - return host->get_cpu()->execution_start(thread_count * flops_amount, thread_count, -1); -} - -/********** - * Action * - **********/ -void S22Action::update_bound() const -{ - double bound = std::numeric_limits::max(); - if (src_disk_) - bound = std::min(bound, src_disk_->get_read_bandwidth()); - if (dst_disk_) - bound = std::min(bound, dst_disk_->get_write_bandwidth()); - if (src_host_ != dst_host_) { - double lat = 0.0; - std::vector route; - src_host_->route_to(dst_host_, route, &lat); - if (lat > 0) - bound = std::min(bound,NetworkModel::cfg_tcp_gamma / (2.0 * lat)); - } - - XBT_DEBUG("action (%p) : bound = %g", this, bound); - - /* latency has been paid (or no latency), we can set the appropriate bound for network limit */ - if ((bound < std::numeric_limits::max()) && (latency_ <= 0.0)) - get_model()->get_maxmin_system()->update_variable_bound(get_variable(), bound); - } - -S22Action::S22Action(Model* model, s4u::Host* src_host, DiskImpl* src_disk, s4u::Host* dst_host, DiskImpl* dst_disk, double size) - : DiskAction(model, size, false) - , src_host_(src_host) - , src_disk_(src_disk) - , dst_host_(dst_host) - , dst_disk_(dst_disk) - , size_(size) -{ - this->set_last_update(); - - size_t disk_nb = 0; - if (src_disk_ != nullptr) - disk_nb++; - if (dst_disk_ != nullptr) - disk_nb++; - - /* there should always be a route between src_host and dst_host (loopback_ for self communication at least) */ - std::vector route; - src_host_->route_to(dst_host_, route, &latency_); - size_t link_nb = route.size(); - - XBT_DEBUG("Creating a stream io (%p) with %zu disk(s) and %zu unique link(s).", this, disk_nb, link_nb); - - set_variable(model->get_maxmin_system()->variable_new(this, 1.0, -1.0, 2 * disk_nb + link_nb)); - - if (latency_ > 0) - model->get_maxmin_system()->update_variable_penalty(get_variable(), 0.0); - - /* Expand it for the disks even if there is nothing to read/write, to make sure that it gets expended even if there is no - * communication either */ - if (src_disk_ != nullptr){ - model->get_maxmin_system()->expand(src_disk_->get_constraint(), get_variable(), 1); - model->get_maxmin_system()->expand(src_disk->get_read_constraint(), get_variable(), 1); - } - if (dst_disk_ != nullptr){ - model->get_maxmin_system()->expand(dst_disk_->get_constraint(), get_variable(), 1); - model->get_maxmin_system()->expand(dst_disk_->get_write_constraint(), get_variable(), 1); - } - - for (auto const& link : route) - model->get_maxmin_system()->expand(link->get_constraint(), get_variable(), 1); - - if (size <= 0) { - this->set_cost(1.0); - this->set_remains(0.0); - } - - /* finally calculate the initial bound value */ - update_bound(); -} -} // namespace simgrid::kernel::resource diff --git a/src/surf/sio_S22.hpp b/src/surf/sio_S22.hpp deleted file mode 100644 index d37d74098d..0000000000 --- a/src/surf/sio_S22.hpp +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright (c) 2022. 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 "src/kernel/resource/NetworkModel.hpp" -#include "src/surf/HostImpl.hpp" -#include - -#ifndef SIO_S22_HPP_ -#define SIO_S22_HPP_ - -namespace simgrid::kernel::resource { - -/*********** - * Classes * - ***********/ - -class XBT_PRIVATE HostS22Model; -class XBT_PRIVATE S22Action; - -/********* - * Model * - *********/ -class HostS22Model : public HostModel { -public: - HostS22Model(const std::string& name); - HostS22Model(const HostS22Model&) = delete; - HostS22Model& operator=(const HostS22Model&) = delete; - - double next_occurring_event(double now) override; - void update_actions_state(double now, double delta) override; - Action* execute_thread(const s4u::Host* host, double flops_amount, int thread_count) override; - CpuAction* execute_parallel(const std::vector& host_list, const double* flops_amount, - const double* bytes_amount, double rate) override { return nullptr; } - DiskAction* io_stream(s4u::Host* src_host, DiskImpl* src_disk, s4u::Host* dst_host, DiskImpl* dst_disk, - double size) override; -}; - -/********** - * Action * - **********/ - -class S22Action : public DiskAction { - const s4u::Host* src_host_; - const DiskImpl* src_disk_; - const s4u::Host* dst_host_; - const DiskImpl* dst_disk_; - - const double size_; - double latency_ = 0; - -public: - S22Action() = delete; - S22Action(Model* model, s4u::Host* src_host, DiskImpl* src_disk, s4u::Host* dst_host, DiskImpl* dst_disk, double size); - S22Action(const S22Action&) = delete; - S22Action& operator=(const S22Action&) = delete; - ~S22Action() override = default; - - void update_bound() const; - double get_latency() const { return latency_; } - void set_latency(double latency) { latency_ = latency; } - void update_latency(double delta, double precision) { double_update(&latency_, delta, precision); } -}; - -} // namespace simgrid::kernel::resource - -#endif /* SIO_S22_HPP_ */ diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 8b46ada8ef..bfd588a57c 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -81,8 +81,6 @@ const std::vector surf_host_model_description = { &surf_host_model_init_compound}, {"ptask_L07", "Host model somehow similar to Cas01+CM02+S19 but allowing parallel tasks", &surf_host_model_init_ptask_L07}, - {"sio_S22", "Host model somehow similar to Cas01+CM02+S19 but allowing streaming I/Os", - &surf_host_model_init_sio_S22}, }; const std::vector surf_optimization_mode_description = { diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index f40f731a50..87bee13be9 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -178,7 +178,6 @@ XBT_PUBLIC void surf_host_model_init_current_default(); * equal share of the model to each action. */ XBT_PUBLIC void surf_host_model_init_ptask_L07(); -XBT_PUBLIC void surf_host_model_init_sio_S22(); /* -------------------- * Model Descriptions diff --git a/teshsuite/s4u/io-stream/io-stream.cpp b/teshsuite/s4u/io-stream/io-stream.cpp index 6c7f39f26c..7734156ab2 100644 --- a/teshsuite/s4u/io-stream/io-stream.cpp +++ b/teshsuite/s4u/io-stream/io-stream.cpp @@ -29,19 +29,20 @@ static void streamer(size_t size) XBT_INFO(" Total : %.6f seconds", sg4::Engine::get_clock()); XBT_INFO("[Bob -> Alice] Store and Forward (100 blocks)"); - sg4::IoPtr read = bob_disk->read_async(size / 100); - sg4::CommPtr transfer = sg4::Comm::sendto_async(bob, alice, size / 100); - sg4::IoPtr write = alice_disk->write_async(size / 100); + size_t block_size = size / 100; + sg4::IoPtr read = bob_disk->read_async(block_size); + sg4::CommPtr transfer = sg4::Comm::sendto_async(bob, alice, block_size); + sg4::IoPtr write = alice_disk->write_async(block_size); clock = sg4::Engine::get_clock(); for (int i = 0; i < 99; i++){ read->wait(); - read = bob_disk->read_async(size / 100); + read = bob_disk->read_async(block_size); transfer->wait(); - transfer = sg4::Comm::sendto_async(bob, alice, size / 100); + transfer = sg4::Comm::sendto_async(bob, alice, block_size); write->wait(); - write = alice_disk->write_async(size / 100); + write = alice_disk->write_async(block_size); } read->wait(); @@ -54,7 +55,7 @@ static void streamer(size_t size) sg4::Io::streamto(bob, bob_disk, alice, alice_disk, size); XBT_INFO(" Total : %.6f seconds", sg4::Engine::get_clock() - clock); - XBT_INFO("[Bob -> Alice] Streaming (Write bottleneck)"); + XBT_INFO("[Alice -> Bob] Streaming (Write bottleneck)"); clock = sg4::Engine::get_clock(); sg4::Io::streamto(alice, alice_disk, bob, bob_disk, size); XBT_INFO(" Total : %.6f seconds", sg4::Engine::get_clock() - clock); @@ -109,7 +110,7 @@ int main(int argc, char** argv) zone->add_route(bob->get_netpoint(), alice->get_netpoint(), nullptr, nullptr, {link}, true); bob->create_disk("bob_disk", "1MBps", "500kBps"); - alice->create_disk("alice_disk", 4e6, 4e6); + alice->create_disk("alice_disk", "4MBps", "4MBps"); zone->seal(); diff --git a/teshsuite/s4u/io-stream/io-stream.tesh b/teshsuite/s4u/io-stream/io-stream.tesh index d6b1b6efda..62caef5f35 100644 --- a/teshsuite/s4u/io-stream/io-stream.tesh +++ b/teshsuite/s4u/io-stream/io-stream.tesh @@ -1,25 +1,47 @@ #!/usr/bin/env tesh -$ ${bindir:=.}/io-stream --cfg=host/model:sio_S22 "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n" -> [ 0.000000] [0:maestro@] Configuration change: Set 'host/model' to 'sio_S22' -> [ 0.000000] [0:maestro@] Switching to the S22 model to handle streaming I/Os. -> [ 0.000000] [1:streamer@bob] [Bob -> Alice] Store and Forward (1 block) -> [ 4.000000] [1:streamer@bob] Read : 4.000000 seconds -> [ 6.165599] [1:streamer@bob] Send : 2.165599 seconds -> [ 7.165599] [1:streamer@bob] Write : 1.000000 seconds -> [ 7.165599] [1:streamer@bob] Total : 7.165599 seconds -> [ 7.165599] [1:streamer@bob] [Bob -> Alice] Store and Forward (100 blocks) -> [ 11.165518] [1:streamer@bob] Total : 3.999919 seconds -> [ 11.165518] [1:streamer@bob] [Bob -> Alice] Streaming (Read bottleneck) -> [ 15.165568] [1:streamer@bob] Total : 4.000050 seconds -> [ 15.165568] [1:streamer@bob] [Bob -> Alice] Streaming (Write bottleneck) -> [ 27.234930] [1:streamer@bob] Total : 12.069362 seconds -> [ 27.234930] [1:streamer@bob] Start two 10-second background traffic between Bob and Alice -> [ 27.234930] [1:streamer@bob] [Bob -> Alice] Streaming (Transfer bottleneck) -> [ 45.285733] [1:streamer@bob] Total : 18.050803 seconds -> [ 45.285733] [1:streamer@bob] [Bob -> Alice] Streaming "from disk to memory" (no write) -> [ 49.285783] [1:streamer@bob] Total : 4.000050 seconds -> [ 49.285783] [1:streamer@bob] [Bob -> Alice] Streaming "from memory to disk" (no read) -> [ 51.285833] [1:streamer@bob] Total : 2.000050 seconds -> [ 51.285833] [1:streamer@bob] [Bob -> Bob] Disk to disk (no transfer) -> [ 59.285833] [1:streamer@bob] Total : 8.000000 seconds \ No newline at end of file +$ ${bindir:=.}/io-stream --cfg=network/model:CM02 --cfg=network/crosstraffic:0 "--log=root.fmt:[%10.6r]%e%m%n" +> [ 0.000000] Configuration change: Set 'network/model' to 'CM02' +> [ 0.000000] Configuration change: Set 'network/crosstraffic' to '0' +> [ 0.000000] [Bob -> Alice] Store and Forward (1 block) +> [ 4.000000] Read : 4.000000 seconds +> [ 6.000050] Send : 2.000050 seconds +> [ 7.000050] Write : 1.000000 seconds +> [ 7.000050] Total : 7.000050 seconds +> [ 7.000050] [Bob -> Alice] Store and Forward (100 blocks) +> [ 11.000050] Total : 4.000000 seconds +> [ 11.000050] [Bob -> Alice] Streaming (Read bottleneck) +> [ 15.000100] Total : 4.000050 seconds +> [ 15.000100] [Alice -> Bob] Streaming (Write bottleneck) +> [ 23.000150] Total : 8.000050 seconds +> [ 23.000150] Start two 10-second background traffic between Bob and Alice +> [ 23.000150] [Bob -> Alice] Streaming (Transfer bottleneck) +> [ 29.000200] Total : 6.000050 seconds +> [ 45.000200] [Bob -> Alice] Streaming "from disk to memory" (no write) +> [ 49.000250] Total : 4.000050 seconds +> [ 49.000250] [Bob -> Alice] Streaming "from memory to disk" (no read) +> [ 51.000300] Total : 2.000050 seconds +> [ 51.000300] [Bob -> Bob] Disk to disk (no transfer) +> [ 59.000300] Total : 8.000000 seconds + +$ ${bindir:=.}/io-stream "--log=root.fmt:[%10.6r]%e%m%n" +> [ 0.000000] [Bob -> Alice] Store and Forward (1 block) +> [ 4.000000] Read : 4.000000 seconds +> [ 6.165599] Send : 2.165599 seconds +> [ 7.165599] Write : 1.000000 seconds +> [ 7.165599] Total : 7.165599 seconds +> [ 7.165599] [Bob -> Alice] Store and Forward (100 blocks) +> [ 11.165518] Total : 3.999919 seconds +> [ 11.165518] [Bob -> Alice] Streaming (Read bottleneck) +> [ 15.166169] Total : 4.000651 seconds +> [ 15.166169] [Alice -> Bob] Streaming (Write bottleneck) +> [ 23.166819] Total : 8.000651 seconds +> [ 23.166819] Start two 10-second background traffic between Bob and Alice +> [ 23.166819] [Bob -> Alice] Streaming (Transfer bottleneck) +> [ 29.662315] Total : 6.495496 seconds +> [ 46.860161] [Bob -> Alice] Streaming "from disk to memory" (no write) +> [ 50.860812] Total : 4.000650 seconds +> [ 50.860812] [Bob -> Alice] Streaming "from memory to disk" (no read) +> [ 53.026411] Total : 2.165599 seconds +> [ 53.026411] [Bob -> Bob] Disk to disk (no transfer) +> [ 61.026411] Total : 8.000000 seconds diff --git a/teshsuite/surf/surf_usage/surf_usage.cpp b/teshsuite/surf/surf_usage/surf_usage.cpp index ff7c14a7e7..9318906ba3 100644 --- a/teshsuite/surf/surf_usage/surf_usage.cpp +++ b/teshsuite/surf/surf_usage/surf_usage.cpp @@ -67,7 +67,7 @@ int main(int argc, char** argv) XBT_INFO("actionC state: %s", string_action(stateActionC)); /* Let's do something on it */ - net_model->communicate(hostA, hostB, 150.0, -1.0); + net_model->communicate(hostA, hostB, 150.0, -1.0, false); e.get_impl()->solve(-1.0); do { diff --git a/teshsuite/surf/surf_usage2/surf_usage2.cpp b/teshsuite/surf/surf_usage2/surf_usage2.cpp index 1af5762e9b..0e1428e5f2 100644 --- a/teshsuite/surf/surf_usage2/surf_usage2.cpp +++ b/teshsuite/surf/surf_usage2/surf_usage2.cpp @@ -40,7 +40,7 @@ int main(int argc, char** argv) const_sg_netzone_t as_zone = e.netzone_by_name_or_null("AS0"); auto net_model = as_zone->get_impl()->get_network_model(); - net_model->communicate(hostA, hostB, 150.0, -1.0); + net_model->communicate(hostA, hostB, 150.0, -1.0, false); e.get_impl()->solve(-1.0); /* Takes traces into account. Returns 0.0 */ do { diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 74c3cdfe30..e3970eeae6 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -43,7 +43,6 @@ set(EXTRA_DIST src/surf/network_ns3.hpp src/surf/ns3/ns3_simulator.hpp src/surf/ptask_L07.hpp - src/surf/sio_S22.hpp src/surf/surf_interface.hpp src/surf/xml/simgrid.dtd src/surf/xml/simgrid_dtd.c @@ -361,7 +360,6 @@ set(SURF_SRC src/surf/network_cm02.cpp src/surf/network_constant.cpp src/surf/ptask_L07.cpp - src/surf/sio_S22.cpp src/surf/sg_platf.cpp src/surf/surf_interface.cpp src/surf/xml/platf.hpp -- 2.20.1