diff TaskManager/Gpu/GpuThreads.cc @ 1447:e8ff87511f46 draft

debug GpuThreads
author Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
date Mon, 23 Apr 2012 22:53:59 +0900
parents dff9b3f388e2
children e7be2c3f2c5c
line wrap: on
line diff
--- a/TaskManager/Gpu/GpuThreads.cc	Mon Apr 23 22:01:51 2012 +0900
+++ b/TaskManager/Gpu/GpuThreads.cc	Mon Apr 23 22:53:59 2012 +0900
@@ -1,6 +1,7 @@
 #include "GpuThreads.h"
 #include "GpuScheduler.h"
 #include "TaskManagerImpl.h"
+#include "GpuTaskManagerImpl.h"
 
 GpuThreads::GpuThreads()
 {
@@ -20,8 +21,8 @@
 void
 GpuThreads::init()
 {
-    clGetPlatformIDs(1, &platfrom_id, &ret_num_platforms); 
-    clGetDeviceIds(platform_id, CL_DEVICE_TYPE_GPU, 1, &device_id, &ret_num_devices);
+    clGetPlatformIDs(1, &platform_id, &ret_num_platforms); 
+    clGetDeviceIDs(platform_id, CL_DEVICE_TYPE_GPU, 1, &device_id, &ret_num_devices);
     // unavailable GPU
     if( ret_num_devices == 0) {
         exit(EXIT_FAILURE);
@@ -29,10 +30,10 @@
     context = clCreateContext(NULL, 1, &device_id, NULL, NULL, &ret);
     command_queue = clCreateCommandQueue(context, device_id, 0, &ret);
 
-    args.scheduler = new GpuScheduler();
-    args.useRefDma = use_refdma;
+    args->scheduler = new GpuScheduler();
+    args->useRefDma = use_refdma;
 
-    pthread_create(&threads, NULL, &cpu_thread_run, (void*)&args);
+    pthread_create(threads, NULL, &gpu_thread_run, args);
 
 }
 
@@ -50,20 +51,20 @@
     g_scheduler->run();
     g_scheduler->finish();
 
-    return NULL
+    return NULL;
 }
 
 int
 GpuThreads::get_mail(int speid, int count, memaddr *ret)
 {
-    *ret = args.scheduler->mail_read_from_host();
+    *ret = args->scheduler->mail_read_from_host();
     return 1;
 }
 
 int
 GpuThreads::has_mail(int speid, int count, memaddr *ret)
 {
-    if (args.scheduler->has_mail_from_host() != 0) {
+    if (args->scheduler->has_mail_from_host() != 0) {
         return get_mail(0, 0, ret);
     } else {
         return 0;
@@ -73,7 +74,7 @@
 void
 CpuThreads::send_mail(int speid, int num, memaddr *data)
 {
-    args.scheduler->mail_write_from_host(*data);
+    args->scheduler->mail_write_from_host(*data);
 }
 
 void