Mercurial > hg > GearsTemplate
changeset 532:3881b91f5820
Generate multiDimIterator_test stub
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 27 Jan 2018 23:23:38 +0900 |
parents | c31912aaa378 |
children | 8fc069b19574 |
files | src/parallel_execution/examples/bitonicSort/bitonicSort.cbc src/parallel_execution/examples/boundedBuffer/main.cbc src/parallel_execution/examples/calc/calc.cbc src/parallel_execution/examples/twice/main.cbc src/parallel_execution/test/multiDimIterator_test.cbc src/parallel_execution/test/printIterator.cbc |
diffstat | 6 files changed, 14 insertions(+), 71 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/examples/bitonicSort/bitonicSort.cbc Sat Jan 27 23:12:52 2018 +0900 +++ b/src/parallel_execution/examples/bitonicSort/bitonicSort.cbc Sat Jan 27 23:23:38 2018 +0900 @@ -14,11 +14,6 @@ int CPU_ANY = -1; int CPU_CUDA = -1; -void *start_taskManager(struct Context *context) { - goto initDataGears(context, Gearef(context, LoopCounter), Gearef(context, TaskManager)); - return 0; -} - __code initDataGears(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { // loopCounter->tree = createRedBlackTree(context); loopCounter->i = 0; @@ -26,13 +21,6 @@ goto code1(); } -__code initDataGears_stub(struct Context* context) { - struct TaskManager* taskManager = Gearef(context, TaskManager); - taskManager->taskManager = 0; - struct LoopCounter* loopCounter = Gearef(context, LoopCounter); - goto initDataGears(context, loopCounter, taskManager); -} - __code code1(struct LoopCounter* loopCounter) { printf("cpus:\t\t%d\n", cpu_num); printf("gpus:\t\t%d\n", gpu_num);
--- a/src/parallel_execution/examples/boundedBuffer/main.cbc Sat Jan 27 23:12:52 2018 +0900 +++ b/src/parallel_execution/examples/boundedBuffer/main.cbc Sat Jan 27 23:23:38 2018 +0900 @@ -14,11 +14,6 @@ int CPU_ANY = -1; int CPU_CUDA = -1; -void *start_taskManager(struct Context *context) { - goto initDataGears(context, Gearef(context, LoopCounter), Gearef(context, TaskManager)); - return 0; -} - __code initDataGears(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { // loopCounter->tree = createRedBlackTree(context); loopCounter->i = 0; @@ -26,13 +21,6 @@ goto code1(); } -__code initDataGears_stub(struct Context* context) { - struct TaskManager* taskManager = Gearef(context, TaskManager); - taskManager->taskManager = 0; - struct LoopCounter* loopCounter = Gearef(context, LoopCounter); - goto initDataGears(context, loopCounter, taskManager); -} - __code code1(struct Timer* timer) { printf("cpus:\t\t%d\n", cpu_num); printf("gpus:\t\t%d\n", gpu_num);
--- a/src/parallel_execution/examples/calc/calc.cbc Sat Jan 27 23:12:52 2018 +0900 +++ b/src/parallel_execution/examples/calc/calc.cbc Sat Jan 27 23:23:38 2018 +0900 @@ -13,11 +13,6 @@ int CPU_ANY = -1; int CPU_CUDA = -1; -void *start_taskManager(struct Context *context) { - goto initDataGears(context, Gearef(context, LoopCounter), Gearef(context, TaskManager)); - return 0; -} - __code initDataGears(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { // loopCounter->tree = createRedBlackTree(context); loopCounter->i = 0; @@ -25,13 +20,6 @@ goto meta(context, C_code1); } -__code initDataGears_stub(struct Context* context) { - struct TaskManager* taskManager = Gearef(context, TaskManager); - taskManager->taskManager = 0; - struct LoopCounter* loopCounter = Gearef(context, LoopCounter); - goto initDataGears(context, loopCounter, taskManager); -} - __code code1(struct Timer* timer) { printf("cpus:\t\t%d\n", cpu_num); printf("gpus:\t\t%d\n", gpu_num);
--- a/src/parallel_execution/examples/twice/main.cbc Sat Jan 27 23:12:52 2018 +0900 +++ b/src/parallel_execution/examples/twice/main.cbc Sat Jan 27 23:23:38 2018 +0900 @@ -14,11 +14,6 @@ int CPU_ANY = -1; int CPU_CUDA = -1; -void *start_taskManager(struct Context *context) { - goto initDataGears(context, Gearef(context, LoopCounter), Gearef(context, TaskManager)); - return 0; -} - __code initDataGears(struct LoopCounter* loopCounter, struct TaskManager* taskManager) { // loopCounter->tree = createRedBlackTree(context); loopCounter->i = 0; @@ -26,13 +21,6 @@ goto code1(); } -__code initDataGears_stub(struct Context* context) { - struct TaskManager* taskManager = Gearef(context, TaskManager); - taskManager->taskManager = 0; - struct LoopCounter* loopCounter = Gearef(context, LoopCounter); - goto initDataGears(context, loopCounter, taskManager); -} - __code code1(struct LoopCounter* loopCounter) { printf("cpus:\t\t%d\n", cpu_num); printf("gpus:\t\t%d\n", gpu_num);
--- a/src/parallel_execution/test/multiDimIterator_test.cbc Sat Jan 27 23:12:52 2018 +0900 +++ b/src/parallel_execution/test/multiDimIterator_test.cbc Sat Jan 27 23:23:38 2018 +0900 @@ -2,7 +2,7 @@ #include <string.h> #include <stdlib.h> #include <unistd.h> -#interface "Iterator.h" +#interface "TaskManager.h" #include "../../context.h" @@ -16,14 +16,7 @@ // loopCounter->tree = createRedBlackTree(context); loopCounter->i = 0; taskManager->taskManager = (union Data*)createTaskManagerImpl(context, cpu_num, gpu_num, 0); - goto meta(context, C_code1); -} - -__code initDataGears_stub(struct Context* context) { - struct TaskManager* taskManager = Gearef(context, TaskManager); - taskManager->taskManager = 0; - struct LoopCounter* loopCounter = Gearef(context, LoopCounter); - goto initDataGears(context, loopCounter, taskManager); + goto code1(); } __code code1(struct LoopCounter* loopCounter) { @@ -44,12 +37,20 @@ if (i < length) { loopCounter->i++; - goto meta(context, C_createTask2); + goto createTask2(); } loopCounter->i = 0; taskManager->next = C_exit_code; - goto meta(context, taskManager->taskManager->TaskManager.shutdown); + goto code2(); +} + +__code code2(struct TaskManager* taskManager) { + goto taskManager->shutdown(exit_code); +} + +__code code2_stub(struct Context* context) { + goto code2(context, &Gearef(context, TaskManager)->taskManager->TaskManager); } __code createTask2(struct TaskManager* taskManager) { @@ -73,9 +74,5 @@ } int main(int argc, char** argv) { - init(argc, argv); - struct Context* main_context = NEW(struct Context); - initContext(main_context); - main_context->next = C_initDataGears; - goto start_code(main_context); + goto initDataGears(); }
--- a/src/parallel_execution/test/printIterator.cbc Sat Jan 27 23:12:52 2018 +0900 +++ b/src/parallel_execution/test/printIterator.cbc Sat Jan 27 23:23:38 2018 +0900 @@ -2,11 +2,5 @@ #include <stdio.h> __code printIterator(struct MultiDim* multiDim, __code next(...)) { printf("x: %d, y: %d, z: %d\n", multiDim->x, multiDim->y, multiDim->z); - goto meta(context, next); + goto next(...); } - -__code printIterator_stub(struct Context* context) { - goto printIterator(context, - &context->data[context->idg]->MultiDim, - context->next); -}