git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7174
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
* Kill the useless "rate" argument of SD_task_get_execution_time()
Everyone used to provide -1 as a value, it was not used, and the
semantic of a possible use wasn't even clear.
* Kill the useless "rate" argument of SD_task_get_execution_time()
Everyone used to provide -1 as a value, it was not used, and the
semantic of a possible use wasn't even clear.
+ * SD_SCHED_NO_COST: Constant to use as cost in SD_task_schedule()
+ either as comm costs or compute costs to mean that there is no
+ such thing for that specific task.
MSG:
* In trace replay, allow to have one trace file per process.
Give the specific trace file as argument of each process,
MSG:
* In trace replay, allow to have one trace file per process.
Give the specific trace file as argument of each process,
SD_task_t InterRedist;
SD_task_t taskFinal;
SD_task_t ParComp_wcomm2;
SD_task_t InterRedist;
SD_task_t taskFinal;
SD_task_t ParComp_wcomm2;
- const double no_cost[] = { 1.0, 1.0 };
SD_workstation_t PtoPcomm1_hosts[2];
SD_workstation_t PtoPcomm2_hosts[2];
double PtoPcomm1_table[] = { 0, 12500000, 0, 0 }; /* 100Mb */
SD_workstation_t PtoPcomm1_hosts[2];
SD_workstation_t PtoPcomm2_hosts[2];
double PtoPcomm1_table[] = { 0, 12500000, 0, 0 }; /* 100Mb */
/* scheduling the tasks */
/* scheduling the tasks */
- SD_task_schedule(taskInit, 1, hosts, no_cost, no_cost, -1.0);
- SD_task_schedule(PtoPComm1, 2, PtoPcomm1_hosts, no_cost, PtoPcomm1_table,
+ SD_task_schedule(taskInit, 1, hosts, SD_SCHED_NO_COST, SD_SCHED_NO_COST, -1.0);
+ SD_task_schedule(PtoPComm1, 2, PtoPcomm1_hosts, SD_SCHED_NO_COST, PtoPcomm1_table,
- SD_task_schedule(PtoPComm2, 2, PtoPcomm2_hosts, no_cost, PtoPcomm2_table,
+ SD_task_schedule(PtoPComm2, 2, PtoPcomm2_hosts, SD_SCHED_NO_COST, PtoPcomm2_table,
-1.0);
SD_task_schedule(ParComp_wocomm, 5, ParComp_wocomm_hosts,
ParComp_wocomm_cost, ParComp_wocomm_table, -1.0);
-1.0);
SD_task_schedule(ParComp_wocomm, 5, ParComp_wocomm_hosts,
ParComp_wocomm_cost, ParComp_wocomm_table, -1.0);
InterRedist_table, -1.0);
SD_task_schedule(ParComp_wcomm2, 5, ParComp_wcomm2_hosts,
ParComp_wcomm2_cost, ParComp_wcomm2_table, -1.0);
InterRedist_table, -1.0);
SD_task_schedule(ParComp_wcomm2, 5, ParComp_wcomm2_hosts,
ParComp_wcomm2_cost, ParComp_wcomm2_table, -1.0);
- SD_task_schedule(taskFinal, 1, &(hosts[9]), &final_cost, no_cost, -1.0);
+ SD_task_schedule(taskFinal, 1, &(hosts[9]), &final_cost, SD_SCHED_NO_COST, -1.0);
/* let's launch the simulation! */
changed_tasks = SD_simulate(-1.0);
/* let's launch the simulation! */
changed_tasks = SD_simulate(-1.0);
XBT_PUBLIC(void) SD_task_schedulev(SD_task_t task, int count, const SD_workstation_t*list);
XBT_PUBLIC(void) SD_task_schedulel(SD_task_t task, int count, ...);
XBT_PUBLIC(void) SD_task_schedulev(SD_task_t task, int count, const SD_workstation_t*list);
XBT_PUBLIC(void) SD_task_schedulel(SD_task_t task, int count, ...);
+/** @brief A constant to use in SD_task_schedule to mean that there is no cost.
+ *
+ * For example, create a pure computation task (no comm) like this:
+ *
+ * SD_task_schedule(task, my_workstation_nb,
+ * my_workstation_list,
+ * my_computation_amount,
+ * SD_TASK_SCHED_NO_COST,
+ * my_rate);
+ */
+#define SD_SCHED_NO_COST NULL
+
task->workstation_nb = workstation_count;
task->rate = rate;
task->workstation_nb = workstation_count;
task->rate = rate;
- task->computation_amount = xbt_new(double, workstation_count);
- memcpy(task->computation_amount, computation_amount,
- sizeof(double) * workstation_count);
+ if (computation_amount) {
+ task->computation_amount = xbt_new(double, workstation_count);
+ memcpy(task->computation_amount, computation_amount,
+ sizeof(double) * workstation_count);
+ } else {
+ task->computation_amount = NULL;
+ }
communication_nb = workstation_count * workstation_count;
communication_nb = workstation_count * workstation_count;
- task->communication_amount = xbt_new(double, communication_nb);
- memcpy(task->communication_amount, communication_amount,
- sizeof(double) * communication_nb);
+ if (communication_amount) {
+ task->communication_amount = xbt_new(double, communication_nb);
+ memcpy(task->communication_amount, communication_amount,
+ sizeof(double) * communication_nb);
+ } else {
+ task->communication_amount = NULL;
+ }
task->workstation_list = xbt_new(SD_workstation_t, workstation_count);
memcpy(task->workstation_list, workstation_list,
task->workstation_list = xbt_new(SD_workstation_t, workstation_count);
memcpy(task->workstation_list, workstation_list,
/* we have to create a Surf workstation array instead of the SimDag workstation array */
surf_workstations = xbt_new(void *, task->workstation_nb);
/* we have to create a Surf workstation array instead of the SimDag workstation array */
surf_workstations = xbt_new(void *, task->workstation_nb);
- for (i = 0; i < task->workstation_nb; i++) {
+ for (i = 0; i < task->workstation_nb; i++)
surf_workstations[i] = task->workstation_list[i]->surf_workstation;
surf_workstations[i] = task->workstation_list[i]->surf_workstation;
+
+ /* It's allowed to pass a NULL vector as cost to mean vector of 0.0 (easing user's life). Let's deal with it */
+#define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0)
task->surf_action = NULL;
task->surf_action = NULL;
- if ((task->workstation_nb == 1) && (task->communication_amount[0] == 0.0)) {
+ if ((task->workstation_nb == 1) && (cost_or_zero(task->communication_amount,0) == 0.0)) {
task->surf_action =
surf_workstation_model->extension.
task->surf_action =
surf_workstation_model->extension.
- workstation.execute(surf_workstations[0], task->computation_amount[0]);
+ workstation.execute(surf_workstations[0], cost_or_zero(task->computation_amount,0));
} else if ((task->workstation_nb == 1)
} else if ((task->workstation_nb == 1)
- && (task->computation_amount[0] == 0.0)) {
+ && (cost_or_zero(task->computation_amount,0) == 0.0)) {
+
task->surf_action =
surf_workstation_model->extension.
workstation.communicate(surf_workstations[0], surf_workstations[0],
task->surf_action =
surf_workstation_model->extension.
workstation.communicate(surf_workstations[0], surf_workstations[0],
- task->communication_amount[0], task->rate);
+ cost_or_zero(task->communication_amount,0), task->rate);
} else if ((task->workstation_nb == 2)
} else if ((task->workstation_nb == 2)
- && (task->computation_amount[0] == 0.0)
- && (task->computation_amount[1] == 0.0)) {
+ && (cost_or_zero(task->computation_amount,0) == 0.0)
+ && (cost_or_zero(task->computation_amount,1) == 0.0)) {
int nb = 0;
double value = 0.0;
for (i = 0; i < task->workstation_nb * task->workstation_nb; i++) {
int nb = 0;
double value = 0.0;
for (i = 0; i < task->workstation_nb * task->workstation_nb; i++) {
- if (task->communication_amount[i] > 0.0) {
+ if (cost_or_zero(task->communication_amount,i) > 0.0) {
- value = task->communication_amount[i];
+ value = cost_or_zero(task->communication_amount,i);
if (!task->surf_action) {
double *computation_amount = xbt_new(double, task->workstation_nb);
double *communication_amount = xbt_new(double, task->workstation_nb *
if (!task->surf_action) {
double *computation_amount = xbt_new(double, task->workstation_nb);
double *communication_amount = xbt_new(double, task->workstation_nb *