# HG changeset patch # User Tatsuki IHA # Date 1504702462 -32400 # Node ID 8ee89eefbc6d164375d04b6afc7b519762f1f73d # Parent 00d9b0664bdb1eccc93ffbf2a681fb25c9cd4fb2 Fix twice diff -r 00d9b0664bdb -r 8ee89eefbc6d src/parallel_execution/CMakeLists.txt --- 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( diff -r 00d9b0664bdb -r 8ee89eefbc6d src/parallel_execution/examples/twice/twice.cbc --- 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 -#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)); }