changeset 1779:0dd39c19dbb2 draft

minor change
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Tue, 26 Nov 2013 15:48:05 +0900
parents 0e6ca13d2ed0
children 17c4dc3573b9
files TaskManager/Gpu/GpuScheduler.cc TaskManager/test/UtilizationTest/multiply example/fft/main.cc example/fft/ppe/task_init.cc example/many_task/Makefile.macosx example/many_task/main.cc example/many_task/ppe/task_init.cc
diffstat 7 files changed, 32 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Gpu/GpuScheduler.cc	Tue Nov 26 01:50:31 2013 +0900
+++ b/TaskManager/Gpu/GpuScheduler.cc	Tue Nov 26 15:48:05 2013 +0900
@@ -62,7 +62,7 @@
     clReleaseContext(context);
 }
 
-#define NOP_REPLY 1
+#define NOP_REPLY NULL
 
 void
 GpuScheduler::wait_for_event(cl_event* event,memaddr* reply,int cur) {
@@ -116,12 +116,12 @@
             clFinish(command_queue);
             if (kernel[0]) clReleaseKernel(kernel[0]);
             if (kernel[1]) clReleaseKernel(kernel[1]);
-            if (event[0] && event[0]!=NOP_REPY) clReleaseEvent(event[0]);
-            if (event[1] && event[1]!=NOP_REPY) clReleaseEvent(event[1]);
-            if ( memout[cur-1] )  clReleaseMemObject(memout[cur-1]);
-            if ( memout[cur] )  clReleaseMemObject(memout[cur]);
-            if ( memin[cur-1] )  clReleaseMemObject(memin[cur-1]);
-            if ( memin[cur] )  clReleaseMemObject(memin[cur]);
+            if (event[0] && event[0]!=NOP_REPLY) clReleaseEvent(event[0]);
+            if (event[1] && event[1]!=NOP_REPLY) clReleaseEvent(event[1]);
+            if ( memout[cur-1] )  clReleaseMemObject(*memout[cur-1]);
+            if ( memout[cur] )  clReleaseMemObject(*memout[cur]);
+            if ( *memin[cur-1] )  clReleaseMemObject(*memin[cur-1]);
+            if ( *memin[cur] )  clReleaseMemObject(*memin[cur]);
             return ;
         }
 
@@ -142,11 +142,11 @@
             for (TaskPtr nextTask = tasklist[cur]->tasks;nextTask < tasklist[cur]->last(); nextTask = nextTask->next()) {
                 if(nextTask->command==ShowTime) {
                     connector->show_profile();
-                        goto nop_repy;
+                        goto nop_reply;
                 }
                 if(nextTask->command==StartProfile) {
                     connector->start_profile();
-                        goto nop_repy;
+                        goto nop_reply;
                 }
                 if (load_kernel(nextTask->command) == 0) {
                     goto nop_skip;
@@ -160,7 +160,7 @@
                 if (ret<0) {
                     const char *msg=convert_error_status(ret);
                     error(msg);
-                        goto nop_repy;
+                        goto nop_reply;
                 }
 
                 int param = 0;
@@ -179,20 +179,20 @@
                 if (ret<0) {
                     const char *msg=convert_error_status(ret);
                     error(msg);
-                        goto nop_repy;
+                        goto nop_reply;
                 }
 
                 ret = clSetKernelArg(kernel[cur], param, sizeof(memaddr),(void *)&memparam);
                 if (ret<0) {
                     const char *msg=convert_error_status(ret);
                     error(msg);
-                        goto nop_repy;
+                        goto nop_reply;
                 }
 
                 param++;
 
                 cl_mem_flags mem_flag = CL_MEM_READ_ONLY;
-                if ( memout[cur] )  clReleaseMemObject(memout[cur]);
+                if ( memout[cur] )  clReleaseMemObject(*memout[cur]);
                 memin[cur] = new cl_mem[nextTask->inData_count];
 
                 if (!flag.flip) { // set input data when not flip
@@ -221,11 +221,11 @@
                 }
                 cl_mem_flags out_mem_flag;
                 if (flag.flip) {
-                    if ( memout[cur] )  clReleaseMemObject(memout[cur]);
+                    if ( memout[cur] )  clReleaseMemObject(*memout[cur]);
                     memout[cur] = new cl_mem[nextTask->inData_count];
                     out_mem_flag = CL_MEM_READ_WRITE;
                 } else {
-                    if ( memout[cur] )  clReleaseMemObject(memout[cur]);
+                    if ( memout[cur] )  clReleaseMemObject(*memout[cur]);
                     memout[cur] = new cl_mem[nextTask->outData_count];
                     out_mem_flag = CL_MEM_WRITE_ONLY;
                 }
@@ -268,7 +268,7 @@
                 if (ret<0) {
                     const char *msg=convert_error_status(ret);
                     error(msg);
-                        goto nop_repy;
+                        goto nop_reply;
                 }
 
                 for(int i=0;i<nextTask->outData_count;i++) { // read output data
@@ -279,7 +279,7 @@
                     if (ret<0) {
                         const char *msg=convert_error_status(ret);
                         error(msg);
-                        goto nop_repy;
+                        goto nop_reply;
                     }
                 }
                 tasklist[cur]->task_end_time = gettime();
@@ -328,14 +328,14 @@
         connector->mail_write((memaddr)MY_SPE_STATUS_READY);
     }
     // TaskArrayの処理
-    if ( memout[cur-1] )  clReleaseMemObject(memout[cur-1]);
-    if ( memout[cur] )  clReleaseMemObject(memout[cur]);
-    if ( memin[cur-1] )  clReleaseMemObject(memin[cur-1]);
-    if ( memin[cur] )  clReleaseMemObject(memin[cur]);
+    if ( memout[cur-1] )  clReleaseMemObject(*memout[cur-1]);
+    if ( memout[cur] )  clReleaseMemObject(*memout[cur]);
+    if ( memin[cur-1] )  clReleaseMemObject(*memin[cur-1]);
+    if ( memin[cur] )  clReleaseMemObject(*memin[cur]);
     if ( kernel[cur]) clReleaseKernel(kernel[cur]);
     if ( kernel[cur-1]) clReleaseKernel(kernel[cur-1]);
-    if (event[0] && event[0]!=NOP_REPY) clReleaseEvent(event[0]);
-    if (event[1] && event[0]!=NOP_REPY) clReleaseEvent(event[1]);
+    if (event[0] && event[0]!=NOP_REPLY) clReleaseEvent(event[0]);
+    if (event[1] && event[0]!=NOP_REPLY) clReleaseEvent(event[1]);
 
 }
 
