changeset 1491:fd09cdf2f531 draft

select CPU_TYPE
author Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp>
date Wed, 08 Aug 2012 13:45:00 +0900
parents 5517f93e2706
children 73f4bfaeaf99
files TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/test/GpuRunTest/GpuRunTest.cc example/basic/main.cc
diffstat 3 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc	Tue Aug 07 14:04:49 2012 +0900
+++ b/TaskManager/Cell/CellTaskManagerImpl.cc	Wed Aug 08 13:45:00 2012 +0900
@@ -98,14 +98,19 @@
 			if (htask->cpu_type == SPE_ANY) {
 				speid = cur_anySpeid++;
 			} else {
+#ifdef __CERIUM_GPU__
+                speid = htask->cpu_type;
+#else
 				// -1 してるのは
 				// htask->cpu_type - CPU_SPE で
 				// SPE0 = 1, SPE1 = 2, ... SPE5 = 6 ってなってるので
 				// 配列的 (SPE0 = arr[0], SPE1 = arr[1]) にするため
 				speid = htask->cpu_type - CPU_SPE - 1;
+#endif
 			}
-
+#ifndef __CERIUM_GPU__
 			speid %= machineNum;
+#endif
 			set_taskList(htask, taskListInfo[speid]);
 
 			HTaskPtr next = activeTaskQueue->getNext(htask);
--- a/TaskManager/test/GpuRunTest/GpuRunTest.cc	Tue Aug 07 14:04:49 2012 +0900
+++ b/TaskManager/test/GpuRunTest/GpuRunTest.cc	Wed Aug 08 13:45:00 2012 +0900
@@ -1,8 +1,8 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <sys/stat.h>
+#include "types.h"
 #include "TaskManager.h"
-#include "GpuThreads.h"
 #include "GpuFunc.h"
 
 #define DEFAULT 5
@@ -43,20 +43,20 @@
     
     int *indata  = new int[length];
     int *outdata = new int[length];
-    int count;
-    for (count=0; count < length ;count++) {
-        indata[count] = count;
+    
+    for (int c=0; c < length ;c++) {
+        indata[c] = c;
     }
 
-    print_data(indata, count, "before");
+    print_data(indata, length, "before");
     
-    HTaskPtr schedtask = manager->create_task(Twice);
+    HTaskPtr twice = manager->create_task(Twice);
 
-    schedtask->set_param(0, length);
-    schedtask->set_inData(0, indata, sizeof (int)*length);
-    schedtask->set_outData(0, outdata, sizeof (int)*length);
-    schedtask->set_cpu(GPU_0);
-    schedtask->spawn();
+    twice->set_param(0, (memaddr)length);
+    twice->set_inData(0, indata, sizeof (int)*length);
+    twice->set_outData(0, outdata, sizeof (int)*length);
+    twice->set_cpu(GPU_0);
+    twice->spawn();
     
 }
     
--- a/example/basic/main.cc	Tue Aug 07 14:04:49 2012 +0900
+++ b/example/basic/main.cc	Wed Aug 08 13:45:00 2012 +0900
@@ -67,7 +67,7 @@
      *   create_task(Task ID);
      */ 
     twice = manager->create_task(TWICE_TASK);
-    twice->set_cpu(SPE_ANY);
+    twice->set_cpu(GPU_0);
     
     /**
      * Set of Input Data