view src/parallel_execution/examples/twice/twice.cbc @ 406:9b35e6581b5c

Use task member of context by par goto meta Use task member of context for par goto meta ate_stub.pl
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Wed, 06 Sep 2017 15:11:27 +0900
parents 8915fce522b3
children 8ee89eefbc6d
line wrap: on
line source

#include <stdio.h>

#include "../context.h"

__code twice(struct Array* array, struct Dim* dim, __code next(...), struct LoopCounter loopCounter) {
    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(context, context->next);
}

__code twice_stub(struct Context* context) {
    struct LoopCounter* loopCounter = &context->data[context->dataNum]->LoopCounter;
    goto twice(context,
               &context->data[context->idgCount]->Array,
               loopCounter);
}