Binary file TaskManager/test/UtilizationTest/multiply has changed
--- a/example/fft/main.cc	Tue Nov 26 01:50:31 2013 +0900
+++ b/example/fft/main.cc	Tue Nov 26 15:48:05 2013 +0900
@@ -15,8 +15,9 @@
 #endif
 #include "pgm.h"
 extern void task_init();
+#ifdef GPUn
 extern void gpu_task_init();
-
+#endif
 #define PI 3.14159265358979
 
 #define MAX_SOURCE_SIZE (0x100000)
@@ -278,7 +279,9 @@
 
 int TMmain(TaskManager *manager, int argc, char** argv) {
     task_init();
+#ifdef GPU
     gpu_task_init();
+#endif
     char * pgm_file = init(argc,argv);
     /* Read image */
     int err = readPGM(&ipgm, pgm_file);
--- a/example/fft/ppe/task_init.cc	Tue Nov 26 01:50:31 2013 +0900
+++ b/example/fft/ppe/task_init.cc	Tue Nov 26 15:48:05 2013 +0900
@@ -18,9 +18,3 @@
     SchedRegisterTask(TRANSPOSE, transpose);
     SchedRegisterTask(HIGH_PASS_FILTER, highPassFilter);
 }
-
-void
-gpu_task_init()
-{
-
-}
--- a/example/many_task/Makefile.macosx	Tue Nov 26 01:50:31 2013 +0900
+++ b/example/many_task/Makefile.macosx	Tue Nov 26 15:48:05 2013 +0900
@@ -17,7 +17,7 @@
 # CFLAGS  = -g -Wall# -O9 #-DDEBUG
 
 INCLUDE =  -I. -I.. -I${CERIUM}/include/TaskManager
-LIBS = -L${CERIUM}/TaskManager -lGpuManager `sdl-config --libs` -framework opencl
+LIBS = -L${CERIUM}/TaskManager -lFifoManager `sdl-config --libs`
 
 .SUFFIXES: .cc .o
 
--- a/example/many_task/main.cc	Tue Nov 26 01:50:31 2013 +0900
+++ b/example/many_task/main.cc	Tue Nov 26 15:48:05 2013 +0900
@@ -9,7 +9,9 @@
 #include "sort.h"
 
 extern void task_init();
+#ifdef GPU
 extern void gpu_task_init();
+#endif
 extern int get_split_num(int len, int num);
 
 
@@ -150,8 +152,9 @@
     }
 
     task_init();
+#ifdef GPU
     gpu_task_init();
-
+#endif
     long cpu  = manager->get_cpuNum();
     // in case of -cpu 0
     if (cpu==0) cpu = 1;
--- a/example/many_task/ppe/task_init.cc	Tue Nov 26 01:50:31 2013 +0900
+++ b/example/many_task/ppe/task_init.cc	Tue Nov 26 15:48:05 2013 +0900
@@ -1,6 +1,5 @@
 #include "Func.h"
 #include "Scheduler.h"
-#include "GpuScheduler.h"
 
 SchedExternTask(QuickSort);
 SchedExternTask(SortSimple);
@@ -13,9 +12,3 @@
     SchedRegister(SortSimple);
     //    SchedRegister(SortCompat);
 }
-
-void
-gpu_task_init(void)
-{
-
-}