include teshsuite/models/cm02-set-lat-bw/cm02-set-lat-bw-bmf.tesh
include teshsuite/models/cm02-set-lat-bw/cm02-set-lat-bw.cpp
include teshsuite/models/cm02-set-lat-bw/cm02-set-lat-bw.tesh
+include teshsuite/models/cm02-tcpgamma/cm02-tcpgamma.cpp
+include teshsuite/models/cm02-tcpgamma/cm02-tcpgamma.tesh
include teshsuite/models/issue105/issue105.cpp
include teshsuite/models/issue105/issue105.tesh
include teshsuite/models/ptask-subflows/ptask-subflows.cpp
the :ref:`network/TCP-gamma <cfg=network/TCP-gamma>` configuration item.
If you want to disable this mechanism altogether (to model e.g. UDP or memory movements), you should set TCP-gamma
-to 0. Otherwise, the time it takes to send 10 Gb of data over a 10 Gb/s link that is otherwise unused is computed as
+to 0. Otherwise, the time it takes to send 10 Gib of data over a 10 Gib/s link that is otherwise unused is computed as
follows. This is always given by :math:`latency + \frac{size}{bandwidth}`, but the bandwidth to use may be the physical
one (10Gb/s) or the one induced by the TCP window, depending on the latency.
- If the link latency is 0, the communication obviously takes one second.
- - If the link latency is 0.00001s, :math:`\frac{gamma}{2\times lat}=209,715,200,000 \approx 209Gb/s` which is larger than the
+ - If the link latency is 0.00001s, :math:`\frac{gamma}{2\times lat}=209,715,200,000 \approx 209Gib/s` which is larger than the
physical bandwidth. So the physical bandwidth is used (you fully use the link) and the communication takes 1.00001s
- - If the link latency is 0.001s, :math:`\frac{gamma}{2\times lat}=2,097,152,000 \approx 2Gb/s`, which is smalled than the
- physical bandwidth. The communication thus fails to fully use the link, and takes 5.12s.
- - With a link latency of 0.1s, :math:`gamma/2\times lat \approx 21Mb/s`, so the communication takes 512 seconds!
+ - If the link latency is 0.001s, :math:`\frac{gamma}{2\times lat}=2,097,152,000 \approx 2Gib/s`, which is smalled than the
+ physical bandwidth. The communication thus fails to fully use the link, and takes about 4.77s.
+ - With a link latency of 0.1s, :math:`gamma/2\times lat \approx 21Mb/s`, so the communication takes about 476.84 + 0.1 seconds!
For more details, please refer to "A Network Model for Simulation of Grid Application" by Henri Casanova and Loris
Marchal (published in 2002, thus the model name).
set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
endforeach()
endif()
-foreach(x cloud-sharing ptask_L07_usage wifi_usage wifi_usage_decay cm02-set-lat-bw issue105 ${optional_examples})
+foreach(x cloud-sharing ptask_L07_usage wifi_usage wifi_usage_decay cm02-set-lat-bw cm02-tcpgamma issue105 ${optional_examples})
add_executable (${x} EXCLUDE_FROM_ALL ${x}/${x}.cpp)
target_link_libraries(${x} simgrid)
set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
--- /dev/null
+/* Copyright (c) 2017-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. */
+
+/**
+ * Test CM02 model wrt TCP gamma
+ *
+ * Platform: single link
+ *
+ * S1 ___[ L1 ]___S2
+ *
+ * Link L1: 1Gb/s, 10ms
+ */
+
+#include "src/kernel/resource/WifiLinkImpl.hpp"
+#include <simgrid/s4u.hpp>
+#include <xbt/config.hpp>
+
+namespace sg4 = simgrid::s4u;
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(cm02_tcpgamma, "Messages specific for this simulation");
+
+static sg4::Link* testlink = nullptr;
+
+void run_ping_test()
+{
+ auto* mailbox = simgrid::s4u::Mailbox::by_name("Test");
+
+ simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("host1"), [mailbox]() {
+ double start_time = simgrid::s4u::Engine::get_clock();
+ static auto message = std::string("message");
+ mailbox->put(&message, 1e10);
+ double end_time = simgrid::s4u::Engine::get_clock();
+ XBT_INFO(" Actual result: Sending 10Gb with bw=%.0eb, lat=%.0es takes %f seconds (TCP_Gamma=%.0f).",
+ testlink->get_bandwidth(), testlink->get_latency(), end_time - start_time,
+ simgrid::config::get_value<double>("network/TCP-gamma"));
+ });
+ simgrid::s4u::Actor::create("receiver", simgrid::s4u::Host::by_name("host2"),
+ [mailbox]() { mailbox->get<std::string>(); });
+ simgrid::s4u::this_actor::sleep_for(500);
+}
+
+/* We need a separate actor so that it can sleep after each test */
+static void main_dispatcher()
+{
+ bool crosstraffic = simgrid::kernel::resource::NetworkModel::cfg_crosstraffic;
+
+ XBT_INFO("TEST: When the latency is 0, the communication takes 1 sec");
+ XBT_INFO(" ");
+ run_ping_test();
+ XBT_INFO("-----------------------------------------------------------");
+ testlink->set_latency(0.00001);
+ XBT_INFO("TEST with latency = 0.00001 sec");
+ XBT_INFO(" Gamma/2lat is about 209 Gb/s, which is larger than the physical bandwidth.");
+ XBT_INFO(" So communication is limited by the physical bandwidth and takes 1.00001 sec.\n");
+ run_ping_test();
+ XBT_INFO("-----------------------------------------------------------");
+ testlink->set_latency(0.001);
+ XBT_INFO("TEST with latency = 0.001 sec");
+ XBT_INFO(" Gamma/2lat is about 2 Gb/s, which is smaller than the physical bandwidth.");
+ XBT_INFO(" So the communication is limited by the latency and takes 4.768372 + 0.001 sec.\n");
+ run_ping_test();
+ XBT_INFO("-----------------------------------------------------------");
+ testlink->set_latency(0.1);
+ XBT_INFO("TEST with latency = 0.1 sec");
+ XBT_INFO(" Gamma/2lat is about 2 Gb/s, which is smaller than the physical bandwidth.");
+ XBT_INFO(" So the communication is limited by the latency and takes 476.837158 + 0.1 sec.\n");
+ run_ping_test();
+ XBT_INFO("-----------------------------------------------------------");
+ XBT_INFO("TEST with latency = 0.001 sec and TCP_Gamma = 0");
+ sg4::Engine::set_config("network/TCP-gamma:0");
+ testlink->set_latency(0.001);
+ XBT_INFO(" The latency=0.001s should make the communication to be limited by the latency, but since gamma=0, the "
+ "physical bandwidth is still used.");
+ XBT_INFO(" So the communication takes 1.001 sec.\n");
+ run_ping_test();
+ XBT_INFO("-----------------------------------------------------------");
+}
+
+int main(int argc, char** argv)
+{
+ // sg4::Engine::set_config("network/model:CM02");
+ sg4::Engine::set_config("network/crosstraffic:0");
+
+ simgrid::s4u::Engine engine(&argc, argv);
+ auto* zone = sg4::create_full_zone("world");
+ auto* host1 = zone->create_host("host1", 1e6)->seal();
+ auto* host2 = zone->create_host("host2", 1e6)->seal();
+ testlink = zone->create_link("L1", 1e10)->seal();
+ zone->add_route(host1->get_netpoint(), host2->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(testlink)});
+
+ simgrid::s4u::Actor::create("dispatcher", engine.host_by_name("host1"), main_dispatcher);
+ engine.run();
+
+ return 0;
+}
--- /dev/null
+#!/usr/bin/env tesh
+
+$ ${bindir:=.}/cm02-tcpgamma --log=root.fmt=%m%n --cfg=network/model:CM02
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/crosstraffic' to '0'
+> Configuration change: Set 'network/model' to 'CM02'
+> TEST: When the latency is 0, the communication takes 1 sec
+>
+> Actual result: Sending 10Gb with bw=1e+10b, lat=0e+00s takes 1.000000 seconds (TCP_Gamma=4194304).
+> -----------------------------------------------------------
+> TEST with latency = 0.00001 sec
+> Gamma/2lat is about 209 Gb/s, which is larger than the physical bandwidth.
+> So communication is limited by the physical bandwidth and takes 1.00001 sec.
+>
+> Actual result: Sending 10Gb with bw=1e+10b, lat=1e-05s takes 1.000010 seconds (TCP_Gamma=4194304).
+> -----------------------------------------------------------
+> TEST with latency = 0.001 sec
+> Gamma/2lat is about 2 Gb/s, which is smaller than the physical bandwidth.
+> So the communication is limited by the latency and takes 4.768372 + 0.001 sec.
+>
+> Actual result: Sending 10Gb with bw=1e+10b, lat=1e-03s takes 4.769372 seconds (TCP_Gamma=4194304).
+> -----------------------------------------------------------
+> TEST with latency = 0.1 sec
+> Gamma/2lat is about 2 Gb/s, which is smaller than the physical bandwidth.
+> So the communication is limited by the latency and takes 476.837158 + 0.1 sec.
+>
+> Actual result: Sending 10Gb with bw=1e+10b, lat=1e-01s takes 476.937158 seconds (TCP_Gamma=4194304).
+> -----------------------------------------------------------
+> TEST with latency = 0.001 sec and TCP_Gamma = 0
+> Configuration change: Set 'network/TCP-gamma' to '0'
+> The latency=0.001s should make the communication to be limited by the latency, but since gamma=0, the physical bandwidth is still used.
+> So the communication takes 1.001 sec.
+>
+> Actual result: Sending 10Gb with bw=1e+10b, lat=1e-03s takes 1.001000 seconds (TCP_Gamma=0).
+> -----------------------------------------------------------
\ No newline at end of file