### Determine the assembly flavor that we need today
set(HAVE_RAW_CONTEXTS 0)
include(CMakeDetermineSystem)
+foreach(arch i686 x86_64 arm64)
+ set(SIMGRID_PROCESSOR_${arch} 0)
+endforeach()
IF(CMAKE_SYSTEM_PROCESSOR MATCHES ".86|AMD64|amd64")
IF(CMAKE_SIZEOF_VOID_P EQUAL 4) # 32 bits
message(STATUS "System processor: i686 (${CMAKE_SYSTEM_PROCESSOR}, 32 bits)")
set(SIMGRID_PROCESSOR_i686 1)
- set(SIMGRID_PROCESSOR_x86_64 0)
ELSE()
message(STATUS "System processor: x86_64 (${CMAKE_SYSTEM_PROCESSOR}, 64 bits)")
- set(SIMGRID_PROCESSOR_i686 0)
set(SIMGRID_PROCESSOR_x86_64 1)
ENDIF()
if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
else()
set(HAVE_RAW_CONTEXTS 1)
endif()
+ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
+ message(STATUS "System processor: arm64 (${CMAKE_SYSTEM_PROCESSOR}, 64 bits)")
+ set(SIMGRID_PROCESSOR_arm64 1)
ELSE()
- set(SIMGRID_PROCESSOR_i686 0)
- set(SIMGRID_PROCESSOR_x86_64 0)
+ message(STATUS "System processor (${CMAKE_SYSTEM_PROCESSOR}) not explicitly accounted for")
ENDIF()
include(CheckFunctionExists)
S4U:
- Activity::set_remaining() is not public anymore. Use for example
Comm::set_payload_size() to change the size of the simulated data.
+ - New function: Engine::flatify_platform(), to get a fully detailed vision of the
+ configured platform.
Kernel:
- optimize an internal datastructure, leading to a potentially big
- New section in the user guide on the provided performance models.
- New section presenting some technical good practices for (potential) contributors.
- Add a section on errors and exceptions to the API documentation.
+ - Move the s4u examples to a section on their own to ease navigation.
Fixed bugs (FG#.. -> FramaGit bugs; FG!.. -> FG merge requests)
(FG: issues on Framagit; GH: issues on GitHub)
# Either by copying it in your tree, or (recommended) by using the
# version automatically installed by SimGrid.
#
-# 2. Afterward, if you have CMake >= 2.8.12, this will define a
-# target called 'SimGrid::Simgrid'. Use it as:
+# 2. This will define a target called 'SimGrid::Simgrid'. Use it as:
# target_link_libraries(your-simulator SimGrid::SimGrid)
#
-# With older CMake (< 2.8.12), it simply defines several variables:
-# SimGrid_INCLUDE_DIR - the SimGrid include directories
-# SimGrid_LIBRARY - link your simulator against it to use SimGrid
-# Use as:
-# include_directories("${SimGrid_INCLUDE_DIR}" SYSTEM)
-# target_link_libraries(your-simulator ${SimGrid_LIBRARY})
-#
-# In both cases, it also define a SimGrid_VERSION macro, that you
-# can use to deal with API evolutions as follows:
+# It also defines a SimGrid_VERSION macro, that you can use to deal with API
+# evolutions as follows:
#
# #if SimGrid_VERSION < 31800
# (code to use if the installed version is lower than v3.18)
VERSION_VAR SimGrid_VERSION
)
-if (SimGrid_FOUND AND NOT CMAKE_VERSION VERSION_LESS 2.8.12)
+if (SimGrid_FOUND)
add_library(SimGrid::SimGrid SHARED IMPORTED)
set_target_properties(SimGrid::SimGrid PROPERTIES
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${SimGrid_INCLUDE_DIR}
InfiniBand network behavior can be modeled through 3 parameters
``smpi/IB-penalty-factors:"βe;βs;γs"``, as explained in `the PhD
-thesis of Jean-Marc Vincent
+thesis of Jérôme Vienne
<http://mescal.imag.fr/membres/jean-marc.vincent/index.html/PhD/Vienne.pdf>`_ (in French)
or more concisely in `this paper <https://hal.inria.fr/hal-00953618/document>`_,
even if that paper does only describe models for myrinet and ethernet.
SIMGRID_REGISTER_PLUGIN(id,desc,init)= \
XBT_PUBLIC= \
XBT_PUBLIC_DATA=extern \
- XBT_PUBLIC= \
- XBT_INLINE= \
- XBT_ALWAYS_INLINE= \
XBT_PRIVATE= \
+ XBT_ALWAYS_INLINE= \
+ XBT_ATTRIB_NOINLINE= \
XBT_ATTRIB_NORETURN= \
XBT_ATTRIB_UNUSED= \
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(cname,parent,desc)= \
.. code-block:: cmake
- cmake_minimum_required(VERSION 2.8.8)
+ cmake_minimum_required(VERSION 2.8.12)
project(MyFirstSimulator)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
.. doxygenfunction:: simgrid::s4u::Engine::load_deployment
.. doxygenfunction:: simgrid::s4u::Engine::load_platform
+ .. doxygenfunction:: simgrid::s4u::Engine::flatify_platform
.. doxygenfunction:: simgrid::s4u::Engine::register_actor(const std::string &name)
.. doxygenfunction:: simgrid::s4u::Engine::register_actor(const std::string &name, F code)
.. doxygenfunction:: simgrid::s4u::Engine::register_default(const std::function< void(int, char **)> &code)
.. doxygenfunction:: simgrid::s4u::Link::get_latency() const
.. doxygenfunction:: simgrid::s4u::Link::get_name() const
.. doxygenfunction:: simgrid::s4u::Link::get_sharing_policy() const
+ .. doxygenfunction:: simgrid::s4u::Link::get_concurrency_limit() const
.. doxygenfunction:: simgrid::s4u::Link::get_usage() const
.. doxygenfunction:: simgrid::s4u::Link::is_used() const
-cmake_minimum_required(VERSION 2.8.8)
+cmake_minimum_required(VERSION 2.8.12)
project(tuto_disk)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
-cmake_minimum_required(VERSION 2.8.8)
+cmake_minimum_required(VERSION 2.8.12)
project(tuto_network)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
sg4::CommPtr comm = mailbox->put_init(computation_amount, 7e6);
exec->set_name("exec on sender")->add_successor(comm)->start();
- comm->set_name("comm to receiver")->vetoable_start();
+ comm->set_name("comm to receiver")->start();
exec->wait();
comm->wait();
}
sg4::CommPtr comm = mailbox->get_init()->set_dst_data((void**)&received, sizeof(double));
comm->set_name("comm from sender")->add_successor(exec)->start();
- exec->set_name("exec on receiver")->vetoable_start();
+ exec->set_name("exec on receiver")->start();
comm->wait();
exec->wait();
p Testing with default compound
$ ${bindir:=.}/s4u-comm-dependent ${platfdir}/small_platform.xml --log=s4u_activity.t:verbose "--log=root.fmt:[%6.2r]%e(%i:%a@%h)%e%m%n"
+> [ 0.00] (1:sender@Tremblay) 'exec on sender' is assigned to a resource and all dependencies are solved. Let's start
+> [ 0.00] (2:receiver@Jupiter) 'comm from sender' is assigned to a resource and all dependencies are solved. Let's start
> [ 2.00] (1:sender@Tremblay) Remove a dependency from 'exec on sender' on 'comm to receiver'
> [ 2.00] (1:sender@Tremblay) 'comm to receiver' is assigned to a resource and all dependencies are solved. Let's start
> [ 3.07] (2:receiver@Jupiter) Remove a dependency from 'comm from sender' on 'exec on receiver'
// Set the parameters (the name is for logging purposes only)
// + parent and child end after 1 second
- parent->set_name("parent")->set_flops_amount(tremblay->get_speed())->vetoable_start();
- transfer->set_name("transfer")->set_payload_size(125e6)->vetoable_start();
- child->set_name("child")->set_flops_amount(jupiter->get_speed())->vetoable_start();
+ parent->set_name("parent")->set_flops_amount(tremblay->get_speed())->start();
+ transfer->set_name("transfer")->set_payload_size(125e6)->start();
+ child->set_name("child")->set_flops_amount(jupiter->get_speed())->start();
// Schedule the different activities
parent->set_host(tremblay);
/* creation of a single Exec that will poorly fail when the workstation will stop */
XBT_INFO("First test: sequential Exec activity");
- sg4::ExecPtr exec = sg4::Exec::init()->set_name("Poor task")->set_flops_amount(2e10)->vetoable_start();
+ sg4::ExecPtr exec = sg4::Exec::init()->set_name("Poor task")->set_flops_amount(2e10)->start();
XBT_INFO("Schedule Activity '%s' on 'Faulty Host'", exec->get_cname());
exec->set_host(faulty);
/* Add a child Exec that depends on the Poor task' */
sg4::ExecPtr child = sg4::Exec::init()->set_name("Child")->set_flops_amount(2e10)->set_host(safe);
exec->add_successor(child);
- child->vetoable_start();
+ child->start();
XBT_INFO("Run the simulation");
e.run();
e.run();
XBT_INFO("Second test: parallel Exec activity");
- exec = sg4::Exec::init()->set_name("Poor parallel task")->set_flops_amounts({2e10, 2e10})->vetoable_start();
+ exec = sg4::Exec::init()->set_name("Poor parallel task")->set_flops_amounts({2e10, 2e10})->start();
XBT_INFO("Schedule Activity '%s' on 'Safe Host' and 'Faulty Host'", exec->get_cname());
exec->set_hosts({safe, faulty});
/* Add a child Exec that depends on the Poor parallel task' */
child = sg4::Exec::init()->set_name("Child")->set_flops_amount(2e10)->set_host(safe);
exec->add_successor(child);
- child->vetoable_start();
+ child->start();
XBT_INFO("Run the simulation");
e.run();
child->set_name("child")->set_flops_amount(carl->get_speed());
// Schedule and try to start the different activities
- parent->set_host(bob)->vetoable_start();
- write_output->set_disk(bob->get_disks().front())->vetoable_start();
- read_input->set_disk(carl->get_disks().front())->vetoable_start();
- child->set_host(carl)->vetoable_start();
+ parent->set_host(bob)->start();
+ write_output->set_disk(bob->get_disks().front())->start();
+ read_input->set_disk(carl->get_disks().front())->start();
+ child->set_host(carl)->start();
e.run();
second_parent->set_host(fafard);
// Start all activities that can actually start.
- first_parent->vetoable_start();
- second_parent->vetoable_start();
- child->vetoable_start();
+ first_parent->start();
+ second_parent->start();
+ child->start();
while (child->get_state() != sg4::Activity::State::FINISHED) {
e.run();
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(s4u_chord);
namespace sg4 = simgrid::s4u;
+void ChordMessage::destroy(void* message)
+{
+ delete static_cast<ChordMessage*>(message);
+}
+
/* Returns whether an id belongs to the interval [start, end].
*
- * The parameters are normalized to make sure they are between 0 and nb_keys - 1).
+ * The parameters are normalized to make sure they are between 0 and nb_keys_ - 1).
* 1 belongs to [62, 3]
* 1 does not belong to [3, 62]
* 63 belongs to [62, 3]
* @param end upper bound
* @return true if id in in [start, end]
*/
-static bool is_in_interval(int id, int start, int end)
+bool Node::is_in_interval(int id, int start, int end)
{
- int i = id % nb_keys;
- int s = start % nb_keys;
- int e = end % nb_keys;
+ int i = id % nb_keys_;
+ int s = start % nb_keys_;
+ int e = end % nb_keys_;
// make sure end >= start and id >= start
if (e < s) {
- e += nb_keys;
+ e += nb_keys_;
}
if (i < s) {
- i += nb_keys;
+ i += nb_keys_;
}
return i <= e;
}
-void ChordMessage::destroy(void* message)
+void Node::set_parameters(int nb_bits, int nb_keys, int timeout)
{
- delete static_cast<ChordMessage*>(message);
+ nb_bits_ = nb_bits;
+ nb_keys_ = nb_keys;
+ timeout_ = timeout;
}
/* Initializes the current node as the first one of the system */
// initialize my node
id_ = std::stoi(args[1]);
XBT_DEBUG("Initialize node with id: %d", id_);
- random.set_seed(id_);
+ random_.set_seed(id_);
mailbox_ = sg4::Mailbox::by_name(std::to_string(id_));
- next_finger_to_fix = 0;
- fingers_.resize(nb_bits, id_);
+ next_finger_to_fix_ = 0;
+ fingers_.resize(nb_bits_, id_);
if (args.size() == 3) { // first ring
deadline_ = std::stod(args[2]);
} else {
setFinger(0, successor_id);
printFingerTable();
- joined = true;
+ joined_ = true;
}
}
{
XBT_INFO("Well Guys! I Think it's time for me to leave ;)");
notifyAndQuit();
- joined = false;
+ joined_ = false;
}
/* Notifies the successor and the predecessor of the current node before leaving */
XBT_DEBUG("Sending a 'PREDECESSOR_LEAVING' to my successor %d", fingers_[0]);
try {
- sg4::Mailbox::by_name(std::to_string(fingers_[0]))->put(pred_msg, 10, timeout);
+ sg4::Mailbox::by_name(std::to_string(fingers_[0]))->put(pred_msg, 10, timeout_);
} catch (const simgrid::TimeoutException&) {
XBT_DEBUG("Timeout expired when sending a 'PREDECESSOR_LEAVING' to my successor %d", fingers_[0]);
delete pred_msg;
XBT_DEBUG("Sending a 'SUCCESSOR_LEAVING' to my predecessor %d", pred_id_);
try {
- sg4::Mailbox::by_name(std::to_string(pred_id_))->put(succ_msg, 10, timeout);
+ sg4::Mailbox::by_name(std::to_string(pred_id_))->put(succ_msg, 10, timeout_);
} catch (const simgrid::TimeoutException&) {
XBT_DEBUG("Timeout expired when sending a 'SUCCESSOR_LEAVING' to my predecessor %d", pred_id_);
delete succ_msg;
void Node::randomLookup()
{
int res = id_;
- int random_index = random.uniform_int(0, nb_bits - 1);
+ int random_index = random_.uniform_int(0, nb_bits_ - 1);
int random_id = fingers_[random_index];
XBT_DEBUG("Making a lookup request for id %d", random_id);
if (random_id != id_)
/* Sets a finger of the current node.
*
* @param node the current node
- * @param finger_index index of the finger to set (0 to nb_bits - 1)
+ * @param finger_index index of the finger to set (0 to nb_bits_ - 1)
* @param id the id to set for this finger
*/
void Node::setFinger(int finger_index, int id)
void Node::fixFingers()
{
XBT_DEBUG("Fixing fingers");
- int id = findSuccessor(id_ + (1U << next_finger_to_fix));
+ int id = findSuccessor(id_ + (1U << next_finger_to_fix_));
if (id != -1) {
- if (id != fingers_[next_finger_to_fix]) {
- setFinger(next_finger_to_fix, id);
+ if (id != fingers_[next_finger_to_fix_]) {
+ setFinger(next_finger_to_fix_, id);
printFingerTable();
}
- next_finger_to_fix = (next_finger_to_fix + 1) % nb_bits;
+ next_finger_to_fix_ = (next_finger_to_fix_ + 1) % nb_bits_;
}
}
if (XBT_LOG_ISENABLED(s4u_chord, xbt_log_priority_verbose)) {
XBT_VERB("My finger table:");
XBT_VERB("Start | Succ");
- for (int i = 0; i < nb_bits; i++) {
- XBT_VERB(" %3u | %3d", (id_ + (1U << i)) % nb_keys, fingers_[i]);
+ for (int i = 0; i < nb_bits_; i++) {
+ XBT_VERB(" %3u | %3d", (id_ + (1U << i)) % nb_keys_, fingers_[i]);
}
XBT_VERB("Predecessor: %d", pred_id_);
XBT_DEBUG("Sending a 'Predecessor Alive' request to my predecessor %d", pred_id_);
try {
- mailbox->put(message, 10, timeout);
+ mailbox->put(message, 10, timeout_);
} catch (const simgrid::TimeoutException&) {
XBT_DEBUG("Failed to send the 'Predecessor Alive' request to %d", pred_id_);
delete message;
sg4::CommPtr comm = return_mailbox->get_async<ChordMessage>(&answer);
try {
- comm->wait_for(timeout);
+ comm->wait_for(timeout_);
XBT_DEBUG("Received the answer to my 'Predecessor Alive': my predecessor %d is alive", pred_id_);
delete answer;
} catch (const simgrid::TimeoutException&) {
// send a "Get Predecessor" request to ask_to_id
XBT_DEBUG("Sending a 'Get Predecessor' request to %d", ask_to);
try {
- mailbox->put(message, 10, timeout);
+ mailbox->put(message, 10, timeout_);
} catch (const simgrid::TimeoutException&) {
XBT_DEBUG("Failed to send the 'Get Predecessor' request to %d", ask_to);
delete message;
sg4::CommPtr comm = return_mailbox->get_async<ChordMessage>(&answer);
try {
- comm->wait_for(timeout);
+ comm->wait_for(timeout_);
XBT_DEBUG("Received the answer to my 'Get Predecessor' request: the predecessor of node %d is %d", ask_to,
answer->answer_id);
predecessor_id = answer->answer_id;
*/
int Node::closestPrecedingFinger(int id)
{
- for (int i = nb_bits - 1; i >= 0; i--) {
+ for (int i = nb_bits_ - 1; i >= 0; i--) {
if (is_in_interval(fingers_[i], id_ + 1, id - 1)) {
return fingers_[i];
}
// send a "Find Successor" request to ask_to_id
XBT_DEBUG("Sending a 'Find Successor' request to %d for id %d", ask_to, id);
try {
- mailbox->put(message, 10, timeout);
+ mailbox->put(message, 10, timeout_);
} catch (const simgrid::TimeoutException&) {
XBT_DEBUG("Failed to send the 'Find Successor' request to %d for id %d", ask_to, id_);
delete message;
sg4::CommPtr comm = return_mailbox->get_async<ChordMessage>(&answer);
try {
- comm->wait_for(timeout);
+ comm->wait_for(timeout_);
XBT_DEBUG("Received the answer to my 'Find Successor' request for id %d: the successor of key %d is %d",
answer->request_id, id_, answer->answer_id);
successor = answer->answer_id;
if (known_id_ == -1) {
setPredecessor(-1); // -1 means that I have no predecessor
printFingerTable();
- joined = true;
+ joined_ = true;
} else {
join(known_id_);
}
- if (not joined)
+ if (not joined_)
return;
ChordMessage* message = nullptr;
double now = sg4::Engine::get_clock();
XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_chord, "Messages specific for this s4u example");
-int nb_bits = 24;
-int nb_keys = 0;
-int timeout = 50;
-
int main(int argc, char* argv[])
{
simgrid::s4u::Engine e(&argc, argv);
argv[0], argv[0]);
std::string platform_file(argv[argc - 2]);
std::string deployment_file(argv[argc - 1]);
+ int nb_bits = 24;
+ int timeout = 50;
for (const auto& option : std::vector<std::string>(argv + 1, argv + argc - 2)) {
if (option.rfind("-nb_bits=", 0) == 0) {
nb_bits = std::stoi(option.substr(option.find('=') + 1));
xbt_die("Invalid chord option '%s'", option.c_str());
}
}
+ int nb_keys = 1U << nb_bits;
+ XBT_DEBUG("Sets nb_keys to %d", nb_keys);
e.load_platform(platform_file);
/* Global initialization of the Chord simulation. */
- nb_keys = 1U << nb_bits;
- XBT_DEBUG("Sets nb_keys to %d", nb_keys);
+ Node::set_parameters(nb_bits, nb_keys, timeout);
e.register_actor<Node>("node");
e.load_deployment(deployment_file);
constexpr double PERIODIC_LOOKUP_DELAY = 10;
constexpr double SLEEP_DELAY = 4.9999;
-extern int nb_bits;
-extern int nb_keys;
-extern int timeout;
-
/* Types of tasks exchanged between nodes. */
enum class MessageType {
FIND_SUCCESSOR,
};
class Node {
+ inline static int nb_bits_;
+ inline static int nb_keys_;
+ inline static int timeout_;
+
int known_id_ = -1;
double start_time_ = -1;
double deadline_ = -1;
- bool joined = false;
+ bool joined_ = false;
int id_; // my id
int pred_id_ = -1; // predecessor id
- simgrid::xbt::random::XbtRandom random; // random number generator for this node
- sg4::Mailbox* mailbox_; // my mailbox
+ simgrid::xbt::random::XbtRandom random_; // random number generator for this node
+ sg4::Mailbox* mailbox_; // my mailbox
std::vector<int> fingers_; // finger table,(fingers[0] is my successor)
- int next_finger_to_fix; // index of the next finger to fix in fix_fingers()
+ int next_finger_to_fix_; // index of the next finger to fix in fix_fingers()
+
+ static bool is_in_interval(int id, int start, int end);
public:
+ static void set_parameters(int nb_bits, int nb_keys, int timeout);
+
explicit Node(std::vector<std::string> args);
Node(const Node&) = delete;
Node& operator=(const Node&) = delete;
// Start the activities.
first_parent->start();
second_parent->start();
- // child uses a vetoable start to force it to wait for the completion of its predecessors
- child->vetoable_start();
+ child->start();
// wait for the completion of all activities
while (not pending_execs.empty()) {
#!/usr/bin/env tesh
$ ${bindir:=.}/s4u-exec-dependent ${platfdir}/small_platform.xml --log=s4u_activity.t:verbose "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n"
+> [ 0.000000] (1:worker@Fafard) 'parent 1' is assigned to a resource and all dependencies are solved. Let's start
+> [ 0.000000] (1:worker@Fafard) 'parent 2' is assigned to a resource and all dependencies are solved. Let's start
> [ 0.000000] (1:worker@Fafard) Activity 'child' vetoed. Dependencies: NOT solved; Ressources: NOT assigned
> [ 2.000000] (1:worker@Fafard) Remove a dependency from 'parent 1' on 'child'
> [ 2.000000] (1:worker@Fafard) Exec 'parent 1' is complete
double computation_amount = sg4::this_actor::get_host()->get_speed();
// Create an unassigned activity and start it. It will not actually start, because it's not assigned to any host yet
- sg4::ExecPtr exec = sg4::Exec::init()->set_flops_amount(computation_amount)->set_name("exec")->vetoable_start();
+ sg4::ExecPtr exec = sg4::Exec::init()->set_flops_amount(computation_amount)->set_name("exec")->start();
// Wait for a while
sg4::this_actor::sleep_for(10);
// Start the activities.
bob_compute->start();
- bob_write->vetoable_start();
- carl_read->vetoable_start();
- carl_compute->vetoable_start();
+ bob_write->start();
+ carl_read->start();
+ carl_compute->start();
// wait for the completion of all activities
while (not pending_activities.empty()) {
! output sort
$ ${bindir:=.}/s4u-io-dependent ${platfdir}/hosts_with_disks.xml --log=s4u_activity.t:verbose "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n"
+> [ 0.000000] (1:bob@bob) 'bob compute' is assigned to a resource and all dependencies are solved. Let's start
> [ 1.000000] (1:bob@bob) 'bob write' is assigned to a resource and all dependencies are solved. Let's start
> [ 1.000000] (1:bob@bob) Remove a dependency from 'bob compute' on 'bob write'
> [ 1.000000] (1:bob@bob) Activity 'bob compute' is complete
XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
namespace sg4 = simgrid::s4u;
-double start_time;
-std::unordered_map<int, std::string> workernames;
-std::unordered_map<int, std::string> masternames;
-
-static void master(std::vector<std::string> args)
+struct MasterWorkerNames {
+ std::string master;
+ std::string worker;
+};
+using MasterWorkerNamesMap = std::unordered_map<int, MasterWorkerNames>;
+
+struct Payload {
+ double msg_size;
+ double start_time;
+};
+
+static void master(MasterWorkerNamesMap& names, const std::vector<std::string>& args)
{
xbt_assert(args.size() == 4, "Strange number of arguments expected 3 got %zu", args.size() - 1);
double msg_size = std::stod(args[1]);
int id = std::stoi(args[3]); // unique id to control statistics
- /* worker name */
- workernames[id] = args[2];
+ /* master and worker names */
+ names.emplace(id, MasterWorkerNames{sg4::Host::current()->get_name(), args[2]});
sg4::Mailbox* mbox = sg4::Mailbox::by_name(args[3]);
- masternames[id] = sg4::Host::current()->get_name();
-
- auto* payload = new double(msg_size);
-
- /* time measurement */
- start_time = sg4::Engine::get_clock();
+ auto* payload = new Payload{msg_size, sg4::Engine::get_clock()};
mbox->put(payload, static_cast<uint64_t>(msg_size));
XBT_DEBUG("Finished");
}
-static void worker(std::vector<std::string> args)
+static void worker(const MasterWorkerNamesMap& names, const std::vector<std::string>& args)
{
xbt_assert(args.size() == 2, "Strange number of arguments expected 1 got %zu", args.size() - 1);
XBT_DEBUG("Worker started");
- auto payload = mbox->get_unique<double>();
+ auto payload = mbox->get_unique<Payload>();
- double elapsed_time = sg4::Engine::get_clock() - start_time;
+ double elapsed_time = sg4::Engine::get_clock() - payload->start_time;
- XBT_INFO("FLOW[%d] : Receive %.0f bytes from %s to %s", id, *payload, masternames.at(id).c_str(),
- workernames.at(id).c_str());
+ XBT_INFO("FLOW[%d] : Receive %.0f bytes from %s to %s", id, payload->msg_size, names.at(id).master.c_str(),
+ names.at(id).worker.c_str());
XBT_DEBUG("FLOW[%d] : transferred in %f seconds", id, elapsed_time);
XBT_DEBUG("Finished");
e.load_platform(argv[1]);
- e.register_function("master", master);
- e.register_function("worker", worker);
+ MasterWorkerNamesMap master_worker_names;
+ e.register_function("master", [&master_worker_names](auto args) { master(master_worker_names, args); });
+ e.register_function("worker", [&master_worker_names](auto args) { worker(master_worker_names, args); });
e.load_deployment(argv[2]);
XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "a sample log category");
namespace sg4 = simgrid::s4u;
-sg4::MutexPtr mtx = nullptr;
-sg4::ConditionVariablePtr cv = nullptr;
-bool ready = false;
-
-static void competitor(int id)
+static void competitor(int id, sg4::ConditionVariablePtr cv, sg4::MutexPtr mtx, std::shared_ptr<bool> ready)
{
XBT_INFO("Entering the race...");
std::unique_lock lck(*mtx);
- while (not ready) {
+ while (not *ready) {
auto now = sg4::Engine::get_clock();
if (cv->wait_until(lck, now + (id+1)*0.25) == std::cv_status::timeout) {
XBT_INFO("Out of wait_until (timeout)");
XBT_INFO("Running!");
}
-static void go()
+static void go(sg4::ConditionVariablePtr cv, sg4::MutexPtr mtx, std::shared_ptr<bool> ready)
{
XBT_INFO("Are you ready? ...");
sg4::this_actor::sleep_for(3);
std::unique_lock lck(*mtx);
XBT_INFO("Go go go!");
- ready = true;
+ *ready = true;
cv->notify_all();
}
static void main_actor()
{
- mtx = sg4::Mutex::create();
- cv = sg4::ConditionVariable::create();
+ auto mtx = sg4::Mutex::create();
+ auto cv = sg4::ConditionVariable::create();
+ auto ready = std::make_shared<bool>(false);
auto host = sg4::this_actor::get_host();
for (int i = 0; i < 10; ++i)
- sg4::Actor::create("competitor", host, competitor, i);
- sg4::Actor::create("go", host, go);
+ sg4::Actor::create("competitor", host, competitor, i, cv, mtx, ready);
+ sg4::Actor::create("go", host, go, cv, mtx, ready);
}
int main(int argc, char* argv[])
XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "a sample log category");
namespace sg4 = simgrid::s4u;
-std::string data;
-bool done = false;
-
-static void worker_fun(sg4::ConditionVariablePtr cv, sg4::MutexPtr mutex)
+static void worker_fun(sg4::ConditionVariablePtr cv, sg4::MutexPtr mutex, std::string& data, bool& done)
{
std::unique_lock lock(*mutex);
{
auto mutex = sg4::Mutex::create();
auto cv = sg4::ConditionVariable::create();
- data = "Example data";
- auto worker = sg4::Actor::create("worker", sg4::Host::by_name("Jupiter"), worker_fun, cv, mutex);
+ std::string data = "Example data";
+ bool done = false;
+
+ auto worker = sg4::Actor::create("worker", sg4::Host::by_name("Jupiter"), worker_fun, cv, mutex, std::ref(data),
+ std::ref(done));
// wait for the worker
- cv->wait(std::unique_lock<sg4::Mutex>(*mutex), []() { return done; });
+ cv->wait(std::unique_lock<sg4::Mutex>(*mutex), [&done]() { return done; });
XBT_INFO("data is now '%s'.", data.c_str());
worker->join();
$ ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs.thres:verbose --log=root.fmt="[Checker]%e%m%n" -- ${bindir:=.}/s4u-synchro-mutex --cfg=actors:1 --log=s4u_test.thres:critical --log=root.fmt="[App%e%e%e%e]%e%m%n"
> [App ] Configuration change: Set 'actors' to '1'
> [Checker] Start a DFS exploration. Reduction is: dpor.
-> [Checker] Execute 1: MUTEX_ASYNC_LOCK(mutex: 0, owner:1) (stack depth: 1, state: 1, 0 interleaves)
-> [Checker] Execute 1: MUTEX_WAIT(mutex: 0, owner:1) (stack depth: 2, state: 2, 0 interleaves)
-> [Checker] Execute 1: MUTEX_UNLOCK(mutex: 0, owner:-1) (stack depth: 3, state: 3, 0 interleaves)
-> [Checker] Execute 2: MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (stack depth: 4, state: 4, 0 interleaves)
-> [Checker] Execute 2: MUTEX_WAIT(mutex: 0, owner:2) (stack depth: 5, state: 5, 0 interleaves)
-> [Checker] Execute 2: MUTEX_UNLOCK(mutex: 0, owner:-1) (stack depth: 6, state: 6, 0 interleaves)
+> [Checker] Execute 1: MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (stack depth: 1, state: 1, 0 interleaves)
+> [Checker] Execute 1: MUTEX_WAIT(mutex: 0, owner: 1) (stack depth: 2, state: 2, 0 interleaves)
+> [Checker] Execute 1: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 3, state: 3, 0 interleaves)
+> [Checker] Execute 2: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 4, state: 4, 0 interleaves)
+> [Checker] Execute 2: MUTEX_WAIT(mutex: 0, owner: 2) (stack depth: 5, state: 5, 0 interleaves)
+> [Checker] Execute 2: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 6, state: 6, 0 interleaves)
> [Checker] Execution came to an end at 1;1;1;2;2;2;0 (state: 7, depth: 7)
> [Checker] Backtracking from 1;1;1;2;2;2;0
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 0, owner:-1) (state=3)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=4)
+> [Checker] MUTEX_UNLOCK(mutex: 0, owner: -1) (state=3)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=4)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_WAIT(mutex: 0, owner:1) (state=2)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=4)
+> [Checker] MUTEX_WAIT(mutex: 0, owner: 1) (state=2)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=4)
> [Checker] Dependent Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:1) (state=1)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=4)
-> [Checker] Execute 2: MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (stack depth: 1, state: 1, 0 interleaves)
-> [Checker] Execute 1: MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (stack depth: 2, state: 8, 0 interleaves)
-> [Checker] Execute 2: MUTEX_WAIT(mutex: 0, owner:2) (stack depth: 3, state: 9, 0 interleaves)
-> [Checker] Execute 2: MUTEX_UNLOCK(mutex: 0, owner:1) (stack depth: 4, state: 10, 0 interleaves)
-> [Checker] Execute 1: MUTEX_WAIT(mutex: 0, owner:1) (stack depth: 5, state: 11, 0 interleaves)
-> [Checker] Execute 1: MUTEX_UNLOCK(mutex: 0, owner:-1) (stack depth: 6, state: 12, 0 interleaves)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (state=1)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=4)
+> [Checker] Execute 2: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 1, state: 1, 0 interleaves)
+> [Checker] Execute 1: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 2, state: 8, 0 interleaves)
+> [Checker] Execute 2: MUTEX_WAIT(mutex: 0, owner: 2) (stack depth: 3, state: 9, 0 interleaves)
+> [Checker] Execute 2: MUTEX_UNLOCK(mutex: 0, owner: 1) (stack depth: 4, state: 10, 0 interleaves)
+> [Checker] Execute 1: MUTEX_WAIT(mutex: 0, owner: 1) (stack depth: 5, state: 11, 0 interleaves)
+> [Checker] Execute 1: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 6, state: 12, 0 interleaves)
> [Checker] Execution came to an end at 2;1;2;2;1;1;0 (state: 13, depth: 7)
> [Checker] Backtracking from 2;1;2;2;1;1;0
> [Checker] Dependent Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 0, owner:1) (state=10)
-> [Checker] MUTEX_WAIT(mutex: 0, owner:1) (state=11)
+> [Checker] MUTEX_UNLOCK(mutex: 0, owner: 1) (state=10)
+> [Checker] MUTEX_WAIT(mutex: 0, owner: 1) (state=11)
> [Checker] Backtracking from 2;1;2;2
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=8)
-> [Checker] MUTEX_WAIT(mutex: 0, owner:2) (state=9)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=8)
+> [Checker] MUTEX_WAIT(mutex: 0, owner: 2) (state=9)
> [Checker] Dependent Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=1)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=8)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=1)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=8)
> [Checker] DFS exploration ended. 13 unique states visited; 3 backtracks (18 transition replays, 3 states visited overall)
$ ${bindir:=.}/../../../bin/simgrid-mc --log=mc_dfs.thres:verbose --log=root.fmt="[Checker]%e%m%n" -- ${bindir:=.}/s4u-synchro-mutex --cfg=actors:2 --log=s4u_test.thres:critical --log=root.fmt="[App%e%e%e%e]%e%m%n"
> [App ] Configuration change: Set 'actors' to '2'
> [Checker] Start a DFS exploration. Reduction is: dpor.
-> [Checker] Execute 1: MUTEX_ASYNC_LOCK(mutex: 0, owner:1) (stack depth: 1, state: 1, 0 interleaves)
-> [Checker] Execute 1: MUTEX_WAIT(mutex: 0, owner:1) (stack depth: 2, state: 2, 0 interleaves)
-> [Checker] Execute 1: MUTEX_UNLOCK(mutex: 0, owner:-1) (stack depth: 3, state: 3, 0 interleaves)
-> [Checker] Execute 2: MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (stack depth: 4, state: 4, 0 interleaves)
-> [Checker] Execute 2: MUTEX_WAIT(mutex: 0, owner:2) (stack depth: 5, state: 5, 0 interleaves)
-> [Checker] Execute 2: MUTEX_UNLOCK(mutex: 0, owner:-1) (stack depth: 6, state: 6, 0 interleaves)
-> [Checker] Execute 3: MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (stack depth: 7, state: 7, 0 interleaves)
-> [Checker] Execute 3: MUTEX_WAIT(mutex: 1, owner:3) (stack depth: 8, state: 8, 0 interleaves)
-> [Checker] Execute 3: MUTEX_UNLOCK(mutex: 1, owner:-1) (stack depth: 9, state: 9, 0 interleaves)
-> [Checker] Execute 4: MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (stack depth: 10, state: 10, 0 interleaves)
-> [Checker] Execute 4: MUTEX_WAIT(mutex: 1, owner:4) (stack depth: 11, state: 11, 0 interleaves)
-> [Checker] Execute 4: MUTEX_UNLOCK(mutex: 1, owner:-1) (stack depth: 12, state: 12, 0 interleaves)
+> [Checker] Execute 1: MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (stack depth: 1, state: 1, 0 interleaves)
+> [Checker] Execute 1: MUTEX_WAIT(mutex: 0, owner: 1) (stack depth: 2, state: 2, 0 interleaves)
+> [Checker] Execute 1: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 3, state: 3, 0 interleaves)
+> [Checker] Execute 2: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 4, state: 4, 0 interleaves)
+> [Checker] Execute 2: MUTEX_WAIT(mutex: 0, owner: 2) (stack depth: 5, state: 5, 0 interleaves)
+> [Checker] Execute 2: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 6, state: 6, 0 interleaves)
+> [Checker] Execute 3: MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (stack depth: 7, state: 7, 0 interleaves)
+> [Checker] Execute 3: MUTEX_WAIT(mutex: 1, owner: 3) (stack depth: 8, state: 8, 0 interleaves)
+> [Checker] Execute 3: MUTEX_UNLOCK(mutex: 1, owner: -1) (stack depth: 9, state: 9, 0 interleaves)
+> [Checker] Execute 4: MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (stack depth: 10, state: 10, 0 interleaves)
+> [Checker] Execute 4: MUTEX_WAIT(mutex: 1, owner: 4) (stack depth: 11, state: 11, 0 interleaves)
+> [Checker] Execute 4: MUTEX_UNLOCK(mutex: 1, owner: -1) (stack depth: 12, state: 12, 0 interleaves)
> [Checker] Execution came to an end at 1;1;1;2;2;2;3;3;3;4;4;4;0 (state: 13, depth: 13)
> [Checker] Backtracking from 1;1;1;2;2;2;3;3;3;4;4;4;0
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 1, owner:-1) (state=9)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=10)
+> [Checker] MUTEX_UNLOCK(mutex: 1, owner: -1) (state=9)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=10)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_WAIT(mutex: 1, owner:3) (state=8)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=10)
+> [Checker] MUTEX_WAIT(mutex: 1, owner: 3) (state=8)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=10)
> [Checker] Dependent Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (state=7)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=10)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (state=7)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=10)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 0, owner:-1) (state=6)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (state=7)
+> [Checker] MUTEX_UNLOCK(mutex: 0, owner: -1) (state=6)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (state=7)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_WAIT(mutex: 0, owner:2) (state=5)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (state=7)
+> [Checker] MUTEX_WAIT(mutex: 0, owner: 2) (state=5)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (state=7)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=4)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (state=7)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=4)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (state=7)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 0, owner:-1) (state=3)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (state=7)
+> [Checker] MUTEX_UNLOCK(mutex: 0, owner: -1) (state=3)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (state=7)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_WAIT(mutex: 0, owner:1) (state=2)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (state=7)
+> [Checker] MUTEX_WAIT(mutex: 0, owner: 1) (state=2)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (state=7)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:1) (state=1)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (state=7)
-> [Checker] Execute 4: MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (stack depth: 7, state: 7, 0 interleaves)
-> [Checker] Execute 3: MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (stack depth: 8, state: 14, 0 interleaves)
-> [Checker] Execute 4: MUTEX_WAIT(mutex: 1, owner:4) (stack depth: 9, state: 15, 0 interleaves)
-> [Checker] Execute 4: MUTEX_UNLOCK(mutex: 1, owner:3) (stack depth: 10, state: 16, 0 interleaves)
-> [Checker] Execute 3: MUTEX_WAIT(mutex: 1, owner:3) (stack depth: 11, state: 17, 0 interleaves)
-> [Checker] Execute 3: MUTEX_UNLOCK(mutex: 1, owner:-1) (stack depth: 12, state: 18, 0 interleaves)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (state=1)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (state=7)
+> [Checker] Execute 4: MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (stack depth: 7, state: 7, 0 interleaves)
+> [Checker] Execute 3: MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (stack depth: 8, state: 14, 0 interleaves)
+> [Checker] Execute 4: MUTEX_WAIT(mutex: 1, owner: 4) (stack depth: 9, state: 15, 0 interleaves)
+> [Checker] Execute 4: MUTEX_UNLOCK(mutex: 1, owner: 3) (stack depth: 10, state: 16, 0 interleaves)
+> [Checker] Execute 3: MUTEX_WAIT(mutex: 1, owner: 3) (stack depth: 11, state: 17, 0 interleaves)
+> [Checker] Execute 3: MUTEX_UNLOCK(mutex: 1, owner: -1) (stack depth: 12, state: 18, 0 interleaves)
> [Checker] Execution came to an end at 1;1;1;2;2;2;4;3;4;4;3;3;0 (state: 19, depth: 13)
> [Checker] Backtracking from 1;1;1;2;2;2;4;3;4;4;3;3;0
> [Checker] Dependent Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 1, owner:3) (state=16)
-> [Checker] MUTEX_WAIT(mutex: 1, owner:3) (state=17)
+> [Checker] MUTEX_UNLOCK(mutex: 1, owner: 3) (state=16)
+> [Checker] MUTEX_WAIT(mutex: 1, owner: 3) (state=17)
> [Checker] Backtracking from 1;1;1;2;2;2;4;3;4;4
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=14)
-> [Checker] MUTEX_WAIT(mutex: 1, owner:4) (state=15)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=14)
+> [Checker] MUTEX_WAIT(mutex: 1, owner: 4) (state=15)
> [Checker] Dependent Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=7)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=14)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=7)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=14)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 0, owner:-1) (state=6)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=7)
+> [Checker] MUTEX_UNLOCK(mutex: 0, owner: -1) (state=6)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=7)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_WAIT(mutex: 0, owner:2) (state=5)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=7)
+> [Checker] MUTEX_WAIT(mutex: 0, owner: 2) (state=5)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=7)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=4)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=7)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=4)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=7)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 0, owner:-1) (state=3)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=7)
+> [Checker] MUTEX_UNLOCK(mutex: 0, owner: -1) (state=3)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=7)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_WAIT(mutex: 0, owner:1) (state=2)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=7)
+> [Checker] MUTEX_WAIT(mutex: 0, owner: 1) (state=2)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=7)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:1) (state=1)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=7)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (state=1)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=7)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 0, owner:-1) (state=3)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=4)
+> [Checker] MUTEX_UNLOCK(mutex: 0, owner: -1) (state=3)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=4)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_WAIT(mutex: 0, owner:1) (state=2)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=4)
+> [Checker] MUTEX_WAIT(mutex: 0, owner: 1) (state=2)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=4)
> [Checker] Dependent Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:1) (state=1)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=4)
-> [Checker] Execute 2: MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (stack depth: 1, state: 1, 0 interleaves)
-> [Checker] Execute 1: MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (stack depth: 2, state: 20, 0 interleaves)
-> [Checker] Execute 2: MUTEX_WAIT(mutex: 0, owner:2) (stack depth: 3, state: 21, 0 interleaves)
-> [Checker] Execute 2: MUTEX_UNLOCK(mutex: 0, owner:1) (stack depth: 4, state: 22, 0 interleaves)
-> [Checker] Execute 1: MUTEX_WAIT(mutex: 0, owner:1) (stack depth: 5, state: 23, 0 interleaves)
-> [Checker] Execute 1: MUTEX_UNLOCK(mutex: 0, owner:-1) (stack depth: 6, state: 24, 0 interleaves)
-> [Checker] Execute 3: MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (stack depth: 7, state: 25, 0 interleaves)
-> [Checker] Execute 3: MUTEX_WAIT(mutex: 1, owner:3) (stack depth: 8, state: 26, 0 interleaves)
-> [Checker] Execute 3: MUTEX_UNLOCK(mutex: 1, owner:-1) (stack depth: 9, state: 27, 0 interleaves)
-> [Checker] Execute 4: MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (stack depth: 10, state: 28, 0 interleaves)
-> [Checker] Execute 4: MUTEX_WAIT(mutex: 1, owner:4) (stack depth: 11, state: 29, 0 interleaves)
-> [Checker] Execute 4: MUTEX_UNLOCK(mutex: 1, owner:-1) (stack depth: 12, state: 30, 0 interleaves)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 1) (state=1)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=4)
+> [Checker] Execute 2: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 1, state: 1, 0 interleaves)
+> [Checker] Execute 1: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (stack depth: 2, state: 20, 0 interleaves)
+> [Checker] Execute 2: MUTEX_WAIT(mutex: 0, owner: 2) (stack depth: 3, state: 21, 0 interleaves)
+> [Checker] Execute 2: MUTEX_UNLOCK(mutex: 0, owner: 1) (stack depth: 4, state: 22, 0 interleaves)
+> [Checker] Execute 1: MUTEX_WAIT(mutex: 0, owner: 1) (stack depth: 5, state: 23, 0 interleaves)
+> [Checker] Execute 1: MUTEX_UNLOCK(mutex: 0, owner: -1) (stack depth: 6, state: 24, 0 interleaves)
+> [Checker] Execute 3: MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (stack depth: 7, state: 25, 0 interleaves)
+> [Checker] Execute 3: MUTEX_WAIT(mutex: 1, owner: 3) (stack depth: 8, state: 26, 0 interleaves)
+> [Checker] Execute 3: MUTEX_UNLOCK(mutex: 1, owner: -1) (stack depth: 9, state: 27, 0 interleaves)
+> [Checker] Execute 4: MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (stack depth: 10, state: 28, 0 interleaves)
+> [Checker] Execute 4: MUTEX_WAIT(mutex: 1, owner: 4) (stack depth: 11, state: 29, 0 interleaves)
+> [Checker] Execute 4: MUTEX_UNLOCK(mutex: 1, owner: -1) (stack depth: 12, state: 30, 0 interleaves)
> [Checker] Execution came to an end at 2;1;2;2;1;1;3;3;3;4;4;4;0 (state: 31, depth: 13)
> [Checker] Backtracking from 2;1;2;2;1;1;3;3;3;4;4;4;0
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 1, owner:-1) (state=27)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=28)
+> [Checker] MUTEX_UNLOCK(mutex: 1, owner: -1) (state=27)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=28)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_WAIT(mutex: 1, owner:3) (state=26)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=28)
+> [Checker] MUTEX_WAIT(mutex: 1, owner: 3) (state=26)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=28)
> [Checker] Dependent Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (state=25)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=28)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (state=25)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=28)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 0, owner:-1) (state=24)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (state=25)
+> [Checker] MUTEX_UNLOCK(mutex: 0, owner: -1) (state=24)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (state=25)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_WAIT(mutex: 0, owner:1) (state=23)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (state=25)
+> [Checker] MUTEX_WAIT(mutex: 0, owner: 1) (state=23)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (state=25)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 0, owner:1) (state=22)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (state=25)
+> [Checker] MUTEX_UNLOCK(mutex: 0, owner: 1) (state=22)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (state=25)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_WAIT(mutex: 0, owner:2) (state=21)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (state=25)
+> [Checker] MUTEX_WAIT(mutex: 0, owner: 2) (state=21)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (state=25)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=20)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (state=25)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=20)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (state=25)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=1)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:3) (state=25)
-> [Checker] Execute 4: MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (stack depth: 7, state: 25, 0 interleaves)
-> [Checker] Execute 3: MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (stack depth: 8, state: 32, 0 interleaves)
-> [Checker] Execute 4: MUTEX_WAIT(mutex: 1, owner:4) (stack depth: 9, state: 33, 0 interleaves)
-> [Checker] Execute 4: MUTEX_UNLOCK(mutex: 1, owner:3) (stack depth: 10, state: 34, 0 interleaves)
-> [Checker] Execute 3: MUTEX_WAIT(mutex: 1, owner:3) (stack depth: 11, state: 35, 0 interleaves)
-> [Checker] Execute 3: MUTEX_UNLOCK(mutex: 1, owner:-1) (stack depth: 12, state: 36, 0 interleaves)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=1)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 3) (state=25)
+> [Checker] Execute 4: MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (stack depth: 7, state: 25, 0 interleaves)
+> [Checker] Execute 3: MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (stack depth: 8, state: 32, 0 interleaves)
+> [Checker] Execute 4: MUTEX_WAIT(mutex: 1, owner: 4) (stack depth: 9, state: 33, 0 interleaves)
+> [Checker] Execute 4: MUTEX_UNLOCK(mutex: 1, owner: 3) (stack depth: 10, state: 34, 0 interleaves)
+> [Checker] Execute 3: MUTEX_WAIT(mutex: 1, owner: 3) (stack depth: 11, state: 35, 0 interleaves)
+> [Checker] Execute 3: MUTEX_UNLOCK(mutex: 1, owner: -1) (stack depth: 12, state: 36, 0 interleaves)
> [Checker] Execution came to an end at 2;1;2;2;1;1;4;3;4;4;3;3;0 (state: 37, depth: 13)
> [Checker] Backtracking from 2;1;2;2;1;1;4;3;4;4;3;3;0
> [Checker] Dependent Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 1, owner:3) (state=34)
-> [Checker] MUTEX_WAIT(mutex: 1, owner:3) (state=35)
+> [Checker] MUTEX_UNLOCK(mutex: 1, owner: 3) (state=34)
+> [Checker] MUTEX_WAIT(mutex: 1, owner: 3) (state=35)
> [Checker] Backtracking from 2;1;2;2;1;1;4;3;4;4
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=32)
-> [Checker] MUTEX_WAIT(mutex: 1, owner:4) (state=33)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=32)
+> [Checker] MUTEX_WAIT(mutex: 1, owner: 4) (state=33)
> [Checker] Dependent Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=25)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=32)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=25)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=32)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 0, owner:-1) (state=24)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=25)
+> [Checker] MUTEX_UNLOCK(mutex: 0, owner: -1) (state=24)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=25)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_WAIT(mutex: 0, owner:1) (state=23)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=25)
+> [Checker] MUTEX_WAIT(mutex: 0, owner: 1) (state=23)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=25)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 0, owner:1) (state=22)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=25)
+> [Checker] MUTEX_UNLOCK(mutex: 0, owner: 1) (state=22)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=25)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_WAIT(mutex: 0, owner:2) (state=21)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=25)
+> [Checker] MUTEX_WAIT(mutex: 0, owner: 2) (state=21)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=25)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=20)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=25)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=20)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=25)
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=1)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner:4) (state=25)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=1)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 1, owner: 4) (state=25)
> [Checker] Dependent Transitions:
-> [Checker] MUTEX_UNLOCK(mutex: 0, owner:1) (state=22)
-> [Checker] MUTEX_WAIT(mutex: 0, owner:1) (state=23)
+> [Checker] MUTEX_UNLOCK(mutex: 0, owner: 1) (state=22)
+> [Checker] MUTEX_WAIT(mutex: 0, owner: 1) (state=23)
> [Checker] Backtracking from 2;1;2;2
> [Checker] INDEPENDENT Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=20)
-> [Checker] MUTEX_WAIT(mutex: 0, owner:2) (state=21)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=20)
+> [Checker] MUTEX_WAIT(mutex: 0, owner: 2) (state=21)
> [Checker] Dependent Transitions:
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=1)
-> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner:2) (state=20)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=1)
+> [Checker] MUTEX_ASYNC_LOCK(mutex: 0, owner: 2) (state=20)
> [Checker] DFS exploration ended. 37 unique states visited; 7 backtracks (76 transition replays, 33 states visited overall)
$ ${bindir:=.}/../../../bin/simgrid-mc -- ${bindir:=.}/s4u-synchro-mutex --cfg=actors:3 --log=s4u_test.thres:critical
XBT_LOG_NEW_DEFAULT_CATEGORY(sem_test, "Simple test of the semaphore");
-const char* buffer; /* Where the data is exchanged */
-sg4::SemaphorePtr sem_empty = sg4::Semaphore::create(1); /* indicates whether the buffer is empty */
-sg4::SemaphorePtr sem_full = sg4::Semaphore::create(0); /* indicates whether the buffer is full */
-
-static void producer(const std::vector<std::string>& args)
+static void producer(std::string& buffer, sg4::SemaphorePtr sem_empty, sg4::SemaphorePtr sem_full,
+ const std::vector<std::string>& args)
{
for (auto const& str : args) {
sem_empty->acquire();
XBT_INFO("Pushing '%s'", str.c_str());
- buffer = str.c_str();
+ buffer = str;
sem_full->release();
}
XBT_INFO("Bye!");
}
-static void consumer()
+static void consumer(const std::string& buffer, sg4::SemaphorePtr sem_empty, sg4::SemaphorePtr sem_full)
{
std::string str;
do {
std::vector<std::string> args({"one", "two", "three", ""});
sg4::Engine e(&argc, argv);
e.load_platform(argc > 1 ? argv[1] : "../../platforms/two_hosts.xml");
- sg4::Actor::create("producer", e.host_by_name("Tremblay"), producer, std::cref(args));
- sg4::Actor::create("consumer", e.host_by_name("Jupiter"), consumer);
+
+ std::string buffer; /* Where the data is exchanged */
+ auto sem_empty = sg4::Semaphore::create(1); /* indicates whether the buffer is empty */
+ auto sem_full = sg4::Semaphore::create(0); /* indicates whether the buffer is full */
+
+ sg4::Actor::create("producer", e.host_by_name("Tremblay"), producer, std::ref(buffer), sem_empty, sem_full,
+ std::cref(args));
+ sg4::Actor::create("consumer", e.host_by_name("Jupiter"), consumer, std::cref(buffer), sem_empty, sem_full);
e.run();
return 0;
args is a strings array containing the blank-separated parameters found in the trace for this event instance. */
}
-action_fun previous_send;
-static void overriding_send(simgrid::xbt::ReplayAction& args)
-{
- previous_send(args); // Just call the overridden symbol. That's a toy example.
-}
-
int main(int argc, char* argv[])
{
auto properties = simgrid::s4u::Actor::self()->get_properties();
/* Connect your callback function to the "blah" event in the trace files */
xbt_replay_action_register("blah", action_blah);
- /* The send action is an override, so we have to first save its previous value in a global */
+ /* The send action is an override, so we could have saved its previous value in a global, or use a lambda capture like
+ * in the following */
int new_rank;
MPI_Comm_rank(MPI_COMM_WORLD, &new_rank);
if (new_rank != rank)
XBT_WARN("Rank inconsistency. Got %d, expected %d", new_rank, rank);
if (rank == 0) {
- previous_send = xbt_replay_action_get("send");
- xbt_replay_action_register("send", overriding_send);
+ auto previous_send = xbt_replay_action_get("send");
+ xbt_replay_action_register("send", [previous_send](simgrid::xbt::ReplayAction& args) {
+ previous_send(args); // Just call the overridden symbol. That's a toy example.
+ });
}
/* The regular run of the replayer */
if (shared_trace != nullptr)
int unique_job_number; //!< The job unique number in [0, n[.
};
-// ugly globals to avoid creating structures for giving args to processes
-static std::vector<simgrid::s4u::Host*> hosts;
-static int noise_between_jobs;
-
static void smpi_replay_process(Job* job, simgrid::s4u::BarrierPtr barrier, int rank)
{
XBT_INFO("Replaying rank %d of job %d (smpi_app '%s')", rank, job->unique_job_number, job->smpi_app_name.c_str());
}
}
-static int job_executor_process(Job* job)
+static int job_executor_process(const std::vector<simgrid::s4u::Host*>& hosts, Job* job)
{
XBT_INFO("Executing job %d (smpi_app '%s')", job->unique_job_number, job->smpi_app_name.c_str());
}
// Executes a workload of SMPI processes
-static int workload_executor_process(const std::vector<std::unique_ptr<Job>>& workload)
+static int workload_executor_process(const std::vector<simgrid::s4u::Host*>& hosts,
+ const std::vector<std::unique_ptr<Job>>& workload, int noise_between_jobs)
{
for (auto const& job : workload) {
// Let's wait until the job's waiting time if needed
// Let's finally run the job executor
char* str_pname = bprintf("job_%04d", job->unique_job_number);
XBT_INFO("Launching the job executor of job %d (app '%s')", job->unique_job_number, job->smpi_app_name.c_str());
- simgrid::s4u::Actor::create(str_pname, hosts[job->allocation[0]], job_executor_process, job.get());
+ simgrid::s4u::Actor::create(str_pname, hosts[job->allocation[0]], job_executor_process, std::cref(hosts),
+ job.get());
xbt_free(str_pname);
}
// Simulation setting
simgrid::s4u::Engine e(&argc, argv);
e.load_platform(argv[1]);
- hosts = e.get_all_hosts();
+ const auto hosts = e.get_all_hosts();
xbt_assert(hosts.size() >= 4, "The given platform should contain at least 4 hosts (found %zu).", hosts.size());
// Let's retrieve all SMPI jobs
int initial_noise = std::stoi(argv[3]);
xbt_assert(initial_noise >= 0, "Invalid initial_noise argument");
- noise_between_jobs = std::stoi(argv[4]);
+ int noise_between_jobs = std::stoi(argv[4]);
xbt_assert(noise_between_jobs >= 0, "Invalid noise_between_jobs argument");
if (initial_noise > 0) {
}
// Let's execute the workload
- simgrid::s4u::Actor::create("workload", hosts[0], workload_executor_process, std::cref(jobs));
+ simgrid::s4u::Actor::create("workload", hosts[0], workload_executor_process, std::cref(hosts), std::cref(jobs),
+ noise_between_jobs);
e.run();
XBT_INFO("Simulation finished! Final time: %g", simgrid::s4u::Engine::get_clock());
> [0.000000] [ker_engine/INFO] 3 actors are still running, waiting for something.
> [0.000000] [ker_engine/INFO] Legend of the following listing: "Actor <pid> (<name>@<host>): <status>"
> [0.000000] [ker_engine/INFO] Actor 1 (main thread@Lilibeth) simcall ActorJoin(pid:2)
-> [0.000000] [ker_engine/INFO] Actor 2 (0:1@Lilibeth) simcall MUTEX_WAIT(mutex_id: 1owner:3)
-> [0.000000] [ker_engine/INFO] Actor 3 (0:2@Lilibeth) simcall MUTEX_WAIT(mutex_id: 0owner:2)
+> [0.000000] [ker_engine/INFO] Actor 2 (0:1@Lilibeth) simcall MUTEX_WAIT(mutex_id:1 owner:3)
+> [0.000000] [ker_engine/INFO] Actor 3 (0:2@Lilibeth) simcall MUTEX_WAIT(mutex_id:0 owner:2)
> [0.000000] [mc_global/INFO] Counter-example execution trace:
-> [0.000000] [mc_global/INFO] 2: MUTEX_ASYNC_LOCK(mutex: 0, owner:2)
-> [0.000000] [mc_global/INFO] 2: MUTEX_WAIT(mutex: 0, owner:2)
-> [0.000000] [mc_global/INFO] 3: MUTEX_ASYNC_LOCK(mutex: 1, owner:3)
-> [0.000000] [mc_global/INFO] 2: MUTEX_ASYNC_LOCK(mutex: 1, owner:3)
-> [0.000000] [mc_global/INFO] 3: MUTEX_WAIT(mutex: 1, owner:3)
-> [0.000000] [mc_global/INFO] 3: MUTEX_ASYNC_LOCK(mutex: 0, owner:2)
+> [0.000000] [mc_global/INFO] 2: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2)
+> [0.000000] [mc_global/INFO] 2: MUTEX_WAIT(mutex: 0, owner: 2)
+> [0.000000] [mc_global/INFO] 3: MUTEX_ASYNC_LOCK(mutex: 1, owner: 3)
+> [0.000000] [mc_global/INFO] 2: MUTEX_ASYNC_LOCK(mutex: 1, owner: 3)
+> [0.000000] [mc_global/INFO] 3: MUTEX_WAIT(mutex: 1, owner: 3)
+> [0.000000] [mc_global/INFO] 3: MUTEX_ASYNC_LOCK(mutex: 0, owner: 2)
> [0.000000] [mc_Session/INFO] You can debug the problem (and see the whole details) by rerunning out of simgrid-mc with --cfg=model-check/replay:'2;2;3;2;3;3'
> [0.000000] [mc_dfs/INFO] DFS exploration ended. 19 unique states visited; 2 backtracks (22 transition replays, 2 states visited overall)
template <typename T> class ProducerConsumer;
template <typename T> using ProducerConsumerPtr = boost::intrusive_ptr<ProducerConsumer<T>>;
-XBT_PUBLIC_DATA unsigned long pc_id;
+class ProducerConsumerId {
+private:
+ static unsigned long pc_id;
+
+protected:
+ const std::string id = "ProducerConsumer" + std::to_string(pc_id);
+ ProducerConsumerId() { ++pc_id; }
+};
-template <typename T> class ProducerConsumer {
+template <typename T> class ProducerConsumer : public ProducerConsumerId {
public:
/** This ProducerConsumer plugin can use two different transfer modes:
* - TransferMode::MAILBOX: this mode induces a s4u::Comm between the actors doing the calls to put() and get().
enum class TransferMode { MAILBOX = 0, QUEUE };
private:
- std::string id;
-
/* Implementation of a Monitor to handle the data exchanges */
s4u::MutexPtr mutex_;
s4u::ConditionVariablePtr can_put_;
{
xbt_assert(max_queue_size > 0, "Max queue size of 0 is not allowed");
- id = "ProducerConsumer" + std::to_string(pc_id);
- pc_id++;
-
mutex_ = s4u::Mutex::create();
can_put_ = s4u::ConditionVariable::create();
can_get_ = s4u::ConditionVariable::create();
class XBT_PUBLIC FileDescriptorHostExt {
public:
static simgrid::xbt::Extension<Host, FileDescriptorHostExt> EXTENSION_ID;
+ static int max_file_descriptors;
FileDescriptorHostExt() = default;
FileDescriptorHostExt(const FileDescriptorHostExt&) = delete;
FileDescriptorHostExt& operator=(const FileDescriptorHostExt&) = delete;
XBT_CVERB(s4u_activity, "Remove a dependency from '%s' on '%s'", get_cname(), b->get_cname());
b->dependencies_.erase(this);
if (b->dependencies_solved()) {
- b->vetoable_start();
+ b->start();
}
successors_.pop_back();
}
/*! Add a callback fired when the activity is resumed after being suspended */
static void on_resumed_cb(const std::function<void(Activity const&)>& cb) { on_resumed.connect(cb); }
- void vetoable_start()
+ XBT_ATTRIB_DEPRECATED_v334("All start() are vetoable now. Please use start() ") void vetoable_start()
+ {
+ start();
+ }
+ void start()
{
state_ = State::STARTING;
if (dependencies_solved() && is_assigned()) {
XBT_CVERB(s4u_activity, "'%s' is assigned to a resource and all dependencies are solved. Let's start", get_cname());
- start();
+ do_start();
} else {
if (vetoed_activities_ != nullptr)
vetoed_activities_->insert(this);
*
* This function is optional: you can call wait() even if you didn't call start()
*/
- virtual Activity* start() = 0;
+ virtual Activity* do_start() = 0;
/** Tests whether the given activity is terminated yet. */
virtual bool test();
/*! take a vector s4u::ActivityPtr and return the rank of the first finished one (or -1 if none is done). */
{
return get_data<void>();
}
-
- AnyActivity* vetoable_start()
+ XBT_ATTRIB_DEPRECATED_v334("All start() are vetoable now. Please use start() ") AnyActivity* vetoable_start()
+ {
+ return start();
+ }
+ AnyActivity* start()
{
- Activity::vetoable_start();
+ Activity::start();
return static_cast<AnyActivity*>(this);
}
std::function<void(kernel::activity::CommImpl*, void*, size_t)> copy_data_function_;
Comm() = default;
+ Comm* do_start() override;
public:
/* signals and related callbacks */
Actor* get_sender() const;
/* Comm life cycle */
- Comm* start() override;
/** Start the comm, and ignore its result. It can be completely forgotten after that. */
Comm* detach();
/** Start the comm, and ignore its result. It can be completely forgotten after that. */
static s4u::Engine* get_instance(int* argc, char** argv);
static bool has_instance() { return instance_ != nullptr; }
+ /**
+ * Creates a new platform, including hosts, links, and the routing table.
+ *
+ * @beginrst
+ * See also: :ref:`platform`.
+ * @endrst
+ */
void load_platform(const std::string& platf) const;
+ /**
+ * @brief Seals the platform, finishing the creation of its resources.
+ *
+ * This method is optional. The seal() is done automatically when you call Engine::run.
+ */
void seal_platform() const;
+ /** @brief Get a debug output of the platform.
+ *
+ * It looks like a XML platform file, but it may be very different from the input platform file: All netzones are
+ * flatified into a unique zone. This representation is mostly useful to debug your platform configuration and ensure
+ * that your assumptions over your configuration hold. This enables you to verify the exact list of links traversed
+ * between any two hosts, and the characteristics of every host and link. But you should not use the resulting file as
+ * an input platform file: it is very verbose, and thus much less efficient (in parsing time and runtime performance)
+ * than a regular platform file with the sufficient amount of intermediary netzones. Even if you use one zone only,
+ * specialized zones (such as clusters) are more efficient than the one with fully explicit routing used here.
+ */
+ std::string flatify_platform() const;
/** @verbatim embed:rst:inline Bind an actor name that could be found in :ref:`pf_tag_actor` tag to a function taking classical argc/argv parameters. See the :ref:`example <s4u_ex_actors_create>`. @endverbatim */
void register_function(const std::string& name, const std::function<void(int, char**)>& code);
protected:
explicit Exec(kernel::activity::ExecImplPtr pimpl);
+ Exec* do_start() override;
void reset() const;
static void on_start_cb(const std::function<void(Exec const&)>& cb) { on_start.connect(cb); }
static ExecPtr init();
- Exec* start() override;
/*! take a vector of s4u::ExecPtr and return when one of them is finished.
* The return value is the rank of the first finished ExecPtr. */
protected:
explicit Io(kernel::activity::IoImplPtr pimpl);
+ Io* do_start() override;
public:
enum class OpType { READ, WRITE };
static void on_start_cb(const std::function<void(Io const&)>& cb) { on_start.connect(cb); }
static IoPtr init();
- Io* start() override;
/*! take a vector of s4u::IoPtr and return when one of them is finished.
* The return value is the rank of the first finished IoPtr. */
static ssize_t wait_any(const std::vector<IoPtr>& ios) { return wait_any_for(ios, -1); }
* @param limit Number of concurrent flows
*/
Link* set_concurrency_limit(int limit);
+ int get_concurrency_limit() const;
/** @brief Set the level of communication speed of the given host on this wifi link.
*
template <typename T> CommPtr Mailbox::get_async(T** data)
{
CommPtr res = get_init()->set_dst_data(reinterpret_cast<void**>(data), sizeof(void*));
- res->vetoable_start();
+ res->start();
return res;
}
# define XBT_ATTRIB_DESTRUCTOR(prio) __attribute__((__destructor__))
#endif
-#ifndef XBT_ALWAYS_INLINE /* defined also in libsosp */
-# if defined(__GNUC__)
-# define XBT_ALWAYS_INLINE inline __attribute__ ((always_inline))
-# else
-# define XBT_ALWAYS_INLINE inline
-# endif
+#define XBT_ATTRIB_NOINLINE __attribute__((noinline))
+
+#if defined(__GNUC__)
+#define XBT_ALWAYS_INLINE inline __attribute__((always_inline))
+#else
+#define XBT_ALWAYS_INLINE inline
#endif
/* Stringify argument. */
SG_BEGIN_DECL
/** Cache the size of a memory page for the current system. */
-XBT_PUBLIC_DATA int xbt_pagesize;
+XBT_PUBLIC_DATA const int xbt_pagesize;
/** Cache the number of bits of addresses inside a given page, log2(xbt_pagesize). */
-XBT_PUBLIC_DATA int xbt_pagebits;
+XBT_PUBLIC_DATA const int xbt_pagebits;
/** Helps ensuring that header version (SIMGRID_VERSION_MAJOR and friends) and dynamic library version do match. */
XBT_PUBLIC void sg_version_check(int lib_version_major, int lib_version_minor, int lib_version_patch);
void disconnect(unsigned int id) { handlers_.erase(id); }
/** Remove all callbacks */
void disconnect_slots() { handlers_.clear(); }
- /** Get the amount of callbacks */
- int get_slot_count() { return handlers_.size(); }
};
}
}
#sonar.cfamily.gcov.reportsPath
#sonar.python.coverage.reportPaths
#sonar.cfamily.threads
-#sonar.cfamily.cache.enabled
-#sonar.cfamily.cache.path
.def("get_netzone_root",
[](py::object self) // XBT_ATTRIB_DEPRECATED_v334
{
- PyErr_WarnEx(PyExc_DeprecationWarning,
- "get_netzone_root() is deprecated and will be dropped after v3.3, use netzone_root instead.",
- 1);
+ PyErr_WarnEx(
+ PyExc_DeprecationWarning,
+ "get_netzone_root() is deprecated and will be dropped after v3.33, use netzone_root instead.", 1);
return self.attr("netzone_root");
})
.def_property_readonly("netzone_root", &Engine::get_netzone_root,
std::string new_name = parent->get_name() + "_" + comm->get_name() + "_" + child->get_name();
- comm->set_name(new_name)->vetoable_start();
+ comm->set_name(new_name)->start();
}
static bool check_for_cycle(const std::vector<simgrid::s4u::ActivityPtr>& dag)
dax_lineno = 1;
auto root_task = Exec::init()->set_name("root")->set_flops_amount(0);
- root_task->vetoable_start();
+ root_task->start();
result.push_back(root_task);
auto end_task = Exec::init()->set_name("end")->set_flops_amount(0);
- end_task->vetoable_start();
+ end_task->start();
xbt_assert(dax_lex() == 0, "Parse error in %s: %s", filename.c_str(), dax__parse_err_msg());
dax__delete_buffer(input_buffer);
if (activities.find(name) == activities.end()) {
XBT_DEBUG("See <Exec id = %s amount = %.0f>", name.c_str(), amount);
- act = Exec::init()->set_name(name)->set_flops_amount(amount)->vetoable_start();
+ act = Exec::init()->set_name(name)->set_flops_amount(amount)->start();
activities.try_emplace(name, act);
if (name != "root" && name != "end")
dag.push_back(act);
}
/*Check if 'root' and 'end' nodes have been explicitly declared. If not, create them. */
if (activities.find("root") == activities.end())
- root = Exec::init()->set_name("root")->set_flops_amount(0)->vetoable_start();
+ root = Exec::init()->set_name("root")->set_flops_amount(0)->start();
else
root = activities.at("root");
if (activities.find("end") == activities.end())
- end = Exec::init()->set_name("end")->set_flops_amount(0)->vetoable_start();
+ end = Exec::init()->set_name("end")->set_flops_amount(0)->start();
else
end = activities.at("end");
std::string name = std::string(src_name) + "->" + dst_name;
XBT_DEBUG("See <Comm id=%s amount = %.0f>", name.c_str(), size);
if (activities.find(name) == activities.end()) {
- act = Comm::sendto_init()->set_name(name)->set_payload_size(size)->vetoable_start();
+ act = Comm::sendto_init()->set_name(name)->set_payload_size(size)->start();
src->add_successor(act);
act->add_successor(dst);
activities.try_emplace(name, act);
std::string name = std::string(A_dax__job_id) + "@" + A_dax__job_name;
runtime *= 4200000000.; /* Assume that timings were done on a 4.2GFlops machine. I mean, why not? */
XBT_DEBUG("See <job id=%s runtime=%s %.0f>", A_dax__job_id, A_dax__job_runtime, runtime);
- simgrid::s4u::current_job = simgrid::s4u::Exec::init()->set_name(name)->set_flops_amount(runtime)->vetoable_start();
+ simgrid::s4u::current_job = simgrid::s4u::Exec::init()->set_name(name)->set_flops_amount(runtime)->start();
simgrid::s4u::jobs.try_emplace(A_dax__job_id, simgrid::s4u::current_job);
simgrid::s4u::result.push_back(simgrid::s4u::current_job);
} catch (const std::invalid_argument&) {
/* Variables for the raw contexts (to select the right assembly code) */
#cmakedefine01 SIMGRID_PROCESSOR_i686
#cmakedefine01 SIMGRID_PROCESSOR_x86_64
+#cmakedefine01 SIMGRID_PROCESSOR_arm64
/* Variables for the SysV contexts */
@sg_makecontext_stack_addr@
#include "simgrid/s4u/Host.hpp"
#include "src/kernel/activity/CommImpl.hpp"
#include "src/kernel/activity/MailboxImpl.hpp"
+#include "src/kernel/activity/MutexImpl.hpp"
#include "src/kernel/actor/ActorImpl.hpp"
#include "src/mc/mc_config.hpp"
}
std::string ConditionWaitSimcall::to_string() const
{
- THROW_UNIMPLEMENTED;
+ return "ConditionWait(cond_id:" + ptr_to_id<activity::ConditionVariableImpl const>(get_cond()) +
+ " mutex_id:" + std::to_string(get_mutex()->get_id()) + ")";
}
ActorJoinSimcall::ActorJoinSimcall(ActorImpl* actor, ActorImpl* other, double timeout)
}
std::string MutexObserver::to_string() const
{
- return std::string(mc::Transition::to_c_str(type_)) + "(mutex_id: " + std::to_string(get_mutex()->get_id()) +
- "owner:" + std::to_string(get_mutex()->get_owner()->get_pid()) + ")";
+ return std::string(mc::Transition::to_c_str(type_)) + "(mutex_id:" + std::to_string(get_mutex()->get_id()) +
+ " owner:" + std::to_string(get_mutex()->get_owner()->get_pid()) + ")";
}
bool MutexObserver::is_enabled()
}
std::string SemaphoreObserver::to_string() const
{
- return std::string(mc::Transition::to_c_str(type_)) + "(sem_id: " + std::to_string(get_sem()->get_id()) + ")";
+ return std::string(mc::Transition::to_c_str(type_)) + "(sem_id:" + std::to_string(get_sem()->get_id()) + ")";
}
SemaphoreAcquisitionObserver::SemaphoreAcquisitionObserver(ActorImpl* actor, mc::Transition::Type type,
std::string SemaphoreAcquisitionObserver::to_string() const
{
return std::string(mc::Transition::to_c_str(type_)) +
- "(sem_id: " + std::to_string(acquisition_->semaphore_->get_id()) + ' ' +
+ "(sem_id:" + std::to_string(acquisition_->semaphore_->get_id()) + ' ' +
(acquisition_->granted_ ? "granted)" : "not granted)");
}
std::string BarrierObserver::to_string() const
{
return std::string(mc::Transition::to_c_str(type_)) +
- "(barrier_id: " + std::to_string(barrier_ != nullptr ? barrier_->get_id() : acquisition_->barrier_->get_id()) +
+ "(barrier_id:" + std::to_string(barrier_ != nullptr ? barrier_->get_id() : acquisition_->barrier_->get_id()) +
")";
}
bool BarrierObserver::is_enabled()
virtual void set_latency_profile(kernel::profile::Profile* profile) = 0;
/** @brief Set the concurrency limit for this link */
virtual void set_concurrency_limit(int limit) const = 0;
+ /** @brief Get the concurrency limit of this link */
+ virtual int get_concurrency_limit() const = 0;
};
} // namespace simgrid::kernel::resource
#include "src/kernel/resource/NetworkModelFactors.hpp"
#include "simgrid/sg_config.hpp"
-#include "src/kernel/resource/FactorSet.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_network);
*********/
namespace simgrid::kernel::resource {
-static FactorSet cfg_latency_factor("network/latency-factor");
-static FactorSet cfg_bandwidth_factor("network/bandwidth-factor");
-
config::Flag<std::string> cfg_latency_factor_str(
"network/latency-factor", std::initializer_list<const char*>{"smpi/lat-factor"},
"Correction factor to apply to the provided latency (default value overridden by network model)", "1.0");
"network/bandwidth-factor", std::initializer_list<const char*>{"smpi/bw-factor"},
"Correction factor to apply to the provided bandwidth (default value overridden by network model)", "1.0");
+FactorSet NetworkModelFactors::cfg_latency_factor("network/latency-factor");
+FactorSet NetworkModelFactors::cfg_bandwidth_factor("network/bandwidth-factor");
+
double NetworkModelFactors::get_bandwidth_factor() const
{
xbt_assert(not bw_factor_cb_,
#define SIMGRID_KERNEL_RESOURCE_NETWORKMODELFACTORS_HPP
#include "simgrid/sg_config.hpp"
+#include "src/kernel/resource/FactorSet.hpp"
#include "xbt/asserts.h"
#include <simgrid/forward.h>
/** This Trait of NetworkModel is in charge of handling the network factors (bw and lat) */
class XBT_PUBLIC NetworkModelFactors {
+ static FactorSet cfg_latency_factor;
+ static FactorSet cfg_bandwidth_factor;
+
using NetworkFactorCb = double(double size, const s4u::Host* src, const s4u::Host* dst,
const std::vector<s4u::Link*>& links,
const std::unordered_set<s4u::NetZone*>& netzones);
link_down_->set_latency_profile(profile);
}
+int SplitDuplexLinkImpl::get_concurrency_limit() const
+{
+ return link_up_->get_concurrency_limit();
+}
+
void SplitDuplexLinkImpl::set_concurrency_limit(int limit) const
{
link_up_->set_concurrency_limit(limit);
* Profile must contain absolute values */
void set_latency_profile(kernel::profile::Profile* profile) override;
void set_concurrency_limit(int limit) const override;
+ int get_concurrency_limit() const override;
};
} // namespace simgrid::kernel::resource
}
get_constraint()->set_concurrency_limit(limit);
}
+int StandardLinkImpl::get_concurrency_limit() const
+{
+ return get_constraint()->get_concurrency_limit();
+}
} // namespace simgrid::kernel::resource
void set_latency_profile(kernel::profile::Profile* profile) override;
void set_concurrency_limit(int limit) const override;
+ int get_concurrency_limit() const override;
};
} // namespace simgrid::kernel::resource
namespace simgrid::mc {
-static void run_child_process(int socket, const std::vector<char*>& args)
+XBT_ATTRIB_NORETURN static void run_child_process(int socket, const std::vector<char*>& args)
{
/* On startup, simix_global_init() calls simgrid::mc::Client::initialize(), which checks whether the MC_ENV_SOCKET_FD
* env variable is set. If so, MC mode is assumed, and the client is setup from its side
// Take a copy of the context for our own purpose:
this->unwind_context_ = *c;
-#if SIMGRID_PROCESSOR_x86_64 || SIMGRID_PROCESSOR_i686 || defined(__aarch64__)
+#if SIMGRID_PROCESSOR_x86_64 || SIMGRID_PROCESSOR_i686
#ifdef __linux__
// On x86_64, ucontext_t contains a pointer to itself for FP registers.
// We don't really need support for FR registers as they are caller saved
// Let's ignore this and see what happens:
this->unwind_context_.uc_mcontext.fpregs = nullptr;
#endif
+#elif SIMGRID_PROCESSOR_arm64
+#ifdef __linux__
+ // On ARM64, ucontext_t doesn't contain `fpregs` and the FP registers
+ // are instead held in the `__reserved` field of the struct. It doesn't
+ // appear anything needs to be done here, although this should be verified
+#endif
#else
// Do we need to do any fixup like this?
#error Target CPU type is not handled.
#ifndef SIMGRID_MC_MMU_HPP
#define SIMGRID_MC_MMU_HPP
+#include "xbt/misc.h"
#include <cstdint>
#include <utility>
-#ifndef XBT_ALWAYS_INLINE
-#define XBT_ALWAYS_INLINE inline __attribute__((always_inline))
-#endif
-
-/** Size of a memory page for the current system. */
-extern "C" int xbt_pagesize;
-/** Number of bits of addresses inside a given page, log2(xbt_pagesize). */
-extern "C" int xbt_pagebits;
-
namespace simgrid::mc::mmu {
// TODO, do not depend on xbt_pagesize/xbt_pagebits but our own chunk size
std::string MutexTransition::to_string(bool verbose) const
{
- return xbt::string_printf("%s(mutex: %" PRIxPTR ", owner:%ld)", Transition::to_c_str(type_), mutex_, owner_);
+ return xbt::string_printf("%s(mutex: %" PRIxPTR ", owner: %ld)", Transition::to_c_str(type_), mutex_, owner_);
}
MutexTransition::MutexTransition(aid_t issuer, int times_considered, Type type, std::stringstream& stream)
XBT_LOG_NEW_CATEGORY(producer_consumer, "Producer-Consumer plugin logging category");
namespace simgrid::plugin {
-unsigned long pc_id = 0;
+unsigned long ProducerConsumerId::pc_id = 0;
}
#include <numeric>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_file, s4u, "S4U files");
-int sg_storage_max_file_descriptors = 1024;
/** @defgroup plugin_filesystem Plugin FileSystem
*
namespace s4u {
simgrid::xbt::Extension<Disk, FileSystemDiskExt> FileSystemDiskExt::EXTENSION_ID;
simgrid::xbt::Extension<Host, FileDescriptorHostExt> FileDescriptorHostExt::EXTENSION_ID;
+int FileDescriptorHostExt::max_file_descriptors;
const Disk* File::find_local_disk_on(const Host* host)
{
local_disk_ = find_local_disk_on(host);
// assign a file descriptor id to the newly opened File
- auto* ext = host->extension<simgrid::s4u::FileDescriptorHostExt>();
+ auto* ext = host->extension<FileDescriptorHostExt>();
if (ext->file_descriptor_table == nullptr) {
- ext->file_descriptor_table = std::make_unique<std::vector<int>>(sg_storage_max_file_descriptors);
+ ext->file_descriptor_table = std::make_unique<std::vector<int>>(FileDescriptorHostExt::max_file_descriptors);
std::iota(ext->file_descriptor_table->rbegin(), ext->file_descriptor_table->rend(), 0); // Fill with ..., 1, 0.
}
xbt_assert(not ext->file_descriptor_table->empty(), "Too much files are opened! Some have to be closed.");
void File::close()
{
- std::vector<int>* desc_table =
- Host::current()->extension<simgrid::s4u::FileDescriptorHostExt>()->file_descriptor_table.get();
+ std::vector<int>* desc_table = Host::current()->extension<FileDescriptorHostExt>()->file_descriptor_table.get();
kernel::actor::simcall_answered([this, desc_table] { desc_table->push_back(this->desc_id); });
delete this;
}
void File::move(const std::string& fullpath) const
{
/* Check if the new full path is on the same mount point */
- if (fullpath.compare(0, mount_point_.length(), mount_point_) == 0) {
+ if (fullpath.rfind(mount_point_, 0) == 0) {
std::map<std::string, sg_size_t, std::less<>>* content = nullptr;
content = local_disk_->extension<FileSystemDiskExt>()->get_content();
if (content) {
*/
void sg_storage_file_system_init()
{
- sg_storage_max_file_descriptors = 1024;
- simgrid::config::bind_flag(sg_storage_max_file_descriptors, "storage/max_file_descriptors",
+ FileDescriptorHostExt::max_file_descriptors = 1024;
+ simgrid::config::bind_flag(FileDescriptorHostExt::max_file_descriptors, "storage/max_file_descriptors",
"Maximum number of concurrently opened files per host. Default is 1024");
if (not FileSystemDiskExt::EXTENSION_ID.valid()) {
Activity* Activity::wait_for(double timeout)
{
if (state_ == State::INITED)
- vetoable_start();
+ start();
if (state_ == State::FAILED) {
if (dynamic_cast<Comm*>(this))
return true;
if (state_ == State::INITED || state_ == State::STARTING)
- this->vetoable_start();
+ this->start();
kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self();
kernel::actor::ActivityTestSimcall observer{issuer, pimpl_.get()};
void execute(double flops, double priority)
{
- exec_init(flops)->set_priority(priority)->vetoable_start()->wait();
+ exec_init(flops)->set_priority(priority)->start()->wait();
}
void parallel_execute(const std::vector<s4u::Host*>& hosts, const std::vector<double>& flops_amounts,
ExecPtr exec_async(double flops)
{
ExecPtr res = exec_init(flops);
- res->vetoable_start();
+ res->start();
return res;
}
if (state_ == State::STARTING && remains_ <= 0)
XBT_DEBUG("This communication has a payload size of 0 byte. It cannot start yet");
else
- vetoable_start();
+ start();
return this;
}
if (state_ == State::STARTING && remains_ <= 0)
XBT_DEBUG("This communication has a payload size of 0 byte. It cannot start yet");
else
- vetoable_start();
+ start();
return this;
}
mailbox_ != nullptr;
}
-Comm* Comm::start()
+Comm* Comm::do_start()
{
xbt_assert(get_state() == State::INITED || get_state() == State::STARTING,
"You cannot use %s() once your communication started (not implemented)", __FUNCTION__);
"You cannot use %s() once your communication is %s (not implemented)", __FUNCTION__, get_state_str());
xbt_assert(dst_buff_ == nullptr && dst_buff_size_ == 0, "You can only detach sends, not recvs");
detached_ = true;
- vetoable_start();
+ start();
return this;
}
case State::INITED:
case State::STARTING: // It's not started yet. Do it in one simcall if it's a regular communication
if (get_source() != nullptr || get_destination() != nullptr) {
- return vetoable_start()->wait_for(timeout); // In the case of host2host comm, do it in two simcalls
+ return start()->wait_for(timeout); // In the case of host2host comm, do it in two simcalls
} else if (src_buff_ != nullptr) {
on_send(*this);
send(sender_, mailbox_, remains_, rate_, src_buff_, src_buff_size_, match_fun_, copy_data_function_,
IoPtr Disk::read_async(sg_size_t size) const
{
- return IoPtr(io_init(size, Io::OpType::READ))->vetoable_start();
+ return IoPtr(io_init(size, Io::OpType::READ))->start();
}
sg_size_t Disk::read(sg_size_t size) const
{
- return IoPtr(io_init(size, Io::OpType::READ))->vetoable_start()->wait()->get_performed_ioops();
+ return IoPtr(io_init(size, Io::OpType::READ))->start()->wait()->get_performed_ioops();
}
sg_size_t Disk::read(sg_size_t size, double priority) const
{
return IoPtr(io_init(size, Io::OpType::READ))
->set_priority(priority)
- ->vetoable_start()
+ ->start()
->wait()
->get_performed_ioops();
}
IoPtr Disk::write_async(sg_size_t size) const
{
- return IoPtr(io_init(size, Io::OpType::WRITE)->vetoable_start());
+ return IoPtr(io_init(size, Io::OpType::WRITE)->start());
}
sg_size_t Disk::write(sg_size_t size) const
{
- return IoPtr(io_init(size, Io::OpType::WRITE))->vetoable_start()->wait()->get_performed_ioops();
+ return IoPtr(io_init(size, Io::OpType::WRITE))->start()->wait()->get_performed_ioops();
}
sg_size_t Disk::write(sg_size_t size, double priority) const
{
return IoPtr(io_init(size, Io::OpType::WRITE))
->set_priority(priority)
- ->vetoable_start()
+ ->start()
->wait()
->get_performed_ioops();
}
return pimpl->get_all_models();
}
-/**
- * Creates a new platform, including hosts, links, and the routing table.
- *
- * @beginrst
- * See also: :ref:`platform`.
- * @endrst
- */
void Engine::load_platform(const std::string& platf) const
{
pimpl->load_platform(platf);
}
-/**
- * @brief Seals the platform, finishing the creation of its resources.
- *
- * This method is optional. The seal() is done automatically when you call Engine::run.
- */
void Engine::seal_platform() const
{
pimpl->seal_platform();
}
+static void flatify_hosts(Engine const& engine, std::stringstream& ss)
+{
+ // Regular hosts
+ std::vector<Host*> hosts = engine.get_all_hosts();
+
+ for (auto const* h : hosts) {
+ ss << " <host id=\"" << h->get_name() << "\" speed=\"" << h->get_speed() << "\"";
+ const std::unordered_map<std::string, std::string>* props = h->get_properties();
+ if (h->get_core_count() > 1)
+ ss << " core=\"" << h->get_core_count() << "\"";
+
+ // Sort the properties before displaying them, so that the tests are perfectly reproducible
+ std::vector<std::string> keys;
+ for (auto const& [key, _] : *props)
+ keys.push_back(key);
+ if (not keys.empty()) {
+ ss << ">\n";
+ std::sort(keys.begin(), keys.end());
+ for (const std::string& key : keys)
+ ss << " <prop id=\"" << key << "\" value=\"" << props->at(key) << "\"/>\n";
+ ss << " </host>\n";
+ } else {
+ ss << "/>\n";
+ }
+ }
+
+ // Routers
+ std::vector<simgrid::kernel::routing::NetPoint*> netpoints = engine.get_all_netpoints();
+ std::sort(netpoints.begin(), netpoints.end(),
+ [](const simgrid::kernel::routing::NetPoint* a, const simgrid::kernel::routing::NetPoint* b) {
+ return a->get_name() < b->get_name();
+ });
+
+ for (auto const& src : netpoints)
+ if (src->is_router())
+ ss << " <router id=\"" << src->get_name() << "\"/>\n";
+}
+
+static void flatify_links(Engine const& engine, std::stringstream& ss)
+{
+ std::vector<Link*> links = engine.get_all_links();
+
+ std::sort(links.begin(), links.end(), [](const Link* a, const Link* b) { return a->get_name() < b->get_name(); });
+
+ for (auto const* link : links) {
+ ss << " <link id=\"" << link->get_name() << "\"";
+ ss << " bandwidth=\"" << link->get_bandwidth() << "\"";
+ ss << " latency=\"" << link->get_latency() << "\"";
+ if (link->get_concurrency_limit() != -1)
+ ss << " concurrency=\"" << link->get_concurrency_limit() << "\"";
+ if (link->is_shared()) {
+ ss << "/>\n";
+ } else {
+ ss << " sharing_policy=\"FATPIPE\"/>\n";
+ }
+ }
+}
+
+static void flatify_routes(Engine const& engine, std::stringstream& ss)
+{
+ auto hosts = engine.get_all_hosts();
+ auto netpoints = engine.get_all_netpoints();
+ std::sort(netpoints.begin(), netpoints.end(),
+ [](const simgrid::kernel::routing::NetPoint* a, const simgrid::kernel::routing::NetPoint* b) {
+ return a->get_name() < b->get_name();
+ });
+
+ for (auto const* src_host : hosts) { // Routes from host
+ const simgrid::kernel::routing::NetPoint* src = src_host->get_netpoint();
+ for (auto const* dst_host : hosts) { // Routes to host
+ std::vector<simgrid::kernel::resource::StandardLinkImpl*> route;
+ const simgrid::kernel::routing::NetPoint* dst = dst_host->get_netpoint();
+ simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
+ if (route.empty())
+ continue;
+ ss << " <route src=\"" << src_host->get_name() << "\" dst=\"" << dst_host->get_name() << "\">\n ";
+ for (auto const& link : route)
+ ss << "<link_ctn id=\"" << link->get_name() << "\"/>";
+ ss << "\n </route>\n";
+ }
+
+ for (auto const& dst : netpoints) { // to router
+ if (not dst->is_router())
+ continue;
+ ss << " <route src=\"" << src_host->get_name() << "\" dst=\"" << dst->get_name() << "\">\n ";
+ std::vector<simgrid::kernel::resource::StandardLinkImpl*> route;
+ simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
+ for (auto const& link : route)
+ ss << "<link_ctn id=\"" << link->get_name() << "\"/>";
+ ss << "\n </route>\n";
+ }
+ }
+
+ for (auto const& value1 : netpoints) { // Routes from router
+ if (not value1->is_router())
+ continue;
+ for (auto const& value2 : netpoints) { // to router
+ if (not value2->is_router())
+ continue;
+ std::vector<simgrid::kernel::resource::StandardLinkImpl*> route;
+ simgrid::kernel::routing::NetZoneImpl::get_global_route(value1, value2, route, nullptr);
+ if (route.empty())
+ continue;
+ ss << " <route src=\"" << value1->get_name() << "\" dst=\"" << value2->get_name() << "\">\n ";
+ for (auto const& link : route)
+ ss << "<link_ctn id=\"" << link->get_name() << "\"/>";
+ ss << "\n </route>\n";
+ }
+ for (auto const* dst_host : hosts) { // Routes to host
+ ss << " <route src=\"" << value1->get_name() << "\" dst=\"" << dst_host->get_name() << "\">\n ";
+ std::vector<simgrid::kernel::resource::StandardLinkImpl*> route;
+ const simgrid::kernel::routing::NetPoint* netcardDst = dst_host->get_netpoint();
+ simgrid::kernel::routing::NetZoneImpl::get_global_route(value1, netcardDst, route, nullptr);
+ for (auto const& link : route)
+ ss << "<link_ctn id=\"" << link->get_name() << "\"/>";
+ ss << "\n </route>\n";
+ }
+ }
+}
+std::string Engine::flatify_platform() const
+{
+ std::string version = "4.1";
+ std::stringstream ss;
+
+ ss << "<?xml version='1.0'?>\n";
+ ss << "<!DOCTYPE platform SYSTEM \"https://simgrid.org/simgrid.dtd\">\n";
+ ss << "<platform version=\"" << version << "\">\n";
+ ss << "<AS id=\"" << get_netzone_root()->get_name() << "\" routing=\"Full\">\n";
+
+ flatify_hosts(*this, ss);
+ flatify_links(*this, ss);
+ flatify_routes(*this, ss);
+
+ ss << "</AS>\n";
+ ss << "</platform>\n";
+ return ss.str();
+}
+
/** Registers the main function of an actor that will be launched from the deployment file */
void Engine::register_function(const std::string& name, const std::function<void(int, char**)>& code)
{
return ExecPtr(static_cast<Exec*>(pimpl->get_iface()));
}
-Exec* Exec::start()
+Exec* Exec::do_start()
{
kernel::actor::simcall_answered([this] {
(*boost::static_pointer_cast<kernel::activity::ExecImpl>(pimpl_))
pimpl_.get(), [this, host] { boost::static_pointer_cast<kernel::activity::ExecImpl>(pimpl_)->set_host(host); });
if (state_ == State::STARTING)
- // Setting the host may allow to start the activity, let's try
- vetoable_start();
+ // Setting the host may allow to start the activity, let's try
+ start();
return this;
}
// Setting the host may allow to start the activity, let's try
if (state_ == State::STARTING)
- vetoable_start();
+ start();
return this;
}
if (state_ == State::STARTED)
cancel();
- vetoable_start();
+ start();
return this;
}
void sg_exec_start(sg_exec_t exec)
{
- exec->vetoable_start();
+ exec->start();
}
void sg_exec_cancel(sg_exec_t exec)
void Host::execute(double flops, double priority) const
{
- this_actor::exec_init(flops)->set_priority(1 / priority)->vetoable_start()->wait();
+ this_actor::exec_init(flops)->set_priority(1 / priority)->start()->wait();
}
Host* Host::seal()
if (state_ == State::STARTING && remains_ <= 0)
XBT_DEBUG("This IO has a size of 0 byte. It cannot start yet");
else
- vetoable_start();
+ start();
return this;
}
if (state_ == State::STARTING && remains_ <= 0)
XBT_DEBUG("This IO has a size of 0 byte. It cannot start yet");
else
- vetoable_start();
+ start();
return this;
}
-Io* Io::start()
+Io* Io::do_start()
{
kernel::actor::simcall_answered(
[this] { (*boost::static_pointer_cast<kernel::activity::IoImpl>(pimpl_)).set_name(get_name()).start(); });
// Setting the disk may allow to start the activity, let's try
if (state_ == State::STARTING)
- vetoable_start();
+ start();
return this;
}
wlink->set_host_rate(host, level);
}
+int Link::get_concurrency_limit() const
+{
+ return pimpl_->get_concurrency_limit();
+}
+
Link* Link::set_concurrency_limit(int limit)
{
kernel::actor::simcall_object_access(pimpl_, [this, limit] { pimpl_->set_concurrency_limit(limit); });
xbt_assert(payload != nullptr, "You cannot send nullptr");
CommPtr res = put_init(payload, simulated_size_in_bytes);
- res->vetoable_start();
+ res->start();
return res;
}
{
xbt_assert(payload != nullptr, "You cannot send nullptr");
- put_init()->set_payload_size(simulated_size_in_bytes)->set_src_data(payload)->vetoable_start()->wait();
+ put_init()->set_payload_size(simulated_size_in_bytes)->set_src_data(payload)->start()->wait();
}
/** Blocking send with timeout */
{
xbt_assert(payload != nullptr, "You cannot send nullptr");
- put_init()->set_payload_size(simulated_size_in_bytes)->set_src_data(payload)->vetoable_start()->wait_for(timeout);
+ put_init()->set_payload_size(simulated_size_in_bytes)->set_src_data(payload)->start()->wait_for(timeout);
}
CommPtr Mailbox::get_init()
#define NOT_YET_IMPLEMENTED_NOFAIL \
{ \
- static bool warning_todo = true; \
- if (warning_todo) \
+ if (static bool warned_todo = false; not warned_todo) { \
XBT_WARN("Not yet implemented: %s. " \
"Please contact the SimGrid team if support is needed. " \
"Run with --log=smpi_mpi.thresh:error to hide", \
__func__); \
- warning_todo = false; \
+ warned_todo = true; \
+ } \
return MPI_SUCCESS; \
}
class NetworkConstantAction final : public NetworkAction {
public:
NetworkConstantAction(NetworkConstantModel* model_, s4u::Host& src, s4u::Host& dst, double size);
- void update_remains_lazy(double now) override;
+ XBT_ATTRIB_NORETURN void update_remains_lazy(double now) override;
};
} // namespace simgrid::kernel::resource
XBT_DEBUG("\tLink (%s) bw:%fbps lat:%fs", link->get_cname(), link->get_bandwidth(), link->get_latency());
ns3_add_direct_route(src, dst, link->get_bandwidth(), link->get_latency(), link->get_sharing_policy());
- } else {
- static bool warned_about_long_routes = false;
-
- if (not warned_about_long_routes)
- XBT_WARN("Ignoring a route between %s and %s of length %zu: Only routes of length 1 are considered with ns-3.\n"
- "WARNING: You can ignore this warning if your hosts can still communicate when only considering routes "
- "of length 1.\n"
- "WARNING: Remove long routes to avoid this harmless message; subsequent long routes will be silently "
- "ignored.",
- src->get_cname(), dst->get_cname(), link_list.size());
+ } else if (static bool warned_about_long_routes = false; not warned_about_long_routes) {
+ XBT_WARN("Ignoring a route between %s and %s of length %zu: Only routes of length 1 are considered with ns-3.\n"
+ "WARNING: You can ignore this warning if your hosts can still communicate when only considering routes "
+ "of length 1.\n"
+ "WARNING: Remove long routes to avoid this harmless message; subsequent long routes will be silently "
+ "ignored.",
+ src->get_cname(), dst->get_cname(), link_list.size());
warned_about_long_routes = true;
}
}
/* ***** Whether to use `mmalloc` of the underlying malloc ***** */
static int __malloc_use_mmalloc;
-int mmalloc_pagesize = 0;
int malloc_use_mmalloc(void)
{
mm_real_calloc = dlsym(RTLD_NEXT, "calloc");
#endif
}
- mmalloc_pagesize = getpagesize();
mm_initializing = 0;
mm_initialized = 1;
xbt_mheap_t mmalloc_preinit(void)
{
if (__mmalloc_default_mdp == NULL) {
- if (!mmalloc_pagesize)
- mmalloc_pagesize = getpagesize();
- unsigned long mask = ~((unsigned long)mmalloc_pagesize - 1);
+ unsigned long mmalloc_pagesize = (unsigned long)sysconf(_SC_PAGESIZE);
+ unsigned long mask = ~(mmalloc_pagesize - 1);
void* addr = (void*)(((unsigned long)sbrk(0) + HEAP_OFFSET) & mask);
__mmalloc_default_mdp = xbt_mheap_new(addr, XBT_MHEAP_OPTION_MEMSET);
}
#define MAP_ANONYMOUS MAP_ANON
#endif
-#define PAGE_ALIGN(addr) (void*)(((long)(addr) + mmalloc_pagesize - 1) & ~((long)mmalloc_pagesize - 1))
+#define PAGE_ALIGN(addr) (void*)(((unsigned long)(addr) + mmalloc_pagesize - 1) & ~(mmalloc_pagesize - 1))
/** @brief Add memory to this heap
*
return mdp->breakval;
}
- if (mmalloc_pagesize == 0) { // Not initialized yet
- mmalloc_pagesize = (int)sysconf(_SC_PAGESIZE);
- }
+ static unsigned long mmalloc_pagesize = 0;
+ if (!mmalloc_pagesize)
+ mmalloc_pagesize = (unsigned long)sysconf(_SC_PAGESIZE);
if (size < 0) {
/* We are deallocating memory. If the amount requested would cause us to try to deallocate back past the base of
if (mapto == MAP_FAILED) {
char buff[1024];
- fprintf(stderr, "Internal error: mmap returned MAP_FAILED! pagesize:%d error: %s\n", mmalloc_pagesize,
+ fprintf(stderr, "Internal error: mmap returned MAP_FAILED! pagesize:%lu error: %s\n", mmalloc_pagesize,
strerror(errno));
snprintf(buff, 1024, "cat /proc/%d/maps", getpid());
int status = system(buff);
} \
} while (0)
-XBT_PUBLIC_DATA int mmalloc_pagesize;
XBT_PRIVATE xbt_mheap_t mmalloc_preinit(void);
#define MMALLOC_MAGIC "mmalloc" /* Mapped file magic number */
"Whether to cleanup SimGrid at exit. Disable it if your code segfaults after its end.",
true};
-int xbt_pagesize;
-int xbt_pagebits = 0;
+const int xbt_pagesize = static_cast<int>(sysconf(_SC_PAGESIZE));
+const int xbt_pagebits = static_cast<int>(log2(xbt_pagesize));
/* Declare xbt_preinit and xbt_postexit as constructor/destructor of the library.
* This is crude and rather compiler-specific, unfortunately.
*/
static void xbt_preinit() XBT_ATTRIB_CONSTRUCTOR(200);
static void xbt_postexit();
-void sthread_enable()
+XBT_ATTRIB_NOINLINE void sthread_enable()
{ // These symbols are used from ContextSwapped in any case, but they are only useful
+ asm("");
}
-void sthread_disable()
+XBT_ATTRIB_NOINLINE void sthread_disable()
{ // when libsthread is LD_PRELOADED. In this case, sthread's implem gets used instead.
+ asm("");
}
static void xbt_preinit()
{
- xbt_pagesize = static_cast<int>(sysconf(_SC_PAGESIZE));
- xbt_pagebits = static_cast<int>(log2(xbt_pagesize));
-
xbt_log_preinit();
xbt_dict_preinit();
atexit(xbt_postexit);
simgrid::xbt::ReplayAction evt;
simgrid::xbt::ReplayReader reader(trace_filename);
while (reader.get(&evt)) {
- if (evt.front().compare(actor_name) == 0) {
+ if (evt.front() == actor_name) {
simgrid::xbt::handle_action(evt);
} else {
XBT_WARN("Ignore trace element not for me (target='%s', I am '%s')", evt.front().c_str(), actor_name);
* The argument of the function is the line describing the action, fields separated by spaces.
*
* @param action_name the reference name of the action.
- * @param function prototype given by the type: void...(const char** action)
+ * @param function prototype given by the type: void...(simgrid::xbt::ReplayAction& action)
*/
void xbt_replay_action_register(const char* action_name, const action_fun& function)
{
#include <algorithm>
#include <cstring>
+#include <sstream>
XBT_LOG_NEW_DEFAULT_CATEGORY(flatifier, "Logging specific to this platform parsing tool");
namespace sg4 = simgrid::s4u;
-static bool parse_cmdline(int* timings, char** platformFile, int argc, char** argv)
+static bool parse_cmdline(bool* timings, char** platformFile, int argc, char** argv)
{
bool parse_ok = true;
for (int i = 1; i < argc; i++) {
if (std::strlen(argv[i]) > 1 && argv[i][0] == '-' && argv[i][1] == '-') {
if (not std::strcmp(argv[i], "--timings")) {
- *timings = 1;
+ *timings = true;
} else {
parse_ok = false;
break;
*platformFile = argv[i];
}
}
- return parse_ok;
-}
-
-static void create_environment(xbt_os_timer_t parse_time, const std::string& platformFile)
-{
- xbt_os_cputimer_start(parse_time);
- sg4::Engine::get_instance()->load_platform(platformFile);
- sg4::Engine::get_instance()->seal_platform();
- xbt_os_cputimer_stop(parse_time);
-}
-
-static void dump_hosts()
-{
- std::vector<sg4::Host*> hosts = sg4::Engine::get_instance()->get_all_hosts();
-
- for (auto const* h : hosts) {
- std::printf(" <host id=\"%s\" speed=\"%.0f\"", h->get_cname(), h->get_speed());
- const std::unordered_map<std::string, std::string>* props = h->get_properties();
- if (h->get_core_count() > 1) {
- std::printf(" core=\"%d\"", h->get_core_count());
- }
- // Sort the properties before displaying them, so that the tests are perfectly reproducible
- std::vector<std::string> keys;
- for (auto const& [key, _] : *props)
- keys.push_back(key);
- if (not keys.empty()) {
- std::printf(">\n");
- std::sort(keys.begin(), keys.end());
- for (const std::string& key : keys)
- std::printf(" <prop id=\"%s\" value=\"%s\"/>\n", key.c_str(), props->at(key).c_str());
- std::printf(" </host>\n");
- } else {
- std::printf("/>\n");
- }
- }
-}
-
-static void dump_links()
-{
- std::vector<sg4::Link*> links = sg4::Engine::get_instance()->get_all_links();
-
- std::sort(links.begin(), links.end(),
- [](const sg4::Link* a, const sg4::Link* b) { return a->get_name() < b->get_name(); });
-
- for (auto const* link : links) {
- std::printf(" <link id=\"");
-
- std::printf("%s\" bandwidth=\"%.0f\" latency=\"%.9f\"", link->get_cname(), link->get_bandwidth(),
- link->get_latency());
- if (link->is_shared()) {
- std::printf("/>\n");
- } else {
- std::printf(" sharing_policy=\"FATPIPE\"/>\n");
- }
- }
-}
-
-static void dump_routers()
-{
- std::vector<simgrid::kernel::routing::NetPoint*> netpoints = sg4::Engine::get_instance()->get_all_netpoints();
- std::sort(netpoints.begin(), netpoints.end(),
- [](const simgrid::kernel::routing::NetPoint* a, const simgrid::kernel::routing::NetPoint* b) {
- return a->get_name() < b->get_name();
- });
-
- for (auto const& src : netpoints)
- if (src->is_router())
- std::printf(" <router id=\"%s\"/>\n", src->get_cname());
-}
-
-static void dump_routes()
-{
- std::vector<sg4::Host*> hosts = sg4::Engine::get_instance()->get_all_hosts();
- std::vector<simgrid::kernel::routing::NetPoint*> netpoints = sg4::Engine::get_instance()->get_all_netpoints();
- std::sort(netpoints.begin(), netpoints.end(),
- [](const simgrid::kernel::routing::NetPoint* a, const simgrid::kernel::routing::NetPoint* b) {
- return a->get_name() < b->get_name();
- });
-
- for (auto const* src_host : hosts) { // Routes from host
- const simgrid::kernel::routing::NetPoint* src = src_host->get_netpoint();
- for (auto const* dst_host : hosts) { // Routes to host
- std::vector<simgrid::kernel::resource::StandardLinkImpl*> route;
- const simgrid::kernel::routing::NetPoint* dst = dst_host->get_netpoint();
- simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
- if (route.empty())
- continue;
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", src_host->get_cname(), dst_host->get_cname());
- for (auto const& link : route)
- std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
- std::printf("\n </route>\n");
- }
-
- for (auto const& dst : netpoints) { // to router
- if (not dst->is_router())
- continue;
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", src_host->get_cname(), dst->get_cname());
- std::vector<simgrid::kernel::resource::StandardLinkImpl*> route;
- simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
- for (auto const& link : route)
- std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
- std::printf("\n </route>\n");
- }
- }
-
- for (auto const& value1 : netpoints) { // Routes from router
- if (not value1->is_router())
- continue;
- for (auto const& value2 : netpoints) { // to router
- if (not value2->is_router())
- continue;
- std::vector<simgrid::kernel::resource::StandardLinkImpl*> route;
- simgrid::kernel::routing::NetZoneImpl::get_global_route(value1, value2, route, nullptr);
- if (route.empty())
- continue;
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->get_cname(), value2->get_cname());
- for (auto const& link : route)
- std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
- std::printf("\n </route>\n");
- }
- for (auto const* dst_host : hosts) { // Routes to host
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->get_cname(), dst_host->get_cname());
- std::vector<simgrid::kernel::resource::StandardLinkImpl*> route;
- const simgrid::kernel::routing::NetPoint* netcardDst = dst_host->get_netpoint();
- simgrid::kernel::routing::NetZoneImpl::get_global_route(value1, netcardDst, route, nullptr);
- for (auto const& link : route)
- std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
- std::printf("\n </route>\n");
- }
- }
-}
-
-static void dump_platform()
-{
- int version = 4;
-
- std::printf("<?xml version='1.0'?>\n");
- std::printf("<!DOCTYPE platform SYSTEM \"https://simgrid.org/simgrid.dtd\">\n");
- std::printf("<platform version=\"%d\">\n", version);
- std::printf("<AS id=\"AS0\" routing=\"Full\">\n");
-
- // Hosts
- dump_hosts();
-
- // Routers
- dump_routers();
-
- // Links
- dump_links();
-
- // Routes
- dump_routes();
-
- std::printf("</AS>\n");
- std::printf("</platform>\n");
+ return parse_ok && platformFile != nullptr;
}
int main(int argc, char** argv)
{
char* platformFile = nullptr;
- int timings = 0;
+ bool timings = false;
xbt_os_timer_t parse_time = xbt_os_timer_new();
sg4::Engine e(&argc, argv);
- xbt_assert(parse_cmdline(&timings, &platformFile, argc, argv) && platformFile,
+ xbt_assert(parse_cmdline(&timings, &platformFile, argc, argv),
"Invalid command line arguments: expected [--timings] platformFile");
- XBT_DEBUG("%d,%s", timings, platformFile);
-
- create_environment(parse_time, platformFile);
+ xbt_os_cputimer_start(parse_time);
+ e.load_platform(platformFile);
+ e.seal_platform();
+ xbt_os_cputimer_stop(parse_time);
if (timings) {
XBT_INFO("Parsing time: %fs (%zu hosts, %zu links)", xbt_os_timer_elapsed(parse_time), e.get_host_count(),
e.get_link_count());
} else {
- dump_platform();
+ std::printf("%s", e.flatify_platform().c_str());
}
xbt_os_timer_free(parse_time);
$ ${bindir:=.}/flatifier ./one_cluster.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
> <?xml version='1.0'?>
> <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-> <platform version="4">
+> <platform version="4.1">
> <AS id="AS0" routing="Full">
-> <host id="bob0.hamburger.edu" speed="1000000000"/>
-> <host id="bob2.hamburger.edu" speed="1000000000"/>
-> <host id="bob3.hamburger.edu" speed="1000000000"/>
-> <host id="bob4.hamburger.edu" speed="1000000000"/>
-> <host id="bob6.hamburger.edu" speed="1000000000"/>
+> <host id="bob0.hamburger.edu" speed="1e+09"/>
+> <host id="bob2.hamburger.edu" speed="1e+09"/>
+> <host id="bob3.hamburger.edu" speed="1e+09"/>
+> <host id="bob4.hamburger.edu" speed="1e+09"/>
+> <host id="bob6.hamburger.edu" speed="1e+09"/>
> <router id="bobbob_cluster_router.hamburger.edu"/>
-> <link id="__loopback__" bandwidth="10000000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_backbone" bandwidth="2250000000" latency="0.000500000"/>
-> <link id="bob_cluster_link_0_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_0_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_2_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_2_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_3_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_3_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_4_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_4_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_6_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_6_UP" bandwidth="125000000" latency="0.000050000"/>
+> <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_backbone" bandwidth="2.25e+09" latency="0.0005"/>
+> <link id="bob_cluster_link_0_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_0_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_2_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_2_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_3_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_3_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_4_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_4_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_6_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_6_UP" bandwidth="1.25e+08" latency="5e-05"/>
> <route src="bob0.hamburger.edu" dst="bob0.hamburger.edu">
> <link_ctn id="bob_cluster_link_0_UP"/><link_ctn id="bob_cluster_backbone"/><link_ctn id="bob_cluster_link_0_DOWN"/>
> </route>
$ ${bindir:=.}/flatifier ./one_cluster_multicore.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
> <?xml version='1.0'?>
> <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-> <platform version="4">
+> <platform version="4.1">
> <AS id="AS0" routing="Full">
-> <host id="bob0.hamburger.edu" speed="1000000000" core="6"/>
-> <host id="bob2.hamburger.edu" speed="1000000000" core="6"/>
-> <host id="bob3.hamburger.edu" speed="1000000000" core="6"/>
-> <host id="bob4.hamburger.edu" speed="1000000000" core="6"/>
-> <host id="bob6.hamburger.edu" speed="1000000000" core="6"/>
+> <host id="bob0.hamburger.edu" speed="1e+09" core="6"/>
+> <host id="bob2.hamburger.edu" speed="1e+09" core="6"/>
+> <host id="bob3.hamburger.edu" speed="1e+09" core="6"/>
+> <host id="bob4.hamburger.edu" speed="1e+09" core="6"/>
+> <host id="bob6.hamburger.edu" speed="1e+09" core="6"/>
> <router id="bobbob_cluster_router.hamburger.edu"/>
-> <link id="__loopback__" bandwidth="10000000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_0_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_0_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_2_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_2_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_3_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_3_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_4_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_4_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_6_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_6_UP" bandwidth="125000000" latency="0.000050000"/>
+> <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_0_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_0_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_2_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_2_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_3_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_3_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_4_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_4_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_6_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_6_UP" bandwidth="1.25e+08" latency="5e-05"/>
> <route src="bob0.hamburger.edu" dst="bob0.hamburger.edu">
> <link_ctn id="bob_cluster_link_0_UP"/><link_ctn id="bob_cluster_link_0_DOWN"/>
> </route>
$ ${bindir:=.}/flatifier ./host_attributes.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
> <?xml version='1.0'?>
> <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-> <platform version="4">
+> <platform version="4.1">
> <AS id="AS0" routing="Full">
-> <host id="alice" speed="1000000000"/>
-> <host id="bob" speed="1000000000"/>
-> <host id="carol" speed="500000000"/>
-> <host id="dave" speed="1000000000">
+> <host id="alice" speed="1e+09"/>
+> <host id="bob" speed="1e+09"/>
+> <host id="carol" speed="5e+08"/>
+> <host id="dave" speed="1e+09">
> <prop id="OS" value="Linux 2.6.22-14"/>
> <prop id="disk" value="80E9"/>
> <prop id="memory" value="1000000000"/>
> </host>
-> <host id="erin" speed="500000000"/>
-> <link id="__loopback__" bandwidth="10000000000" latency="0.000000000" sharing_policy="FATPIPE"/>
+> <host id="erin" speed="5e+08"/>
+> <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
> <route src="alice" dst="alice">
> <link_ctn id="__loopback__"/>
> </route>
$ ${bindir:=.}/flatifier ./link_attributes.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
> <?xml version='1.0'?>
> <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-> <platform version="4">
+> <platform version="4.1">
> <AS id="AS0" routing="Full">
-> <host id="bob" speed="500000000"/>
-> <link id="__loopback__" bandwidth="10000000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="link1" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link2" bandwidth="125000000" latency="0.000050000" sharing_policy="FATPIPE"/>
-> <link id="link3" bandwidth="80000000" latency="0.000100000"/>
-> <link id="link4" bandwidth="80000000" latency="0.000100000"/>
+> <host id="bob" speed="5e+08"/>
+> <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
+> <link id="link1" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link2" bandwidth="1.25e+08" latency="5e-05" sharing_policy="FATPIPE"/>
+> <link id="link3" bandwidth="8e+07" latency="0.0001"/>
+> <link id="link4" bandwidth="8e+07" latency="0.0001"/>
> <route src="bob" dst="bob">
> <link_ctn id="__loopback__"/>
> </route>
$ ${bindir:=.}/flatifier ./three_hosts_non_symmetric_route.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
> <?xml version='1.0'?>
> <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-> <platform version="4">
+> <platform version="4.1">
> <AS id="AS0" routing="Full">
-> <host id="alice" speed="500000000"/>
-> <host id="bob" speed="1000000000"/>
-> <host id="trudy" speed="250000000"/>
-> <link id="__loopback__" bandwidth="10000000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="link1" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link2" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link3" bandwidth="125000000" latency="0.000050000"/>
+> <host id="alice" speed="5e+08"/>
+> <host id="bob" speed="1e+09"/>
+> <host id="trudy" speed="2.5e+08"/>
+> <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
+> <link id="link1" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link2" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link3" bandwidth="1.25e+08" latency="5e-05"/>
> <route src="alice" dst="alice">
> <link_ctn id="__loopback__"/>
> </route>
$ ${bindir:=.}/flatifier ./two_clusters.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
> <?xml version='1.0'?>
> <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-> <platform version="4">
+> <platform version="4.1">
> <AS id="AS0" routing="Full">
-> <host id="alice0.crepe.fr" speed="1000000000"/>
-> <host id="alice1.crepe.fr" speed="1000000000"/>
-> <host id="bob0.hamburger.edu" speed="1000000000"/>
-> <host id="bob1.hamburger.edu" speed="1000000000"/>
+> <host id="alice0.crepe.fr" speed="1e+09"/>
+> <host id="alice1.crepe.fr" speed="1e+09"/>
+> <host id="bob0.hamburger.edu" speed="1e+09"/>
+> <host id="bob1.hamburger.edu" speed="1e+09"/>
> <router id="alicealice_cluster_router.crepe.fr"/>
> <router id="bobbob_cluster_router.hamburger.edu"/>
-> <link id="__loopback__" bandwidth="10000000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="alice_cluster_backbone" bandwidth="2250000000" latency="0.000500000"/>
-> <link id="alice_cluster_link_0_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="alice_cluster_link_0_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="alice_cluster_link_1_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="alice_cluster_link_1_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="backbone" bandwidth="1250000000" latency="0.000500000"/>
-> <link id="bob_cluster_backbone" bandwidth="2250000000" latency="0.000500000"/>
-> <link id="bob_cluster_link_0_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_0_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_1_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_1_UP" bandwidth="125000000" latency="0.000050000"/>
+> <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
+> <link id="alice_cluster_backbone" bandwidth="2.25e+09" latency="0.0005"/>
+> <link id="alice_cluster_link_0_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="alice_cluster_link_0_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="alice_cluster_link_1_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="alice_cluster_link_1_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="backbone" bandwidth="1.25e+09" latency="0.0005"/>
+> <link id="bob_cluster_backbone" bandwidth="2.25e+09" latency="0.0005"/>
+> <link id="bob_cluster_link_0_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_0_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_1_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_1_UP" bandwidth="1.25e+08" latency="5e-05"/>
> <route src="alice0.crepe.fr" dst="alice0.crepe.fr">
> <link_ctn id="alice_cluster_link_0_UP"/><link_ctn id="alice_cluster_backbone"/><link_ctn id="alice_cluster_link_0_DOWN"/>
> </route>
$ ${bindir:=.}/flatifier ./two_hosts_multi_hop.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
> <?xml version='1.0'?>
> <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-> <platform version="4">
+> <platform version="4.1">
> <AS id="AS0" routing="Full">
-> <host id="alice" speed="500000000"/>
-> <host id="bob" speed="1000000000"/>
-> <link id="__loopback__" bandwidth="10000000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="link_alice" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_bob" bandwidth="125000000" latency="0.000050000"/>
-> <link id="switch" bandwidth="125000000" latency="0.000050000" sharing_policy="FATPIPE"/>
+> <host id="alice" speed="5e+08"/>
+> <host id="bob" speed="1e+09"/>
+> <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
+> <link id="link_alice" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_bob" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="switch" bandwidth="1.25e+08" latency="5e-05" sharing_policy="FATPIPE"/>
> <route src="alice" dst="alice">
> <link_ctn id="__loopback__"/>
> </route>
$ ${bindir:=.}/flatifier ./two_hosts_one_link.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
> <?xml version='1.0'?>
> <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-> <platform version="4">
+> <platform version="4.1">
> <AS id="AS0" routing="Full">
-> <host id="alice" speed="500000000"/>
-> <host id="bob" speed="1000000000"/>
-> <link id="__loopback__" bandwidth="10000000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="link1" bandwidth="125000000" latency="0.000050000"/>
+> <host id="alice" speed="5e+08"/>
+> <host id="bob" speed="1e+09"/>
+> <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
+> <link id="link1" bandwidth="1.25e+08" latency="5e-05"/>
> <route src="alice" dst="alice">
> <link_ctn id="__loopback__"/>
> </route>
$ ${bindir:=.}/flatifier ${srcdir:=.}/examples/platforms/bypassZoneRoute.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
> <?xml version='1.0'?>
> <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-> <platform version="4">
+> <platform version="4.1">
> <AS id="AS0" routing="Full">
-> <host id="1" speed="1000000000"/>
-> <host id="2" speed="1000000000"/>
-> <host id="3" speed="1000000000"/>
+> <host id="1" speed="1e+09"/>
+> <host id="2" speed="1e+09"/>
+> <host id="3" speed="1e+09"/>
> <router id="my_cluster_1_router"/>
> <router id="my_cluster_2_router"/>
> <router id="my_cluster_3_router"/>
-> <link id="__loopback__" bandwidth="10000000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="link1" bandwidth="1250000000" latency="0.000500000"/>
-> <link id="link2" bandwidth="1250000000" latency="0.000500000"/>
-> <link id="link3" bandwidth="1250000000" latency="0.000500000"/>
-> <link id="link_tmp" bandwidth="1250000000" latency="0.000500000"/>
-> <link id="my_cluster_1_link_1_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="my_cluster_1_link_1_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="my_cluster_2_link_2_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="my_cluster_2_link_2_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="my_cluster_3_link_3_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="my_cluster_3_link_3_UP" bandwidth="125000000" latency="0.000050000"/>
+> <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
+> <link id="link1" bandwidth="1.25e+09" latency="0.0005"/>
+> <link id="link2" bandwidth="1.25e+09" latency="0.0005"/>
+> <link id="link3" bandwidth="1.25e+09" latency="0.0005"/>
+> <link id="link_tmp" bandwidth="1.25e+09" latency="0.0005"/>
+> <link id="my_cluster_1_link_1_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="my_cluster_1_link_1_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="my_cluster_2_link_2_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="my_cluster_2_link_2_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="my_cluster_3_link_3_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="my_cluster_3_link_3_UP" bandwidth="1.25e+08" latency="5e-05"/>
> <route src="1" dst="1">
> <link_ctn id="my_cluster_1_link_1_UP"/><link_ctn id="my_cluster_1_link_1_DOWN"/>
> </route>
$ ${bindir:=.}/flatifier ${srcdir:=.}/examples/platforms/cluster_torus.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
> <?xml version='1.0'?>
> <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-> <platform version="4">
-> <AS id="AS0" routing="Full">
-> <host id="node-0.simgrid.org" speed="1000000000"/>
-> <host id="node-1.simgrid.org" speed="1000000000"/>
-> <host id="node-10.simgrid.org" speed="1000000000"/>
-> <host id="node-11.simgrid.org" speed="1000000000"/>
-> <host id="node-2.simgrid.org" speed="1000000000"/>
-> <host id="node-3.simgrid.org" speed="1000000000"/>
-> <host id="node-4.simgrid.org" speed="1000000000"/>
-> <host id="node-5.simgrid.org" speed="1000000000"/>
-> <host id="node-6.simgrid.org" speed="1000000000"/>
-> <host id="node-7.simgrid.org" speed="1000000000"/>
-> <host id="node-8.simgrid.org" speed="1000000000"/>
-> <host id="node-9.simgrid.org" speed="1000000000"/>
-> <link id="__loopback__" bandwidth="10000000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_0_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_10_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_11_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_1_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_2_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_3_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_4_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_5_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_6_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_7_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_8_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_9_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_from_0_to_1_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_0_to_1_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_0_to_3_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_0_to_3_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_0_to_6_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_0_to_6_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_10_to_11_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_10_to_11_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_10_to_4_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_10_to_4_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_10_to_7_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_10_to_7_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_11_to_5_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_11_to_5_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_11_to_8_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_11_to_8_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_11_to_9_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_11_to_9_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_1_to_2_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_1_to_2_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_1_to_4_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_1_to_4_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_1_to_7_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_1_to_7_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_2_to_0_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_2_to_0_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_2_to_5_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_2_to_5_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_2_to_8_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_2_to_8_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_3_to_0_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_3_to_0_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_3_to_4_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_3_to_4_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_3_to_9_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_3_to_9_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_4_to_10_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_4_to_10_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_4_to_1_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_4_to_1_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_4_to_5_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_4_to_5_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_5_to_11_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_5_to_11_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_5_to_2_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_5_to_2_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_5_to_3_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_5_to_3_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_6_to_0_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_6_to_0_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_6_to_7_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_6_to_7_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_6_to_9_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_6_to_9_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_7_to_10_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_7_to_10_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_7_to_1_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_7_to_1_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_7_to_8_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_7_to_8_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_8_to_11_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_8_to_11_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_8_to_2_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_8_to_2_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_8_to_6_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_8_to_6_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_9_to_10_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_9_to_10_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_9_to_3_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_9_to_3_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_9_to_6_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_9_to_6_UP" bandwidth="125000000" latency="0.000050000"/>
+> <platform version="4.1">
+> <AS id="world" routing="Full">
+> <host id="node-0.simgrid.org" speed="1e+09"/>
+> <host id="node-1.simgrid.org" speed="1e+09"/>
+> <host id="node-10.simgrid.org" speed="1e+09"/>
+> <host id="node-11.simgrid.org" speed="1e+09"/>
+> <host id="node-2.simgrid.org" speed="1e+09"/>
+> <host id="node-3.simgrid.org" speed="1e+09"/>
+> <host id="node-4.simgrid.org" speed="1e+09"/>
+> <host id="node-5.simgrid.org" speed="1e+09"/>
+> <host id="node-6.simgrid.org" speed="1e+09"/>
+> <host id="node-7.simgrid.org" speed="1e+09"/>
+> <host id="node-8.simgrid.org" speed="1e+09"/>
+> <host id="node-9.simgrid.org" speed="1e+09"/>
+> <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_0_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_10_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_11_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_1_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_2_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_3_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_4_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_5_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_6_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_7_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_8_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_9_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_from_0_to_1_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_0_to_1_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_0_to_3_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_0_to_3_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_0_to_6_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_0_to_6_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_10_to_11_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_10_to_11_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_10_to_4_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_10_to_4_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_10_to_7_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_10_to_7_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_11_to_5_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_11_to_5_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_11_to_8_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_11_to_8_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_11_to_9_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_11_to_9_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_1_to_2_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_1_to_2_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_1_to_4_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_1_to_4_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_1_to_7_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_1_to_7_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_2_to_0_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_2_to_0_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_2_to_5_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_2_to_5_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_2_to_8_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_2_to_8_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_3_to_0_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_3_to_0_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_3_to_4_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_3_to_4_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_3_to_9_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_3_to_9_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_4_to_10_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_4_to_10_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_4_to_1_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_4_to_1_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_4_to_5_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_4_to_5_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_5_to_11_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_5_to_11_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_5_to_2_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_5_to_2_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_5_to_3_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_5_to_3_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_6_to_0_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_6_to_0_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_6_to_7_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_6_to_7_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_6_to_9_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_6_to_9_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_7_to_10_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_7_to_10_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_7_to_1_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_7_to_1_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_7_to_8_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_7_to_8_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_8_to_11_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_8_to_11_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_8_to_2_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_8_to_2_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_8_to_6_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_8_to_6_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_9_to_10_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_9_to_10_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_9_to_3_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_9_to_3_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_9_to_6_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_9_to_6_UP" bandwidth="1.25e+08" latency="5e-05"/>
> <route src="node-0.simgrid.org" dst="node-0.simgrid.org">
> <link_ctn id="bob_cluster_link_0_loopback"/>
> </route>
$ ${bindir:=.}/flatifier ./cluster_dragonfly_noncontiguous_rad.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
> <?xml version='1.0'?>
> <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-> <platform version="4">
-> <AS id="AS0" routing="Full">
-> <host id="node-0.simgrid.org" speed="1000000000"/>
-> <host id="node-1002.simgrid.org" speed="1000000000"/>
-> <host id="node-1003.simgrid.org" speed="1000000000"/>
-> <host id="node-1004.simgrid.org" speed="1000000000"/>
-> <link id="__loopback__" bandwidth="10000000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="black_link_in_group_0_between_chassis_0_and_1_blade_0_6_DOWN" bandwidth="375000000" latency="0.000050000"/>
-> <link id="black_link_in_group_0_between_chassis_0_and_1_blade_0_6_UP" bandwidth="375000000" latency="0.000050000"/>
-> <link id="black_link_in_group_0_between_chassis_0_and_1_blade_1_7_DOWN" bandwidth="375000000" latency="0.000050000"/>
-> <link id="black_link_in_group_0_between_chassis_0_and_1_blade_1_7_UP" bandwidth="375000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_0_limiter" bandwidth="150000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_0_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_1002_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_1003_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_1004_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_1_limiter" bandwidth="150000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_2_limiter" bandwidth="150000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_3_limiter" bandwidth="150000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_4_limiter" bandwidth="150000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_5_limiter" bandwidth="150000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_6_limiter" bandwidth="150000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_7_limiter" bandwidth="150000000" latency="0.000000000"/>
-> <link id="green_link_in_chassis_0_between_routers_0_and_1_4_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="green_link_in_chassis_0_between_routers_0_and_1_4_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="green_link_in_chassis_1_between_routers_0_and_1_5_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="green_link_in_chassis_1_between_routers_0_and_1_5_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="local_link_from_router_0_to_node_0_0_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="local_link_from_router_0_to_node_0_0_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="local_link_from_router_1_to_node_0_1_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="local_link_from_router_1_to_node_0_1_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="local_link_from_router_2_to_node_0_2_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="local_link_from_router_2_to_node_0_2_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="local_link_from_router_3_to_node_0_3_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="local_link_from_router_3_to_node_0_3_UP" bandwidth="125000000" latency="0.000050000"/>
+> <platform version="4.1">
+> <AS id="world" routing="Full">
+> <host id="node-0.simgrid.org" speed="1e+09"/>
+> <host id="node-1002.simgrid.org" speed="1e+09"/>
+> <host id="node-1003.simgrid.org" speed="1e+09"/>
+> <host id="node-1004.simgrid.org" speed="1e+09"/>
+> <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
+> <link id="black_link_in_group_0_between_chassis_0_and_1_blade_0_6_DOWN" bandwidth="3.75e+08" latency="5e-05"/>
+> <link id="black_link_in_group_0_between_chassis_0_and_1_blade_0_6_UP" bandwidth="3.75e+08" latency="5e-05"/>
+> <link id="black_link_in_group_0_between_chassis_0_and_1_blade_1_7_DOWN" bandwidth="3.75e+08" latency="5e-05"/>
+> <link id="black_link_in_group_0_between_chassis_0_and_1_blade_1_7_UP" bandwidth="3.75e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_0_limiter" bandwidth="1.5e+08" latency="0"/>
+> <link id="bob_cluster_link_0_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_1002_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_1003_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_1004_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_1_limiter" bandwidth="1.5e+08" latency="0"/>
+> <link id="bob_cluster_link_2_limiter" bandwidth="1.5e+08" latency="0"/>
+> <link id="bob_cluster_link_3_limiter" bandwidth="1.5e+08" latency="0"/>
+> <link id="bob_cluster_link_4_limiter" bandwidth="1.5e+08" latency="0"/>
+> <link id="bob_cluster_link_5_limiter" bandwidth="1.5e+08" latency="0"/>
+> <link id="bob_cluster_link_6_limiter" bandwidth="1.5e+08" latency="0"/>
+> <link id="bob_cluster_link_7_limiter" bandwidth="1.5e+08" latency="0"/>
+> <link id="green_link_in_chassis_0_between_routers_0_and_1_4_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="green_link_in_chassis_0_between_routers_0_and_1_4_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="green_link_in_chassis_1_between_routers_0_and_1_5_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="green_link_in_chassis_1_between_routers_0_and_1_5_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="local_link_from_router_0_to_node_0_0_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="local_link_from_router_0_to_node_0_0_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="local_link_from_router_1_to_node_0_1_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="local_link_from_router_1_to_node_0_1_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="local_link_from_router_2_to_node_0_2_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="local_link_from_router_2_to_node_0_2_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="local_link_from_router_3_to_node_0_3_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="local_link_from_router_3_to_node_0_3_UP" bandwidth="1.25e+08" latency="5e-05"/>
> <route src="node-0.simgrid.org" dst="node-0.simgrid.org">
> <link_ctn id="bob_cluster_link_0_loopback"/>
> </route>
$ ${bindir:=.}/flatifier ./cluster_fat_tree_noncontiguous_rad.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
> <?xml version='1.0'?>
> <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-> <platform version="4">
-> <AS id="AS0" routing="Full">
-> <host id="node-100.simgrid.org" speed="1000000000"/>
-> <host id="node-101.simgrid.org" speed="1000000000"/>
-> <host id="node-119.simgrid.org" speed="1000000000"/>
-> <host id="node-120.simgrid.org" speed="1000000000"/>
-> <link id="__loopback__" bandwidth="10000000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_0_limiter" bandwidth="50000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_100_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_101_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_119_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_120_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_1_limiter" bandwidth="50000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_2_limiter" bandwidth="50000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_3_limiter" bandwidth="50000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_4_limiter" bandwidth="50000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_5_limiter" bandwidth="50000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_6_limiter" bandwidth="50000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_7_limiter" bandwidth="50000000" latency="0.000000000"/>
-> <link id="link_from_0_7_0_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_0_7_0_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_1_7_1_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_1_7_1_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_2_6_2_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_2_6_2_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_3_6_3_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_3_6_3_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_6_4_10_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_6_4_10_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_6_4_11_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_6_4_11_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_6_5_8_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_6_5_8_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_6_5_9_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_6_5_9_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_7_4_6_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_7_4_6_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_7_4_7_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_7_4_7_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_7_5_4_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_7_5_4_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_7_5_5_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link_from_7_5_5_UP" bandwidth="125000000" latency="0.000050000"/>
+> <platform version="4.1">
+> <AS id="world" routing="Full">
+> <host id="node-100.simgrid.org" speed="1e+09"/>
+> <host id="node-101.simgrid.org" speed="1e+09"/>
+> <host id="node-119.simgrid.org" speed="1e+09"/>
+> <host id="node-120.simgrid.org" speed="1e+09"/>
+> <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_0_limiter" bandwidth="5e+07" latency="0"/>
+> <link id="bob_cluster_link_100_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_101_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_119_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_120_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_1_limiter" bandwidth="5e+07" latency="0"/>
+> <link id="bob_cluster_link_2_limiter" bandwidth="5e+07" latency="0"/>
+> <link id="bob_cluster_link_3_limiter" bandwidth="5e+07" latency="0"/>
+> <link id="bob_cluster_link_4_limiter" bandwidth="5e+07" latency="0"/>
+> <link id="bob_cluster_link_5_limiter" bandwidth="5e+07" latency="0"/>
+> <link id="bob_cluster_link_6_limiter" bandwidth="5e+07" latency="0"/>
+> <link id="bob_cluster_link_7_limiter" bandwidth="5e+07" latency="0"/>
+> <link id="link_from_0_7_0_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_0_7_0_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_1_7_1_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_1_7_1_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_2_6_2_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_2_6_2_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_3_6_3_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_3_6_3_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_6_4_10_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_6_4_10_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_6_4_11_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_6_4_11_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_6_5_8_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_6_5_8_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_6_5_9_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_6_5_9_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_7_4_6_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_7_4_6_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_7_4_7_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_7_4_7_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_7_5_4_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_7_5_4_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_7_5_5_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link_from_7_5_5_UP" bandwidth="1.25e+08" latency="5e-05"/>
> <route src="node-100.simgrid.org" dst="node-100.simgrid.org">
> <link_ctn id="bob_cluster_link_100_loopback"/>
> </route>
$ ${bindir:=.}/flatifier ./cluster_torus_noncontiguous_rad.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
> <?xml version='1.0'?>
> <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-> <platform version="4">
-> <AS id="AS0" routing="Full">
-> <host id="node-0.simgrid.org" speed="1000000000"/>
-> <host id="node-1.simgrid.org" speed="1000000000"/>
-> <host id="node-102.simgrid.org" speed="1000000000"/>
-> <host id="node-103.simgrid.org" speed="1000000000"/>
-> <link id="__loopback__" bandwidth="10000000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_0_limiter" bandwidth="50000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_0_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_102_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_103_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_1_limiter" bandwidth="50000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_1_loopback" bandwidth="100000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="bob_cluster_link_2_limiter" bandwidth="50000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_3_limiter" bandwidth="50000000" latency="0.000000000"/>
-> <link id="bob_cluster_link_from_0_to_0_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_0_to_0_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_0_to_1_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_0_to_1_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_0_to_2_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_0_to_2_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_1_to_0_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_1_to_0_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_1_to_1_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_1_to_1_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_1_to_3_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_1_to_3_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_2_to_0_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_2_to_0_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_2_to_2_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_2_to_2_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_2_to_3_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_2_to_3_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_3_to_1_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_3_to_1_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_3_to_2_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_3_to_2_UP" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_3_to_3_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="bob_cluster_link_from_3_to_3_UP" bandwidth="125000000" latency="0.000050000"/>
+> <platform version="4.1">
+> <AS id="world" routing="Full">
+> <host id="node-0.simgrid.org" speed="1e+09"/>
+> <host id="node-1.simgrid.org" speed="1e+09"/>
+> <host id="node-102.simgrid.org" speed="1e+09"/>
+> <host id="node-103.simgrid.org" speed="1e+09"/>
+> <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_0_limiter" bandwidth="5e+07" latency="0"/>
+> <link id="bob_cluster_link_0_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_102_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_103_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_1_limiter" bandwidth="5e+07" latency="0"/>
+> <link id="bob_cluster_link_1_loopback" bandwidth="1e+08" latency="0" sharing_policy="FATPIPE"/>
+> <link id="bob_cluster_link_2_limiter" bandwidth="5e+07" latency="0"/>
+> <link id="bob_cluster_link_3_limiter" bandwidth="5e+07" latency="0"/>
+> <link id="bob_cluster_link_from_0_to_0_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_0_to_0_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_0_to_1_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_0_to_1_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_0_to_2_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_0_to_2_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_1_to_0_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_1_to_0_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_1_to_1_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_1_to_1_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_1_to_3_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_1_to_3_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_2_to_0_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_2_to_0_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_2_to_2_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_2_to_2_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_2_to_3_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_2_to_3_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_3_to_1_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_3_to_1_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_3_to_2_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_3_to_2_UP" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_3_to_3_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="bob_cluster_link_from_3_to_3_UP" bandwidth="1.25e+08" latency="5e-05"/>
> <route src="node-0.simgrid.org" dst="node-0.simgrid.org">
> <link_ctn id="bob_cluster_link_0_loopback"/>
> </route>
$ ${bindir:=.}/flatifier ./two_hosts_one_link_splitduplex.xml "--log=root.fmt:[%10.6r]%e[%i:%a@%h]%e%m%n"
> <?xml version='1.0'?>
> <!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
-> <platform version="4">
+> <platform version="4.1">
> <AS id="AS0" routing="Full">
-> <host id="alice" speed="500000000"/>
-> <host id="bob" speed="1000000000"/>
-> <link id="__loopback__" bandwidth="10000000000" latency="0.000000000" sharing_policy="FATPIPE"/>
-> <link id="link1_DOWN" bandwidth="125000000" latency="0.000050000"/>
-> <link id="link1_UP" bandwidth="125000000" latency="0.000050000"/>
+> <host id="alice" speed="5e+08"/>
+> <host id="bob" speed="1e+09"/>
+> <link id="__loopback__" bandwidth="1e+10" latency="0" sharing_policy="FATPIPE"/>
+> <link id="link1_DOWN" bandwidth="1.25e+08" latency="5e-05"/>
+> <link id="link1_UP" bandwidth="1.25e+08" latency="5e-05"/>
> <route src="alice" dst="alice">
> <link_ctn id="__loopback__"/>
> </route>
// Make sure we have a clean slate
xbt_assert(not mbox_.eager->listen(), "Eager mailbox should be empty when starting a test");
xbt_assert(not mbox_.rdv->listen(), "RDV mailbox should be empty when starting a test");
- for (; step_index < s.steps.size(); step_index++) {
- const Step& step = s.steps[step_index];
- if (step.entity != Step::Entity::SND || step.type != Step::Type::ACTION)
- continue;
- try {
+
+ Action current_action;
+ try {
+ for (; step_index < s.steps.size(); step_index++) {
+ const Step& step = s.steps[step_index];
+ if (step.entity != Step::Entity::SND || step.type != Step::Type::ACTION)
+ continue;
+
+ current_action = Action::SLEEP;
sg4::this_actor::sleep_until(s.start_time + step.rel_time);
- } catch (const simgrid::Exception& e) {
- XBT_DEBUG("During Sleep, failed to send message because of a %s exception (%s)", typeid(e).name(), e.what());
- break;
- }
- // Check if the other host is still OK.
- if (not other_host_->is_on())
- break;
- // Perform the action
- try {
+
+ // Check if the other host is still OK.
+ if (not other_host_->is_on())
+ break;
+
+ // Perform the action
+ current_action = step.action_type;
switch (step.action_type) {
case Action::PUT:
comm = do_put(s.type, send_value);
default:
xbt_die("Not a valid action for SND");
}
- } catch (const simgrid::Exception& e) {
- XBT_DEBUG("During %s, failed to send message because of a %s exception (%s)", to_c_str(step.action_type),
- typeid(e).name(), e.what());
- break;
}
+ } catch (const simgrid::Exception& e) {
+ XBT_DEBUG("During %s, failed to send message because of a %s exception (%s)", to_c_str(current_action),
+ typeid(e).name(), e.what());
}
try {
sg4::this_actor::sleep_until(end_time);
// Make sure we have a clean slate
xbt_assert(not mbox_.eager->listen(), "Eager mailbox should be empty when starting a test");
xbt_assert(not mbox_.rdv->listen(), "RDV mailbox should be empty when starting a test");
- for (; step_index < s.steps.size(); step_index++) {
- const Step& step = s.steps[step_index];
- if (step.entity != Step::Entity::RCV || step.type != Step::Type::ACTION)
- continue;
- try {
+
+ Action current_action;
+ try {
+ for (; step_index < s.steps.size(); step_index++) {
+ const Step& step = s.steps[step_index];
+ if (step.entity != Step::Entity::RCV || step.type != Step::Type::ACTION)
+ continue;
+
+ current_action = Action::SLEEP;
sg4::this_actor::sleep_until(s.start_time + step.rel_time);
- } catch (const simgrid::Exception& e) {
- XBT_DEBUG("During Sleep, failed to receive message because of a %s exception (%s)", typeid(e).name(), e.what());
- break;
- }
- // Check if the other host is still OK.
- if (not other_host_->is_on())
- break;
- // Perform the action
- try {
+
+ // Check if the other host is still OK.
+ if (not other_host_->is_on())
+ break;
+ // Perform the action
switch (step.action_type) {
case Action::GET:
comm = do_get(type, receive_ptr);
default:
xbt_die("Not a valid action for RCV");
}
- } catch (const simgrid::Exception& e) {
- XBT_DEBUG("During %s, failed to receive message because of a %s exception (%s)", to_c_str(step.action_type),
- typeid(e).name(), e.what());
- break;
}
+ } catch (const simgrid::Exception& e) {
+ XBT_DEBUG("During %s, failed to receive message because of a %s exception (%s)", to_c_str(current_action),
+ typeid(e).name(), e.what());
}
try {
sg4::this_actor::sleep_until(end_time - .1);
auto host = e.host_by_name("cpu0");
/* creation of the tasks and their dependencies */
- simgrid::s4u::ExecPtr Init = simgrid::s4u::Exec::init()->set_name("Init")->set_flops_amount(0)->vetoable_start();
- simgrid::s4u::CommPtr A = simgrid::s4u::Comm::sendto_init()->set_name("A")->set_payload_size(1e9)->vetoable_start();
- simgrid::s4u::CommPtr B = simgrid::s4u::Comm::sendto_init()->set_name("B")->vetoable_start();
- simgrid::s4u::ExecPtr C = simgrid::s4u::Exec::init()->set_name("C")->vetoable_start();
- simgrid::s4u::CommPtr D = simgrid::s4u::Comm::sendto_init()->set_name("D")->set_payload_size(1e9)->vetoable_start();
+ simgrid::s4u::ExecPtr Init = simgrid::s4u::Exec::init()->set_name("Init")->set_flops_amount(0)->start();
+ simgrid::s4u::CommPtr A = simgrid::s4u::Comm::sendto_init()->set_name("A")->set_payload_size(1e9)->start();
+ simgrid::s4u::CommPtr B = simgrid::s4u::Comm::sendto_init()->set_name("B")->start();
+ simgrid::s4u::ExecPtr C = simgrid::s4u::Exec::init()->set_name("C")->start();
+ simgrid::s4u::CommPtr D = simgrid::s4u::Comm::sendto_init()->set_name("D")->set_payload_size(1e9)->start();
std::vector<simgrid::s4u::ActivityPtr> activities = {Init, A, B, C, D};
Init->add_successor(A);
});
/* creation of the activities and their dependencies */
- simgrid::s4u::ExecPtr A = simgrid::s4u::Exec::init()->set_name("A")->vetoable_start();
- simgrid::s4u::ExecPtr B = simgrid::s4u::Exec::init()->set_name("B")->vetoable_start();
- simgrid::s4u::ExecPtr C = simgrid::s4u::Exec::init()->set_name("C")->vetoable_start();
- simgrid::s4u::ExecPtr D = simgrid::s4u::Exec::init()->set_name("D")->vetoable_start();
+ simgrid::s4u::ExecPtr A = simgrid::s4u::Exec::init()->set_name("A")->start();
+ simgrid::s4u::ExecPtr B = simgrid::s4u::Exec::init()->set_name("B")->start();
+ simgrid::s4u::ExecPtr C = simgrid::s4u::Exec::init()->set_name("C")->start();
+ simgrid::s4u::ExecPtr D = simgrid::s4u::Exec::init()->set_name("D")->start();
B->add_successor(A);
C->add_successor(A);
mode=3;
if(mode==1)
- xbt_log_control_set("ker_lmm.threshold:DEBUG ker_lmm.fmt:\'[%r]: [%c/%p] %m%n\' "
- "kernel.threshold:DEBUG kernel.fmt:\'[%r]: [%c/%p] %m%n\' ");
+ xbt_log_control_set("ker_lmm.threshold:DEBUG ker_lmm.fmt:'[%r]: [%c/%p] %m%n' "
+ "kernel.threshold:DEBUG kernel.fmt:'[%r]: [%c/%p] %m%n' ");
if(mode==2)
xbt_log_control_set("ker_lmm.threshold:DEBUG kernel.threshold:DEBUG");
# Do not leak the current directory into the binaries
if(CMAKE_COMPILER_IS_GNUCC AND NOT enable_coverage)
- execute_process(COMMAND realpath --relative-to=${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}
- RESULT_VARIABLE RESULT OUTPUT_VARIABLE RELATIVE_SOURCE_DIR ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(RESULT EQUAL 0)
- message(STATUS "Relative source directory is \"${RELATIVE_SOURCE_DIR}\".")
- else()
- message(WARNING "Failed to find relative source directory. Using \".\".")
- set(RELATIVE_SOURCE_DIR ".")
+ if (CMAKE_VERSION VERSION_LESS "3.20")
+ file(RELATIVE_PATH RELATIVE_SOURCE_DIR ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
+ else() # cmake >= 3.20
+ cmake_path(RELATIVE_PATH CMAKE_SOURCE_DIR BASE_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE RELATIVE_SOURCE_DIR)
endif()
+ message(STATUS "Relative source directory is \"${RELATIVE_SOURCE_DIR}\".")
if (CMAKE_C_COMPILER_VERSION VERSION_LESS "8.0")
set(optCFLAGS "${optCFLAGS} -fdebug-prefix-map=\"${CMAKE_SOURCE_DIR}=${RELATIVE_SOURCE_DIR}\"")
else()