diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fc094ff7..d375f9df1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,8 +133,8 @@ option(PARSEC_WANT_HOME_CONFIG_FILES "Should the runtime check for the parameter configuration file in the user home (\$HOME/.parsec/mca-params.conf)" ON) ### PaRSEC PP options -set(PARSEC_PTGFLAGS "--noline" CACHE STRING "Additional parsec-ptgpp precompiling flags (separate flags with ';')" ) -mark_as_advanced(PARSEC_PTGFLAGS) +set(PARSEC_PTGPP_FLAGS "--noline" CACHE STRING "Additional parsec-ptgpp precompiling flags (separate flags with ';')" ) +mark_as_advanced(PARSEC_PTGPP_FLAGS) option(PARSEC_WITH_DEVEL_HEADERS "Install additional headers in include/parsec allowing external compilation." ON) diff --git a/cmake_modules/PaRSECConfig.cmake.in b/cmake_modules/PaRSECConfig.cmake.in index 429ee4a33..2ca9053f5 100644 --- a/cmake_modules/PaRSECConfig.cmake.in +++ b/cmake_modules/PaRSECConfig.cmake.in @@ -78,6 +78,6 @@ endif(NOT TARGET PaRSEC::parsec) # Populate the variables -set(PARSEC_PTGFLAGS "$ENV{PTGFLAGS}" CACHE STRING "Flags to pass to the parsec-ptgpp executable") +set(PARSEC_PTGPP_FLAGS "$ENV{PTGPPFLAGS}" CACHE STRING "Flags to pass to the parsec-ptgpp executable") set(PARSEC_PTGPP_EXECUTABLE ${PARSEC_BINARY_DIRS}/parsec-ptgpp CACHE STRING "Point to the parsec-ptgpp executable") set(PARSEC_LIBRARIES PaRSEC::parsec CACHE STRING "List of libraries suitable for use in target_link_libraries") # for compatibility with older (non-target based) clients diff --git a/cmake_modules/ParsecCompilePTG.cmake b/cmake_modules/ParsecCompilePTG.cmake index 758ea8874..affdcb4dd 100644 --- a/cmake_modules/ParsecCompilePTG.cmake +++ b/cmake_modules/ParsecCompilePTG.cmake @@ -25,7 +25,11 @@ function(target_ptg_source_ex) set(target "${PARSEC_PTGPP_TARGET}") set(_ptgpp_flags "") - if(DEFINED PARSEC_PTGPP_PTGPP_FLAGS) + if(DEFINED PARSEC_PTGPP_FLAGS) #Those are the global flags set at the top level CMakeLists.txt + list(APPEND _ptgpp_flags ${PARSEC_PTGPP_FLAGS}) + endif() + + if(DEFINED PARSEC_PTGPP_PTGPP_FLAGS) #Those are optional flags passed to this function list(APPEND _ptgpp_flags ${PARSEC_PTGPP_PTGPP_FLAGS}) endif() @@ -53,7 +57,7 @@ function(target_ptg_source_ex) endif() get_property(compile_options SOURCE ${PARSEC_PTGPP_SOURCE} PROPERTY PTGPP_COMPILE_OPTIONS) - list(APPEND _ptgpp_flags "${compile_options}") + list(APPEND _ptgpp_flags "${compile_options}") #In case the user has set compile options specific to this source if(PARSEC_PTGPP_DEBUG) list(APPEND _ptgpp_flags "--debug") @@ -64,6 +68,9 @@ function(target_ptg_source_ex) if(PARSEC_PTGPP_FORCE_PROFILE) list(APPEND _ptgpp_flags "--force-profile") endif() + if(PARSEC_PTGPP_DYNAMIC_TERMDET) + list(APPEND -ptgpp_flags "--dynmic-termdet") + endif() if(DEFINED PARSEC_PTGPP_DEP_MANAGEMENT) list(APPEND _ptgpp_flags "--dep-management;${PARSEC_PTGPP_DEP_MANAGEMENT}") diff --git a/parsec/interfaces/ptg/ptg-compiler/jdf.c b/parsec/interfaces/ptg/ptg-compiler/jdf.c index 913da894f..6ed58951c 100644 --- a/parsec/interfaces/ptg/ptg-compiler/jdf.c +++ b/parsec/interfaces/ptg/ptg-compiler/jdf.c @@ -1662,7 +1662,7 @@ const char*jdf_property_get_string( const jdf_def_list_t* properties, jdf_expr_t* expr = jdf_find_property(properties, prop_name, &property); if( NULL != expr ) { - if( JDF_OP_IS_VAR(expr->op) ) + if( JDF_OP_IS_VAR(expr->op) || JDF_OP_IS_STRING(expr->op) ) return expr->jdf_var; printf("Warning: property %s defined at line %d only support ON/OFF\n", prop_name, JDF_OBJECT_LINENO(property)); diff --git a/parsec/interfaces/ptg/ptg-compiler/jdf.h b/parsec/interfaces/ptg/ptg-compiler/jdf.h index 189d276f7..2c9bce9fe 100644 --- a/parsec/interfaces/ptg/ptg-compiler/jdf.h +++ b/parsec/interfaces/ptg/ptg-compiler/jdf.h @@ -90,6 +90,9 @@ int jdf_sanity_checks( jdf_warning_mask_t mask ); #define DEP_MANAGEMENT_INDEX_ARRAY_STRING "index-array" #define DEP_MANAGEMENT_INDEX_ARRAY 2 +#define TERMDET_DEFAULT 0 +#define TERMDET_DYNAMIC 1 + #define DISABLE_DEP_WARNING_PROPERTY_NAME "warning" typedef struct jdf_compiler_global_args { @@ -104,6 +107,7 @@ typedef struct jdf_compiler_global_args { int dep_management; int noline; /**< Don't dump the jdf line number in the generate .c file */ struct jdf_name_list *ignore_properties; /**< Properties to ignore */ + int termdet; /**< What termination detection to use (one of TERMDET_*) */ } jdf_compiler_global_args_t; extern jdf_compiler_global_args_t JDF_COMPILER_GLOBAL_ARGS; @@ -207,6 +211,13 @@ typedef unsigned int jdf_flags_t; #define JDF_PROP_NO_AUTOMATIC_TASKPOOL_INSTANCE "no_taskpool_instance" +#define JDF_PROP_TERMDET_NAME "termdet" +#define JDF_HAS_USER_TRIGGERED_TERMDET ((jdf_flags_t)(1 << 5)) +#define JDF_HAS_DYNAMIC_TERMDET ((jdf_flags_t)(1 << 6)) +#define JDF_PROP_TERMDET_LOCAL "local" +#define JDF_PROP_TERMDET_DYNAMIC "dynamic" +#define JDF_PROP_TERMDET_USER_TRIGGERED "user-triggered" + typedef struct jdf_function_entry { struct jdf_object_t super; struct jdf_function_entry *next; diff --git a/parsec/interfaces/ptg/ptg-compiler/jdf2c.c b/parsec/interfaces/ptg/ptg-compiler/jdf2c.c index ee7d0060a..e3ba5bc5d 100644 --- a/parsec/interfaces/ptg/ptg-compiler/jdf2c.c +++ b/parsec/interfaces/ptg/ptg-compiler/jdf2c.c @@ -183,6 +183,12 @@ static void var_to_c_code(jdf_expr_t* expr) expr->jdf_c_code.function_context = NULL; } +static int jdf_uses_dynamic_termdet( const jdf_t *jdf ) +{ + const char *pname = jdf_property_get_string(jdf->global_properties, JDF_PROP_TERMDET_NAME, NULL); + if(NULL == pname) return 0; + return strcmp(pname, JDF_PROP_TERMDET_DYNAMIC) == 0; +} /** * Generate a semi-persistent string (kept in a circular buffer that will be reused after @@ -3166,8 +3172,13 @@ static void jdf_generate_startup_tasks(const jdf_t *jdf, const jdf_function_entr coutput("%s restore_context = 0;\n" "%s (void)restore_context;\n" "%s if( nb_tasks > this_task->locals.reserved[0].value ) {\n" - "%s if( (size_t)this_task->locals.reserved[0].value < parsec_task_startup_iter ) this_task->locals.reserved[0].value <<= 1;\n" - "%s __parsec_schedule_vp(es, (parsec_task_t**)pready_ring, 0);\n" + "%s if( (size_t)this_task->locals.reserved[0].value < parsec_task_startup_iter ) this_task->locals.reserved[0].value <<= 1;\n", + indent(nesting), indent(nesting), indent(nesting), indent(nesting)); + if(jdf_uses_dynamic_termdet(jdf)) { + coutput("%s __parsec_tp->super.super.tdm.module->taskpool_addto_nb_tasks(&__parsec_tp->super.super, nb_tasks);\n", + indent(nesting)); + } + coutput("%s __parsec_schedule_vp(es, (parsec_task_t**)pready_ring, 0);\n" "%s total_nb_tasks += nb_tasks;\n" "%s nb_tasks = 0;\n" "%s if( total_nb_tasks > parsec_task_startup_chunk ) { /* stop here and request to be rescheduled */\n" @@ -3175,7 +3186,6 @@ static void jdf_generate_startup_tasks(const jdf_t *jdf, const jdf_function_entr "%s }\n" "%s }\n", indent(nesting), indent(nesting), indent(nesting), indent(nesting), - indent(nesting), indent(nesting), indent(nesting), indent(nesting), indent(nesting), indent(nesting), indent(nesting)); /* We close all variables, in reverse order to manage the local indices */ @@ -3202,8 +3212,11 @@ static void jdf_generate_startup_tasks(const jdf_t *jdf, const jdf_function_entr string_arena_free(sa_properties); coutput(" (void)vpid;\n" - " if( 0 != nb_tasks ) {\n" - " __parsec_schedule_vp(es, (parsec_task_t**)pready_ring, 0);\n" + " if( 0 != nb_tasks ) {\n"); + if(jdf_uses_dynamic_termdet(jdf)) { + coutput(" __parsec_tp->super.super.tdm.module->taskpool_addto_nb_tasks(&__parsec_tp->super.super, nb_tasks);\n"); + } + coutput(" __parsec_schedule_vp(es, (parsec_task_t**)pready_ring, 0);\n" " nb_tasks = 0;\n" " }\n" " return PARSEC_HOOK_RETURN_DONE;\n" @@ -3796,16 +3809,29 @@ static void jdf_generate_internal_init(const jdf_t *jdf, const jdf_function_entr jdf_expr_t *expr; jdf_def_list_t* property; if( NULL != (expr = jdf_find_property(jdf->global_properties, JDF_PROP_UD_NB_LOCAL_TASKS_FN_NAME, &property) ) ) { - coutput(" __parsec_tp->super.super.tdm.module->taskpool_addto_nb_tasks(&__parsec_tp->super.super, %s(__parsec_tp));\n", - expr->jdf_c_code.fname); + if(JDF_C_CODE == expr->op) { + assert(NULL != expr->jdf_c_code.fname); + coutput(" __parsec_tp->super.super.tdm.module->taskpool_addto_nb_tasks(&__parsec_tp->super.super, %s(__parsec_tp));\n", + expr->jdf_c_code.fname); + } else if(JDF_VAR == expr->op || JDF_STRING == expr->op) { + assert(NULL != expr->jdf_var); + coutput(" __parsec_tp->super.super.tdm.module->taskpool_addto_nb_tasks(&__parsec_tp->super.super, %s(__parsec_tp));\n", + expr->jdf_var); + } else { + jdf_fatal(JDF_OBJECT_LINENO(expr), + "During code generation: the expression that defines the property '%s' is neither a function, a string nor a variable name (op code: %d).\n" + "Unable to generate user-defined task counting operation in the internal_init of %s\n", + JDF_PROP_UD_NB_LOCAL_TASKS_FN_NAME, expr->op, + f->fname); + } } else { assert((f->user_defines & JDF_HAS_USER_TRIGGERED_TERMDET) || - (NULL != jdf_property_get_string(jdf->global_properties, JDF_PROP_TERMDET_DYNAMIC, NULL))); + (f->user_defines & JDF_HAS_DYNAMIC_TERMDET)); /* The startup tasks are going to count the real number of tasks as they discover them. * For now, we lock the idleness by creating a runtime pending action, and * we use sync_point to find when all the startup tasks are done. */ - coutput(" __parsec_tp->sync_point = PARSEC_%s_NB_TASK_CLASSES\n;" - " __parsec_tp->super.super.tdm.module->taskpool_addto_nb_tasks(&__parsec_tp->super.super, 1);\n", + coutput(" __parsec_tp->sync_point = PARSEC_%s_NB_TASK_CLASSES;\n" + " //__parsec_tp->super.super.tdm.module->taskpool_addto_nb_tasks(&__parsec_tp->super.super, 1);\n", jdf_basename); } } else { @@ -4236,19 +4262,10 @@ static void jdf_generate_one_function( const jdf_t *jdf, jdf_function_entry_t *f } } string_arena_add_string(sa, " .find_deps = %s,\n", jdf_property_get_function(f->properties, JDF_PROP_UD_FIND_DEPS_FN_NAME, NULL)); - if( use_mask ) { - if( NULL == jdf_property_get_string(jdf->global_properties, JDF_PROP_TERMDET_DYNAMIC, NULL)) { - string_arena_add_string(sa, " .update_deps = parsec_update_deps_with_mask,\n"); - } else { - string_arena_add_string(sa, " .update_deps = parsec_update_deps_with_mask_count_task,\n"); - } + string_arena_add_string(sa, " .update_deps = parsec_update_deps_with_mask,\n"); } else { - if( NULL == jdf_property_get_string(jdf->global_properties, JDF_PROP_TERMDET_DYNAMIC, NULL)) { - string_arena_add_string(sa, " .update_deps = parsec_update_deps_with_counter,\n"); - } else { - string_arena_add_string(sa, " .update_deps = parsec_update_deps_with_counter_count_task,\n"); - } + string_arena_add_string(sa, " .update_deps = parsec_update_deps_with_counter,\n"); } if( !(f->flags & JDF_FUNCTION_FLAG_NO_SUCCESSORS) ) { @@ -4582,18 +4599,6 @@ static void jdf_generate_constructor( const jdf_t* jdf ) sa1 = string_arena_new(64); sa2 = string_arena_new(64); - if( NULL != jdf_property_get_string(jdf->global_properties, JDF_PROP_TERMDET_DYNAMIC, NULL)) { - coutput("static parsec_hook_return_t tp_ready_when_synced(struct parsec_execution_stream_s *es, parsec_task_t *task) {\n" - " (void)es;\n" - " __parsec_%s_internal_taskpool_t *__parsec_tp = (__parsec_%s_internal_taskpool_t *)task->taskpool;\n" - " int remaining = parsec_atomic_fetch_dec_int32(&__parsec_tp->sync_point) - 1;\n" - " if( 0 == remaining ) {\n" - " __parsec_tp->super.super.tdm.module->taskpool_addto_nb_tasks(&__parsec_tp->super.super, __parsec_tp->initial_number_tasks-1);\n" - " }\n" - " return PARSEC_HOOK_RETURN_DONE;\n" - "}\n\n", jdf_basename, jdf_basename); - } - coutput("void __parsec_%s_internal_constructor(__parsec_%s_internal_taskpool_t* __parsec_tp)\n{\n" " parsec_task_class_t* tc;\n" " uint32_t i, j;\n\n", @@ -4660,10 +4665,6 @@ static void jdf_generate_constructor( const jdf_t* jdf ) coutput(" ((__parsec_chore_t*)&tc->incarnations[0])->hook = (parsec_hook_t *)%s;\n", jdf_property_get_function(f->properties, JDF_PROP_UD_STARTUP_TASKS_FN_NAME, NULL)); } - if( NULL != jdf_property_get_string(jdf->global_properties, JDF_PROP_TERMDET_DYNAMIC, NULL) ) { - coutput(" assert(NULL == tc->complete_execution);\n" - " tc->complete_execution = (parsec_hook_t*)tp_ready_when_synced;\n"); - } } { @@ -4779,7 +4780,7 @@ static void jdf_generate_new_function( const jdf_t* jdf ) " (void)parsec_taskpool_reserve_id((parsec_taskpool_t*)__parsec_tp);\n", jdf_basename); - if( NULL != jdf_property_get_string(jdf->global_properties, JDF_PROP_TERMDET_DYNAMIC, NULL) ) { + if( jdf_uses_dynamic_termdet(jdf) ) { coutput(" __parsec_tp->initial_number_tasks = 0;\n"); } @@ -7221,11 +7222,21 @@ static void jdf_generate_code_release_deps(const jdf_t *jdf, const jdf_function_ "#endif\n" "\n"); coutput(" if(action_mask & PARSEC_ACTION_RELEASE_LOCAL_DEPS) {\n" - " data_repo_entry_addto_usage_limit(%s_repo, arg.output_entry->ht_item.key, arg.output_usage);\n" - " __parsec_schedule_vp(es, arg.ready_lists, 0);\n" - " }\n", + " data_repo_entry_addto_usage_limit(%s_repo, arg.output_entry->ht_item.key, arg.output_usage);\n", f->fname); - + if(jdf_uses_dynamic_termdet(jdf)) { + coutput(" {\n" + " /* Using Dynamic Termination Detection, the DSL is reponsible of counting the number of tasks scheduled before scheduling them */\n" + " int __nb_tasks = 0;\n" + " for(__vp_id = 0; __vp_id < es->virtual_process->parsec_context->nb_vp; __vp_id++) {\n" + " if( NULL == arg.ready_lists[__vp_id] ) continue;\n" + " _LIST_ITEM_ITERATOR(arg.ready_lists[__vp_id], &arg.ready_lists[__vp_id]->super, __item, __nb_tasks++);" + " }\n" + " __parsec_tp->super.super.tdm.module->taskpool_addto_nb_tasks((parsec_taskpool_t*)__parsec_tp, __nb_tasks);\n" + " }\n"); + } + coutput(" __parsec_schedule_vp(es, arg.ready_lists, 0);\n" + " }\n"); } else { coutput(" /* No successors, don't call iterate_successors and don't release any local deps */\n"); } @@ -8358,6 +8369,46 @@ int jdf_optimize( jdf_t* jdf ) return 0; } +/** Force the PTG to use a dynamic termination detection **/ +int jdf_force_termdet_dynamic(jdf_t* jdf) +{ + jdf_def_list_t* property; + jdf_expr_t *termdet_expr; + int rc = 0; + + termdet_expr = jdf_find_property(jdf->global_properties, JDF_PROP_TERMDET_NAME, &property); + if( NULL != termdet_expr && strcmp(termdet_expr->jdf_var, JDF_PROP_TERMDET_USER_TRIGGERED) == 0 ) { + return rc; // We don't override a user-trigger termination detection selection + } + if( NULL != termdet_expr && strcmp(termdet_expr->jdf_var, JDF_PROP_TERMDET_DYNAMIC) == 0 ) { + return rc; // The PTG developer already asked for dynamic termination detection + } + if(NULL != termdet_expr) { + if(strcmp(termdet_expr->jdf_var, JDF_PROP_TERMDET_LOCAL) != 0) { + jdf_warn(termdet_expr->super.lineno, "'%s' is not a recognized value for option '%s' -- option overwritten to '%s' because --termdet-dynamic is requested\n", + termdet_expr->jdf_var, JDF_PROP_TERMDET_NAME, JDF_PROP_TERMDET_DYNAMIC); + } + free(termdet_expr->jdf_var); + termdet_expr->jdf_var = strdup(JDF_PROP_TERMDET_DYNAMIC); + return rc; + } + + termdet_expr = (jdf_expr_t *)calloc(sizeof(jdf_expr_t), 1); + termdet_expr->op = JDF_STRING; + termdet_expr->local_variables = NULL; + termdet_expr->scope = -1; + termdet_expr->alias = NULL; + termdet_expr->jdf_var = strdup(JDF_PROP_TERMDET_DYNAMIC); + + property = (jdf_def_list_t*)calloc(sizeof(jdf_def_list_t), 1); + property->expr = termdet_expr; + property->name = strdup(JDF_PROP_TERMDET_NAME); + property->next = jdf->global_properties; + jdf->global_properties = property; + + return rc; +} + /** Main Function */ #if defined(PARSEC_HAVE_INDENT) && !(defined(__WINDOWS__) || defined(__MING64__) || defined(__CYGWIN__)) diff --git a/parsec/interfaces/ptg/ptg-compiler/jdf2c.h b/parsec/interfaces/ptg/ptg-compiler/jdf2c.h index f87ad1c7b..4d02c7ada 100644 --- a/parsec/interfaces/ptg/ptg-compiler/jdf2c.h +++ b/parsec/interfaces/ptg/ptg-compiler/jdf2c.h @@ -10,6 +10,8 @@ int jdf_optimize( jdf_t* jdf ); +int jdf_force_termdet_dynamic(jdf_t* jdf); + int jdf2c(const char *output_c, const char *output_h, const char *_basename, jdf_t *jdf); #endif /* _jdf2c_h */ diff --git a/parsec/interfaces/ptg/ptg-compiler/main.c b/parsec/interfaces/ptg/ptg-compiler/main.c index 4ff11c5eb..ab705d00f 100644 --- a/parsec/interfaces/ptg/ptg-compiler/main.c +++ b/parsec/interfaces/ptg/ptg-compiler/main.c @@ -34,6 +34,7 @@ static jdf_compiler_global_args_t DEFAULTS = { .wmask = JDF_ALL_WARNINGS, .compile = 1, /* by default the file must be compiled */ .dep_management = DEP_MANAGEMENT_DYNAMIC_HASH_TABLE, + .termdet = TERMDET_DEFAULT, #if defined(PARSEC_HAVE_INDENT) && !defined(PARSEC_HAVE_AWK) .noline = 1, /*< By default, don't print the #line per default if can't fix the line numbers with awk */ #else @@ -67,6 +68,12 @@ static void usage(void) " are '"DEP_MANAGEMENT_INDEX_ARRAY_STRING"' or '"DEP_MANAGEMENT_DYNAMIC_HASH_TABLE_STRING"'\n" " (default '%s')\n" "\n" + " --dynamic-termdet|-D Use dynamic termination detection, even for PTGs that can use\n" + " local (i.e. pre-counted number of tasks) termination detection\n" + " NB. PTGs that are defined to use user-trigger termination\n" + " detection continue to rely on user-trigger termination detection.\n" + " (default: use local termination detection)\n" + "\n" " --noline Do not dump the JDF line number in the .c output file\n" " --line Force dumping the JDF line number in the .c output file\n" " Default: %s\n" @@ -187,6 +194,7 @@ static void parse_args(int argc, char *argv[]) { "dep-management",required_argument, NULL, 'M' }, { "force-profile", no_argument, NULL, 2 }, { "ignore-properties", required_argument, NULL, 'I' }, + { "dynamic-termdet", no_argument, NULL, 'D' }, { NULL, 0, NULL, 0 } }; @@ -196,12 +204,15 @@ static void parse_args(int argc, char *argv[]) print_jdf_line = !DEFAULTS.noline; - while( (ch = getopt_long(argc, argv, "di:C:H:o:f:hEsIO:M:I:", longopts, NULL)) != -1) { + while( (ch = getopt_long(argc, argv, "dDi:C:H:o:f:hEsIO:M:I:", longopts, NULL)) != -1) { switch(ch) { case 'd': yydebug = 1; jdfdebug = 1; break; + case 'D': + JDF_COMPILER_GLOBAL_ARGS.termdet = TERMDET_DYNAMIC; + break; case 'i': if( NULL != JDF_COMPILER_GLOBAL_ARGS.input ) free(JDF_COMPILER_GLOBAL_ARGS.input); @@ -265,8 +276,10 @@ static void parse_args(int argc, char *argv[]) usage(); exit(0); default: - /* save the option for later */ - parsec_argv_append(&token_count, &extra_argv, optarg); + if(NULL != optarg) { + /* save the option for later, if there was one */ + parsec_argv_append(&token_count, &extra_argv, optarg); + } } } @@ -408,6 +421,13 @@ int main(int argc, char *argv[]) return 1; } + if( JDF_COMPILER_GLOBAL_ARGS.termdet == TERMDET_DYNAMIC ) { + rc = jdf_force_termdet_dynamic(¤t_jdf); + if(rc != 0) { + return 1; + } + } + /* Lets try to optimize the jdf */ jdf_optimize( ¤t_jdf ); diff --git a/parsec/mca/termdet/fourcounter/termdet_fourcounter.h b/parsec/mca/termdet/fourcounter/termdet_fourcounter.h index a7850f22a..37a36b4f5 100644 --- a/parsec/mca/termdet/fourcounter/termdet_fourcounter.h +++ b/parsec/mca/termdet/fourcounter/termdet_fourcounter.h @@ -35,7 +35,8 @@ BEGIN_C_DECLS PARSEC_DECLSPEC extern const parsec_termdet_base_component_t parsec_termdet_fourcounter_component; PARSEC_DECLSPEC extern const parsec_termdet_module_t parsec_termdet_fourcounter_module; -int parsec_termdet_fourcounter_msg_dispatch(parsec_comm_engine_t *ce, unsigned long long tag, void *msg, unsigned long size, int src, void *module); +int parsec_termdet_fourcounter_msg_dispatch(parsec_comm_engine_t *ce, parsec_ce_tag_t tag, void *msg, + size_t size, int src, void *module); typedef enum { PARSEC_TERMDET_FOURCOUNTER_MSG_TYPE_DOWN, diff --git a/parsec/mca/termdet/fourcounter/termdet_fourcounter_module.c b/parsec/mca/termdet/fourcounter/termdet_fourcounter_module.c index 90a98d4d6..66f0f6fbd 100644 --- a/parsec/mca/termdet/fourcounter/termdet_fourcounter_module.c +++ b/parsec/mca/termdet/fourcounter/termdet_fourcounter_module.c @@ -147,7 +147,8 @@ static int parsec_termdet_fourcounter_msg_dispatch_taskpool(parsec_taskpool_t *t return PARSEC_ERROR; } -int parsec_termdet_fourcounter_msg_dispatch(parsec_comm_engine_t *ce, unsigned long long tag, void *msg, unsigned long size, int src, void *module) +int parsec_termdet_fourcounter_msg_dispatch(parsec_comm_engine_t *ce, parsec_ce_tag_t tag, void *msg, + size_t size, int src, void *module) { parsec_termdet_fourcounter_delayed_msg_t *delayed_msg; parsec_termdet_fourcounter_msg_down_t *down_msg = (parsec_termdet_fourcounter_msg_down_t*)msg; diff --git a/parsec/mca/termdet/user_trigger/termdet_user_trigger.h b/parsec/mca/termdet/user_trigger/termdet_user_trigger.h index 33f5cda88..feae8c0a9 100644 --- a/parsec/mca/termdet/user_trigger/termdet_user_trigger.h +++ b/parsec/mca/termdet/user_trigger/termdet_user_trigger.h @@ -39,8 +39,8 @@ PARSEC_DECLSPEC extern const parsec_termdet_module_t parsec_termdet_user_trigger /* static accessor */ mca_base_component_t *termdet_user_trigger_static_component(void); -int parsec_termdet_user_trigger_msg_dispatch(parsec_comm_engine_t *ce, unsigned long long tag, void *msg, - unsigned long size, int src, void *module); +int parsec_termdet_user_trigger_msg_dispatch(parsec_comm_engine_t *ce, parsec_ce_tag_t tag, void *msg, + size_t size, int src, void *module); typedef struct { uint32_t tp_id; diff --git a/parsec/mca/termdet/user_trigger/termdet_user_trigger_module.c b/parsec/mca/termdet/user_trigger/termdet_user_trigger_module.c index 990457318..16a01e2bf 100644 --- a/parsec/mca/termdet/user_trigger/termdet_user_trigger_module.c +++ b/parsec/mca/termdet/user_trigger/termdet_user_trigger_module.c @@ -114,8 +114,8 @@ static int parsec_termdet_user_trigger_msg_dispatch_taskpool(parsec_taskpool_t * return PARSEC_SUCCESS; } -int parsec_termdet_user_trigger_msg_dispatch(parsec_comm_engine_t *ce, unsigned long long tag, void *msg, - unsigned long size, int src, void *module) +int parsec_termdet_user_trigger_msg_dispatch(parsec_comm_engine_t *ce, parsec_ce_tag_t tag, void *msg, + size_t size, int src, void *module) { parsec_termdet_user_trigger_delayed_msg_t *delayed_msg; parsec_termdet_user_trigger_msg_t *ut_msg = (parsec_termdet_user_trigger_msg_t*)msg; diff --git a/parsec/parsec.c b/parsec/parsec.c index 186330f6c..895096585 100644 --- a/parsec/parsec.c +++ b/parsec/parsec.c @@ -1606,55 +1606,6 @@ parsec_update_deps_with_counter(parsec_taskpool_t *tp, return dep_cur_value == 0; } -int -parsec_update_deps_with_counter_count_task(parsec_taskpool_t *tp, - const parsec_task_t* restrict task, - parsec_dependency_t *deps, - const parsec_task_t* restrict origin, - const parsec_flow_t* restrict origin_flow, - const parsec_flow_t* restrict dest_flow) -{ - parsec_dependency_t dep_new_value, dep_cur_value; -#if defined(PARSEC_DEBUG_PARANOID) || defined(PARSEC_DEBUG_NOISIER) - char tmp[MAX_TASK_STRLEN]; - parsec_task_snprintf(tmp, MAX_TASK_STRLEN, task); -#endif - - (void)origin; - (void)origin_flow; - (void)dest_flow; - - if( 0 == *deps ) { - dep_new_value = parsec_check_IN_dependencies_with_counter(tp, task) - 1; - if( parsec_atomic_cas_int32( deps, 0, dep_new_value ) == 1 ) { - dep_cur_value = dep_new_value; - tp->tdm.module->taskpool_addto_nb_tasks(tp, 1); - } else { - dep_cur_value = parsec_atomic_fetch_dec_int32( deps ) - 1; - } - } else { - dep_cur_value = parsec_atomic_fetch_dec_int32( deps ) - 1; - } - PARSEC_DEBUG_VERBOSE(10, parsec_debug_output, "Activate counter dependency for %s leftover %d (excluding current)", - tmp, dep_cur_value); - -#if defined(PARSEC_DEBUG_PARANOID) - { - char wtmp[MAX_TASK_STRLEN]; - if( (uint32_t)dep_cur_value > (uint32_t)-128) { - parsec_fatal("task %s as reached an improbable dependency count of %u", - wtmp, dep_cur_value ); - } - - PARSEC_DEBUG_VERBOSE(20, parsec_debug_output, "Task %s has a current dependencies count of %d remaining. %s to go!", - tmp, dep_cur_value, - (dep_cur_value == 0) ? "Ready" : "Not ready"); - } -#endif /* PARSEC_DEBUG_PARANOID */ - - return dep_cur_value == 0; -} - int parsec_update_deps_with_mask(parsec_taskpool_t *tp, const parsec_task_t* restrict task, @@ -1721,77 +1672,6 @@ parsec_update_deps_with_mask(parsec_taskpool_t *tp, return (dep_cur_value & tc->dependencies_goal) == tc->dependencies_goal; } -int -parsec_update_deps_with_mask_count_task(parsec_taskpool_t *tp, - const parsec_task_t* restrict task, - parsec_dependency_t *deps, - const parsec_task_t* restrict origin, - const parsec_flow_t* restrict origin_flow, - const parsec_flow_t* restrict dest_flow) -{ - parsec_dependency_t dep_new_value, dep_cur_value; - const parsec_task_class_t* tc = task->task_class; -#if defined(PARSEC_DEBUG_NOISIER) || defined(PARSEC_DEBUG_PARANOID) - char tmpo[MAX_TASK_STRLEN], tmpt[MAX_TASK_STRLEN]; - parsec_task_snprintf(tmpo, MAX_TASK_STRLEN, origin); - parsec_task_snprintf(tmpt, MAX_TASK_STRLEN, task); -#endif - - PARSEC_DEBUG_VERBOSE(10, parsec_debug_output, "Activate mask dep for %s:%s (current 0x%x now 0x%x goal 0x%x) from %s:%s", - dest_flow->name, tmpt, *deps, (1 << dest_flow->flow_index), tc->dependencies_goal, - origin_flow->name, tmpo); -#if defined(PARSEC_DEBUG_PARANOID) - if( (*deps) & (1 << dest_flow->flow_index) ) { - parsec_fatal("Output dependencies 0x%x from %s (flow %s) activate an already existing dependency 0x%x on %s (flow %s)", - dest_flow->flow_index, tmpo, - origin_flow->name, *deps, - tmpt, dest_flow->name ); - } -#else - (void) origin; (void) origin_flow; -#endif - - assert( 0 == (*deps & (1 << dest_flow->flow_index)) ); - - dep_new_value = PARSEC_DEPENDENCIES_IN_DONE | (1 << dest_flow->flow_index); - /* Mark the dependencies and check if this particular instance can be executed */ - if( !(PARSEC_DEPENDENCIES_IN_DONE & (*deps)) ) { - dep_new_value |= parsec_check_IN_dependencies_with_mask(tp, task); -#if defined(PARSEC_DEBUG_NOISIER) - if( dep_new_value != 0 ) { - PARSEC_DEBUG_VERBOSE(20, parsec_debug_output, "Activate IN dependencies with mask 0x%x", dep_new_value); - } -#endif - } - - dep_cur_value = parsec_atomic_fetch_or_int32( deps, dep_new_value ) | dep_new_value; - if( (dep_cur_value & (~dep_new_value)) == 0 ) { - tp->tdm.module->taskpool_addto_nb_tasks(tp, 1); - } else { - assert(0); - } - -#if defined(PARSEC_DEBUG_PARANOID) - if( (dep_cur_value & tc->dependencies_goal) == tc->dependencies_goal ) { - int success; - parsec_dependency_t tmp_mask; - tmp_mask = *deps; - success = parsec_atomic_cas_int32(deps, - tmp_mask, (tmp_mask | PARSEC_DEPENDENCIES_TASK_DONE)); - if( !success || (tmp_mask & PARSEC_DEPENDENCIES_TASK_DONE) ) { - parsec_fatal("Task %s scheduled twice (second time by %s)!!!", - tmpt, tmpo); - } - } -#endif /* defined(PARSEC_DEBUG_PARANOID) */ - - PARSEC_DEBUG_VERBOSE(20, parsec_debug_output, "Task %s has a current dependencies of 0x%x and a goal of 0x%x. %s to go!", - tmpt, dep_cur_value, tc->dependencies_goal, - ((dep_cur_value & tc->dependencies_goal) == tc->dependencies_goal) ? - "Ready" : "Not ready"); - return (dep_cur_value & tc->dependencies_goal) == tc->dependencies_goal; -} - /* * Mark the task as having all it's dependencies satisfied. This is not * necessarily required for the startup process, but it leaves traces such that diff --git a/parsec/parsec_internal.h b/parsec/parsec_internal.h index 3beb1310f..aaf8abcfc 100644 --- a/parsec/parsec_internal.h +++ b/parsec/parsec_internal.h @@ -358,24 +358,12 @@ int parsec_update_deps_with_mask(parsec_taskpool_t *tp, const parsec_task_t* restrict origin, const parsec_flow_t* restrict origin_flow, const parsec_flow_t* restrict dest_flow); -int parsec_update_deps_with_mask_count_task(parsec_taskpool_t *tp, - const parsec_task_t* restrict task, - parsec_dependency_t *deps, - const parsec_task_t* restrict origin, - const parsec_flow_t* restrict origin_flow, - const parsec_flow_t* restrict dest_flow); int parsec_update_deps_with_counter(parsec_taskpool_t *tp, const parsec_task_t* restrict task, parsec_dependency_t *deps, const parsec_task_t* restrict origin, const parsec_flow_t* restrict origin_flow, const parsec_flow_t* restrict dest_flow); -int parsec_update_deps_with_counter_count_task(parsec_taskpool_t *tp, - const parsec_task_t* restrict task, - parsec_dependency_t *deps, - const parsec_task_t* restrict origin, - const parsec_flow_t* restrict origin_flow, - const parsec_flow_t* restrict dest_flow); typedef struct __parsec_internal_incarnation_s { int32_t type; diff --git a/parsec/remote_dep.h b/parsec/remote_dep.h index b42699a1d..7095aa175 100644 --- a/parsec/remote_dep.h +++ b/parsec/remote_dep.h @@ -42,9 +42,9 @@ typedef enum { REMOTE_DEP_ACTIVATE_TAG = 2, REMOTE_DEP_GET_DATA_TAG, REMOTE_DEP_PUT_END_TAG, - REMOTE_DEP_MAX_CTRL_TAG, PARSEC_TERMDET_FOURCOUNTER_MSG_TAG, - PARSEC_TERMDET_USER_TRIGGER_MSG_TAG + PARSEC_TERMDET_USER_TRIGGER_MSG_TAG, + REMOTE_DEP_MAX_CTRL_TAG } parsec_remote_dep_tag_t; typedef struct remote_dep_wire_activate_s { diff --git a/tests/dsl/ptg/ptgpp/Testings.cmake b/tests/dsl/ptg/ptgpp/Testings.cmake index 83d2913a1..a8344a0b4 100644 --- a/tests/dsl/ptg/ptgpp/Testings.cmake +++ b/tests/dsl/ptg/ptgpp/Testings.cmake @@ -4,13 +4,13 @@ include(ParsecCompilePTG) # Test that NULL as output returns an error # parsec_addtest_cmd(dsl/ptg/ptgpp/output_NULL - COMMAND ${PARSEC_PTGPP_EXECUTABLE} ${PARSEC_PTGFLAGS} -E -i ${CMAKE_CURRENT_SOURCE_DIR}/dsl/ptg/ptgpp/output_NULL.jdf -o output_NULL -f output_NULL) + COMMAND ${PARSEC_PTGPP_EXECUTABLE} ${PARSEC_PTGPP_FLAGS} -E -i ${CMAKE_CURRENT_SOURCE_DIR}/dsl/ptg/ptgpp/output_NULL.jdf -o output_NULL -f output_NULL) parsec_addtest_cmd(dsl/ptg/ptgpp/output_NULL_true - COMMAND ${PARSEC_PTGPP_EXECUTABLE} ${PARSEC_PTGFLAGS} -E -i ${CMAKE_CURRENT_SOURCE_DIR}/dsl/ptg/ptgpp/output_NULL_true.jdf -o output_NULL_true -f output_NULL_true) + COMMAND ${PARSEC_PTGPP_EXECUTABLE} ${PARSEC_PTGPP_FLAGS} -E -i ${CMAKE_CURRENT_SOURCE_DIR}/dsl/ptg/ptgpp/output_NULL_true.jdf -o output_NULL_true -f output_NULL_true) parsec_addtest_cmd(dsl/ptg/ptgpp/output_NULL_false - COMMAND ${PARSEC_PTGPP_EXECUTABLE} ${PARSEC_PTGFLAGS} -E -i ${CMAKE_CURRENT_SOURCE_DIR}/dsl/ptg/ptgpp/output_NULL_false.jdf -o output_NULL_false -f output_NULL_false) + COMMAND ${PARSEC_PTGPP_EXECUTABLE} ${PARSEC_PTGPP_FLAGS} -E -i ${CMAKE_CURRENT_SOURCE_DIR}/dsl/ptg/ptgpp/output_NULL_false.jdf -o output_NULL_false -f output_NULL_false) set_tests_properties(dsl/ptg/ptgpp/output_NULL dsl/ptg/ptgpp/output_NULL_true dsl/ptg/ptgpp/output_NULL_false PROPERTIES @@ -21,13 +21,13 @@ set_tests_properties(dsl/ptg/ptgpp/output_NULL dsl/ptg/ptgpp/output_NULL_true ds # Test that NEW as output returns an error # parsec_addtest_cmd(dsl/ptg/ptgpp/output_NEW - COMMAND ${PARSEC_PTGPP_EXECUTABLE} ${PARSEC_PTGFLAGS} -E -i ${CMAKE_CURRENT_SOURCE_DIR}/dsl/ptg/ptgpp/output_NEW.jdf -o output_NEW -f output_NEW) + COMMAND ${PARSEC_PTGPP_EXECUTABLE} ${PARSEC_PTGPP_FLAGS} -E -i ${CMAKE_CURRENT_SOURCE_DIR}/dsl/ptg/ptgpp/output_NEW.jdf -o output_NEW -f output_NEW) parsec_addtest_cmd(dsl/ptg/ptgpp/output_NEW_true - COMMAND ${PARSEC_PTGPP_EXECUTABLE} ${PARSEC_PTGFLAGS} -E -i ${CMAKE_CURRENT_SOURCE_DIR}/dsl/ptg/ptgpp/output_NEW_true.jdf -o output_NEW_true -f output_NEW_true) + COMMAND ${PARSEC_PTGPP_EXECUTABLE} ${PARSEC_PTGPP_FLAGS} -E -i ${CMAKE_CURRENT_SOURCE_DIR}/dsl/ptg/ptgpp/output_NEW_true.jdf -o output_NEW_true -f output_NEW_true) parsec_addtest_cmd(dsl/ptg/ptgpp/output_NEW_false - COMMAND ${PARSEC_PTGPP_EXECUTABLE} ${PARSEC_PTGFLAGS} -E -i ${CMAKE_CURRENT_SOURCE_DIR}/dsl/ptg/ptgpp/output_NEW_false.jdf -o output_NEW_false -f output_NEW_false) + COMMAND ${PARSEC_PTGPP_EXECUTABLE} ${PARSEC_PTGPP_FLAGS} -E -i ${CMAKE_CURRENT_SOURCE_DIR}/dsl/ptg/ptgpp/output_NEW_false.jdf -o output_NEW_false -f output_NEW_false) set_tests_properties(dsl/ptg/ptgpp/output_NEW dsl/ptg/ptgpp/output_NEW_true dsl/ptg/ptgpp/output_NEW_false PROPERTIES