From: Martin Quinson Date: Wed, 23 May 2018 16:17:25 +0000 (+0200) Subject: fix a gramatical error all over our variables X-Git-Tag: v3.20~198 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f679512d82a1ab52c61c4ccebc5144362334a65a?ds=sidebyside fix a gramatical error all over our variables --- diff --git a/doc/tuto-msg/masterworker-sol1.c b/doc/tuto-msg/masterworker-sol1.c index 7441cab134..180c61e1b0 100644 --- a/doc/tuto-msg/masterworker-sol1.c +++ b/doc/tuto-msg/masterworker-sol1.c @@ -43,23 +43,23 @@ static int master(int argc, char* argv[]) } /* Get the info about the worker processes (directly from SimGrid) */ - int workers_count = MSG_get_host_number(); + int worker_count = MSG_get_host_number(); msg_host_t* workers = xbt_dynar_to_array(MSG_hosts_as_dynar()); - for (int i = 0; i < workers_count; i++) + for (int i = 0; i < worker_count; i++) if (host_self == workers[i]) { - workers[i] = workers[workers_count - 1]; - workers_count--; + workers[i] = workers[worker_count - 1]; + worker_count--; break; } - for (int i = 0; i < workers_count; i++) + for (int i = 0; i < worker_count; i++) MSG_process_create("worker", worker, (void*)master_name, workers[i]); - XBT_INFO("Got %d workers and %ld tasks to process", workers_count, number_of_tasks); + XBT_INFO("Got %d workers and %ld tasks to process", worker_count, number_of_tasks); /* Dispatch the tasks */ for (int i = 0; i < number_of_tasks; i++) { - build_channel_name(channel, master_name, MSG_host_get_name(workers[i % workers_count])); + build_channel_name(channel, master_name, MSG_host_get_name(workers[i % worker_count])); XBT_INFO("Sending '%s' to channel '%s'", todo[i]->name, channel); @@ -68,9 +68,9 @@ static int master(int argc, char* argv[]) } XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over."); - for (int i = 0; i < workers_count; i++) { + for (int i = 0; i < worker_count; i++) { msg_task_t finalize = MSG_task_create("finalize", 0, 0, FINALIZE); - MSG_task_send(finalize, build_channel_name(channel, master_name, MSG_host_get_name(workers[i % workers_count]))); + MSG_task_send(finalize, build_channel_name(channel, master_name, MSG_host_get_name(workers[i % worker_count]))); } XBT_INFO("Goodbye now!"); diff --git a/doc/tuto-msg/masterworker-sol2.c b/doc/tuto-msg/masterworker-sol2.c index 2b71a0bacc..16d44b0446 100644 --- a/doc/tuto-msg/masterworker-sol2.c +++ b/doc/tuto-msg/masterworker-sol2.c @@ -34,19 +34,19 @@ static int master(int argc, char* argv[]) double comm_size = xbt_str_parse_double(argv[3], "Invalid communication size: %s"); /** - Task communication size */ /* Get the info about the worker processes (directly from SimGrid) */ - int workers_count = MSG_get_host_number(); + int worker_count = MSG_get_host_number(); msg_host_t* workers = xbt_dynar_to_array(MSG_hosts_as_dynar()); - for (int i = 0; i < workers_count; i++) // Remove my host from the list + for (int i = 0; i < worker_count; i++) // Remove my host from the list if (host_self == workers[i]) { - workers[i] = workers[workers_count - 1]; - workers_count--; + workers[i] = workers[worker_count - 1]; + worker_count--; break; } - for (int i = 0; i < workers_count; i++) + for (int i = 0; i < worker_count; i++) MSG_process_create("worker", worker, (void*)master_name, workers[i]); - XBT_INFO("Got %d workers and will send tasks for %g seconds", workers_count, timeout); + XBT_INFO("Got %d workers and will send tasks for %g seconds", worker_count, timeout); /* Dispatch the tasks */ int task_num = 0; @@ -58,7 +58,7 @@ static int master(int argc, char* argv[]) sprintf(sprintf_buffer, "Task_%d", task_num); msg_task_t task = MSG_task_create(sprintf_buffer, comp_size, comm_size, NULL); - build_channel_name(channel, master_name, MSG_host_get_name(workers[task_num % workers_count])); + build_channel_name(channel, master_name, MSG_host_get_name(workers[task_num % worker_count])); XBT_DEBUG("Sending '%s' to channel '%s'", task->name, channel); MSG_task_send(task, channel); @@ -67,9 +67,9 @@ static int master(int argc, char* argv[]) } XBT_DEBUG("All tasks have been dispatched. Let's tell everybody the computation is over."); - for (int i = 0; i < workers_count; i++) { + for (int i = 0; i < worker_count; i++) { msg_task_t finalize = MSG_task_create("finalize", 0, 0, FINALIZE); - MSG_task_send(finalize, build_channel_name(channel, master_name, MSG_host_get_name(workers[i % workers_count]))); + MSG_task_send(finalize, build_channel_name(channel, master_name, MSG_host_get_name(workers[i % worker_count]))); } XBT_DEBUG("Sent %d tasks in total!", task_num); diff --git a/doc/tuto-msg/masterworker-sol3.c b/doc/tuto-msg/masterworker-sol3.c index 8cb7f1910a..2c187ec62f 100644 --- a/doc/tuto-msg/masterworker-sol3.c +++ b/doc/tuto-msg/masterworker-sol3.c @@ -36,19 +36,19 @@ static int master(int argc, char* argv[]) double comm_size = xbt_str_parse_double(argv[3], "Invalid communication size: %s"); /** - Task communication size */ /* Get the info about the worker processes */ - int workers_count = MSG_get_host_number(); + int worker_count = MSG_get_host_number(); msg_host_t* workers = xbt_dynar_to_array(MSG_hosts_as_dynar()); - for (int i = 0; i < workers_count; i++) // Remove my host from the list + for (int i = 0; i < worker_count; i++) // Remove my host from the list if (host_self == workers[i]) { - workers[i] = workers[workers_count - 1]; - workers_count--; + workers[i] = workers[worker_count - 1]; + worker_count--; break; } - for (int i = 0; i < workers_count; i++) + for (int i = 0; i < worker_count; i++) MSG_process_create("worker", worker, (void*)master_name, workers[i]); - XBT_INFO("Got %d workers and will send tasks for %g seconds", workers_count, timeout); + XBT_INFO("Got %d workers and will send tasks for %g seconds", worker_count, timeout); /* Dispatch the tasks */ int task_num = 0; @@ -62,7 +62,7 @@ static int master(int argc, char* argv[]) msg_task_t task = MSG_task_create(sprintf_buffer, comp_size, comm_size, NULL); MSG_task_set_category(task, master_name); - build_channel_name(channel, master_name, MSG_host_get_name(workers[task_num % workers_count])); + build_channel_name(channel, master_name, MSG_host_get_name(workers[task_num % worker_count])); XBT_DEBUG("Sending '%s' to channel '%s'", task->name, channel); MSG_task_send(task, channel); @@ -71,9 +71,9 @@ static int master(int argc, char* argv[]) } XBT_DEBUG("All tasks have been dispatched. Let's tell everybody the computation is over."); - for (int i = 0; i < workers_count; i++) { + for (int i = 0; i < worker_count; i++) { msg_task_t finalize = MSG_task_create("finalize", 0, 0, FINALIZE); - MSG_task_send(finalize, build_channel_name(channel, master_name, MSG_host_get_name(workers[i % workers_count]))); + MSG_task_send(finalize, build_channel_name(channel, master_name, MSG_host_get_name(workers[i % worker_count]))); } XBT_INFO("Sent %d tasks in total!", task_num); diff --git a/doc/tuto-msg/masterworker-sol4.c b/doc/tuto-msg/masterworker-sol4.c index 890cdc41ed..6235ed639f 100644 --- a/doc/tuto-msg/masterworker-sol4.c +++ b/doc/tuto-msg/masterworker-sol4.c @@ -36,19 +36,19 @@ static int master(int argc, char* argv[]) double comm_size = xbt_str_parse_double(argv[3], "Invalid communication size: %s"); /** - Task communication size */ /* Get the info about the worker processes */ - int workers_count = MSG_get_host_number(); + int worker_count = MSG_get_host_number(); msg_host_t* workers = xbt_dynar_to_array(MSG_hosts_as_dynar()); - for (int i = 0; i < workers_count; i++) // Remove my host from the list + for (int i = 0; i < worker_count; i++) // Remove my host from the list if (host_self == workers[i]) { - workers[i] = workers[workers_count - 1]; - workers_count--; + workers[i] = workers[worker_count - 1]; + worker_count--; break; } - for (int i = 0; i < workers_count; i++) + for (int i = 0; i < worker_count; i++) MSG_process_create("worker", worker, (void*)master_name, workers[i]); - XBT_INFO("Got %d workers and will send tasks for %g seconds", workers_count, timeout); + XBT_INFO("Got %d workers and will send tasks for %g seconds", worker_count, timeout); /* Dispatch the tasks */ int task_num = 0; @@ -78,7 +78,7 @@ static int master(int argc, char* argv[]) } XBT_DEBUG("Time is up. Let's tell everybody the computation is over."); - for (int i = 0; i < workers_count; i++) { /* We don't write in order, but the total amount is right */ + for (int i = 0; i < worker_count; i++) { /* We don't write in order, but the total amount is right */ /* Don't write to a worker that did not request for work, or it will deadlock: both would be sending something */ msg_task_t request = NULL; diff --git a/doc/tuto-msg/masterworker.c b/doc/tuto-msg/masterworker.c index 4ff16b002b..2a2b906354 100644 --- a/doc/tuto-msg/masterworker.c +++ b/doc/tuto-msg/masterworker.c @@ -28,28 +28,28 @@ static int master(int argc, char* argv[]) } /* Get the info about the worker processes from my parameters */ - int workers_count = argc - 4; - msg_host_t* workers = xbt_new0(msg_host_t, workers_count); + int worker_count = argc - 4; + msg_host_t* workers = xbt_new0(msg_host_t, worker_count); for (int i = 4; i < argc; i++) { workers[i - 4] = MSG_get_host_by_name(argv[i]); xbt_assert(workers[i - 4] != NULL, "Unknown host %s. Stopping Now! ", argv[i]); } - XBT_INFO("Got %d workers and %ld tasks to process", workers_count, number_of_tasks); + XBT_INFO("Got %d workers and %ld tasks to process", worker_count, number_of_tasks); /* Dispatch the tasks */ for (int i = 0; i < number_of_tasks; i++) { - XBT_INFO("Sending '%s' to '%s'", todo[i]->name, MSG_host_get_name(workers[i % workers_count])); - if (MSG_host_self() == workers[i % workers_count]) { + XBT_INFO("Sending '%s' to '%s'", todo[i]->name, MSG_host_get_name(workers[i % worker_count])); + if (MSG_host_self() == workers[i % worker_count]) { XBT_INFO("Hey ! It's me ! :)"); } - MSG_task_send(todo[i], MSG_host_get_name(workers[i % workers_count])); + MSG_task_send(todo[i], MSG_host_get_name(workers[i % worker_count])); XBT_INFO("Sent"); } XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over."); - for (int i = 0; i < workers_count; i++) { + for (int i = 0; i < worker_count; i++) { msg_task_t finalize = MSG_task_create("finalize", 0, 0, FINALIZE); MSG_task_send(finalize, MSG_host_get_name(workers[i])); } diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index f345566b9d..e70d67e785 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -133,7 +133,7 @@ bool Host::is_on() int Host::get_pstate_count() const { - return this->pimpl_cpu->get_pstates_count(); + return this->pimpl_cpu->get_pstate_count(); } /** @@ -246,7 +246,7 @@ double Host::get_available_speed() /** @brief Returns the number of core of the processor. */ int Host::get_core_count() { - return this->pimpl_cpu->get_cores_count(); + return this->pimpl_cpu->get_core_count(); } /** @brief Set the pstate at which the host should run */ diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 92d582d361..1cf6f1b7cf 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -104,7 +104,7 @@ void CpuCas01::on_speed_change() const kernel::lmm::Element* elem = nullptr; get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), - get_cores_count() * speed_.scale * speed_.peak); + get_core_count() * speed_.scale * speed_.peak); while ((var = get_constraint()->get_variable(&elem))) { CpuCas01Action* action = static_cast(var->get_id()); @@ -119,7 +119,7 @@ void CpuCas01::apply_event(tmgr_trace_event_t event, double value) { if (event == speed_.event) { /* TODO (Hypervisor): do the same thing for constraint_core[i] */ - xbt_assert(get_cores_count() == 1, "FIXME: add speed scaling code also for constraint_core[i]"); + xbt_assert(get_core_count() == 1, "FIXME: add speed scaling code also for constraint_core[i]"); speed_.scale = value; on_speed_change(); @@ -127,7 +127,7 @@ void CpuCas01::apply_event(tmgr_trace_event_t event, double value) tmgr_trace_event_unref(&speed_.event); } else if (event == state_event_) { /* TODO (Hypervisor): do the same thing for constraint_core[i] */ - xbt_assert(get_cores_count() == 1, "FIXME: add state change code also for constraint_core[i]"); + xbt_assert(get_core_count() == 1, "FIXME: add state change code also for constraint_core[i]"); if (value > 0) { if (is_off()) diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 245c019b8f..eba8890457 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -60,7 +60,7 @@ Cpu::Cpu(kernel::resource::Model* model, simgrid::s4u::Host* host, std::vector* speedPerPstate, int core) - : Resource(model, host->get_cname(), constraint), cores_count_(core), host_(host) + : Resource(model, host->get_cname(), constraint), core_count_(core), host_(host) { xbt_assert(core > 0, "Host %s must have at least one core, not 0.", host->get_cname()); @@ -81,7 +81,7 @@ Cpu::~Cpu() speed_per_pstate_.clear(); } -int Cpu::get_pstates_count() +int Cpu::get_pstate_count() { return speed_per_pstate_.size(); } @@ -129,9 +129,9 @@ void Cpu::on_speed_change() s4u::Host::on_speed_change(*host_); } -int Cpu::get_cores_count() +int Cpu::get_core_count() { - return cores_count_; + return core_count_; } void Cpu::set_state_trace(tmgr_trace_t trace) diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index 2b0b3ec36e..fed276a697 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -103,7 +103,7 @@ public: virtual simgrid::kernel::resource::Action* sleep(double duration) = 0; /** @brief Get the amount of cores */ - virtual int get_cores_count(); + virtual int get_core_count(); /** @brief Get a forecast of the speed (in flops/s) if the load were as provided. * @@ -130,14 +130,14 @@ public: /** @brief Get the peak processor speed (in flops/s), at the specified pstate */ virtual double get_pstate_peak_speed(int pstate_index); - virtual int get_pstates_count(); + virtual int get_pstate_count(); virtual void set_pstate(int pstate_index); virtual int get_pstate(); simgrid::s4u::Host* get_host() { return host_; } private: - int cores_count_ = 1; + int core_count_ = 1; simgrid::s4u::Host* host_; int pstate_ = 0; /*< Current pstate (index in the speed_per_pstate_)*/ diff --git a/src/surf/plugins/host_energy.cpp b/src/surf/plugins/host_energy.cpp index dcd67a3936..f0e7c9bc7f 100644 --- a/src/surf/plugins/host_energy.cpp +++ b/src/surf/plugins/host_energy.cpp @@ -235,7 +235,7 @@ double HostEnergy::getCurrentWattsValue() cpu_load = host->pimpl_cpu->get_constraint()->get_usage() / current_speed; /** Divide by the number of cores here **/ - cpu_load /= host->pimpl_cpu->get_cores_count(); + cpu_load /= host->pimpl_cpu->get_core_count(); if (cpu_load > 1) // A machine with a load > 1 consumes as much as a fully loaded machine, not more cpu_load = 1; diff --git a/teshsuite/msg/energy-ptask/energy-ptask.c b/teshsuite/msg/energy-ptask/energy-ptask.c index 39fdfb447d..8075c58b45 100644 --- a/teshsuite/msg/energy-ptask/energy-ptask.c +++ b/teshsuite/msg/energy-ptask/energy-ptask.c @@ -19,38 +19,38 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example") static int runner(int argc, char* argv[]) { /* Retrieve the list of all hosts as an array of hosts */ - int hosts_count = MSG_get_host_number(); + int host_count = MSG_get_host_number(); msg_host_t* hosts = xbt_dynar_to_array(MSG_hosts_as_dynar()); XBT_INFO("First, build a classical parallel task, with 1 Gflop to execute on each node, " "and 10MB to exchange between each pair"); - double* computation_amounts = xbt_new0(double, hosts_count); - double* communication_amounts = xbt_new0(double, hosts_count* hosts_count); + double* computation_amounts = xbt_new0(double, host_count); + double* communication_amounts = xbt_new0(double, host_count* host_count); - for (int i = 0; i < hosts_count; i++) + for (int i = 0; i < host_count; i++) computation_amounts[i] = 1e9; // 1 Gflop - for (int i = 0; i < hosts_count; i++) - for (int j = i + 1; j < hosts_count; j++) - communication_amounts[i * hosts_count + j] = 1e7; // 10 MB + for (int i = 0; i < host_count; i++) + for (int j = i + 1; j < host_count; j++) + communication_amounts[i * host_count + j] = 1e7; // 10 MB msg_task_t ptask = - MSG_parallel_task_create("parallel task", hosts_count, hosts, computation_amounts, communication_amounts, NULL); + MSG_parallel_task_create("parallel task", host_count, hosts, computation_amounts, communication_amounts, NULL); MSG_parallel_task_execute(ptask); MSG_task_destroy(ptask); xbt_free(communication_amounts); xbt_free(computation_amounts); XBT_INFO("We can do the same with a timeout of one second enabled."); - computation_amounts = xbt_new0(double, hosts_count); - communication_amounts = xbt_new0(double, hosts_count* hosts_count); - for (int i = 0; i < hosts_count; i++) + computation_amounts = xbt_new0(double, host_count); + communication_amounts = xbt_new0(double, host_count* host_count); + for (int i = 0; i < host_count; i++) computation_amounts[i] = 1e9; // 1 Gflop - for (int i = 0; i < hosts_count; i++) - for (int j = i + 1; j < hosts_count; j++) - communication_amounts[i * hosts_count + j] = 1e7; // 10 MB + for (int i = 0; i < host_count; i++) + for (int j = i + 1; j < host_count; j++) + communication_amounts[i * host_count + j] = 1e7; // 10 MB ptask = - MSG_parallel_task_create("parallel task", hosts_count, hosts, computation_amounts, communication_amounts, NULL); + MSG_parallel_task_create("parallel task", host_count, hosts, computation_amounts, communication_amounts, NULL); msg_error_t errcode = MSG_parallel_task_execute_with_timeout(ptask, 1 /* timeout (in seconds)*/); xbt_assert(errcode == MSG_TIMEOUT, "Woops, this did not timeout as expected... Please report that bug."); MSG_task_destroy(ptask); @@ -58,19 +58,19 @@ static int runner(int argc, char* argv[]) xbt_free(computation_amounts); XBT_INFO("Then, build a parallel task involving only computations and no communication (1 Gflop per node)"); - computation_amounts = xbt_new0(double, hosts_count); - for (int i = 0; i < hosts_count; i++) + computation_amounts = xbt_new0(double, host_count); + for (int i = 0; i < host_count; i++) computation_amounts[i] = 1e9; // 1 Gflop - ptask = MSG_parallel_task_create("parallel exec", hosts_count, hosts, computation_amounts, NULL /* no comm */, NULL); + ptask = MSG_parallel_task_create("parallel exec", host_count, hosts, computation_amounts, NULL /* no comm */, NULL); MSG_parallel_task_execute(ptask); MSG_task_destroy(ptask); xbt_free(computation_amounts); XBT_INFO("Then, build a parallel task with no computation nor communication (synchro only)"); - computation_amounts = xbt_new0(double, hosts_count); - communication_amounts = xbt_new0(double, hosts_count* hosts_count); /* memset to 0 by xbt_new0 */ + computation_amounts = xbt_new0(double, host_count); + communication_amounts = xbt_new0(double, host_count* host_count); /* memset to 0 by xbt_new0 */ ptask = - MSG_parallel_task_create("parallel sync", hosts_count, hosts, computation_amounts, communication_amounts, NULL); + MSG_parallel_task_create("parallel sync", host_count, hosts, computation_amounts, communication_amounts, NULL); MSG_parallel_task_execute(ptask); MSG_task_destroy(ptask); xbt_free(communication_amounts);