view src/parallel_execution/worker.c @ 217:c34e6aa10967

Fix DataGear access name
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Mon, 09 Jan 2017 01:18:13 +0900
parents 39d87ba6039d
children 77faa28128b4
line wrap: on
line source

#include <libkern/OSAtomic.h>

#include "context.h"
#include "origin_cs.h"

union Data* createWorker(struct Context* context) {
    struct Worker* worker = &ALLOCATE(context, Worker)->Worker;
    // worker->execute = C_executeWorker;
    // worker->taskSend = C_taskSendWorker;
    // worker->taskRecive = C_taskReciveWorker;
    // worker->shutdown = C_shutdownWorker;
    return (union Data*)(worker);
}

__code getTask1(struct Context* context, struct Queue* queue) {
    queue->next = C_getTask2;
    goto meta(context, queue->take);
}

__code getTask1_stub(struct Context* context) {
    goto getTask1(context,/* &context->data[D_ActiveQueue]->Queue*/ NULL);
}

__code getTask2(struct Context* context, struct Task* task, struct Node* node) {
    context->next = C_getTask1;
    goto meta(context, C_getTask2);
}

__code getTask2_stub(struct Context* context) {
    goto getTask2(context, /*&(context->data[D_ActiveQueue]->Queue.data->Task)*/ NULL, &context->data[D_Node]->Node);
}

#ifdef USE_CUDA
__code twiceGpu(struct Context* context) {
    cuMemcpyHtoDAsync(context,context,context,context->stream);
    cuLaunchkanel();
    cuMemcpyDtoHAsync();
}
#endif