changeset 1554:bd97edaed523 draft

nd_range
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 19 Feb 2013 20:26:26 +0900
parents 21ddbc06dcde
children 096412ad80fb
files TaskManager/Gpu/GpuScheduler.cc TaskManager/test/GpuRunTest/GpuRunTest.cc TaskManager/test/GpuRunTest/twice.cl
diffstat 3 files changed, 13 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Gpu/GpuScheduler.cc	Sun Feb 17 19:42:36 2013 +0900
+++ b/TaskManager/Gpu/GpuScheduler.cc	Tue Feb 19 20:26:26 2013 +0900
@@ -113,33 +113,16 @@
                     error(msg);
                 }
                 int param = 0;
+                // typedief struct nd_range {
+                //   cl_unit dimesion
+                //   size_t  gws[dimenssion]
+                //   size_t  lws[dimenssion]
+                // } ND_RANGE_T, *ND_RANGE_T_PTR;
                 
-                size_t gws[3],lws[3];
-                gws[0] = 1;
-                gws[1] = 1;
-                gws[2] = 1;
-                lws[0] = 1;
-                lws[1] = 1;
-                lws[2] = 1;
-
-                size_t *gws_buf,*lws_buf;
-                cl_uint dimension;
                 if (flag.nd_range) {
-                    // size_t *ws_buf = (size_t *)nextTask->param(1);
-                    // dimension = (cl_uint)ws_buf[0];
-                    cl_uint *dim_buf = (cl_uint*)nextTask->param(1);
-                    dimension = dim_buf[0];
-                    /* dimension check
-                     * if () {
-                     * error("Invalid work item dimension\n");
-                     * }
-                     */
-                    for (int i=0; i<dimension; i++) {
-                        gws_buf = (size_t*)nextTask->param(i+2);
-                        lws_buf = (size_t*)nextTask->param(i+2+dimension);
-                        gws[i]=*gws_buf;
-                        lws[i]=*lws_buf;
-                    }
+                    ND_RANGE_T *dim= (cl_uint*)nextTask->param(0);
+                    gws= dim->gws;
+                    lws= dim->lws;
                 }
 
                 // set arg count
--- a/TaskManager/test/GpuRunTest/GpuRunTest.cc	Sun Feb 17 19:42:36 2013 +0900
+++ b/TaskManager/test/GpuRunTest/GpuRunTest.cc	Tue Feb 19 20:26:26 2013 +0900
@@ -83,9 +83,9 @@
     HTaskPtr twice = manager->create_task(Twice);
     twice->set_param(0, (memaddr)length);
     twice->set_inData(0, indata, sizeof (int)*length);
-    int *n = new int[1];
-    n[0]= 3;
-    twice->set_inData(1, n, sizeof (int));
+    //int *n = new int[1];
+    //n[0]= 3;
+    //twice->set_inData(1, n, sizeof (int));
     twice->set_outData(0, outdata, sizeof (int)*length);
     twice->set_cpu(GPU_0);
 
--- a/TaskManager/test/GpuRunTest/twice.cl	Sun Feb 17 19:42:36 2013 +0900
+++ b/TaskManager/test/GpuRunTest/twice.cl	Tue Feb 19 20:26:26 2013 +0900
@@ -1,12 +1,12 @@
 __kernel void
 twice(__global int *data_count,
       __global int *input_data,
-      __constant int *n,
+//       __constant int *n,
       __global int *output_data)
 {
     long count = (long)data_count[0];
     for (int i = 0; i<count; i++) {
-        output_data[i] = input_data[i] * n[0];
+        output_data[i] = input_data[i] * 2; // n[0];
     }
 
 }