changeset 1727:e99dc86d39e2 draft

minor fix
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Wed, 30 Oct 2013 19:05:38 +0900
parents 9e4d2827d804
children 0ae49bff30e9
files TaskManager/kernel/schedule/Scheduler.cc TaskManager/test/SetCpuTest/Makefile.def TaskManager/test/SetCpuTest/gpu/task_init.cc TaskManager/test/SetCpuTest/gpu/task_init.o TaskManager/test/SetCpuTest/main.cc example/fft/gpu/gpu_task_init.cc example/fft/main.cc example/fft/output.pgm example/fft/task_init.cc example/word_count/main.cc
diffstat 10 files changed, 26 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/kernel/schedule/Scheduler.cc	Wed Oct 30 18:34:52 2013 +0900
+++ b/TaskManager/kernel/schedule/Scheduler.cc	Wed Oct 30 19:05:38 2013 +0900
@@ -184,7 +184,7 @@
     if (table) {
         MemorySegment* here = (MemorySegment*)(
                                                manager->allocate(sizeof(MemorySegment)));
-        here->data = &table->vma;
+        here->data = &(table->vma);
         here->size = size;
         here->address = (memaddr)here;
         code_segment_pool->addLast(here);
--- a/TaskManager/test/SetCpuTest/Makefile.def	Wed Oct 30 18:34:52 2013 +0900
+++ b/TaskManager/test/SetCpuTest/Makefile.def	Wed Oct 30 19:05:38 2013 +0900
@@ -11,5 +11,5 @@
 OPT = -g
 CFLAGS  = $(OPT) -Wall 
 
-INCLUDE = -I${CERIUM}/include/TaskManager -I. -I..
+INCLUDE =  -I. -I.. -I${CERIUM}/include/TaskManager
 LIBS = -L${CERIUM}/TaskManager
--- a/TaskManager/test/SetCpuTest/gpu/task_init.cc	Wed Oct 30 18:34:52 2013 +0900
+++ b/TaskManager/test/SetCpuTest/gpu/task_init.cc	Wed Oct 30 19:05:38 2013 +0900
@@ -1,4 +1,4 @@
-#include "GpuFunc.h"
+#include "Func.h"
 #include "GpuScheduler.h"
 
 SchedExternTask(Twice);
@@ -6,10 +6,10 @@
 void
 gpu_task_init(void)
 {
-    GpuSchedRegister(Twice, "gpu/twice.cl", "twice");
+    GpuSchedRegister(TWICE_TASK, "gpu/twice.cl", "twice");
 }
 
 void task_init(void)
 {
-  SchedRegister(Twice);
+    SchedRegisterTask(TWICE_TASK,Twice);
 }
Binary file TaskManager/test/SetCpuTest/gpu/task_init.o has changed
--- a/TaskManager/test/SetCpuTest/main.cc	Wed Oct 30 18:34:52 2013 +0900
+++ b/TaskManager/test/SetCpuTest/main.cc	Wed Oct 30 19:05:38 2013 +0900
@@ -10,7 +10,7 @@
 #define DEFAULT 5
 static long int length = DEFAULT;
 static int task = 1;
-static CPU_TYPE cputype = SPE_ANY;
+static CPU_TYPE cputype = GPU_ANY;
 
 extern void gpu_task_init(void);
 extern void task_init(void);
@@ -57,7 +57,7 @@
 
 void
 tester(int *indata, int *outdata, int num) {
-
+    
     //チェック
     int check = 0;
     for (int c=0; c<num; c++) {
@@ -83,7 +83,7 @@
 
     print_data(indata, length, "before");
 
-    HTaskPtr twice = manager->create_task(twice);
+    HTask* twice = manager->create_task(TWICE_TASK);
     twice->set_param(0, (memaddr)length);
     twice->set_inData(0, indata, sizeof (int)*length);
     //int *n = new int[1];
@@ -106,10 +106,8 @@
     if (init(argc, argv) < 0) {
         return -1;
     }
-
+    //    task_init();
     gpu_task_init();
-    task_init();
-
     for (int i = 0; i < task; ++i) {
         test(manager);
     }
--- a/example/fft/gpu/gpu_task_init.cc	Wed Oct 30 18:34:52 2013 +0900
+++ b/example/fft/gpu/gpu_task_init.cc	Wed Oct 30 19:05:38 2013 +0900
@@ -1,4 +1,5 @@
 #include "Func.h"
+#include "Scheduler.h"
 #include "GpuScheduler.h"
 
 void
--- a/example/fft/main.cc	Wed Oct 30 18:34:52 2013 +0900
+++ b/example/fft/main.cc	Wed Oct 30 19:05:38 2013 +0900
@@ -5,7 +5,7 @@
 #include <fcntl.h>
 #include <sys/time.h>
 #include "TaskManager.h"
-//#include "GpuScheduler.h"
+#include "GpuScheduler.h"
 #include "SchedTask.h"
 #include "Func.h"
 #ifdef __APPLE__
@@ -15,7 +15,7 @@
 #endif
 #include "pgm.h"
 extern void task_init();
-//extern void gpu_task_init();
+extern void gpu_task_init();
 
 #define PI 3.14159265358979
 
@@ -278,7 +278,7 @@
 
 int TMmain(TaskManager *manager, int argc, char** argv) {
     task_init();
-    //    gpu_task_init();
+    gpu_task_init();
     char * pgm_file = init(argc,argv);
     /* Read image */
     int err = readPGM(&ipgm, pgm_file);
Binary file example/fft/output.pgm has changed
--- a/example/fft/task_init.cc	Wed Oct 30 18:34:52 2013 +0900
+++ b/example/fft/task_init.cc	Wed Oct 30 19:05:38 2013 +0900
@@ -2,31 +2,31 @@
 #include "Scheduler.h"
 #include "GpuScheduler.h"
 
-#ifndef __CERIUM_GPU__
 SchedExternTask(spinFact);
 SchedExternTask(bitReverse);
 SchedExternTask(norm);
 SchedExternTask(butterfly);
 SchedExternTask(transpose);
 SchedExternTask(highPassFilter);
-#endif // not __CERIUM_GPU__
 
 void
 task_init(void)
 {
-#ifdef __CERIUM_GPU__
-    GpuSchedRegister(SPIN_FACT, "gpu/fft.cl", "spinFact");
-    GpuSchedRegister(BIT_REVERSE, "gpu/fft.cl", "bitReverse");
-    GpuSchedRegister(NORMALIZATION, "gpu/fft.cl", "norm");
-    GpuSchedRegister(BUTTERFLY, "gpu/fft.cl", "butterfly");
-    GpuSchedRegister(TRANSPOSE, "gpu/fft.cl", "transpose");
-    GpuSchedRegister(HIGH_PASS_FILTER, "gpu/fft.cl", "highPassFilter");
-#else
     SchedRegisterTask(SPIN_FACT,spinFact);
     SchedRegisterTask(NORMALIZATION, norm);
     SchedRegisterTask(BIT_REVERSE, bitReverse);
     SchedRegisterTask(BUTTERFLY, butterfly);
     SchedRegisterTask(TRANSPOSE, transpose);
     SchedRegisterTask(HIGH_PASS_FILTER, highPassFilter);
-#endif
 }
+
+void
+gpu_task_init()
+{
+        GpuSchedRegister(SPIN_FACT, "gpu/spinFact.cl", "spinFact");
+    GpuSchedRegister(BIT_REVERSE, "gpu/bitReverse.cl", "bitReverse");
+    GpuSchedRegister(NORMALIZATION, "gpu/norm.cl", "norm");
+    GpuSchedRegister(BUTTERFLY, "gpu/butterfly.cl", "butterfly");
+    GpuSchedRegister(TRANSPOSE, "gpu/transpose.cl", "transpose");
+    GpuSchedRegister(HIGH_PASS_FILTER, "gpu/highPassFilter.cl", "highPassFilter");
+}
--- a/example/word_count/main.cc	Wed Oct 30 18:34:52 2013 +0900
+++ b/example/word_count/main.cc	Wed Oct 30 19:05:38 2013 +0900
@@ -119,7 +119,7 @@
             if (size==0) break;
             if (use_task_array) {
                 t_exec = task_array->next_task_array(TASK_EXEC,t_exec);
-                t_exec->set_param(0,(memaddr)length);
+                t_exec->set_param(0,&length);
                 t_exec->set_inData(0,w->file_mmap + i*w->division_size, size);
                 t_exec->set_outData(0,w->o_data + i*w->out_size, w->division_out_size);
             } else if (use_compat) {
@@ -135,7 +135,7 @@
                 h_exec = manager->create_task(TASK_EXEC,
                                               (memaddr)(w->file_mmap + i*w->division_size), size,
                                               (memaddr)(w->o_data + i*w->out_size), w->division_out_size);
-                h_exec->set_param(0,(memaddr)length);
+                h_exec->set_param(0,&length);
                 t_next->wait_for(h_exec);
                 h_exec->set_cpu(SPE_ANY);
                 h_exec->spawn();