Mercurial > hg > Members > Moririn
view src/parallel_execution/CUDAtwice.cbc @ 319:a15511b1a6e0
separate cuda.c, and USE_CUDA_MAIN_THREAD flag
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 15 Feb 2017 20:43:55 +0900 |
parents | 054c47e6ca20 |
children | a9a6d571fa80 |
line wrap: on
line source
#include <stdio.h> #include "../context.h" extern void CUDAExec(struct Context* context, Array* array, LoopCounter *loopCounter) ; __code CUDAtwice(struct Context* context, struct LoopCounter* loopCounter, int index, int prefix, int* array, struct Context* workerContext) { int i = loopCounter->i; if (i < prefix) { array[i+index*prefix] = array[i+index*prefix]*2; loopCounter->i++; goto meta(context, C_twice); } loopCounter->i = 0; goto meta(workerContext, workerContext->next); } __code CUDAtwice_stub(struct Context* context) { printf("CUdAtwice stub\n"); struct LoopCounter* loopCounter = &context->data[context->dataNum]->LoopCounter; struct Array* array = &context->data[context->dataNum+1]->Array; CUDAExec(context,array,loopCounter); //continuationにそってGPUworkerに戻る goto meta(context, context->next); }