X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/35a389f7c71363e88bc1d4537390305fc24a959b..20617cf3b759fbd35ddc68d0aee2965e8379c98b:/examples/s4u/exec-ptask/s4u-exec-ptask.cpp diff --git a/examples/s4u/exec-ptask/s4u-exec-ptask.cpp b/examples/s4u/exec-ptask/s4u-exec-ptask.cpp index 14907717b4..c243494d00 100644 --- a/examples/s4u/exec-ptask/s4u-exec-ptask.cpp +++ b/examples/s4u/exec-ptask/s4u-exec-ptask.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017-2018. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2019. 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. */ @@ -26,8 +26,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_energyptask, "Messages specific for this s4u ex static void runner() { /* Retrieve the list of all hosts as an array of hosts */ - std::vector hosts = simgrid::s4u::Engine::get_instance()->get_all_hosts(); - int hosts_count = hosts.size(); + auto hosts = simgrid::s4u::Engine::get_instance()->get_all_hosts(); + size_t hosts_count = hosts.size(); XBT_INFO("First, build a classical parallel task, with 1 Gflop to execute on each node, " "and 10MB to exchange between each pair"); @@ -38,8 +38,8 @@ static void runner() /* ------[ test 1 ]----------------- */ computation_amounts.assign(hosts.size(), 1e9 /*1Gflop*/); communication_amounts.assign(hosts.size() * hosts.size(), 0); - for (int i = 0; i < hosts_count; i++) - for (int j = i + 1; j < hosts_count; j++) + for (size_t i = 0; i < hosts_count; i++) + for (size_t j = i + 1; j < hosts_count; j++) communication_amounts[i * hosts_count + j] = 1e7; // 10 MB simgrid::s4u::this_actor::parallel_execute(hosts, computation_amounts, communication_amounts); @@ -48,8 +48,8 @@ static void runner() XBT_INFO("We can do the same with a timeout of one second enabled."); computation_amounts.assign(hosts.size(), 1e9 /*1Gflop*/); communication_amounts.assign(hosts.size() * hosts.size(), 0); - for (int i = 0; i < hosts_count; i++) - for (int j = i + 1; j < hosts_count; j++) + for (size_t i = 0; i < hosts_count; i++) + for (size_t j = i + 1; j < hosts_count; j++) communication_amounts[i * hosts_count + j] = 1e7; // 10 MB try { @@ -70,7 +70,7 @@ static void runner() /* ------[ test 4 ]----------------- */ XBT_INFO("Then, build a parallel task involving only heterogeneous computations and no communication"); computation_amounts.resize(hosts.size()); - for (int i = 0; i < hosts_count; i++) + for (size_t i = 0; i < hosts_count; i++) computation_amounts[i] = 5 * (i + 1) * 1e8; // 500Mflop, 1Gflop, 1.5Gflop communication_amounts.clear(); /* no comm */ simgrid::s4u::this_actor::parallel_execute(hosts, computation_amounts, communication_amounts);