changeset 408:8ee89eefbc6d

Fix twice
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Wed, 06 Sep 2017 21:54:22 +0900
parents 00d9b0664bdb
children 4d1e3697a6b8
files src/parallel_execution/CMakeLists.txt src/parallel_execution/examples/twice/twice.cbc
diffstat 2 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/CMakeLists.txt	Wed Sep 06 20:40:43 2017 +0900
+++ b/src/parallel_execution/CMakeLists.txt	Wed Sep 06 21:54:22 2017 +0900
@@ -59,7 +59,7 @@
   TARGET
       twice
   SOURCES
-      examples/twice/twice.cbc CPUWorker.cbc twice.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc TimeImpl.cbc
+  examples/twice/main.cbc examples/twice/createArray.cbc examples/twice/twice.cbc CPUWorker.cbc TaskManagerImpl.cbc SingleLinkedQueue.cbc SynchronizedQueue.cbc TimeImpl.cbc MultiDimIterator.cbc
 )
 
 GearsCommand(
--- a/src/parallel_execution/examples/twice/twice.cbc	Wed Sep 06 20:40:43 2017 +0900
+++ b/src/parallel_execution/examples/twice/twice.cbc	Wed Sep 06 21:54:22 2017 +0900
@@ -1,11 +1,12 @@
 #include <stdio.h>
 
-#include "../context.h"
+#include "../../../context.h"
 
-__code twice(struct Array* array, struct Dim* dim, __code next(...), struct LoopCounter loopCounter) {
+__code twice(struct Array* array, struct MultiDim* multiDim, __code next(...), struct LoopCounter* loopCounter) {
     int i = loopCounter->i;
-    if (i < prefix) {
-        array[i+index*prefix] = array[i+index*prefix]*2;
+    int index = multiDim->x;
+    if (i < array->prefix) {
+        array->array[i+index*array->prefix] = array->array[i+index*array->prefix]*2;
         loopCounter->i++;
 
         goto meta(context, C_twice);
@@ -16,8 +17,9 @@
 }
 
 __code twice_stub(struct Context* context) {
-    struct LoopCounter* loopCounter = &context->data[context->dataNum]->LoopCounter;
     goto twice(context,
-               &context->data[context->idgCount]->Array,
-               loopCounter);
+               &context->data[context->idg]->Array,
+               &context->data[context->idg+1]->MultiDim,
+               context->next,
+               Gearef(context, LoopCounter));
 }