Mercurial > hg > Game > Cerium
changeset 968:122b1fddfa94 draft
fix wordcount
author | Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 09 Aug 2010 00:09:00 +0900 |
parents | daab1b74b32d |
children | 52c4353308e7 1a4849b2acad |
files | example/word_count/main.cc |
diffstat | 1 files changed, 18 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/example/word_count/main.cc Sun Aug 08 14:00:12 2010 +0900 +++ b/example/word_count/main.cc Mon Aug 09 00:09:00 2010 +0900 @@ -89,7 +89,11 @@ int task_num = (w->size+size-1)/size; if (task_num>array_task_num) task_num = array_task_num; task_array = manager->create_task_array(TASK_EXEC,task_num,0,1,1); - if (!all) t_next->wait_for(task_array); + if (!all) { + t_next->wait_for(task_array); + } else { + w->t_print->wait_for(task_array); + } } Task *t_exec = 0; @@ -106,12 +110,16 @@ h_exec = manager->create_task(TASK_EXEC); h_exec->set_inData(0,w->file_mmap + i*w->division_size, size); h_exec->set_outData(0,w->o_data + i*w->out_size, w->division_out_size); + + t_next->wait_for(h_exec); + h_exec->set_cpu(SPE_ANY); h_exec->spawn(); } else { h_exec = manager->create_task(TASK_EXEC, (memaddr)(w->file_mmap + i*w->division_size), size, (memaddr)(w->o_data + i*w->out_size), w->division_out_size); + t_next->wait_for(h_exec); h_exec->set_cpu(SPE_ANY); h_exec->spawn(); } @@ -123,7 +131,7 @@ task_array->set_cpu(SPE_ANY); task_array->spawn(); } else { - if (!all) t_next->wait_for(h_exec); + //if (!all) t_next->wait_for(h_exec); } } } @@ -176,7 +184,7 @@ // bzero(w,sizeof(WordCount)); w->self = w; - w->task_blocks = blocks; + //w->task_blocks = blocks; w->task_spwaned = 0; /*sizeはdivision_sizeの倍数にしている。*/ @@ -200,6 +208,12 @@ w->task_num = w->task_num + (w->division_size*w->task_num < w->size); int out_task_num = w->task_num; + if(!all) { + w->task_blocks = blocks; + } else { + w->task_blocks = w->task_num; + } + w->out_task_num = out_task_num; printf("task_num %d\n",w->task_num); printf("out_task_num %d\n",w->out_task_num); @@ -219,7 +233,7 @@ w->t_print = t_print; - for(int i = 0;i<2;i++) { + for(int i = 0;i<1;i++) { /* Task を task_blocks ずつ起動する Task */ /* serialize されていると仮定する... */ HTaskPtr t_exec = manager->create_task(RUN_TASK_BLOCKS,