From 8b47d18183827cb13535fd1b3f50df6dfb04b73e Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 12 Apr 2023 17:58:18 +0200 Subject: [PATCH] Use host->set_concurrency_limit(1) in an example where it makes sense --- examples/cpp/dag-scheduling/s4u-dag-scheduling.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/cpp/dag-scheduling/s4u-dag-scheduling.cpp b/examples/cpp/dag-scheduling/s4u-dag-scheduling.cpp index d20de088e1..97938f20de 100644 --- a/examples/cpp/dag-scheduling/s4u-dag-scheduling.cpp +++ b/examples/cpp/dag-scheduling/s4u-dag-scheduling.cpp @@ -165,10 +165,17 @@ int main(int argc, char** argv) }); 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 host_attributes(total_nhosts); for (unsigned long i = 0; i < total_nhosts; i++) hosts[i]->set_data(&host_attributes[i]); -- 2.20.1