view src/parallel_execution/CUDAtwice.cbc @ 321:a9a6d571fa80

Update todo
author innparusu
date Wed, 01 Mar 2017 18:28:49 +0900
parents a15511b1a6e0
children
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);
}