# HG changeset patch # User Tatsuki IHA # Date 1509960998 -32400 # Node ID eab6f8cd28205e327d6ab70909af4d3fc87ef1bb # Parent 7679093bdd72e932af26a02f4b2e95d7c8eaf582 Add printArray diff -r 7679093bdd72 -r eab6f8cd2820 src/parallel_execution/CUDAExecutor.cbc --- a/src/parallel_execution/CUDAExecutor.cbc Mon Nov 06 00:11:43 2017 +0900 +++ b/src/parallel_execution/CUDAExecutor.cbc Mon Nov 06 18:36:38 2017 +0900 @@ -41,8 +41,8 @@ if (task->iterate) { struct MultiDimIterator* iterator = &task->iterator->iterator->MultiDimIterator; checkCudaErrors(cuLaunchKernel(task->function, - iterator->x/1024, iterator->y, iterator->z, - 1024, 1, 1, + iterator->x, iterator->y, iterator->z, + 1, 1, 1, 0, NULL, (void**)executor->kernelParams, NULL)); } else { checkCudaErrors(cuLaunchKernel(task->function, diff -r 7679093bdd72 -r eab6f8cd2820 src/parallel_execution/examples/twice/printArray.cbc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parallel_execution/examples/twice/printArray.cbc Mon Nov 06 18:36:38 2017 +0900 @@ -0,0 +1,37 @@ +#include "../../../context.h" +#include + +__code printArray(struct Array* array, struct Time* inputTime, __code next(...)){ + Gearef(context, Time)->time = (union Data*)inputTime; + Gearef(context, Time)->next = C_printArray1; + goto meta(context, inputTime->end); +} + +__code printArray_stub(struct Context* context) { + goto printArray(context, + &context->data[context->idg]->Array, + &context->data[context->idg+1]->Time, + context->next); +} + +__code printArray1(struct Array* array, __code next(...), struct LoopCounter* loopCounter){ + int i = loopCounter->i; + //printf("%d\n", array->array[i]); + if(i < GET_LEN(array->array)) { + if (array->array[i] == i*2) { + loopCounter->i++; + goto meta(context, C_printArray1); + } else { + printf("wrong result\n"); + } + } + loopCounter->i = 0; + goto meta(context, next); +} + +__code printArray1_stub(struct Context* context) { + goto printArray1(context, + &context->data[context->idg]->Array, + context->next, + Gearef(context, LoopCounter)); +}