#include "simdag/simdag.h"
#include "xbt/misc.h"
#include "xbt/log.h"
+#include <libgen.h>
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_daxparse, sd, "Parsing DAX files");
static void dax_parse_error(char *msg)
{
fprintf(stderr, "Parse error on line %d: %s\n", dax_lineno, msg);
- abort();
+ xbt_abort();
}
static double dax_parse_double(const char *string)
unsigned int cursor;
SD_task_t task;
xbt_dynar_foreach(result, cursor, task) {
- XBT_INFO("Task %d", cursor);
+ XBT_INFO("Task %u", cursor);
SD_task_dump(task);
}
}
xbt_dict_foreach(files, cursor, name, file) {
unsigned int cpt1, cpt2;
- SD_task_t newfile = NULL;
+ SD_task_t newfile;
SD_dependency_t depbefore, depafter;
if (xbt_dynar_is_empty(file->tasks_before)) {
xbt_dynar_foreach(file->tasks_after, cpt2, depafter) {
- SD_task_t newfile =
- SD_task_create_comm_e2e(file->name, NULL, file->amount);
+ 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);
#ifdef HAVE_TRACING
const char *category = depafter->src->category;
if (category){
TRACE_category (category);
- TRACE_sd_set_task_category (newfile, category);
+ SD_task_set_category (newfile, category);
}
}
#endif
}
} else if (xbt_dynar_is_empty(file->tasks_after)) {
xbt_dynar_foreach(file->tasks_before, cpt2, depbefore) {
- SD_task_t newfile =
- SD_task_create_comm_e2e(file->name, NULL, file->amount);
+ 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);
#ifdef HAVE_TRACING
const char *category = depbefore->src->category;
if (category){
TRACE_category (category);
- TRACE_sd_set_task_category (newfile, category);
+ SD_task_set_category (newfile, category);
}
}
#endif
("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);
+ 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);
#ifdef HAVE_TRACING
const char *category = depbefore->src->category;
if (category){
TRACE_category (category);
- TRACE_sd_set_task_category (newfile, category);
+ SD_task_set_category (newfile, category);
}
}
#endif
}
}
- acyclic_graph_detail(result);
- return result;
+ if (!acyclic_graph_detail(result)){
+ XBT_ERROR("The DAX described in %s is not a DAG. It contains a cycle.",
+ basename((char*)filename));
+ xbt_dynar_foreach(result, cpt, file)
+ SD_task_destroy(file);
+ xbt_dynar_free_container(&result);
+ return NULL;
+ } else {
+ return result;
+ }
}
void STag_dax__adag(void)
char *category = A_dax__job_name;
if (category){
TRACE_category (category);
- TRACE_sd_set_task_category(current_job, category);
+ SD_task_set_category(current_job, category);
}
#endif
xbt_dict_set(jobs, A_dax__job_id, current_job, NULL);