Mercurial > hg > Gears > GearsAgda
comparison src/parallel_execution/CPUWorker.cbc @ 411:0eba9a04633f
Work CUDAtwice
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 14 Sep 2017 18:26:52 +0900 |
parents | 85b0ddbf458e |
children | 55db2a339958 |
comparison
equal
deleted
inserted
replaced
410:85b0ddbf458e | 411:0eba9a04633f |
---|---|
8 worker->worker = (union Data*)cpuWorker; | 8 worker->worker = (union Data*)cpuWorker; |
9 worker->tasks = queue; | 9 worker->tasks = queue; |
10 cpuWorker->id = id; | 10 cpuWorker->id = id; |
11 worker->taskReceive = C_taskReceiveWorker; | 11 worker->taskReceive = C_taskReceiveWorker; |
12 worker->shutdown = C_shutdownWorker; | 12 worker->shutdown = C_shutdownWorker; |
13 pthread_create(&worker->worker->CPUWorker.thread, NULL, (void*)&startWorker, worker); | 13 pthread_create(&worker->thread, NULL, (void*)&startWorker, worker); |
14 return worker; | 14 return worker; |
15 } | 15 } |
16 | 16 |
17 static void startWorker(Worker* worker) { | 17 static void startWorker(Worker* worker) { |
18 CPUWorker* cpuWorker = (CPUWorker*)worker->worker; | 18 CPUWorker* cpuWorker = (CPUWorker*)worker->worker; |
32 goto taskReceiveWorker(context, &Gearef(context, Worker)->worker->Worker, Gearef(context, Queue)); | 32 goto taskReceiveWorker(context, &Gearef(context, Worker)->worker->Worker, Gearef(context, Queue)); |
33 } | 33 } |
34 | 34 |
35 __code getTask(struct Worker* worker, struct Context* task) { | 35 __code getTask(struct Worker* worker, struct Context* task) { |
36 if (!task) | 36 if (!task) |
37 return; // end thread | 37 goto meta(context, worker->shutdown); // end thread |
38 task->worker = worker; | 38 task->worker = worker; |
39 enum Code taskCg = task->next; | 39 enum Code taskCg = task->next; |
40 if (task->iterate) { | 40 if (task->iterate) { |
41 task->next = C_iterateCommit; | 41 task->next = C_iterateCommit; |
42 } else { | 42 } else { |