-void dot_add_task(Agnode_t *dag_node) {
- char *name = agnameof(dag_node);
- double runtime = dot_parse_double(agget(dag_node,(char*)"size"));
- long performer = (long)dot_parse_int((char *) agget(dag_node,(char*)"performer"));
- INFO3("See <job id=%s runtime=%s %.0f>",name,agget(dag_node,(char*)"size"),runtime);
- SD_task_t current_job = SD_task_create_comp_seq(name,(void*)performer,runtime);
- xbt_dict_set(jobs,name,current_job,NULL);
- xbt_dynar_push(result,¤t_job);
- Agedge_t *e;
- int count = 0;
- for (e = agfstin(dag_dot,dag_node); e; e = agnxtin(dag_dot,e)) {
- dot_add_input_dependencies(current_job,e);
- count++;
- }
- if (count==0){
- SD_task_t file;
- char *name= (char*)"root->many";
- double size = 0;
-
- file = xbt_dict_get_or_null(files,name);
- if (file==NULL) {
- file = SD_task_create_comm_e2e(name,NULL,size);
- xbt_dict_set(files,name,file,&dot_task_free);
- } else {
- if (SD_task_get_amount(file)!=size) {
- WARN3("Ignoring file %s size redefinition from %.0f to %.0f",
- name,SD_task_get_amount(file),size);
- }
+void dot_add_task(Agnode_t * dag_node)
+{
+ char *name = agnameof(dag_node);
+ SD_task_t current_job;
+ double runtime = dot_parse_double(agget(dag_node, (char *) "size"));
+
+ XBT_DEBUG("See <job id=%s runtime=%s %.0f>", name,
+ agget(dag_node, (char *) "size"), runtime);
+ current_job = xbt_dict_get_or_null(jobs, name);
+ if (current_job == NULL) {
+ current_job =
+ SD_task_create_comp_seq(name, NULL , runtime);
+#ifdef HAVE_TRACING
+ TRACE_sd_dotloader (current_job, agget (dag_node, (char*)"category"));
+#endif
+ xbt_dict_set(jobs, name, current_job, NULL);
+ xbt_dynar_push(result, ¤t_job);
+ }
+ Agedge_t *e;
+ int count = 0;
+
+#ifdef HAVE_CGRAPH_H
+ for (e = agfstin(dag_dot, dag_node); e; e = agnxtin(dag_dot, e))
+#elif HAVE_AGRAPH_H
+ for (e = agfstin(dag_node); e; e = agnxtin(e))
+#endif
+ {
+ dot_add_input_dependencies(current_job, e);
+ count++;
+ }
+ if (count == 0 && current_job != root_task) {
+ SD_task_dependency_add(NULL, NULL, root_task, current_job);
+ }
+ count = 0;
+#ifdef HAVE_CGRAPH_H
+ for (e = agfstout(dag_dot, dag_node); e; e = agnxtout(dag_dot, e))
+#elif HAVE_AGRAPH_H
+ for (e = agfstout(dag_node); e; e = agnxtout(e))
+#endif
+ {
+
+ dot_add_output_dependencies(current_job, e);
+ count++;
+ }
+ if (count == 0 && current_job != end_task) {
+ SD_task_dependency_add(NULL, NULL, current_job, end_task);
+ }
+
+ if(schedule || XBT_LOG_ISENABLED(sd_dotparse, xbt_log_priority_verbose)){
+ /* try to take the information to schedule the task only if all is
+ * right*/
+ // performer is the computer which execute the task
+ unsigned long performer = -1;
+ char * char_performer = agget(dag_node, (char *) "performer");
+ if (char_performer != NULL)
+ performer = (long) dot_parse_int(char_performer);
+
+ // order is giving the task order on one computer
+ unsigned long order = -1;
+ char * char_order = agget(dag_node, (char *) "order");
+ if (char_order != NULL)
+ order = (long) dot_parse_int(char_order);
+ xbt_dynar_t computer = NULL;
+ //XBT_INFO("performer = %d, order=%d",performer,order);
+ if(performer != -1 && order != -1){
+ //necessary parameters are given
+ computer = xbt_dict_get_or_null(computers, char_performer);
+ if(computer == NULL){
+ computer = xbt_dynar_new(sizeof(SD_task_t), NULL);
+ xbt_dict_set(computers, char_performer, computer, NULL);
+ }
+ if(performer < host_lib->count){
+ // the wanted computer is available
+ SD_task_t *task_test = NULL;
+ if(order < computer->used)
+ task_test = xbt_dynar_get_ptr(computer,order);
+ if(task_test != NULL && *task_test != NULL && *task_test != current_job){
+ /*the user gives the same order to several tasks*/
+ schedule = false;
+ XBT_VERB("The task %s starts on the computer %s at the position : %s like the task %s",
+ (*task_test)->name, char_performer, char_order, current_job->name);
+ }else{
+ //the parameter seems to be ok
+ xbt_dynar_set_as(computer, order, SD_task_t, current_job);