Mercurial > hg > Game > Cerium
changeset 1680:e44e5a18392c draft
fix regex_mas.
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 06 Aug 2013 05:00:04 +0900 |
parents | ff43dc274ec9 |
children | 7bc7780e8ece |
files | example/regex_mas/d.txt example/regex_mas/main.cc example/regex_mas/ppe/Exec.cc |
diffstat | 3 files changed, 20 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/example/regex_mas/d.txt Sun Aug 04 02:14:18 2013 +0900 +++ b/example/regex_mas/d.txt Tue Aug 06 05:00:04 2013 +0900 @@ -80,4 +80,4 @@ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabcd16380 -abaaabaaabab +doingabaaabaaabab
--- a/example/regex_mas/main.cc Sun Aug 04 02:14:18 2013 +0900 +++ b/example/regex_mas/main.cc Tue Aug 06 05:00:04 2013 +0900 @@ -12,7 +12,7 @@ #include "Func.h" #include "WordCount.h" -#define EXTRA_LENGTH 2 //多く取ってくる文字数(search word length - 1) +#define EXTRA_LENGTH 4 //多く取ってくる文字数(search word length - 1) /* ;TODO * PS3でCPU数が2以上の時に、あまりが計算されてない @@ -230,18 +230,25 @@ int a = w->task_spwaned++; if (w->size < size) size = w->size; - int length = size/sizeof(char); + + int set_one_task_length = size/sizeof(char); const int ONE_TASK_LENGTH = w->division_size; - - t_exec[k] = task_array[k]->next_task_array(TASK_EXEC,t_exec[k]); const int ONE_LOOP_LENGTH = array_task_num*spe_num*ONE_TASK_LENGTH; const int ARRAY_LENGTH_SIZE = spe_num * ONE_TASK_LENGTH; int offset = ONE_LOOP_LENGTH * i + ARRAY_LENGTH_SIZE*j + ONE_TASK_LENGTH*k; - t_exec[k]->set_param(0,(memaddr)length); - t_exec[k]->set_param(1,(memaddr)offset); - if(size != w->size){ //ラストのタスクかどうかの判定 + + t_exec[k] = task_array[k]->next_task_array(TASK_EXEC,t_exec[k]); + t_exec[k]->set_param(0,(memaddr)offset); + + /*set_inDataで多めに文字を取ってきているが、 + *Exec.ccに文字列検索をさせるときにはset_param(1)で + *設定した文字列しか検索してくれないようになっている。 + */ + if(size != w->size){ //最後のタスクかどうかの判定 + t_exec[k]->set_param(1,(memaddr)set_one_task_length + EXTRA_LENGTH); t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size+EXTRA_LENGTH); }else{ + t_exec[k]->set_param(1,(memaddr)set_one_task_length); t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size); } t_exec[k]->set_outData(0,w->o_data + a*w->out_size, w->division_out_size); @@ -371,8 +378,8 @@ w->division_size = w->size; } - /* "word num" and "line num" */ - w->status_num = 2; + /* exec output only "match_num" */ + w->status_num = 1; /* taskの数 */ w->task_num = w->size / w->division_size; w->task_num = w->task_num + (w->division_size*w->task_num < w->size);
--- a/example/regex_mas/ppe/Exec.cc Sun Aug 04 02:14:18 2013 +0900 +++ b/example/regex_mas/ppe/Exec.cc Tue Aug 06 05:00:04 2013 +0900 @@ -47,13 +47,12 @@ { unsigned char *i_data = (unsigned char *)rbuf; unsigned long long *o_data = (unsigned long long*)wbuf; - int *length = (int*)s->get_param(0); - int *offset = (int*)s->get_param(1); - unsigned char search_word[] = "aba"; + int *offset = (int*)s->get_param(0); + int *length = (int*)s->get_param(1); + unsigned char search_word[] = "doing"; o_data[0] = BM_method(i_data,offset,length,search_word,o_data); - s->printf("%d\n",o_data[0]); //s->printf("in Exec.cc\n");