changeset 223:8d2519c3a36e

Add input data gear example
author one
date Wed, 11 Jan 2017 17:19:53 +0900
parents 77faa28128b4
children 578f283efb4a
files src/parallel_execution/Todo src/parallel_execution/taskManager.c src/parallel_execution/twice.c
diffstat 3 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/Todo	Wed Jan 11 16:52:27 2017 +0900
+++ b/src/parallel_execution/Todo	Wed Jan 11 17:19:53 2017 +0900
@@ -5,10 +5,12 @@
 
     Task
         CodeGen
-            DataSeg
-            DataSeg
-            DataSeg
+            IDataSeg
+            IDataSeg
+            ...
         idsCount
+        nextTask(can be C_exit)
+            ODataSeg?
 
     TaskManager
         createWorker
--- a/src/parallel_execution/taskManager.c	Wed Jan 11 16:52:27 2017 +0900
+++ b/src/parallel_execution/taskManager.c	Wed Jan 11 17:19:53 2017 +0900
@@ -47,23 +47,20 @@
     goto meta(context, TaskManager->next);
 }
 
-__code shutdownTaskManager(struct Context* context, struct LoopCounter* loopCounter, struct Worker* worker) {
+__code shutdownTaskManager(struct Context* context, struct LoopCounter* loopCounter, struct Worker* worker, struct TaskManager* taskManager) {
     int i = loopCounter->i;
 
     if (i < worker->id) {
         pthread_join(worker->contexts[i].thread, NULL);
         loopCounter->i++;
 
-        goto meta(context, C_taskManager);
+        goto meta(context, C_shutDownTaskManager);
     }
 
     loopCounter->i = 0;
-
-    Time *t = &context->data[D_Time]->Time;
-    t->next = C_code2;
-    goto meta(context, C_end_time);
+    goto meta(context, taskManager->next);
 }
 
 __code shutdownTaskManager_stub(struct Context* context) {
-    goto shutdownTaskManager(context, &context->data[D_LoopCounter]->LoopCounter, &context->data[D_Worker]->Worker);
+    goto shutdownTaskManager(context, &context->data[D_LoopCounter]->LoopCounter, &context->data[D_Worker]->Worker, Gearef(context, TaskManager));
 }
--- a/src/parallel_execution/twice.c	Wed Jan 11 16:52:27 2017 +0900
+++ b/src/parallel_execution/twice.c	Wed Jan 11 17:19:53 2017 +0900
@@ -3,7 +3,7 @@
 #include "context.h"
 #include "origin_cs.h"
 
-__code twice(struct Context* context, struct LoopCounter* loopCounter, int index, int prefix, int* array) {
+__code twice(struct Context* context, struct LoopCounter* loopCounter, int index, int prefix, int* array, enum Code next) {
     int i = loopCounter->i;
 
     if (i < prefix) {
@@ -16,13 +16,14 @@
     loopCounter->i = 0;
 
     //stack_pop(context->code_stack, &context->next);
-    goto meta(context, context->next);
+    goto meta(context, next);
 }
 
 __code twice_stub(struct Context* context) {
     goto twice(context,
-               &context->data[D_LoopCounter]->LoopCounter,
-               context->data[D_Node]->Node.value->Array.index,
-               context->data[D_Node]->Node.value->Array.prefix,
-               context->data[D_Node]->Node.value->Array.array);
+               &context->data[task->data[0]]->LoopCounter,
+               context->data[task->data[1]]->Node.value->Array.index,
+               context->data[task->data[2]]->Node.value->Array.prefix,
+               context->data[task->data[3]]->Node.value->Array.array
+               task->next);
 }