X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9dbeb2372ad9a123d0558132ebb6e003e10aa641..6a6c1a432ee6568c58d74d31746544e6afabdf6f:/src/simdag/sd_task.c diff --git a/src/simdag/sd_task.c b/src/simdag/sd_task.c index aa310877e7..9fd6cd3f53 100644 --- a/src/simdag/sd_task.c +++ b/src/simdag/sd_task.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2006-2014. The SimGrid Team. +/* Copyright (c) 2006-2015. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -8,7 +8,7 @@ #include "simgrid/simdag.h" #include "xbt/sysdep.h" #include "xbt/dynar.h" -#include "instr/instr_private.h" +#include "src/instr/instr_private.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_task, sd, "Logging specific to SimDag (task)"); @@ -1090,7 +1090,7 @@ void __SD_task_really_run(SD_task_t task) { int i; - void **surf_hosts; + sg_host_t *hosts; xbt_assert(__SD_task_is_runnable_or_in_fifo(task), "Task '%s' is not runnable or in a fifo! Task state: %d", @@ -1106,7 +1106,7 @@ void __SD_task_really_run(SD_task_t task) for (i = 0; i < host_nb; i++) { if (SD_workstation_get_access_mode(task->workstation_list[i]) == SD_WORKSTATION_SEQUENTIAL_ACCESS) { - SD_workstation_priv(task->workstation_list[i])->current_task = task; + sg_host_sd(task->workstation_list[i])->current_task = task; xbt_assert(__SD_workstation_is_busy(task->workstation_list[i]), "The workstation should be busy now"); } @@ -1117,12 +1117,11 @@ void __SD_task_really_run(SD_task_t task) /* start the task */ - /* we have to create a Surf workstation array instead of the SimDag - * workstation array */ - surf_hosts = xbt_new(void *, host_nb); + /* Copy the elements of the task into the action */ + hosts = xbt_new(sg_host_t, host_nb); for (i = 0; i < host_nb; i++) - surf_hosts[i] = surf_host_resource_priv(task->workstation_list[i]); + hosts[i] = task->workstation_list[i]; double *flops_amount = xbt_new0(double, host_nb); double *bytes_amount = xbt_new0(double, host_nb * host_nb); @@ -1137,7 +1136,7 @@ void __SD_task_really_run(SD_task_t task) task->surf_action = surf_host_model_execute_parallel_task((surf_host_model_t)surf_host_model, host_nb, - surf_hosts, + hosts, flops_amount, bytes_amount, task->rate); @@ -1185,11 +1184,11 @@ int __SD_task_try_to_run(SD_task_t task) if (!can_start) { /* if the task cannot start and is not in the FIFOs yet */ for (i = 0; i < task->workstation_nb; i++) { workstation = task->workstation_list[i]; - if (SD_workstation_priv(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) { + if (sg_host_sd(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) { XBT_DEBUG("Pushing task '%s' in the FIFO of workstation '%s'", SD_task_get_name(task), SD_workstation_get_name(workstation)); - xbt_fifo_push(SD_workstation_priv(workstation)->task_fifo, task); + xbt_fifo_push(sg_host_sd(workstation)->task_fifo, task); } } __SD_task_set_state(task, SD_IN_FIFO); @@ -1239,23 +1238,23 @@ void __SD_task_just_done(SD_task_t task) for (i = 0; i < task->workstation_nb; i++) { workstation = task->workstation_list[i]; XBT_DEBUG("Workstation '%s': access_mode = %d", - SD_workstation_get_name(workstation), (int)SD_workstation_priv(workstation)->access_mode); - if (SD_workstation_priv(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) { - xbt_assert(SD_workstation_priv(workstation)->task_fifo != NULL, + SD_workstation_get_name(workstation), (int)sg_host_sd(workstation)->access_mode); + if (sg_host_sd(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) { + xbt_assert(sg_host_sd(workstation)->task_fifo != NULL, "Workstation '%s' has sequential access but no FIFO!", SD_workstation_get_name(workstation)); - xbt_assert(SD_workstation_priv(workstation)->current_task = + xbt_assert(sg_host_sd(workstation)->current_task = task, "Workstation '%s': current task should be '%s'", SD_workstation_get_name(workstation), SD_task_get_name(task)); /* the task is over so we can release the workstation */ - SD_workstation_priv(workstation)->current_task = NULL; + sg_host_sd(workstation)->current_task = NULL; XBT_DEBUG("Getting candidate in FIFO"); candidate = xbt_fifo_get_item_content(xbt_fifo_get_first_item - (SD_workstation_priv(workstation)->task_fifo)); + (sg_host_sd(workstation)->task_fifo)); if (candidate != NULL) { XBT_DEBUG("Candidate: '%s'", SD_task_get_name(candidate)); @@ -1309,10 +1308,10 @@ void __SD_task_just_done(SD_task_t task) /* I can start on this workstation if the workstation is shared or if I am the first task in the FIFO */ - can_start = SD_workstation_priv(workstation)->access_mode == SD_WORKSTATION_SHARED_ACCESS + can_start = sg_host_sd(workstation)->access_mode == SD_WORKSTATION_SHARED_ACCESS || candidate == xbt_fifo_get_item_content(xbt_fifo_get_first_item - (SD_workstation_priv(workstation)->task_fifo)); + (sg_host_sd(workstation)->task_fifo)); } XBT_DEBUG("Candidate '%s' can start: %d", SD_task_get_name(candidate), @@ -1324,8 +1323,8 @@ void __SD_task_just_done(SD_task_t task) workstation = candidate->workstation_list[j]; /* update the FIFO */ - if (SD_workstation_priv(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) { - candidate = xbt_fifo_shift(SD_workstation_priv(workstation)->task_fifo); /* the return value is stored just for debugging */ + if (sg_host_sd(workstation)->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) { + candidate = xbt_fifo_shift(sg_host_sd(workstation)->task_fifo); /* the return value is stored just for debugging */ XBT_DEBUG("Head of the FIFO: '%s'", (candidate != NULL) ? SD_task_get_name(candidate) : "NULL");