- /* And now, post-process the files.
- * We want a file task per pair of computation tasks exchanging the file. Duplicate on need
- * Files not produced in the system are said to be produced by root task (top of DAG).
- * Files not consumed in the system are said to be consumed by end task (bottom of DAG).
- */
- xbt_dict_cursor_t cursor;
- SD_task_t file;
- char *name;
- xbt_dict_foreach(files,cursor,name,file) {
- unsigned int cpt1,cpt2;
- SD_task_t newfile = NULL;
- SD_dependency_t depbefore,depafter;
- if (xbt_dynar_length(file->tasks_before) == 0) {
- xbt_dynar_foreach(file->tasks_after,cpt2,depafter) {
- SD_task_t newfile = SD_task_create_comm_e2e(file->name,NULL,file->amount);
- SD_task_dependency_add(NULL,NULL,root_task,newfile);
- SD_task_dependency_add(NULL,NULL,newfile,depafter->dst);
- xbt_dynar_push(result,&newfile);
- }
- } else if (xbt_dynar_length(file->tasks_after) == 0) {
- xbt_dynar_foreach(file->tasks_before,cpt2,depbefore) {
- SD_task_t newfile = SD_task_create_comm_e2e(file->name,NULL,file->amount);
- SD_task_dependency_add(NULL,NULL,depbefore->src,newfile);
- SD_task_dependency_add(NULL,NULL,newfile,end_task);
- xbt_dynar_push(result,&newfile);
- }
- } else {
- xbt_dynar_foreach(file->tasks_before,cpt1,depbefore) {
- xbt_dynar_foreach(file->tasks_after,cpt2,depafter) {
- if (depbefore->src == depafter->dst) {
- WARN2("File %s is produced and consumed by task %s. This loop dependency will prevent the execution of the task.",
- file->name,depbefore->src->name);
- }
- newfile = SD_task_create_comm_e2e(file->name,NULL,file->amount);
- SD_task_dependency_add(NULL,NULL,depbefore->src,newfile);
- SD_task_dependency_add(NULL,NULL,newfile,depafter->dst);
- xbt_dynar_push(result,&newfile);
- }
- }
+ if(schedule){
+ xbt_dynar_t computer = NULL;
+ xbt_dict_cursor_t dict_cursor;
+ char *computer_name;
+ const SD_workstation_t *workstations = SD_workstation_get_list ();
+ xbt_dict_foreach(computers,dict_cursor,computer_name,computer){
+ int count_computer = atoi(computer_name);
+ unsigned int count=0;
+ SD_task_t task;
+ SD_task_t task_previous = NULL;
+ xbt_dynar_foreach(computer,count,task){
+ /* add dependency between the previous and the task to avoid
+ * parallel execution */
+ if(task != NULL ){
+ if(task_previous != NULL &&
+ !SD_task_dependency_exists(task_previous, task))
+ SD_task_dependency_add(NULL, NULL, task_previous, task);
+ SD_task_schedulel(task, 1, workstations[count_computer]);
+ task_previous = task;