changeset 1926:777bdbf6c072 draft

fix CudaScheduler
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Fri, 31 Jan 2014 06:08:13 +0900
parents cd5bbd8ec5d6
children 4eefec26e3e2
files TaskManager/kernel/ppe/CpuThreads.cc TaskManager/kernel/ppe/CpuThreads.h
diffstat 2 files changed, 36 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/kernel/ppe/CpuThreads.cc	Fri Jan 31 05:56:23 2014 +0900
+++ b/TaskManager/kernel/ppe/CpuThreads.cc	Fri Jan 31 06:08:13 2014 +0900
@@ -4,6 +4,9 @@
 #ifdef __CERIUM_GPU__
 #include "GpuThreads.h"
 #endif
+#ifdef __CERIUM_CUDA__
+#include "CudaThreads.h"
+#endif
 #include "MainScheduler.h"
 #include "SysFunc.h"
 #include "SchedNop.h"
@@ -22,6 +25,10 @@
 #ifdef __CERIUM_GPU__
     gpu = new GpuThreads(useRefDma);
 #endif
+#ifdef __CERIUM_CUDA__
+    gpu = new CudaThreads(useRefDma);
+#endif
+
     threads = new pthread_t[cpu_num+io_num];
     args    = new cpu_thread_arg_t[cpu_num+io_num+id_offset];
     wait    = new Sem(0);
@@ -49,6 +56,9 @@
 #ifdef __CERIUM_GPU__
     delete gpu;
 #endif
+#ifdef __CERIUM_CUDA__
+    delete gpu;
+#endif
 }
 
 void *
@@ -91,7 +101,11 @@
     gpu->init();
     wait->sem_p();
 #endif
-
+#ifdef __CERIUM_CUDA__
+    gpu->set_wait(wait);
+    gpu->init();
+    wait->sem_p();
+#endif
     for (int i = 0; i < cpu_num+io_num; i++) {
         args[i].cpuid = i + id_offset;
         args[i].scheduler = new MainScheduler();
@@ -119,7 +133,9 @@
 #ifdef __CERIUM_GPU__
     gpu->set_mail_waiter(w);
 #endif
-
+#ifdef __CERIUM_CUDA__
+    gpu->set_mail_waiter(w);
+#endif
 }
 
 int
@@ -149,6 +165,9 @@
 #ifdef __CERIUM_GPU__
     if (is_gpu(cpuid)) return gpu->get_mail(cpuid, count, ret);
 #endif
+#ifdef __CERIUM_CUDA__
+    if (is_gpu(cpuid)) return gpu->get_mail(cpuid, count, ret);
+#endif
     *ret = args[cpuid-id_offset].scheduler->mail_read_from_host();
     return 1;
 }
@@ -159,6 +178,9 @@
 #ifdef __CERIUM_GPU__
     if (is_gpu(cpuid)) return gpu->has_mail(cpuid, count, ret);
 #endif
+#ifdef __CERIUM_CUDA__
+    if (is_gpu(cpuid)) return gpu->has_mail(cpuid, count, ret);
+#endif
     if (args[cpuid-id_offset].scheduler->has_mail_from_host() != 0) {
         return get_mail(cpuid,count,ret);
     } else {
@@ -189,6 +211,12 @@
         return;
     }
 #endif
+#ifdef __CERIUM_CUDA__
+    if (is_gpu(cpuid)){
+        gpu->send_mail(cpuid, num, data);
+        return;
+    }
+#endif
     args[cpuid-id_offset].scheduler->mail_write_from_host(*data);
 }
 
--- a/TaskManager/kernel/ppe/CpuThreads.h	Fri Jan 31 05:56:23 2014 +0900
+++ b/TaskManager/kernel/ppe/CpuThreads.h	Fri Jan 31 06:08:13 2014 +0900
@@ -4,6 +4,9 @@
 #include <pthread.h>
 #include "Threads.h"
 #include "GpuThreads.h"
+#ifdef __CERIUM_CUDA__
+#include "CudaThreads.h"
+#endif
 #include "TaskManagerImpl.h"
 #include "MainScheduler.h"
 #include "Sem.h"
@@ -50,6 +53,9 @@
 #ifdef __CERIUM_GPU__
     GpuThreads *gpu;
 #endif
+#ifdef __CERIUM_CUDA__
+    CudaThreads *gpu;
+#endif    
 };
 
 #endif