diff TaskManager/Gpu/GpuScheduler.cc @ 1829:45d4ed567cd7 draft

fix GpuScheduler
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Tue, 17 Dec 2013 16:42:35 +0900
parents d3a9772074d6
children 812b14ffe5dc
line wrap: on
line diff
--- a/TaskManager/Gpu/GpuScheduler.cc	Tue Dec 17 14:07:40 2013 +0900
+++ b/TaskManager/Gpu/GpuScheduler.cc	Tue Dec 17 16:42:35 2013 +0900
@@ -101,11 +101,11 @@
  * kernel_event, memout_event
  */
 void
-GpuScheduler::wait_for_event(cl_event* kernel_event, GpuBufferPtr memout, memaddr* reply, TaskListPtr taskList, int cur) {
+GpuScheduler::wait_for_event(cl_event* kernel_event, GpuBufferPtr memout, memaddr reply, TaskListPtr taskList, int cur) {
     if (kernel_event[1-cur] == NOP_REPLY) {
-        if(reply[1-cur]) {
-            connector->mail_write(reply[1-cur]);
-            reply[1-cur]=0;
+        if(reply) {
+            connector->mail_write(reply);
+            reply=0;
         }
     } else if (kernel_event[1-cur] != NULL) {
         int ret=clWaitForEvents(1,&kernel_event[1-cur]);
@@ -161,7 +161,7 @@
     kernel[cur] = 0;
     memout[cur].buf = 0;
     memin[cur].buf = 0;
-    reply[cur] = (memaddr)tasklist->waiter;
+    reply = (memaddr)tasklist->waiter;
 
     // wait kernel[1-cur] and write[1-cur]
     wait_for_event(kernel_event, memout, reply, tasklist, cur);
@@ -214,8 +214,8 @@
                 flag = tasklist->self->flag;
             }
             TaskPtr nextTask = NULL;
-            nextTask[cur] = tasklist->tasks;
-            while (nextTask < taskList->last()) {
+            nextTask = tasklist->tasks;
+            while (nextTask < tasklist->last()) {
                 if(nextTask->command==ShowTime) {
                     connector->show_profile();
                     gpuTaskError(cur,tasklist,ret);
@@ -369,7 +369,7 @@
                 cur = 1 - cur;
                 nextTask = nextTask->next();
             }
-            printf("GPU %d %s\t%lld\n",tasklist[cur]->self->cpu_type,(char*)(gpu_task_list[tasklist[cur]->tasks[0].command].name),tasklist[cur]->task_end_time-tasklist[cur]->task_start_time);
+            printf("GPU %d %s\t%lld\n",tasklist->self->cpu_type,(char*)(gpu_task_list[tasklist->tasks[0].command].name),tasklist->task_end_time-tasklist->task_start_time);
             reply = (memaddr)tasklist->waiter;
             if(reply) {
                 connector->mail_write(reply);