X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2e9105988280d1e88b5b496d6e2eed4c8d541883..b18c943247318ff666cf7811fe5358e985b38cc1:/src/simdag/sd_daxloader.c diff --git a/src/simdag/sd_daxloader.c b/src/simdag/sd_daxloader.c index 9d9d6753b4..87b0c9dc83 100644 --- a/src/simdag/sd_daxloader.c +++ b/src/simdag/sd_daxloader.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2010. The SimGrid Team. +/* Copyright (c) 2009-2013. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -37,17 +37,6 @@ static double dax_parse_double(const char *string) return value; } -static int dax_parse_int(const char *string) -{ - int ret = 0; - int value; - - ret = sscanf(string, "%d", &value); - if (ret != 1) - dax_parse_error(bprintf("%s is not an integer", string)); - return value; -} - /* Ensure that transfer tasks have unique names even though a file is used * several times */ @@ -254,16 +243,6 @@ static xbt_dict_t files; static SD_task_t current_job; static SD_task_t root_task, end_task; -static void dump_res() -{ - unsigned int cursor; - SD_task_t task; - xbt_dynar_foreach(result, cursor, task) { - XBT_INFO("Task %u", cursor); - SD_task_dump(task); - } -} - static void dax_task_free(void *task) { SD_task_t t = task; @@ -296,10 +275,9 @@ xbt_dynar_t SD_daxload(const char *filename) xbt_dynar_push(result, &root_task); end_task = SD_task_create_comp_seq("end", NULL, 0); - _XBT_GNUC_UNUSED int res; - res = dax_lex(); - xbt_assert(!res, "Parse error in %s: %s", filename, - dax__parse_err_msg()); + int res = dax_lex(); + if (res != 0) + xbt_die("Parse error in %s: %s", filename, dax__parse_err_msg()); dax__delete_buffer(input_buffer); fclose(in_file); dax_lex_destroy(); @@ -382,6 +360,16 @@ xbt_dynar_t SD_daxload(const char *filename) xbt_dynar_foreach(result, cpt, file) { if (SD_task_get_kind(file) == SD_TASK_COMM_E2E) { uniq_transfer_task_name(file); + } else if (SD_task_get_kind(file) == SD_TASK_COMP_SEQ){ + /* If some tasks do not take files as input, connect them to the root, if + * they don't produce files, connect them to the end node. + */ + if ((file != root_task) && xbt_dynar_is_empty(file->tasks_before)) { + SD_task_dependency_add(NULL, NULL, root_task, file); + } + if ((file != end_task) && xbt_dynar_is_empty(file->tasks_after)) { + SD_task_dependency_add(NULL, NULL, file, end_task); + } } }