From: Frederic Suter Date: Fri, 22 Jul 2016 16:57:13 +0000 (+0200) Subject: workstation -> host X-Git-Tag: v3_14~727 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/611d000324e804eed80f815f5aaba6d919a0884a?hp=852206e7c30bec727ddacf8d7300e0c452e2b0fd;ds=sidebyside workstation -> host --- diff --git a/include/simgrid/simdag.h b/include/simgrid/simdag.h index 2e4ed51d2f..d49faa5c6f 100644 --- a/include/simgrid/simdag.h +++ b/include/simgrid/simdag.h @@ -102,10 +102,10 @@ XBT_PUBLIC(double) SD_task_get_amount(SD_task_t task); XBT_PUBLIC(void) SD_task_set_amount(SD_task_t task, double amount); XBT_PUBLIC(double) SD_task_get_alpha(SD_task_t task); XBT_PUBLIC(double) SD_task_get_remaining_amount(SD_task_t task); -XBT_PUBLIC(double) SD_task_get_execution_time(SD_task_t task, int workstation_nb, const sg_host_t *workstation_list, +XBT_PUBLIC(double) SD_task_get_execution_time(SD_task_t task, int host_count, const sg_host_t *host_list, const double *flops_amount, const double *bytes_amount); XBT_PUBLIC(e_SD_task_kind_t) SD_task_get_kind(SD_task_t task); -XBT_PUBLIC(void) SD_task_schedule(SD_task_t task, int workstation_nb, const sg_host_t *workstation_list, +XBT_PUBLIC(void) SD_task_schedule(SD_task_t task, int host_count, const sg_host_t *host_list, const double *flops_amount, const double *bytes_amount, double rate); XBT_PUBLIC(void) SD_task_unschedule(SD_task_t task); XBT_PUBLIC(double) SD_task_get_start_time(SD_task_t task); diff --git a/src/simdag/sd_task.cpp b/src/simdag/sd_task.cpp index 65465b01a7..d0e1f3061b 100644 --- a/src/simdag/sd_task.cpp +++ b/src/simdag/sd_task.cpp @@ -720,37 +720,32 @@ void SD_task_unwatch(SD_task_t task, e_SD_task_state_t state) * now and if it was the only task. * * \param task the task to evaluate - * \param workstation_nb number of workstations on which the task would be executed - * \param workstation_list the workstations on which the task would be executed - * \param flops_amount computation amount for each workstation (i.e., an array of workstation_nb doubles) - * \param bytes_amount communication amount between each pair of workstations (i.e., a matrix of - * workstation_nb*workstation_nb doubles) + * \param host_count number of hosts on which the task would be executed + * \param host_list the hosts on which the task would be executed + * \param flops_amount computation amount for each host(i.e., an array of host_count doubles) + * \param bytes_amount communication amount between each pair of hosts (i.e., a matrix of host_count*host_count doubles) * \see SD_schedule() */ -double SD_task_get_execution_time(SD_task_t task, int workstation_nb, const sg_host_t *workstation_list, +double SD_task_get_execution_time(SD_task_t task, int host_count, const sg_host_t *host_list, const double *flops_amount, const double *bytes_amount) { - xbt_assert(workstation_nb > 0, "Invalid parameter"); + xbt_assert(host_count > 0, "Invalid parameter"); double max_time = 0.0; /* the task execution time is the maximum execution time of the parallel tasks */ - for (int i = 0; i < workstation_nb; i++) { + for (int i = 0; i < host_count; i++) { double time = 0.0; if (flops_amount != nullptr) - time = flops_amount[i] / workstation_list[i]->speed(); + time = flops_amount[i] / host_list[i]->speed(); if (bytes_amount != nullptr) - for (int j = 0; j < workstation_nb; j++) { - if (bytes_amount[i * workstation_nb + j] !=0 ) { - time += (SD_route_get_latency(workstation_list[i], workstation_list[j]) + - bytes_amount[i * workstation_nb + j] / - SD_route_get_bandwidth(workstation_list[i], workstation_list[j])); - } - } + for (int j = 0; j < host_count; j++) + if (bytes_amount[i * host_count + j] != 0) + time += (SD_route_get_latency(host_list[i], host_list[j]) + + bytes_amount[i * host_count + j] / SD_route_get_bandwidth(host_list[i], host_list[j])); - if (time > max_time) { + if (time > max_time) max_time = time; - } } return max_time; } @@ -780,7 +775,7 @@ static inline void SD_task_do_schedule(SD_task_t task) * \param rate task execution speed rate * \see SD_task_unschedule() */ -void SD_task_schedule(SD_task_t task, int host_count, const sg_host_t * workstation_list, +void SD_task_schedule(SD_task_t task, int host_count, const sg_host_t * host_list, const double *flops_amount, const double *bytes_amount, double rate) { xbt_assert(host_count > 0, "workstation_nb must be positive"); @@ -806,7 +801,7 @@ void SD_task_schedule(SD_task_t task, int host_count, const sg_host_t * workstat } task->host_list = static_cast(xbt_realloc(task->host_list, sizeof(sg_host_t) * host_count)); - memcpy(task->host_list, workstation_list, sizeof(sg_host_t) * host_count); + memcpy(task->host_list, host_list, sizeof(sg_host_t) * host_count); SD_task_do_schedule(task); }