Mercurial > hg > Game > Cerium
changeset 1655:963d2fc5f685 draft
push (but can't run regex_mas)
author | Masa <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 01 Jul 2013 21:15:23 +0900 |
parents | 0e1d40a3474b |
children | 05adaf6f7afb |
files | example/regex_mas/main.cc example/regex_mas/ppe/Exec.cc example/regex_mas/ppe/Print.cc |
diffstat | 3 files changed, 29 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/example/regex_mas/main.cc Wed Jun 26 19:41:18 2013 +0900 +++ b/example/regex_mas/main.cc Mon Jul 01 21:15:23 2013 +0900 @@ -268,20 +268,21 @@ const int ONE_TASK_LENGTH = w->division_size; t_exec[k] = task_array[k]->next_task_array(TASK_EXEC,t_exec[k]); - t_exec[k]->set_param(0,length); 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(1,offset); - //t_exec[k]->set_param(2,search_word); - //printf("%s\n",search_word); + int sw_len = strlen((char *)search_word); + //printf("%d\n",sw_len); + t_exec[k]->set_inData(0,search_word,sizeof(search_word)); if(size != w->size){ //ラストのタスクかどうかの判定 - t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size+EXTRA_LENGTH); + t_exec[k]->set_inData(1,w->file_mmap + a*w->division_size, size+EXTRA_LENGTH); }else{ - t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size); + t_exec[k]->set_inData(1,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); - + t_exec[k]->set_outData(1,w->o_data + a*w->out_size, w->division_out_size); + t_exec[k]->set_param(0,length); //1タスクのtextの長さ + t_exec[k]->set_param(1,offset); //何文字目かどうかを送る + t_exec[k]->set_param(2,sw_len); //検索する文字の長さ w->size -= size; w->task_num--; }
--- a/example/regex_mas/ppe/Exec.cc Wed Jun 26 19:41:18 2013 +0900 +++ b/example/regex_mas/ppe/Exec.cc Mon Jul 01 21:15:23 2013 +0900 @@ -9,12 +9,12 @@ SchedDefineTask(Exec); //ボイヤームーア法による文字列検索アルゴリズム -int BM_method(unsigned char *text,long int offset,int text_length, - unsigned char *pattern,unsigned long long *match_string) +int BM_method(unsigned char *text,int *offset,int *text_length, + unsigned char *pattern,int *sw_len,unsigned long long *match_string) { int skip[256]; - int text_len = text_length; - int pattern_len = strlen((char *)pattern); + int text_len = (long int)text_length; + int pattern_len = (long int)sw_len; int i = 0; int k = 0; @@ -49,14 +49,22 @@ static int run(SchedTask *s, void *rbuf, void *wbuf) { - unsigned char *i_data = (unsigned char *)rbuf; - unsigned long long *o_data = (unsigned long long*)wbuf; - int length = (int)s->get_inputSize(0); + unsigned char *search_word = (unsigned char *)s->get_input(rbuf, 0); + unsigned char *i_data = (unsigned char *)s->get_input(rbuf, 1); + //unsigned char *search_word = (unsigned char *)s->get_inputAddr(0); + //unsigned char *i_data = (unsigned char *)s->get_inputAddr(1); + s->printf("input word : %s\n",search_word); + unsigned long long *o_data = (unsigned long long*)s->get_output(wbuf,0); + s->printf("in(1):%d in(2):%d\n",s->get_inputSize(0),s->get_inputSize(1)); + + + int *length = (int*)s->get_param(0); int *offset = (int*)s->get_param(1); - unsigned char search_word[] = "doing"; - //s->printf("%ld,%ld,%s\n",length,offset,search_word); + int *sw_len = (int*)s->get_param(2); + //unsigned char search_word[] = "doing"; + s->printf("length:%ld,offset:%ld,sw_len:%d,search_word:%s,i_data:%s\n",length,offset,sw_len,search_word,i_data); - BM_method(i_data,(long int)offset,(int)length,search_word,o_data); + BM_method(i_data,offset,length,search_word,sw_len,o_data); //s->printf("in Exec.cc\n");
--- a/example/regex_mas/ppe/Print.cc Wed Jun 26 19:41:18 2013 +0900 +++ b/example/regex_mas/ppe/Print.cc Mon Jul 01 21:15:23 2013 +0900 @@ -18,7 +18,7 @@ s->printf("position\n"); for (int i = 0;i < idata_task_num/2;i++) { - if(idata[2*i] == 0x64){ + // if(idata[2*i] == 0x61){ s->printf("%d ",(int)idata[2*i+1]); s->printf("%c\n",(unsigned char)idata[2*i]); @@ -26,7 +26,7 @@ //s->printf("%d:%d ",2*i+1,(int)idata[2*i+1]); match_count++; - } + // } } s->printf("HIT:%d\n",match_count); s->printf("task num : %d\n",w->task_spwaned);