From 20617cf3b759fbd35ddc68d0aee2965e8379c98b Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 10 Jan 2019 14:55:14 +0100 Subject: [PATCH] Fix signess that bother Qt Creator --- examples/s4u/exec-ptask/s4u-exec-ptask.cpp | 14 +++++++------- include/simgrid/actor.h | 4 ++-- src/s4u/s4u_Actor.cpp | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/s4u/exec-ptask/s4u-exec-ptask.cpp b/examples/s4u/exec-ptask/s4u-exec-ptask.cpp index 645afd45b6..c243494d00 100644 --- a/examples/s4u/exec-ptask/s4u-exec-ptask.cpp +++ b/examples/s4u/exec-ptask/s4u-exec-ptask.cpp @@ -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); diff --git a/include/simgrid/actor.h b/include/simgrid/actor.h index 5871dc0a58..5aa30d1f92 100644 --- a/include/simgrid/actor.h +++ b/include/simgrid/actor.h @@ -20,8 +20,8 @@ SG_BEGIN_DECL() You should not access directly to the fields of the pointed structure, but always use the provided API to interact with actors. */ -XBT_PUBLIC int sg_actor_get_PID(sg_actor_t actor); -XBT_PUBLIC int sg_actor_get_PPID(sg_actor_t actor); +XBT_PUBLIC aid_t sg_actor_get_PID(sg_actor_t actor); +XBT_PUBLIC aid_t sg_actor_get_PPID(sg_actor_t actor); XBT_PUBLIC sg_actor_t sg_actor_by_PID(aid_t pid); XBT_PUBLIC const char* sg_actor_get_name(sg_actor_t actor); XBT_PUBLIC sg_host_t sg_actor_get_host(sg_actor_t actor); diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index b22b2b0531..3869be94f6 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -460,7 +460,7 @@ void kill() /* deprecated */ * * This function checks whether @a actor is a valid pointer and return its PID (or 0 in case of problem). */ -int sg_actor_get_PID(sg_actor_t actor) +aid_t sg_actor_get_PID(sg_actor_t actor) { /* Do not raise an exception here: this function is called by the logs * and the exceptions, so it would be called back again and again */ @@ -475,7 +475,7 @@ int sg_actor_get_PID(sg_actor_t actor) * This function checks whether @a actor is a valid pointer and return its parent's PID. * Returns -1 if the actor has not been created by any other actor. */ -int sg_actor_get_PPID(sg_actor_t actor) +aid_t sg_actor_get_PPID(sg_actor_t actor) { return actor->get_ppid(); } -- 2.20.1