changeset 116:69fbd905d750

Modify Create_Data
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Tue, 12 Jul 2016 16:26:05 +0900
parents 135472238fb7
children c9ab10847fc3
files src/parallel_execution/context.h src/parallel_execution/dependency.c src/parallel_execution/main.c
diffstat 3 files changed, 64 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/context.h	Tue Jun 28 15:59:24 2016 +0900
+++ b/src/parallel_execution/context.h	Tue Jul 12 16:26:05 2016 +0900
@@ -133,7 +133,6 @@
     struct Task {
         enum Code code;
         int key;
-        int idsCount;
     } task;
     struct Queue {
         struct Element* first;
--- a/src/parallel_execution/dependency.c	Tue Jun 28 15:59:24 2016 +0900
+++ b/src/parallel_execution/dependency.c	Tue Jul 12 16:26:05 2016 +0900
@@ -59,17 +59,20 @@
             &context->data[WaitQueue]->queue);
 }
 
-__code taskA(struct Context* context) {
-    printf("TaskA\n");
-    goto meta(context, context->next);
+__code taskA(struct Context* context, struct Integer* input1, struct Integer* input2) {
+    allocator(context);
+    goto meta(context, calcPlus);
+}
+
+__code add(struct Context* context, struct Integer* input1, struct Integer* input2, struct Integer* output) {
+    output->value = input1->value + input2->value;
 }
 
 __code taskB(struct Context* context) {
-    printf("TaskB\n");
+    allocator(context);
     goto meta(context, context->next);
 }
 
-__code taskC(struct Context* context) {
-    printf("TaskC\n");
-    goto meta(context, context->next);
+__code mult(struct Context* context, struct Integer* input1, struct Integer* input2, struct Integer* output) {
+    output->value = input1->value * input2->value;
 }
--- a/src/parallel_execution/main.c	Tue Jun 28 15:59:24 2016 +0900
+++ b/src/parallel_execution/main.c	Tue Jul 12 16:26:05 2016 +0900
@@ -106,20 +106,21 @@
             &context->data[LoopCounter]->loopCounter,
             &context->data[context->dataNum]->array,
             &context->data[Node]->node);
-}
-*/
+} */
 
 __code createData1(struct Context* context, struct Allocate* allocate, struct LoopCounter* loopCounter) {
     int i = loopCounter->i;
 
-    allocate->size = sizeof(struct Queue);
-    metaAllocator(context);
-    allocate->size = sizeof(struct Integer);
-    allocator(context);
-    goto meta(context, CreateData2);
+    if (i < 4) {
+        allocate->size = sizeof(struct Queue);
+        metaAllocator(context);
+        allocate->size = sizeof(struct Integer);
+        allocator(context);
+        goto meta(context, CreateData2);
+    }
 
     loopCounter->i = 0;
-    goto meta(context, Code1);
+    goto meta(context, CreateTask1);
 }
 
 __code createData1_stub(struct Context* context) {
@@ -128,13 +129,13 @@
 
 __code createData2(struct Context* context, struct LoopCounter* loopCounter, struct Integer* integer, struct Node* node) {
     int i = loopCounter->i;
-
     integer->value = i;
-    integer->mDataOffset = -sizeof(struct Integer);
+    integer->mDataOffset = -sizeof(struct Queue);
     node->key = i;
     node->value = (union Data*)integer;
 
-    context->next = CreateTask1;
+    context->next = CreateData1;
+    loopCounter->i++;
 
     goto meta(context, PutTree);
 }
@@ -142,7 +143,7 @@
 __code createData2_stub(struct Context* context) {
     goto createData2(context,
             &context->data[LoopCounter]->loopCounter,
-            &context->data[context->dataNum]->array,
+            &context->data[context->dataNum]->integer,
             &context->data[Node]->node);
 }
 
@@ -156,12 +157,35 @@
     goto createTask1(context, &context->data[Allocate]->allocate);
 }
 
+/*
+   __code createTask2(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Element* element) {
+   int i = loopCounter->i;
+
+   task->code = Twice;
+   task->key = i;
+
+   element->data = (union Data *)task;
+
+   context->next = CreateData1;
+   loopCounter->i++;
+
+   goto meta(context, SpawnTask);
+   }
+
+   __code createTask2_stub(struct Context* context) {
+   goto createTask2(context,
+   &context->data[LoopCounter]->loopCounter,
+   &context->data[context->dataNum]->task,
+   &context->data[Element]->element);
+   }
+*/
+
+
 __code createTask2(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Element* element, struct Queue* activeQueue) {
     int i = loopCounter->i;
 
-    task->code = Twice;
+    task->code = TaskB;
     task->key = i;
-    task->idsCount = 0;
 
     element->data = (union Data *)task;
 
@@ -175,58 +199,28 @@
     goto createTask2(context,
             &context->data[LoopCounter]->loopCounter,
             &context->data[context->dataNum]->task,
-            &context->data[Element]->element,
-            &context->data[ActiveQueue]->queue);
+            &context->data[Element]->element);
 }
 
-
-/*
-   __code createTask2(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Queue* waitMe, struct OdsQueue* waitI, struct Element* element, struct Queue* activeQueue) {
-   int i = loopCounter->i;
+__code createTask3(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Task* slave, struct Element* element) {
+    int i = loopCounter->i;
 
-   task->code = TaskC;
-   task->key = i;
-   task->waitMe = waitMe;
-   task->waitI = waitI;
-   task->idsCount = 1;
+    task->code = TaskA;
+    task->key = i;
+    element->data = (union Data *)task;
 
-   element->data = (union Data *)task;
-
-   context->next = CreateData1;
-   loopCounter->i++;
-
-   goto meta_createTask2(context, activeQueue, PutQueue1);
-   }
+    context->next = CreateData1;
+    loopCounter->i++;
 
-   __code createTask2_stub(struct Context* context) {
-   goto createTask2(context,
-   &context->data[LoopCounter]->loopCounter,
-   &context->data[context->dataNum]->task,
-   &context->data[context->dataNum-1]->queue,
-   &context->data[context->dataNum-2]->odsQueue,
-   &context->data[Element]->element,
-   &context->data[ActiveQueue]->queue);
-   }
-
-   __code createTask3(struct Context* context, struct LoopCounter* loopCounter, struct Task* task, struct Task* slave, struct Element* element) {
-   int i = loopCounter->i;
+    goto meta(context, WaitFor1);
+}
 
-   task->code = TaskB;
-   task->key = i;
-   element->data = (union Data *)task;
-
-   context->next = CreateData1;
-   loopCounter->i++;
-
-   goto meta(context, WaitFor1);
-   }
-
-   __code createTask3_stub(struct Context* context) {
-   goto createTask2(context,
-   &context->data[context->dataNum]->task,
-   &context->data[Element]->element);
-   }
-   */
+__code createTask3_stub(struct Context* context) {
+    goto createTask3(context,
+            &context->data[LoopCounter]->loopCounter,
+            &context->data[context->dataNum]->task,
+            &context->data[Element]->element);
+}
 
 __code putQueue1(struct Context* context, struct Allocate* allocate) {
     allocate->size = sizeof(struct Element);