-/* Copyright (c) 2009-2022. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2009-2023. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
});
e.load_platform(argv[1]);
+ const auto hosts = e.get_all_hosts();
+
+ /* Mark all hosts as sequential, as it ought to be in such a scheduling example.
+ *
+ * It means that the hosts can only compute one thing at a given time. If an execution already takes place on a given
+ * host, any subsequently started execution will be queued until after the first execution terminates */
+ for (auto const& host : hosts)
+ host->set_concurrency_limit(1);
/* Allocating the host attribute */
unsigned long total_nhosts = e.get_host_count();
- const auto hosts = e.get_all_hosts();
std::vector<HostAttribute> host_attributes(total_nhosts);
for (unsigned long i = 0; i < total_nhosts; i++)
hosts[i]->set_data(&host_attributes[i]);
* new dependency
*/
- auto last_scheduled_task = sg_host_get_last_scheduled_task(selected_host);
- if (last_scheduled_task && (last_scheduled_task->get_state() != sg4::Activity::State::FINISHED) &&
+ if (auto last_scheduled_task = sg_host_get_last_scheduled_task(selected_host);
+ last_scheduled_task && (last_scheduled_task->get_state() != sg4::Activity::State::FINISHED) &&
(last_scheduled_task->get_state() != sg4::Activity::State::FAILED) &&
not dependency_exists(sg_host_get_last_scheduled_task(selected_host), selected_task))
last_scheduled_task->add_successor(selected_task);