Mercurial > hg > GearsTemplate
changeset 310:782f4c560de4
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 14 Feb 2017 22:02:39 +0900 |
parents | 8c2123bb577b |
children | 6fcbbe644b92 |
files | src/parallel_execution/CUDAtwice.cbc |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/CUDAtwice.cbc Tue Feb 14 21:55:11 2017 +0900 +++ b/src/parallel_execution/CUDAtwice.cbc Tue Feb 14 22:02:39 2017 +0900 @@ -6,7 +6,7 @@ #include <cuda_runtime.h> #include "helper_cuda.h" -__code twice(struct Context* context, struct LoopCounter* loopCounter, int index, int prefix, int* array, struct Context* workerContext) { +__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; @@ -19,10 +19,7 @@ goto meta(workerContext, workerContext->next); } -__code twice_stub(struct Context* context) { - // struct LoopCounter* loopCounter = &context->data[context->dataNum]->LoopCounter; - struct Array* array = &context->data[context->dataNum+1]->Array; - +static void CUDAExec(struct Context* context, struct Array* array) { // Worker *worker = context->worker; // CUDAWorker* cudaWorker = (CUDAWorker*)worker->worker; // memory allocate @@ -50,6 +47,12 @@ //コマンドの終了待ちを行う checkCudaErrors(cuMemcpyDtoH(array->array, devA, array->size)); // wait for stream +} + +__code CUDAtwice_stub(struct Context* context) { + // struct LoopCounter* loopCounter = &context->data[context->dataNum]->LoopCounter; + struct Array* array = &context->data[context->dataNum+1]->Array; + CUDAExec(context,array); //continuationにそってGPUworkerに戻る goto meta(context, context->next);