Mercurial > hg > Game > Cerium
changeset 1694:1755ae347fce draft
use iterate for multiply
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 24 Sep 2013 17:14:51 +0900 |
parents | 3cfc65841ef7 |
children | 9c065614561f |
files | example/multiply/Func.h example/multiply/main.cc example/multiply/ppe/Multi.cc example/word_count/main.cc example/word_count/ppe/Print.cc |
diffstat | 5 files changed, 13 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/example/multiply/Func.h Tue Sep 24 00:16:21 2013 +0900 +++ b/example/multiply/Func.h Tue Sep 24 17:14:51 2013 +0900 @@ -3,4 +3,4 @@ MULTIPLY_TASK, }; -#define DATA_NUM 100 +#define DATA_NUM 10000000
--- a/example/multiply/main.cc Tue Sep 24 00:16:21 2013 +0900 +++ b/example/multiply/main.cc Tue Sep 24 17:14:51 2013 +0900 @@ -92,18 +92,13 @@ */ multiply->set_inData(0,(memaddr)A, sizeof(float)*length); multiply->set_inData(1,(memaddr)B, sizeof(float)*length); - - multiply->set_param(3,256); - multiply->set_param(4,512); /** * Set of OutPut area * add_outData(address of output area, size of output area); */ multiply->set_outData(0,(memaddr)C, sizeof(float)*length); - // param 0に0~length-1をsetしたtaskをlength個spawnする multiply->iterate(length); - } @@ -126,8 +121,8 @@ { ed_time = getTime(); print_result(); + printf("Time: %0.6f\n",ed_time-st_time); check_data(); - printf("Time: %0.6f\n",ed_time-st_time); delete A; delete B;
--- a/example/multiply/ppe/Multi.cc Tue Sep 24 00:16:21 2013 +0900 +++ b/example/multiply/ppe/Multi.cc Tue Sep 24 17:14:51 2013 +0900 @@ -17,10 +17,6 @@ C = (float*)s->get_output(wbuf, 0); long i = s->x; - long a = (long)s->get_param(3); - long b = (long)s->get_param(4); - if (a==256 && b==512) { - C[i]=A[i]*B[i]; - } + C[i]=A[i]*B[i]; return 0; }
--- a/example/word_count/main.cc Tue Sep 24 00:16:21 2013 +0900 +++ b/example/word_count/main.cc Tue Sep 24 17:14:51 2013 +0900 @@ -250,15 +250,15 @@ (memaddr)&w->self,sizeof(memaddr),0,0); w->t_print = t_print; - for(int i = 0;i<4;i++) { - /* Task を task_blocks ずつ起動する Task */ - /* serialize されていると仮定する... */ - HTaskPtr t_exec = manager->create_task(RUN_TASK_BLOCKS, - (memaddr)&w->self,sizeof(memaddr),0,0); - t_print->wait_for(t_exec); - t_exec->spawn(); - } - + // for(int i = 0;i<4;i++) { + // /* Task を task_blocks ずつ起動する Task */ + // /* serialize されていると仮定する... */ + HTaskPtr t_exec = manager->create_task(RUN_TASK_BLOCKS, + (memaddr)&w->self,sizeof(memaddr),0,0); + t_print->wait_for(t_exec); + t_exec->iterate(4); + // t_exec->spawn(); + // } t_print->spawn(); }
--- a/example/word_count/ppe/Print.cc Tue Sep 24 00:16:21 2013 +0900 +++ b/example/word_count/ppe/Print.cc Tue Sep 24 17:14:51 2013 +0900 @@ -68,7 +68,7 @@ for (int i = 0; i < out_task_num ; i++) { word_data[0] += idata[i*w->out_size+0]; - printf("idata[%d]=%lld\n",i*w->out_size+0,idata[i*w->out_size+0]); + // printf("idata[%d]=%lld\n",i*w->out_size+0,idata[i*w->out_size+0]); word_data[1] += idata[i*w->out_size+1]; unsigned long long *head_tail_flag = &idata[i*w->out_size+2];