- double data_available = 0.;
- double last_data_available = -1.0;
- /* compute last_data_available */
- for (const auto& parent : task->get_dependencies()) {
- /* normal case */
- if (const auto* comm = dynamic_cast<sg4::Comm*>(parent.get())) {
- auto source = comm->get_source();
- XBT_DEBUG("transfer from %s to %s", source->get_cname(), host->get_cname());
- /* Estimate the redistribution time from this parent */
- double redist_time;
- if (comm->get_remaining() <= 1e-6) {
- redist_time = 0;
- } else {
- double bandwidth = std::numeric_limits<double>::max();
- auto [links, latency] = source->route_to(host);
- for (auto const& link : links)
- bandwidth = std::min(bandwidth, link->get_bandwidth());
-
- redist_time = latency + comm->get_remaining() / bandwidth;
+ sg4::Host* best_host = nullptr;
+ *min_finish_time = std::numeric_limits<double>::max();
+
+ for (const auto& host : sg4::Engine::get_instance()->get_all_hosts()) {
+ double data_available = 0.;
+ double last_data_available = -1.0;
+ /* compute last_data_available */
+ for (const auto& parent : exec->get_dependencies()) {
+ /* normal case */
+ if (const auto* comm = dynamic_cast<sg4::Comm*>(parent.get())) {
+ const auto* source = comm->get_source();
+ XBT_DEBUG("transfer from %s to %s", source->get_cname(), host->get_cname());
+ /* Estimate the redistribution time from this parent */
+ double redist_time;
+ if (comm->get_remaining() <= 1e-6) {
+ redist_time = 0;
+ } else {
+ double bandwidth = std::numeric_limits<double>::max();
+ auto [links, latency] = source->route_to(host);
+ for (auto const& link : links)
+ bandwidth = std::min(bandwidth, link->get_bandwidth());
+
+ redist_time = latency + comm->get_remaining() / bandwidth;
+ }
+ // We use the user data field to store the finish time of the predecessor of the comm, i.e., its potential
+ // start time
+ data_available = *comm->get_data<double>() + redist_time;