# HG changeset patch # User Tatsuki IHA # Date 1503563021 -32400 # Node ID c43ec0e3fa84993787184689d9acfb9d46c8ec39 # Parent bba401f93dcd0f06d4e2ed7715b8b3edc750dd8e Add par_meta diff -r bba401f93dcd -r c43ec0e3fa84 src/parallel_execution/context.h --- a/src/parallel_execution/context.h Thu Aug 24 15:32:38 2017 +0900 +++ b/src/parallel_execution/context.h Thu Aug 24 17:23:41 2017 +0900 @@ -88,6 +88,7 @@ int odg; int maxOdg; int workerId; + struct Context** contexts; #ifdef USE_CUDAWorker int num_exec; CUmodule module; diff -r bba401f93dcd -r c43ec0e3fa84 src/parallel_execution/examples/calc/calc.cbc --- a/src/parallel_execution/examples/calc/calc.cbc Thu Aug 24 15:32:38 2017 +0900 +++ b/src/parallel_execution/examples/calc/calc.cbc Thu Aug 24 17:23:41 2017 +0900 @@ -118,10 +118,7 @@ par goto initIntegerDataGears(integer2, integer4, integer5, __exit); - taskManager->contexts = tasks; - // goto crateTask1(); - taskManager->next1 = C_createTask1; - goto meta(context, taskManager->taskManager->TaskManager.spawnTasks); + goto crateTask1(); } void init(int argc, char** argv) { diff -r bba401f93dcd -r c43ec0e3fa84 src/parallel_execution/generate_context.pl --- a/src/parallel_execution/generate_context.pl Thu Aug 24 15:32:38 2017 +0900 +++ b/src/parallel_execution/generate_context.pl Thu Aug 24 17:23:41 2017 +0900 @@ -168,6 +168,13 @@ print $fd $context_c; my $meta_call = <<"EOFEOF"; +__code par_meta(struct Context* context, enum Code spawns, enum Code next) { + if (context->contexts != NULL) { + context->contexts = NULL; + goto (context->code[spawns])(context); + } + goto (context->code[next])(context); +} __code meta(struct Context* context, enum Code next) { // printf("meta %d\\n",next); diff -r bba401f93dcd -r c43ec0e3fa84 src/parallel_execution/generate_stub.pl --- a/src/parallel_execution/generate_stub.pl Thu Aug 24 15:32:38 2017 +0900 +++ b/src/parallel_execution/generate_stub.pl Thu Aug 24 17:23:41 2017 +0900 @@ -469,7 +469,17 @@ my $v = shift(@args); print $fd "\t*O_$arg = $v;\n"; } - print $fd "${prev}goto meta(context, $next);\n"; + if ($inParGoto) { + print $fd "${prev}taskManager->contexts = tasks;\n"; + print $fd "${prev}goto par_meta(context, Gearef(context, TaskManager)->taskManager->TaskManager.spawnTasks, $next);\n"; + } else { + print $fd "${prev}goto meta(context, $next);\n"; + } + next; + } + if ($inParGoto) { + print $fd "${prev}taskManager->contexts = tasks;\n"; + print $fd "${prev}goto par_meta(context, Gearef(context, TaskManager)->taskManager->TaskManager.spawnTasks, $next);\n"; next; } }