Mercurial > hg > Game > Cerium
changeset 1514:99ea7b932470 draft
create OpenCL test
author | Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 14 Oct 2012 02:40:05 +0900 |
parents | 18b63e697c61 |
children | b3644b73d2cf |
files | example/OpenCL/twice.cl example/many_task/README example/many_task/main.cc example/many_task/ppe/QuickSort.cc example/many_task/ppe/sort_test.cc |
diffstat | 5 files changed, 27 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/example/OpenCL/twice.cl Mon Oct 08 02:03:18 2012 +0900 +++ b/example/OpenCL/twice.cl Sun Oct 14 02:40:05 2012 +0900 @@ -3,18 +3,8 @@ __global int *input_data, __global int *output_data) { - int a = 1; - int b = rec(a); long count = (long)data_count[0]; for (int i = 0; i<count; i++) { - output_data[i] = b; + output_data[i] = input_data[i]*2; } } - -int -rec(int a) -{ - if (a<=1) return a; - return rec(a-1)+rec(a-2); - -}
--- a/example/many_task/README Mon Oct 08 02:03:18 2012 +0900 +++ b/example/many_task/README Sun Oct 14 02:40:05 2012 +0900 @@ -1,3 +1,6 @@ +2012/10/8 tomari +ppe内でmakeしたらCeriumを使わないtest routineが走る + 2010/7/31 kono bitoinc sort の一段落を待って、次のtaskを生成する方法だと、
--- a/example/many_task/main.cc Mon Oct 08 02:03:18 2012 +0900 +++ b/example/many_task/main.cc Sun Oct 14 02:40:05 2012 +0900 @@ -36,6 +36,7 @@ gettimeofday(&tv, NULL); return tv.tv_sec + (double)tv.tv_usec*1e-6; } + /* static void show_data(void) @@ -113,7 +114,10 @@ HTaskPtr restart = manager->create_task(sort_task,0,0,0,0); restart->set_param(0,(memaddr)&sorter); - //set flip flag + //restart->set_inData(0,sorter.data,sizeof(Data)*length); + //restart->set_param(0,(memaddr)&length); + // restart->set_outData(0,sorter.data,sizeof(Data)*(int)length); + // set flip flag restart->spawn(); }
--- a/example/many_task/ppe/QuickSort.cc Mon Oct 08 02:03:18 2012 +0900 +++ b/example/many_task/ppe/QuickSort.cc Sun Oct 14 02:40:05 2012 +0900 @@ -14,12 +14,12 @@ data[right] = tmp; } -// #define USE_MEMCPY +//#define USE_MEMCPY static int run(SchedTask *s, void* rbuff, void* wbuff) { // copy value - int begin = 0; + int begin = 0; #if USE_SIMPLE_TASK int end = s->read_size()/sizeof(Data); Data *r_data = (Data*)rbuff;
--- a/example/many_task/ppe/sort_test.cc Mon Oct 08 02:03:18 2012 +0900 +++ b/example/many_task/ppe/sort_test.cc Sun Oct 14 02:40:05 2012 +0900 @@ -33,6 +33,19 @@ Sort sorter; +void +check_data() +{ + for(int i=0; i< sorter.data_length-1;i++) { + if (sorter.data[i].index>sorter.data[i+1].index) { + printf("Data are not sorted at %d. %d > %d \n",i, sorter.data[i].index,sorter.data[i+1].index); + return; + } + } + printf("Data are sorted\n"); +} + + int main(int argc, char *argv[]) { @@ -50,9 +63,9 @@ int begin = 0; int end = length; - show(sorter.data, end-1); + //show(sorter.data, end-1); qsort_test(sorter.data, begin, end); - show(sorter.data, end-1); - + //show(sorter.data, end-1); + check_data(); return 0; }