Mercurial > hg > Members > kono > Cerium
changeset 669:4af9d20cf3af
fix non SIMPLE_TASK code
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 03 Dec 2009 04:47:05 +0900 |
parents | 6bec6efda444 |
children | 9eefc1b24c87 |
files | example/word_count/Makefile.def example/word_count_test/Makefile.def example/word_count_test/main.cc example/word_count_test/ppe/Print.cc example/word_count_test/spe/Print.cc |
diffstat | 5 files changed, 19 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/example/word_count/Makefile.def Thu Dec 03 04:29:51 2009 +0900 +++ b/example/word_count/Makefile.def Thu Dec 03 04:47:05 2009 +0900 @@ -9,7 +9,7 @@ OPT = -O9 CC = g++ -CFLAGS = -Wall -O9 +CFLAGS = -Wall $(OPT) INCLUDE = -I${CERIUM}/include/TaskManager -I. -I.. LIBS = -L${CERIUM}/TaskManager
--- a/example/word_count_test/Makefile.def Thu Dec 03 04:29:51 2009 +0900 +++ b/example/word_count_test/Makefile.def Thu Dec 03 04:47:05 2009 +0900 @@ -10,8 +10,8 @@ # SIMPLE_TASK= -DSIMPLE_TASK SIMPLE_TASK= -# OPT = -O9 -OPT = -g +OPT = -O9 +# OPT = -g CC = g++ CFLAGS = -Wall $(OPT) $(SIMPLE_TASK)
--- a/example/word_count_test/main.cc Thu Dec 03 04:29:51 2009 +0900 +++ b/example/word_count_test/main.cc Thu Dec 03 04:47:05 2009 +0900 @@ -180,8 +180,8 @@ w-> division_out_size = 16; int out_size = w->division_out_size*out_task_num; /* out用のデータのサイズ。*/ - caddr_t p = manager->allocate(out_size*2); - w->o_data = (unsigned long long*)p + caddr_t p = (caddr_t) manager->allocate(out_size*2); + w->o_data = (unsigned long long*)p; //bzero(w->o_data,out_size); w-> pad = 2;
--- a/example/word_count_test/ppe/Print.cc Thu Dec 03 04:29:51 2009 +0900 +++ b/example/word_count_test/ppe/Print.cc Thu Dec 03 04:47:05 2009 +0900 @@ -24,11 +24,11 @@ * */ #else - int pad = w->pad; unsigned long long *idata = (unsigned long long*)s->get_input(rbuf, 0); - long task_num = (long)s->get_param(0); + unsigned long long *head_tail_flag = (unsigned long long*)s->get_input(rbuf, 1); + // long task_num = (long)s->get_param(0); long status_num = (long)s->get_param(1); - // int out_task_num = (int)s->get_param(2); + int out_task_num = (int)s->get_param(2); int pad = (int)s->get_param(3); #endif unsigned long long word_data[2];
--- a/example/word_count_test/spe/Print.cc Thu Dec 03 04:29:51 2009 +0900 +++ b/example/word_count_test/spe/Print.cc Thu Dec 03 04:47:05 2009 +0900 @@ -5,15 +5,15 @@ #include "WordCount.h" /* これは必須 */ -SchedDefineTask(Print); +SchedDefineTask1(Print,run_print); static int -run(SchedTask *s, void *rbuf, void *wbuf) +run_print(SchedTask *s, void *rbuf, void *wbuf) { #ifdef SIMPLE_TASK WordCount *w = *(WordCount**)rbuf; unsigned long long *idata = w->o_data; - long task_num = w->task_num; + // long task_num = w->task_num; long status_num = w->status_num; int out_task_num = w->out_task_num; @@ -24,14 +24,14 @@ * */ #else - int pad = w->pad; unsigned long long *idata = (unsigned long long*)s->get_input(rbuf, 0); - long task_num = (long)s->get_param(0); + unsigned long long *head_tail_flag = (unsigned long long*)s->get_input(rbuf, 1); + // long task_num = (long)s->get_param(0); long status_num = (long)s->get_param(1); int out_task_num = (int)s->get_param(2); int pad = (int)s->get_param(3); #endif - unsigned long long word_data[task_num]; // まぁ、gcc では通るんだけど.. + unsigned long long word_data[2]; int flag_cal_sum = 0; //printf("pad %d\n",pad); @@ -81,9 +81,10 @@ word_data[1] += idata[i*w->out_size+1]; unsigned long long *head_tail_flag = &idata[i*w->out_size+2]; - if((head_tail_flag[1] == 1) && (head_tail_flag[4] == 0)) { - flag_cal_sum++; - } + if((i!=out_task_num-1)&& + (head_tail_flag[1] == 1) && (head_tail_flag[4] == 0)) { + flag_cal_sum++; + } } #else for (int i = 1; i < out_task_num * pad - pad; i += pad) { @@ -94,7 +95,7 @@ } } - for (int i = 0; i < task_num*status_num; i += status_num) { + for (int i = 0; i < out_task_num*status_num; i += status_num) { for (int j = 0; j < status_num; j++) { word_data[j] += idata[i+j]; }